Skip to contentSkip to conversation

drm/amdkfd: Fix compile error if HMM support not enabled

PATCH In review Philip Yang 2 participants 2 messages Jul 25, 2024 – Jul 26, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Fix compile error if HMM support not enabled

Fixes the below if kernel config not enable HMM support

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:26: error:

implicit declaration of function 'svm_range_from_addr'

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:24: error:

assignment to 'struct svm_range *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:111:28: error:

invalid use of undefined type 'struct svm_range'

Fixes de165b53c93f ("drm/amdkfd: Validate user queue svm memory residency")
---
 drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_queue.c +14 -0
index 9807e8adf77d..64c292f0ba1b 100644
@@ -85,6 +85,8 @@ void uninit_queue(struct queue *q)
 	kfree(q);
 }
 
+#if IS_ENABLED(CONFIG_HSA_AMD_SVM)
+
 static int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
 {
 	struct kfd_process *p = pdd->process;
@@ -178,6 +180,18 @@ static void kfd_queue_buffer_svm_put(struct kfd_process_device *pdd, u64 addr, u
 
 	mutex_unlock(&p->svms.lock);
 }
+#else
+
+static int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
+{
+	return -EINVAL;
+}
+
+static void kfd_queue_buffer_svm_put(struct kfd_process_device *pdd, u64 addr, u64 size)
+{
+}
+
+#endif
 
 int kfd_queue_buffer_get(struct amdgpu_vm *vm, void __user *addr, struct amdgpu_bo **pbo,
 			 u64 expected_size)
Signature · 1 line
2.43.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Philip Yang

Fixes the below if kernel config not enable HMM support

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:26: error:

implicit declaration of function 'svm_range_from_addr'

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:107:24: error:

assignment to 'struct svm_range *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

Quoted 7 lines
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_queue.c:111:28: error:

invalid use of undefined type 'struct svm_range'

Fixes de165b53c93f ("drm/amdkfd: Validate user queue svm memory residency")
Quoted 36 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_queue.c +14 -0
index 9807e8adf77d..64c292f0ba1b 100644
@@ -85,6 +85,8 @@ void uninit_queue(struct queue *q)
  	kfree(q);
  }
 
+#if IS_ENABLED(CONFIG_HSA_AMD_SVM)
+
  static int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
  {
  	struct kfd_process *p = pdd->process;
@@ -178,6 +180,18 @@ static void kfd_queue_buffer_svm_put(struct kfd_process_device *pdd, u64 addr, u
 
  	mutex_unlock(&p->svms.lock);
  }
+#else
+
+static int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
+{
+	return -EINVAL;
+}
+
+static void kfd_queue_buffer_svm_put(struct kfd_process_device *pdd, u64 addr, u64 size)
+{
+}
+
+#endif
 
  int kfd_queue_buffer_get(struct amdgpu_vm *vm, void __user *addr, struct amdgpu_bo **pbo,
  			 u64 expected_size)