On NPA mappings PTE.X is repurposed as the RPC (remote presence check) enable bit. Set it for importer mappings, so the importer takes a page fault once the exporter's NPA mapping is gone, instead of accessing a stale mapping.
This runs after the generic AMDGPU_VM_PAGE_EXECUTABLE handling and intentionally overrides the UAPI flag. The exporter and the remote ring, wptr and doorbell mappings keep their own PTE.X handling. Signed-off-by: Philip Yang <[email protected]> --- drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c index cee90dfa445c..8da63045b5a8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c @@ -616,7 +616,9 @@ static void gmc_v12_1_get_npa_flags(struct amdgpu_device *adev, AMDGPU_PTE_BUS_ATOMICS; *flags &= ~AMDGPU_PTE_VALID; *flags &= ~AMDGPU_PTE_SYSTEM; - *flags &= ~AMDGPU_PTE_EXECUTABLE; + + /* PTE.X=1 turns on RPC (remote presence check), overrides vm_flags */ + *flags |= AMDGPU_PTE_EXECUTABLE; } /* -- 2.50.1
