Merge tag 'x86-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / arch / x86 / events / amd / iommu.h
blob0e5c036fd7bea1b2b0801b7bcc7122670095463f
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2013 Advanced Micro Devices, Inc.
5 * Author: Steven Kinney <Steven.Kinney@amd.com>
6 * Author: Suravee Suthikulpanit <Suraveee.Suthikulpanit@amd.com>
7 */
9 #ifndef _PERF_EVENT_AMD_IOMMU_H_
10 #define _PERF_EVENT_AMD_IOMMU_H_
12 /* iommu pc mmio region register indexes */
13 #define IOMMU_PC_COUNTER_REG 0x00
14 #define IOMMU_PC_COUNTER_SRC_REG 0x08
15 #define IOMMU_PC_PASID_MATCH_REG 0x10
16 #define IOMMU_PC_DOMID_MATCH_REG 0x18
17 #define IOMMU_PC_DEVID_MATCH_REG 0x20
18 #define IOMMU_PC_COUNTER_REPORT_REG 0x28
20 /* maximun specified bank/counters */
21 #define PC_MAX_SPEC_BNKS 64
22 #define PC_MAX_SPEC_CNTRS 16
24 struct amd_iommu;
26 /* amd_iommu_init.c external support functions */
27 extern int amd_iommu_get_num_iommus(void);
29 extern bool amd_iommu_pc_supported(void);
31 extern u8 amd_iommu_pc_get_max_banks(unsigned int idx);
33 extern u8 amd_iommu_pc_get_max_counters(unsigned int idx);
35 extern int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
36 u8 fxn, u64 *value);
38 extern int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr,
39 u8 fxn, u64 *value);
41 extern struct amd_iommu *get_amd_iommu(int idx);
43 #endif /*_PERF_EVENT_AMD_IOMMU_H_*/