18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2013 Advanced Micro Devices, Inc. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Author: Steven Kinney <Steven.Kinney@amd.com> 68c2ecf20Sopenharmony_ci * Author: Suravee Suthikulpanit <Suraveee.Suthikulpanit@amd.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _PERF_EVENT_AMD_IOMMU_H_ 108c2ecf20Sopenharmony_ci#define _PERF_EVENT_AMD_IOMMU_H_ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/* iommu pc mmio region register indexes */ 138c2ecf20Sopenharmony_ci#define IOMMU_PC_COUNTER_REG 0x00 148c2ecf20Sopenharmony_ci#define IOMMU_PC_COUNTER_SRC_REG 0x08 158c2ecf20Sopenharmony_ci#define IOMMU_PC_PASID_MATCH_REG 0x10 168c2ecf20Sopenharmony_ci#define IOMMU_PC_DOMID_MATCH_REG 0x18 178c2ecf20Sopenharmony_ci#define IOMMU_PC_DEVID_MATCH_REG 0x20 188c2ecf20Sopenharmony_ci#define IOMMU_PC_COUNTER_REPORT_REG 0x28 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* maximun specified bank/counters */ 218c2ecf20Sopenharmony_ci#define PC_MAX_SPEC_BNKS 64 228c2ecf20Sopenharmony_ci#define PC_MAX_SPEC_CNTRS 16 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistruct amd_iommu; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* amd_iommu_init.c external support functions */ 278c2ecf20Sopenharmony_ciextern int amd_iommu_get_num_iommus(void); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciextern bool amd_iommu_pc_supported(void); 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciextern u8 amd_iommu_pc_get_max_banks(unsigned int idx); 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciextern u8 amd_iommu_pc_get_max_counters(unsigned int idx); 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciextern int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, 368c2ecf20Sopenharmony_ci u8 fxn, u64 *value); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciextern int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, 398c2ecf20Sopenharmony_ci u8 fxn, u64 *value); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciextern struct amd_iommu *get_amd_iommu(int idx); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#endif /*_PERF_EVENT_AMD_IOMMU_H_*/ 44