Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Stuart Summers" <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 10/11] drm/xe: Require a fully visible VRAM BAR without a primary GT
Date: Wed, 11 Nov 2026 04:38:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-208305@kernel.org> (raw)
In-Reply-To: <20261110231442.218721-23-stuart.summers@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/xe: NULL deref of tile->primary_gt in tile_vram_size() in
  xe_vram_probe()
--

commit 5c01d4a69cb121bc624de632e7f741dd67a3eabc
Author: Stuart Summers <stuart.summers@intel.com>

drm/xe: Require a fully visible VRAM BAR without a primary GT

This commit rejects device probe in xe_vram_probe() if a tile has no
primary GT and its VRAM BAR is smaller than the tile's usable VRAM size.

> diff --git a/drivers/gpu/drm/xe/xe_vram.c b/drivers/gpu/drm/xe/xe_vram.c
> index 1c02889ba29b2..4d399a83479ef 100644
> --- a/drivers/gpu/drm/xe/xe_vram.c
> +++ b/drivers/gpu/drm/xe/xe_vram.c
[ ... ]
> @@ -346,6 +347,20 @@ int xe_vram_probe(struct xe_device *xe)
>  		if (err)
>  			return err;
>  
> +		/*
> +		 * Without a primary GT there is no copy engine, so VRAM is
> +		 * moved with the CPU through the BAR.  That only works if the
> +		 * BAR covers all of it.
> +		 */
> +		if (!tile->primary_gt &&
> +		    tile->mem.vram->io_size < tile->mem.vram->usable_size) {
> +			xe_tile_err(tile,
> +				    "VRAM is not fully CPU visible (%pa of %pa); a resizable BAR is required without a primary GT\n",
> +				    &tile->mem.vram->io_size,
> +				    &tile->mem.vram->usable_size);
> +			return -ENODEV;
> +		}
> +
>  		if (total_size > lmem_bar.io_size) {
>  			xe_log_info(xe, VRAM,
>  				    "Total size %#llx is larger than resource %#llx\n",

[Severity: High]
Can xe_vram_probe() reach this !tile->primary_gt check when
xe->info.has_flat_ccs is set, or does tile_vram_size() dereference a NULL
tile->primary_gt first?

Earlier in the same loop, xe_vram_probe() calls tile_vram_size(), which
passes tile->primary_gt to get_flat_ccs_offset():

drivers/gpu/drm/xe/xe_vram.c:tile_vram_size() {
	struct xe_device *xe = tile_to_xe(tile);
	struct xe_gt *gt = tile->primary_gt;
...
	if (xe->info.has_flat_ccs) {
		int ret = get_flat_ccs_offset(gt, *tile_size, &offset);
}

When a discrete GPU with Flat-CCS (such as Battlemage) is probed with
gt_types_allowed=media via configfs, xe->info.has_flat_ccs remains set
while tile->primary_gt is NULL, and get_flat_ccs_offset() immediately
dereferences gt via gt_to_xe(gt) and gt_to_fw(gt).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110231442.218721-13-stuart.summers@intel.com?part=10

  reply	other threads:[~2026-11-11  4:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 23:14 [PATCH 00/11] Allow boot with only media GT Stuart Summers
2026-11-10 23:14 ` [PATCH 01/11] drm/xe: Detect each GMD_ID IP in a loop Stuart Summers
2026-11-10 23:14 ` [PATCH 02/11] drm/xe: Tolerate a missing graphics IP in xe_info_init() Stuart Summers
2026-11-10 23:14 ` [PATCH 03/11] drm/xe: Verify IP presence against GU_CNTL Stuart Summers
2026-11-10 23:14 ` [PATCH 04/11] drm/xe: Guard per-tile primary GT accesses Stuart Summers
2026-11-10 23:14 ` [PATCH 05/11] drm/xe: Stop assuming the root tile has a primary GT Stuart Summers
2026-11-11  2:59   ` sashiko-bot
2026-11-10 23:14 ` [PATCH 06/11] drm/xe: Do not claim flat CCS without a graphics IP Stuart Summers
2026-11-11  3:21   ` sashiko-bot
2026-11-10 23:14 ` [PATCH 07/11] drm/xe: Run page table updates on the media GT when there is no primary Stuart Summers
2026-11-11  3:53   ` sashiko-bot
2026-11-10 23:14 ` [PATCH 08/11] drm/xe: Document that gt_types_allowed=media now probes Stuart Summers
2026-11-10 23:14 ` [PATCH 09/11] drm/xe: Fall back to CPU copies when the tile cannot blit Stuart Summers
2026-11-11  4:25   ` sashiko-bot
2026-11-10 23:14 ` [PATCH 10/11] drm/xe: Require a fully visible VRAM BAR without a primary GT Stuart Summers
2026-11-11  4:38   ` sashiko-bot [this message]
2026-11-10 23:14 ` [PATCH 11/11] drm/xe: Allow probe " Stuart Summers
2026-11-11  4:57   ` sashiko-bot
2026-11-10 23:39 ` ✓ CI.KUnit: success for Allow boot with only media GT Patchwork
2026-11-11  0:14 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-11  4:17 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-12 12:21 ` [PATCH 00/11] " Piotr Piórkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-208305@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=stuart.summers@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox