From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 20/31] drm/amdgpu/gmc: add new callback to lookup vmid to pasid mapping
Date: Tue, 1 Sep 2026 16:10:23 -0400 [thread overview]
Message-ID: <20260901201034.2960437-21-alexander.deucher@amd.com> (raw)
In-Reply-To: <20260901201034.2960437-1-alexander.deucher@amd.com>
Look up the mapping so we know which vmid to flush.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 7 ++++++-
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 6 ++++--
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 6 ++++--
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 6 ++++--
drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c | 1 +
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 6 ++++--
6 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
index 204cf1c360896..27785b1b38ccd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
@@ -171,6 +171,10 @@ struct amdgpu_gmc_funcs {
/* Change the VMID -> PASID mapping */
void (*emit_pasid_mapping)(struct amdgpu_ring *ring, unsigned vmid,
unsigned pasid);
+ /* look up the vmids for the pasid */
+ bool (*get_vmid_pasid_mapping_info)(struct amdgpu_device *adev,
+ uint8_t vmid, uint8_t inst,
+ uint16_t *p_pasid);
/* enable/disable PRT support */
void (*set_prt)(struct amdgpu_device *adev, bool enable);
/* get the pde for a given mc addr */
@@ -384,7 +388,8 @@ struct amdgpu_gmc {
#define amdgpu_gmc_emit_flush_gpu_tlb(r, vmid, addr) (r)->adev->gmc.gmc_funcs->emit_flush_gpu_tlb((r), (vmid), (addr))
#define amdgpu_gmc_emit_pasid_mapping(r, vmid, pasid) (r)->adev->gmc.gmc_funcs->emit_pasid_mapping((r), (vmid), (pasid))
#define amdgpu_gmc_get_vm_pde(adev, level, dst, flags) (adev)->gmc.gmc_funcs->get_vm_pde((adev), (level), (dst), (flags))
-#define amdgpu_gmc_get_vm_pte(adev, vm, bo, vm_flags, pte_flags) \
+#define amdgpu_gmc_get_vmid_pasid_mapping_info(adev, v, i, p) (adev)->gmc.gmc_funcs->get_vmid_pasid_mapping_info((a), (v), (i), (p))
+#define amdgpu_gmc_get_vm_pte(adev, vm, bo, vm_flags, pte_flags) \
((adev)->gmc.gmc_funcs->get_vm_pte((adev), (vm), (bo), (vm_flags), \
(pte_flags)))
#define amdgpu_gmc_override_vm_pte_flags(adev, vm, addr, pte_flags) \
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index 23d9fe995a2b5..0028639448956 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -204,7 +204,8 @@ static bool gmc_v10_0_use_invalidate_semaphore(struct amdgpu_device *adev,
static bool gmc_v10_0_get_atc_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)
{
uint32_t value;
@@ -346,7 +347,7 @@ static void gmc_v10_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
for (vmid = 1; vmid < AMDGPU_NUM_VMID; vmid++) {
bool valid;
- valid = gmc_v10_0_get_atc_vmid_pasid_mapping_info(adev, vmid,
+ valid = gmc_v10_0_get_atc_vmid_pasid_mapping_info(adev, vmid, 0,
&queried);
if (!valid || queried != pasid)
continue;
@@ -555,6 +556,7 @@ static const struct amdgpu_gmc_funcs gmc_v10_0_gmc_funcs = {
.flush_gpu_tlb_pasid = gmc_v10_0_flush_gpu_tlb_pasid,
.emit_flush_gpu_tlb = gmc_v10_0_emit_flush_gpu_tlb,
.emit_pasid_mapping = gmc_v10_0_emit_pasid_mapping,
+ .get_vmid_pasid_mapping_info = gmc_v10_0_get_atc_vmid_pasid_mapping_info,
.get_vm_pde = gmc_v10_0_get_vm_pde,
.get_vm_pte = gmc_v10_0_get_vm_pte,
.get_vbios_fb_size = gmc_v10_0_get_vbios_fb_size,
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
index 098e1340554c5..b34bd7881726d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
@@ -200,7 +200,8 @@ static bool gmc_v11_0_use_invalidate_semaphore(struct amdgpu_device *adev,
static bool gmc_v11_0_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)
{
*p_pasid = RREG32(SOC15_REG_OFFSET(OSSSYS, 0, regIH_VMID_0_LUT) + vmid) & 0xffff;
@@ -338,7 +339,7 @@ static void gmc_v11_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
for (vmid = 1; vmid < 16; vmid++) {
bool valid;
- valid = gmc_v11_0_get_vmid_pasid_mapping_info(adev, vmid,
+ valid = gmc_v11_0_get_vmid_pasid_mapping_info(adev, vmid, 0,
&queried);
if (!valid || queried != pasid)
continue;
@@ -546,6 +547,7 @@ static const struct amdgpu_gmc_funcs gmc_v11_0_gmc_funcs = {
.flush_gpu_tlb_pasid = gmc_v11_0_flush_gpu_tlb_pasid,
.emit_flush_gpu_tlb = gmc_v11_0_emit_flush_gpu_tlb,
.emit_pasid_mapping = gmc_v11_0_emit_pasid_mapping,
+ .get_vmid_pasid_mapping_info = gmc_v11_0_get_vmid_pasid_mapping_info,
.get_vm_pde = gmc_v11_0_get_vm_pde,
.get_vm_pte = gmc_v11_0_get_vm_pte,
.get_vbios_fb_size = gmc_v11_0_get_vbios_fb_size,
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
index cffc818880d12..9179dc0787f13 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
@@ -196,7 +196,8 @@ static bool gmc_v12_0_use_invalidate_semaphore(struct amdgpu_device *adev,
static bool gmc_v12_0_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)
{
*p_pasid = RREG32(SOC15_REG_OFFSET(OSSSYS, 0, regIH_VMID_0_LUT) + vmid) & 0xffff;
@@ -374,7 +375,7 @@ static void gmc_v12_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
for (vmid = 1; vmid < 16; vmid++) {
bool valid;
- valid = gmc_v12_0_get_vmid_pasid_mapping_info(adev, vmid,
+ valid = gmc_v12_0_get_vmid_pasid_mapping_info(adev, vmid, 0,
&queried);
if (!valid || queried != pasid)
continue;
@@ -581,6 +582,7 @@ static const struct amdgpu_gmc_funcs gmc_v12_0_gmc_funcs = {
.flush_gpu_tlb_pasid = gmc_v12_0_flush_gpu_tlb_pasid,
.emit_flush_gpu_tlb = gmc_v12_0_emit_flush_gpu_tlb,
.emit_pasid_mapping = gmc_v12_0_emit_pasid_mapping,
+ .get_vmid_pasid_mapping_info = gmc_v12_0_get_vmid_pasid_mapping_info,
.get_vm_pde = gmc_v12_0_get_vm_pde,
.get_vm_pte = gmc_v12_0_get_vm_pte,
.get_vbios_fb_size = gmc_v12_0_get_vbios_fb_size,
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
index 6c0d2689cc05d..3fa1ec3dca273 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
@@ -668,6 +668,7 @@ static const struct amdgpu_gmc_funcs gmc_v12_1_gmc_funcs = {
.flush_gpu_tlb_pasid = gmc_v12_1_flush_gpu_tlb_pasid,
.emit_flush_gpu_tlb = gmc_v12_1_emit_flush_gpu_tlb,
.emit_pasid_mapping = gmc_v12_1_emit_pasid_mapping,
+ .get_vmid_pasid_mapping_info = gmc_v12_1_get_vmid_pasid_mapping_info,
.get_vm_pde = gmc_v12_1_get_vm_pde,
.get_vm_pte = gmc_v12_1_get_vm_pte,
.query_mem_partition_mode = &amdgpu_gmc_query_memory_partition,
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index a91d0ddb6e729..0019706b0b2a9 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -727,7 +727,8 @@ static bool gmc_v9_0_use_invalidate_semaphore(struct amdgpu_device *adev,
}
static bool gmc_v9_0_get_atc_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)
{
uint32_t value;
@@ -889,7 +890,7 @@ static void gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
bool valid;
valid = gmc_v9_0_get_atc_vmid_pasid_mapping_info(adev, vmid,
- &queried);
+ inst, &queried);
if (!valid || queried != pasid)
continue;
@@ -1302,6 +1303,7 @@ static const struct amdgpu_gmc_funcs gmc_v9_0_gmc_funcs = {
.flush_gpu_tlb_pasid = gmc_v9_0_flush_gpu_tlb_pasid,
.emit_flush_gpu_tlb = gmc_v9_0_emit_flush_gpu_tlb,
.emit_pasid_mapping = gmc_v9_0_emit_pasid_mapping,
+ .get_vmid_pasid_mapping_info = gmc_v9_0_get_atc_vmid_pasid_mapping_info,
.get_vm_pde = gmc_v9_0_get_vm_pde,
.get_vm_pte = gmc_v9_0_get_vm_pte,
.override_vm_pte_flags = gmc_v9_0_override_vm_pte_flags,
--
2.55.0
next prev parent reply other threads:[~2026-09-01 20:11 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 20:10 [PATCH V2 00/31] Rework GPU TLB invalidation Alex Deucher
2026-09-01 20:10 ` [PATCH 01/31] drm/amdgpu/gmc9: disallow gfxoff around TLB flushes Alex Deucher
2026-09-02 7:10 ` Christian König
2026-09-02 13:08 ` Alex Deucher
2026-09-02 13:10 ` Alex Deucher
2026-09-01 20:10 ` [PATCH 02/31] drm/amdgpu/gmc10: " Alex Deucher
2026-09-01 20:10 ` [PATCH 03/31] drm/amdgpu/gmc11: " Alex Deucher
2026-09-01 20:10 ` [PATCH 04/31] drm/amdgpu/gmc12: " Alex Deucher
2026-09-01 20:10 ` [PATCH 05/31] drm/amdgpu/gmc9: set vmhub funcs for gfxhub and mmhub Alex Deucher
2026-09-01 20:10 ` [PATCH 06/31] drm/amdgpu: add a gmc flag for using MMIO for TLB flush Alex Deucher
2026-09-01 20:10 ` [PATCH 07/31] drm/amdgpu/gmc9: use MMIO for TLB flushes Alex Deucher
2026-09-01 20:10 ` [PATCH 08/31] drm/amdgpu/gmc10: " Alex Deucher
2026-09-01 20:10 ` [PATCH 09/31] drm/amdgpu/gmc11: " Alex Deucher
2026-09-01 20:10 ` [PATCH 10/31] drm/amdgpu/gmc12: " Alex Deucher
2026-09-01 20:10 ` [PATCH 11/31] drm/amdgpu: add a buffer funcs callback for TLB invalidation Alex Deucher
2026-09-01 20:10 ` [PATCH 12/31] drm/amdgpu/sdma5.0: add tlb invalidation buffer func callback Alex Deucher
2026-09-01 20:10 ` [PATCH 13/31] drm/amdgpu/sdma5.2: " Alex Deucher
2026-09-01 20:10 ` [PATCH 14/31] drm/amdgpu/sdma6: " Alex Deucher
2026-09-01 20:10 ` [PATCH 15/31] drm/amdgpu/sdma7: " Alex Deucher
2026-09-01 20:10 ` [PATCH 16/31] drm/amdgpu: simplify amdgpu_gmc_flush_gpu_tlb() Alex Deucher
2026-09-01 20:10 ` [PATCH 17/31] drm/amdgpu: add tlb invalidation method enum Alex Deucher
2026-09-01 20:10 ` [PATCH 18/31] drm/amdgpu: plumb tlb inv method in amdgpu_gmc_flush_gpu_tlb_gart() Alex Deucher
2026-09-01 20:10 ` [PATCH 19/31] drm/amdgpu: uplevel reset check " Alex Deucher
2026-09-01 20:10 ` Alex Deucher [this message]
2026-09-02 6:26 ` [PATCH 20/31] drm/amdgpu/gmc: add new callback to lookup vmid to pasid mapping Zhang, Jesse(Jie)
2026-09-01 20:10 ` [PATCH 21/31] drm/amdgpu: add a gmc callback for the inv semaphore Alex Deucher
2026-09-01 20:10 ` [PATCH 22/31] drm/amdgpu/gmc: rework pasid flushing Alex Deucher
2026-09-02 3:04 ` Zhang, Jesse(Jie)
2026-09-01 20:10 ` [PATCH 23/31] drm/amdgpu/gmc9: use SDMA for gart TLB invalidation Alex Deucher
2026-09-01 20:10 ` [PATCH 24/31] drm/amdgpu/gmc10: " Alex Deucher
2026-09-01 20:10 ` [PATCH 25/31] drm/amdgpu/gmc11: " Alex Deucher
2026-09-01 20:10 ` [PATCH 26/31] drm/amdgpu/gmc12: " Alex Deucher
2026-09-01 20:10 ` [PATCH 27/31] drm/amdgpu/gmc10: use SDMA for pasid " Alex Deucher
2026-09-01 20:10 ` [PATCH 28/31] drm/amdgpu/gmc11: " Alex Deucher
2026-09-01 20:10 ` [PATCH 29/31] drm/amdgpu/gmc12: use MES or " Alex Deucher
2026-09-01 20:10 ` [PATCH 30/31] drm/amdgpu/gmc12: drop MES tlb inv in gmc callbacks Alex Deucher
2026-09-01 20:10 ` [PATCH 31/31] drm/amdgpu/gmc: add helpers for various tlb inv functions Alex Deucher
2026-09-02 7:07 ` [PATCH V2 00/31] Rework GPU TLB invalidation Christian König
2026-09-02 13:06 ` Alex Deucher
2026-09-02 13:20 ` Christian König
2026-09-02 13:25 ` Alex Deucher
2026-09-02 13:38 ` Alex Deucher
2026-09-02 13:57 ` Christian König
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=20260901201034.2960437-21-alexander.deucher@amd.com \
--to=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@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.