aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
diff options
context:
space:
mode:
authorGravatar Felix Kuehling <Felix.Kuehling@amd.com> 2021-03-29 18:49:12 -0400
committerGravatar Alex Deucher <alexander.deucher@amd.com> 2021-04-20 21:50:35 -0400
commit4ab159d2547c26b34a4ff4770598b72660da1461 (patch)
tree7ebed7e4a926a030f93272d87e3532a376a78871 /drivers/gpu/drm/amd/amdkfd/kfd_svm.h
parentdrm/amdkfd: Add SVM API support capability bits (diff)
downloadlinux-4ab159d2547c26b34a4ff4770598b72660da1461.tar.gz
linux-4ab159d2547c26b34a4ff4770598b72660da1461.tar.bz2
linux-4ab159d2547c26b34a4ff4770598b72660da1461.zip
drm/amdkfd: Add CONFIG_HSA_AMD_SVM
Control whether to build SVM support into amdgpu with a Kconfig option. This makes it easier to disable it in production kernels if this new feature causes problems in production environments. Use "depends on" instead of "select" for DEVICE_PRIVATE, as is recommended for visible options. Reviewed-by: Philip Yang <Philip.Yang@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_svm.h')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_svm.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.h b/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
index aa829b3c992d..573f984b81fe 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
@@ -25,6 +25,8 @@
#ifndef KFD_SVM_H_
#define KFD_SVM_H_
+#if IS_ENABLED(CONFIG_HSA_AMD_SVM)
+
#include <linux/rwsem.h>
#include <linux/list.h>
#include <linux/mutex.h>
@@ -173,4 +175,32 @@ void svm_range_dma_unmap(struct device *dev, dma_addr_t *dma_addr,
void svm_range_free_dma_mappings(struct svm_range *prange);
void svm_range_prefault(struct svm_range *prange, struct mm_struct *mm);
+#else
+
+struct kfd_process;
+
+static inline int svm_range_list_init(struct kfd_process *p)
+{
+ return 0;
+}
+static inline void svm_range_list_fini(struct kfd_process *p)
+{
+ /* empty */
+}
+
+static inline int svm_range_restore_pages(struct amdgpu_device *adev,
+ unsigned int pasid, uint64_t addr)
+{
+ return -EFAULT;
+}
+
+static inline int svm_range_schedule_evict_svm_bo(
+ struct amdgpu_amdkfd_fence *fence)
+{
+ WARN_ONCE(1, "SVM eviction fence triggered, but SVM is disabled");
+ return -EINVAL;
+}
+
+#endif /* IS_ENABLED(CONFIG_HSA_AMD_SVM) */
+
#endif /* KFD_SVM_H_ */