accel/amdxdna: Preserve user address when PASID is disabled
Lizhi Hou
maintainerPATCH 1/1 accel/amdxdna: Preserve user address when PASID is disabled
When PASID is not used, the buffer user address is set to AMDXDNA_INVALID_ADDR. As a result, heap buffer user address validation fails even though the original userspace address is available.
Preserve the userspace address regardless of PASID usage so heap buffer address validation works correctly.
--- drivers/accel/amdxdna/amdxdna_gem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/accel/amdxdna/amdxdna_gem.c +4 -1
@@ -349,8 +349,11 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,u32 nr_pages;int ret; -if (!amdxdna_pasid_on (abo->client)) +if (!amdxdna_pasid_on (abo->client)) { +/* Need to set uva for heap uva validation */ + abo->mem.uva = addr;return 0 ; + } mapp =kzalloc_obj (*mapp);if (!mapp)
Signature · 1 line
2.34.1
Quoted 9 lines · Lizhi Hou
When PASID is not used, the buffer user address is set to
AMDXDNA_INVALID_ADDR. As a result, heap buffer user address validation fails even though the original userspace address is available.Preserve the userspace address regardless of PASID usage so heap buffer address validation works correctly.
Fixes dbc8fd7a03cb ("accel/amdxdna: Add expandable device heap support")Signed-off-by Lizhi Hou <[email protected]>
Quoted 21 lines
--- drivers/accel/amdxdna/amdxdna_gem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/accel/amdxdna/amdxdna_gem.c +4
-1@@ -349,8 +349,11 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,u32 nr_pages;int ret; -if (!amdxdna_pasid_on (abo->client)) +if (!amdxdna_pasid_on (abo->client)) { +/* Need to set uva for heap uva validation */ + abo->mem.uva = addr;return 0 ; + } mapp =kzalloc_obj (*mapp);if (!mapp)
Applied to drm-misc-next-fixes
Quoted 34 lines · Mario Limonciello
Quoted 9 lines · Lizhi Hou
When PASID is not used, the buffer user address is set to
AMDXDNA_INVALID_ADDR. As a result, heap buffer user address validation fails even though the original userspace address is available.Preserve the userspace address regardless of PASID usage so heap buffer address validation works correctly.
Fixes dbc8fd7a03cb ("accel/amdxdna: Add expandable device heap support")Signed-off-by Lizhi Hou <[email protected]>Reviewed-by Mario Limonciello (AMD) <[email protected]>Quoted 20 lines
---
drivers/accel/amdxdna/amdxdna_gem.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)drivers/accel/amdxdna/amdxdna_gem.c +4
-0@@ -349,8 +349,11 @@ static int amdxdna_hmm_register(structamdxdna_gem_obj *abo, u32 nr_pages; int ret; - if (!amdxdna_pasid_on(abo->client)) + if (!amdxdna_pasid_on(abo->client)) { + /* Need to set uva for heap uva validation */ + abo->mem.uva = addr; return 0; + } mapp = kzalloc_obj(*mapp); if (!mapp)