]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Program IH_VMID_LUT_INDEX register on GFX 12.1
authorMukul Joshi <mukul.joshi@amd.com>
Thu, 24 Jul 2025 02:34:11 +0000 (22:34 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 5 Jan 2026 21:26:15 +0000 (16:26 -0500)
For querying VMID <-> PASID mapping on GFX 12.1, we need to first
program the IH_VMID_LUT_INDEX before fetching the LUT mapping. Without
this TLB flush may not work.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Michael Chen <michael.chen@amd.com>
Reviewed-by: Alex Sierra <alex.sierra@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c

index 061d1be723408d20af54980639083bc7dc0655fa..d68e5a2377b6340b9b654dce40c35239a9222acc 100644 (file)
@@ -230,8 +230,18 @@ static int gmc_v12_1_process_interrupt(struct amdgpu_device *adev,
 }
 
 static bool gmc_v12_1_get_vmid_pasid_mapping_info(struct amdgpu_device *adev,
-                                                 uint8_t vmid, uint16_t *p_pasid)
+                                                 uint8_t vmid, uint8_t inst,
+                                                 uint16_t *p_pasid)
 {
+       uint16_t index;
+
+       if (inst/4)
+               index = 0xA + inst%4;
+       else
+               index = 0x2 + inst%4;
+
+       WREG32(SOC15_REG_OFFSET(OSSSYS, 0, regIH_VMID_LUT_INDEX), index);
+
        *p_pasid = RREG32(SOC15_REG_OFFSET(OSSSYS, 0, regIH_VMID_0_LUT) + vmid) & 0xffff;
 
        return !!(*p_pasid);
@@ -350,7 +360,7 @@ static void gmc_v12_1_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
        for (vmid = 1; vmid < 16; vmid++) {
                bool valid;
 
-               valid = gmc_v12_1_get_vmid_pasid_mapping_info(adev, vmid,
+               valid = gmc_v12_1_get_vmid_pasid_mapping_info(adev, vmid, inst,
                                                              &queried);
                if (!valid || queried != pasid)
                        continue;