drm/radeon: Assign VMID to PASID for IH in non-HWS mode
Subsystems (3)
PATCH 1/2 drm/radeon: Assign VMID to PASID for IH in non-HWS mode
From: Ben Goz <[email protected]>
This patch fixes a bug in kgd_set_pasid_vmid_mapping(), where the function only updated the ATC registers (IOMMU) with the new VMID <--> PASID mapping, but didn't update the IH (Interrupt) registers.
The bug only occurs when using non-HWS mode. In HWS mode, the CP automatically does the VMID <--> PASID mapping.
--- drivers/gpu/drm/radeon/cikd.h | 2 ++ drivers/gpu/drm/radeon/radeon_kfd.c | 4 ++++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/radeon/cikd.h +2 -0
@@ -2156,4 +2156,6 @@#define ATC_VM_APERTURE1_HIGH_ADDR 0x330Cu#define ATC_VM_APERTURE1_LOW_ADDR 0x3304u +#define IH_VMID_0_LUT 0x3D40u +#endif
drivers/gpu/drm/radeon/radeon_kfd.c +4 -0
@@ -390,6 +390,10 @@ static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid,cpu_relax ();write_register (kgd,ATC_VMID_PASID_MAPPING_UPDATE_STATUS ,1U << vmid); +/* Mapping vmid to pasid also for IH block */ +write_register (kgd,IH_VMID_0_LUT + vmid *sizeof (uint32_t ), + pasid_mapping); +return 0 ; }
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 drm/amdkfd: unmap VMID<-->PASID when relesing VMID (non-HWS)
From: Ben Goz <[email protected]>
This patch fixes a bug where deallocate_vmid() didn't actually unmap the VMID<-->PASID mapping (in the registers).
That can cause undefined behavior.
This bug only occurs in non-HWS mode.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -0
@@ -161,6 +161,9 @@ static void deallocate_vmid(struct device_queue_manager *dqm, {int bit = qpd->vmid -KFD_VMID_START_OFFSET ; +/* Release the vmid mapping */ +set_pasid_vmid_mapping (dqm,0 , qpd->vmid); +set_bit (bit, (unsigned long *)&dqm->vmid_bitmap); qpd->vmid =0 ; q->properties.vmid =0 ;
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Oded Gabbay
From: Ben Goz <[email protected]>
This patch fixes a bug in
kgd_set_pasid_vmid_mapping(), where the function only updated the ATC registers (IOMMU) with the new VMID <--> PASID mapping, but didn't update the IH (Interrupt) registers.The bug only occurs when using non-HWS mode. In HWS mode, the CP automatically does the VMID <--> PASID mapping.
Signed-off-by Ben Goz <[email protected]>Signed-off-by Oded Gabbay <[email protected]>
I'm not too familiar with how these registers work. I'm assuming they are just scratch registers that either the fw or the driver has to update depending on the scheduling model? For the series:
Quoted 32 lines
--- drivers/gpu/drm/radeon/cikd.h | 2 ++ drivers/gpu/drm/radeon/radeon_kfd.c | 4 ++++ 2 files changed, 6 insertions(+)drivers/gpu/drm/radeon/cikd.h +2
-0@@ -2156,4 +2156,6 @@#define ATC_VM_APERTURE1_HIGH_ADDR 0x330Cu#define ATC_VM_APERTURE1_LOW_ADDR 0x3304u +#define IH_VMID_0_LUT 0x3D40u +#endif drivers/gpu/drm/radeon/radeon_kfd.c +4
-1@@ -390,6 +390,10 @@ static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid,cpu_relax ();write_register (kgd,ATC_VMID_PASID_MAPPING_UPDATE_STATUS ,1U << vmid); +/* Mapping vmid to pasid also for IH block */ +write_register (kgd,IH_VMID_0_LUT + vmid *sizeof (uint32_t ), + pasid_mapping); +return 0 ; } --
Quoted 2 lines
1.9.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Alex Deucher
Quoted 9 lines · Oded Gabbay
From: Ben Goz <[email protected]>
This patch fixes a bug in
kgd_set_pasid_vmid_mapping(), where the function only updated the ATC registers (IOMMU) with the new VMID <--> PASID mapping, but didn't update the IH (Interrupt) registers.The bug only occurs when using non-HWS mode. In HWS mode, the CP automatically does the VMID <--> PASID mapping.
Quoted 9 lines
Quoted 2 lines
Signed-off-by Ben Goz <[email protected]>Signed-off-by Oded Gabbay <[email protected]>I'm not too familiar with how these registers work. I'm assuming they are just scratch registers that either the fw or the driver has to update depending on the scheduling model? For the series:
Acked-by Alex Deucher <[email protected]>
Yes, those registers need to be updated by the driver, if we are working in non-HWS mode, or by the fw, if we are working in HWS mode, which is the default mode and the "production" mode.
Oded
Quoted 31 lines
Quoted 31 lines
--- drivers/gpu/drm/radeon/cikd.h | 2 ++ drivers/gpu/drm/radeon/radeon_kfd.c | 4 ++++ 2 files changed, 6 insertions(+)drivers/gpu/drm/radeon/cikd.h +2
-0@@ -2156,4 +2156,6 @@#define ATC_VM_APERTURE1_HIGH_ADDR 0x330Cu#define ATC_VM_APERTURE1_LOW_ADDR 0x3304u +#define IH_VMID_0_LUT 0x3D40u +#endif drivers/gpu/drm/radeon/radeon_kfd.c +4
-0@@ -390,6 +390,10 @@ static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid,cpu_relax ();write_register (kgd,ATC_VMID_PASID_MAPPING_UPDATE_STATUS ,1U << vmid); +/* Mapping vmid to pasid also for IH block */ +write_register (kgd,IH_VMID_0_LUT + vmid *sizeof (uint32_t ), + pasid_mapping); +return 0 ; }
Quoted 3 lines
Quoted 3 lines
--
1.9.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel