All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Mukul Joshi <mukul.joshi@amd.com>,
	Michael Chen <michael.chen@amd.com>,
	Alex Sierra <alex.sierra@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH] drm/amdgpu: Program IH_VMID_LUT_INDEX register on GFX 12.1
Date: Mon, 15 Dec 2025 13:15:49 -0500	[thread overview]
Message-ID: <20251215181607.29132-2-alexander.deucher@amd.com> (raw)
In-Reply-To: <20251215181607.29132-1-alexander.deucher@amd.com>

From: Mukul Joshi <mukul.joshi@amd.com>

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 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
index 061d1be723408..d68e5a2377b63 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
@@ -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;
-- 
2.52.0


  reply	other threads:[~2025-12-15 18:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 18:15 [PATCH] drm/amdgpu/gfx_v12_1: add mqd_stride_size input parameter Alex Deucher
2025-12-15 18:15 ` Alex Deucher [this message]
2025-12-15 18:15 ` [PATCH] drm/amdgpu: Setup Retry based thrashing prevention on GFX 12.1 Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdgpu: disable burst for gfx v12_1 Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdkfd: Set SDMA_QUEUEx_IB_CNTL/SWITCH_INSIDE_IB Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdkfd: Add SDMA queue quantum support for GFX12.1 Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdgpu: adjust xcc_cp_resume function for gfx_v12_1 Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdgpu: adjust xcc logic for gfxhub v12_1 Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdgpu: adjust xcc_id program logic for sdma v7_1 Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdgpu: Use correct MES pipe in non-SPX mode on GFX 12.1 Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdgpu: Rework MES initialization " Alex Deucher
2025-12-15 18:15 ` [PATCH] drm/amdkfd: Don't partition VMID space " Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdkfd: Add/remove queues on the correct XCC " Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdkfd: Send MES packets on " Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdgpu: Report correct compute partition mode " Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdgpu: Setup MTYPE on SOC models for " Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdgpu: make normalize reg addr to common func for soc v1 Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdgpu: Switch to gfx_v12_1_get_xccs_per_xcp Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdgpu: Do not initialize imu callback for vf Alex Deucher
2025-12-15 18:16 ` [PATCH] drm/amdgpu: Fix xcc_id input for soc_v1_0_grbm_select Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251215181607.29132-2-alexander.deucher@amd.com \
    --to=alexander.deucher@amd.com \
    --cc=alex.sierra@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=michael.chen@amd.com \
    --cc=mukul.joshi@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.