Currently this function pointer is missing for GFX10. Considering it is
a void function since GFX9, fix it by checking the function pointer
before dereferencing it.

Change-Id: I1dc8e5163f259251357bfaa42a91ff991fba6dd5
Signed-off-by: Yong Zhao <yong.z...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c   |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c     | 10 ----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h     |  2 --
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c              |  2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c |  5 +++--
 drivers/gpu/drm/amd/include/kgd_kfd_interface.h       |  5 +++++
 6 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c
index 39768d6cb07c..3abaf92caf5c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c
@@ -283,7 +283,6 @@ static const struct kfd2kgd_calls kfd2kgd = {
                        kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid,
        .get_atc_vmid_pasid_mapping_valid =
                        kgd_gfx_v9_get_atc_vmid_pasid_mapping_valid,
-       .set_scratch_backing_va = kgd_gfx_v9_set_scratch_backing_va,
        .get_tile_config = kgd_gfx_v9_get_tile_config,
        .set_vm_context_page_table_base = 
kgd_gfx_v9_set_vm_context_page_table_base,
        .invalidate_tlbs = kgd_gfx_v9_invalidate_tlbs,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
index 4a126df93885..745cae5b6282 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c
@@ -775,15 +775,6 @@ uint32_t kgd_gfx_v9_address_watch_get_offset(struct 
kgd_dev *kgd,
        return 0;
 }
 
-void kgd_gfx_v9_set_scratch_backing_va(struct kgd_dev *kgd,
-                                       uint64_t va, uint32_t vmid)
-{
-       /* No longer needed on GFXv9. The scratch base address is
-        * passed to the shader by the CP. It's the user mode driver's
-        * responsibility.
-        */
-}
-
 void kgd_gfx_v9_set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t 
vmid,
                uint64_t page_table_base)
 {
@@ -829,7 +820,6 @@ static const struct kfd2kgd_calls kfd2kgd = {
                        kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid,
        .get_atc_vmid_pasid_mapping_valid =
                        kgd_gfx_v9_get_atc_vmid_pasid_mapping_valid,
-       .set_scratch_backing_va = kgd_gfx_v9_set_scratch_backing_va,
        .get_tile_config = kgd_gfx_v9_get_tile_config,
        .set_vm_context_page_table_base = 
kgd_gfx_v9_set_vm_context_page_table_base,
        .invalidate_tlbs = kgd_gfx_v9_invalidate_tlbs,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h
index 26d8879bff9d..225bf64001e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h
@@ -61,8 +61,6 @@ uint16_t kgd_gfx_v9_get_atc_vmid_pasid_mapping_pasid(struct 
kgd_dev *kgd,
                uint8_t vmid);
 void kgd_gfx_v9_set_vm_context_page_table_base(struct kgd_dev *kgd, uint32_t 
vmid,
                uint64_t page_table_base);
-void kgd_gfx_v9_set_scratch_backing_va(struct kgd_dev *kgd,
-                                       uint64_t va, uint32_t vmid);
 int kgd_gfx_v9_invalidate_tlbs(struct kgd_dev *kgd, uint16_t pasid);
 int kgd_gfx_v9_invalidate_tlbs_vmid(struct kgd_dev *kgd, uint16_t vmid);
 int kgd_gfx_v9_get_tile_config(struct kgd_dev *kgd,
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index a53864bb70bb..d14aed983663 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1128,7 +1128,7 @@ static int kfd_ioctl_set_scratch_backing_va(struct file 
*filep,
        mutex_unlock(&p->mutex);
 
        if (dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS &&
-           pdd->qpd.vmid != 0)
+           pdd->qpd.vmid != 0 && dev->kfd2kgd->set_scratch_backing_va)
                dev->kfd2kgd->set_scratch_backing_va(
                        dev->kgd, args->va_addr, pdd->qpd.vmid);
 
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index c826634938d2..9a53bc79fb42 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -220,8 +220,9 @@ static int allocate_vmid(struct device_queue_manager *dqm,
        /* invalidate the VM context after pasid and vmid mapping is set up */
        kfd_flush_tlb(qpd_to_pdd(qpd));
 
-       dqm->dev->kfd2kgd->set_scratch_backing_va(
-               dqm->dev->kgd, qpd->sh_hidden_private_base, qpd->vmid);
+       if (dqm->dev->kfd2kgd->set_scratch_backing_va)
+               dqm->dev->kfd2kgd->set_scratch_backing_va(dqm->dev->kgd,
+                               qpd->sh_hidden_private_base, qpd->vmid);
 
        return 0;
 }
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h 
b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index 98b9533e672b..e4f7bba11a3a 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -298,8 +298,13 @@ struct kfd2kgd_calls {
                                        struct kgd_dev *kgd,
                                        uint8_t vmid);
 
+       /* No longer needed from GFXv9 onward. The scratch base address is
+        * passed to the shader by the CP. It's the user mode driver's
+        * responsibility.
+        */
        void (*set_scratch_backing_va)(struct kgd_dev *kgd,
                                uint64_t va, uint32_t vmid);
+
        int (*get_tile_config)(struct kgd_dev *kgd, struct tile_config *config);
 
        void (*set_vm_context_page_table_base)(struct kgd_dev *kgd,
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to