Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] Logical OR (||) used instead of bitwise OR (|) when packing ASID and 
SRCID into pf.consumer.id.
--

commit 1788c2503016dd2829d88985880f0d679983c0b4
Author: Jonathan Cavitt <[email protected]>

    drm/xe/pagefault: Add SRCID to pagefault struct

This commit adds SRCID information to the pagefault struct to report the
hardware unit that caused the pagefault, folding it into the same field as
ASID to keep the struct compact.

> diff --git a/drivers/gpu/drm/xe/xe_guc_pagefault.c 
> b/drivers/gpu/drm/xe/xe_guc_pagefault.c
> index 8f8210a732e98..036175faadd4a 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pagefault.c
> @@ -108,7 +108,13 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 
> *msg, u32 len)
>                                     << PFD_VIRTUAL_ADDR_HI_SHIFT) |
>               (FIELD_GET(PFD_VIRTUAL_ADDR_LO, msg[2]) <<
>                PFD_VIRTUAL_ADDR_LO_SHIFT);
> -     pf.consumer.asid = FIELD_GET(PFD_ASID, msg[1]);
> +
> +     BUILD_BUG_ON(XE_MAX_ASID > XE_PAGEFAULT_ASID_MASK);
> +
> +     pf.consumer.id = FIELD_PREP(XE_PAGEFAULT_ASID_MASK,
> +                                 FIELD_GET(PFD_ASID, msg[1])) ||
> +                      FIELD_PREP(XE_PAGEFAULT_SRCID_MASK,
> +                                 FIELD_GET(PFD_SRC_ID, msg[0]));

[Severity: High]
Is this intended to be a bitwise OR (|) rather than a logical OR (||)?

Using a logical OR will result in pf.consumer.id being assigned a boolean
value (1 or 0) rather than the packed ASID and SRCID bits. When
xe_pagefault_service() extracts the ASID using FIELD_GET, it will likely
read 1 rather than the true ASID of the faulting VM. This misroutes page
faults and breaks virtual memory management.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to