* [PATCH V1] accel/amdxdna: Preserve user address when PASID is disabled
@ 2026-06-02 4:06 Lizhi Hou
2026-06-02 14:15 ` Mario Limonciello
0 siblings, 1 reply; 3+ messages in thread
From: Lizhi Hou @ 2026-06-02 4:06 UTC (permalink / raw)
To: ogabbay, quic_jhugo, dri-devel, mario.limonciello, karol.wachowski
Cc: Lizhi Hou, linux-kernel, max.zhen, sonal.santan
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 <lizhi.hou@amd.com>
---
drivers/accel/amdxdna/amdxdna_gem.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
index 77e5fad08ae5..33cf5af98ceb 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.c
+++ b/drivers/accel/amdxdna/amdxdna_gem.c
@@ -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)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH V1] accel/amdxdna: Preserve user address when PASID is disabled
2026-06-02 4:06 [PATCH V1] accel/amdxdna: Preserve user address when PASID is disabled Lizhi Hou
@ 2026-06-02 14:15 ` Mario Limonciello
2026-06-02 15:40 ` Lizhi Hou
0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2026-06-02 14:15 UTC (permalink / raw)
To: Lizhi Hou, ogabbay, quic_jhugo, dri-devel, karol.wachowski
Cc: linux-kernel, max.zhen, sonal.santan
On 6/1/26 23:06, Lizhi Hou wrote:
> 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 <lizhi.hou@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
> drivers/accel/amdxdna/amdxdna_gem.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
> index 77e5fad08ae5..33cf5af98ceb 100644
> --- a/drivers/accel/amdxdna/amdxdna_gem.c
> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
> @@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH V1] accel/amdxdna: Preserve user address when PASID is disabled
2026-06-02 14:15 ` Mario Limonciello
@ 2026-06-02 15:40 ` Lizhi Hou
0 siblings, 0 replies; 3+ messages in thread
From: Lizhi Hou @ 2026-06-02 15:40 UTC (permalink / raw)
To: Mario Limonciello, ogabbay, quic_jhugo, dri-devel, karol.wachowski
Cc: linux-kernel, max.zhen, sonal.santan
Applied to drm-misc-next-fixes
On 6/2/26 07:15, Mario Limonciello wrote:
>
>
> On 6/1/26 23:06, Lizhi Hou wrote:
>> 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 <lizhi.hou@amd.com>
> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> ---
>> drivers/accel/amdxdna/amdxdna_gem.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c
>> b/drivers/accel/amdxdna/amdxdna_gem.c
>> index 77e5fad08ae5..33cf5af98ceb 100644
>> --- a/drivers/accel/amdxdna/amdxdna_gem.c
>> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
>> @@ -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)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-02 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-02 4:06 [PATCH V1] accel/amdxdna: Preserve user address when PASID is disabled Lizhi Hou
2026-06-02 14:15 ` Mario Limonciello
2026-06-02 15:40 ` Lizhi Hou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®