0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef __KFD_IOMMU_H__
0025 #define __KFD_IOMMU_H__
0026
0027 #include <linux/kconfig.h>
0028
0029 #if IS_REACHABLE(CONFIG_AMD_IOMMU_V2)
0030
0031 #define KFD_SUPPORT_IOMMU_V2
0032
0033 int kfd_iommu_check_device(struct kfd_dev *kfd);
0034 int kfd_iommu_device_init(struct kfd_dev *kfd);
0035
0036 int kfd_iommu_bind_process_to_device(struct kfd_process_device *pdd);
0037 void kfd_iommu_unbind_process(struct kfd_process *p);
0038
0039 void kfd_iommu_suspend(struct kfd_dev *kfd);
0040 int kfd_iommu_resume(struct kfd_dev *kfd);
0041
0042 int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev);
0043
0044 #else
0045
0046 static inline int kfd_iommu_check_device(struct kfd_dev *kfd)
0047 {
0048 return -ENODEV;
0049 }
0050 static inline int kfd_iommu_device_init(struct kfd_dev *kfd)
0051 {
0052 #if IS_MODULE(CONFIG_AMD_IOMMU_V2)
0053 WARN_ONCE(1, "iommu_v2 module is not usable by built-in KFD");
0054 #endif
0055 return 0;
0056 }
0057
0058 static inline int kfd_iommu_bind_process_to_device(
0059 struct kfd_process_device *pdd)
0060 {
0061 return 0;
0062 }
0063 static inline void kfd_iommu_unbind_process(struct kfd_process *p)
0064 {
0065
0066 }
0067
0068 static inline void kfd_iommu_suspend(struct kfd_dev *kfd)
0069 {
0070
0071 }
0072 static inline int kfd_iommu_resume(struct kfd_dev *kfd)
0073 {
0074 return 0;
0075 }
0076
0077 static inline int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev)
0078 {
0079 return 0;
0080 }
0081
0082 #endif
0083
0084 #endif