Because we record the mapping in the software, we can query pasid through vmid using the stored mapping instead of reading from ATC registers. This also prepares for the defeatured ATC block in future ASICs. Change-Id: I781cb9d30dc0cc93379908ff1cf8da798bb26f13 Signed-off-by: Yong Zhao <Yong.Zhao@xxxxxxx> --- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 12 ++++++++++++ .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c | 3 +-- 3 files changed, 16 insertions(+), 2 deletions(-) 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 d006adefef55..57d33e887f43 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -220,6 +220,18 @@ static void deallocate_doorbell(struct qcm_process_device *qpd, WARN_ON(!old); } +uint16_t get_pasid_from_vmid_nocpsch(struct device_queue_manager *dqm, + uint16_t vmid) +{ + int idx = vmid - dqm->dev->vm_info.first_vmid_kfd; + + uint16_t pasid = dqm->dev->dqm->vmid_pasid[idx]; + if (!pasid) + pr_err("pasid is not queried correctly\n"); + + return pasid; +} + static int allocate_vmid(struct device_queue_manager *dqm, struct qcm_process_device *qpd, struct queue *q) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h index 67b5e5fadd95..9e8f6cde397e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h @@ -244,6 +244,9 @@ void set_queue_snapshot_entry(struct device_queue_manager *dqm, int flags, struct kfd_queue_snapshot_entry *qss_entry); +uint16_t get_pasid_from_vmid_nocpsch(struct device_queue_manager *dqm, + uint16_t vmid); + static inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd) { return (pdd->lds_base >> 16) & 0xFF; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c index ab8a695c4a3c..adb5bbab7160 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_int_process_v9.c @@ -58,8 +58,7 @@ static bool event_interrupt_isr_v9(struct kfd_dev *dev, memcpy(patched_ihre, ih_ring_entry, dev->device_info->ih_ring_entry_size); - pasid = dev->kfd2kgd->get_atc_vmid_pasid_mapping_pasid( - dev->kgd, vmid); + pasid = get_pasid_from_vmid_nocpsch(dev->dqm, vmid); /* Patch the pasid field */ patched_ihre[3] = cpu_to_le32((le32_to_cpu(patched_ihre[3]) -- 2.17.1 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx