Re: [PATCH v2 3/3] drm/xe: Implement Wa_22016122933

[email protected]
Newsgroups org.freedesktop.lists.intel-xe,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Direct dereference of `xe_device_get_gt()` return value without a preceding NULL check.
--

--- Patch [3]: [PATCH v2 3/3] drm/xe: Implement Wa_22016122933 ---
commit 79bddd9db4e49ddb9738f564c898446b08519d91
Author: Tales A. Mendonça <[email protected]>

drm/xe: Implement Wa_22016122933

On platforms with a standalone media GT and media version 13.00
(MTL/ARL), memory shared between the CPU and the media GT's GuC must
not be mapped cached on the CPU side: the CPU can otherwise read stale
cache lines for data the GuC has already written.

Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/8678

> diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
> index 4286bd05c6861..c988a2a3b7bdb 100644
> --- a/drivers/gpu/drm/xe/xe_guc.c
> +++ b/drivers/gpu/drm/xe/xe_guc.c

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential NULL
pointer dereference in this file in guc_g2g_alloc().

The xe_device_get_gt() function can return NULL for invalid GT indices, but
its return value is immediately dereferenced without a check:

	if (gt->info.id != 0) {
		struct xe_gt *root_gt = xe_device_get_gt(xe, 0);
		struct xe_guc *root_guc = &root_gt->uc.guc;

If the primary GT (index 0) is missing or invalid, this will crash the
system. Does this code need a NULL check for root_gt, or should it use
xe_root_mmio_gt(xe) instead if the root tile's primary GT is specifically
needed?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.