All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maarten Lankhorst" <dev@lankhorst.se>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v4 4/6] drm/xe/display: Use the correct calculation for phys_base on integrated
Date: Mon, 16 Nov 2026 12:49:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-217024@kernel.org> (raw)
In-Reply-To: <20261116122828.266113-12-dev@lankhorst.se>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/xe/display: phys_base underflow in initial_plane_bo()
  without bounds check
- [Medium] drm/xe/display: unmasked upper GGTT PTE bits in
  initial_plane_bo() phys_base
- [Low] drm/xe/display: missing Fixes trailer for integrated phys_base
  fix
--

commit eed4039b7f540e8781cba90ce638a76b3efbdd53
Author: Maarten Lankhorst <dev@lankhorst.se>

> drm/xe/display: Use the correct calculation for phys_base on integrated
>
> The code originally assumed there was a 1:1 mapping between
> stolen and GGTT offset. This is no longer true as of MTL, so
> perform the correct calculations, similar to how they're
> performed for the DGFX case.
>
> Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>

[Severity: Low]
This fixes the integrated phys_base calculation introduced in the initial
display support.  Should this include:

  Fixes: 44e694958b95 ("drm/xe/display: Implement display support")

> diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c b/drivers/gpu/drm/xe/display/xe_initial_plane.c
> index a100ad23be2a0..451c24a4ed8d5 100644
> --- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
> +++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
> @@ -101,7 +101,7 @@ initial_plane_bo(struct xe_device *xe,
>  			return NULL;
>  		}
>  
> -		phys_base = base;
> +		phys_base = (pte & ~(page_size - 1)) - xe_ttm_stolen_gpu_offset(xe);

[Severity: Medium]
Can phys_base underflow when the PTE address is below
xe_ttm_stolen_gpu_offset(xe)?

Unlike the IS_DGFX(xe) path, this branch does not check XE_PAGE_PRESENT or
verify that the PTE address lies within the stolen range before
subtracting xe_ttm_stolen_gpu_offset(xe).  If the initial plane PTE is
unmapped or points to system memory below stolen_base (for example across
module reload, PCI rebind, or kexec when the active framebuffer was
allocated in system memory), phys_base underflows near U64_MAX.  When
size >= xe_ttm_stolen_gpu_offset(xe) - pte_addr,
xe_bo_create_pin_map_at_novm() -> xe_bo_create_pin_map_at_aligned() wraps
end = start + size so that end <= start:

drivers/gpu/drm/xe/xe_bo.c:xe_bo_create_pin_map_at_aligned() {
	...
	u64 start = offset == ~0ull ? 0 : offset;
	u64 end = offset == ~0ull ? ~0ull : start + size;
	...
}

ttm_range_man_alloc() then passes place->fpfn > lpfn into
drm_mm_insert_node_in_range(), triggering DRM_MM_BUG_ON(range_start >
range_end) when CONFIG_DRM_DEBUG_MM is enabled.

[Severity: Medium]
Does masking pte with ~(page_size - 1) leave upper GGTT PTE flag bits set
in phys_base?

On Xe_LPG and newer platforms (GRAPHICS_VERx100(xe) >= 1270), GGTT PTEs
encode the PAT index in bits 52 and 53 (XELPG_GGTT_PTE_PAT0 and
XELPG_GGTT_PTE_PAT1 in xelpg_ggtt_pte_flags()), while the physical page
address occupies bits [51:shift] as defined by XE_PAGE_ADDR_MASK().
Masking with ~(page_size - 1) only clears the low page-offset bits, so any
non-zero PAT index in the PTE (both here and in the IS_DGFX(xe) path
above) leaves bits 52:53 set in phys_base and causes
xe_bo_create_pin_map_at_novm() to fail with -ENOSPC, discarding the
initial framebuffer.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116122828.266113-8-dev@lankhorst.se?part=4

  reply	other threads:[~2026-11-16 12:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 12:28 [PATCH v4 0/6] drm/xe: More BIOS FB takeover fixes Maarten Lankhorst
2026-11-16 12:28 ` [PATCH v4 1/6] drm/xe/ggtt: Add xe_ggtt_reserve_area Maarten Lankhorst
2026-11-16 12:38   ` sashiko-bot
2026-11-16 12:28 ` [PATCH v4 2/6] drm/xe/ggtt: Add xe_ggtt_node_remove_noclear Maarten Lankhorst
2026-11-16 12:28 ` [PATCH v4 3/6] drm/xe/display: Reserve the original GGTT space before creating a bo Maarten Lankhorst
2026-11-16 12:28 ` [PATCH v4 4/6] drm/xe/display: Use the correct calculation for phys_base on integrated Maarten Lankhorst
2026-11-16 12:49   ` sashiko-bot [this message]
2026-11-16 12:28 ` [PATCH v4 5/6] drm/xe/display: Remove duplicated code Maarten Lankhorst
2026-11-16 12:56   ` sashiko-bot
2026-11-16 12:28 ` [PATCH v4 6/6] drm/xe/ggtt: Remove xe_ggtt_insert_bo_at Maarten Lankhorst
2026-11-16 14:40 ` ✗ CI.checkpatch: warning for drm/xe: More BIOS FB takeover fixes (rev5) Patchwork
2026-11-16 14:43 ` ✓ CI.KUnit: success " Patchwork
2026-11-16 15:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16 23:16 ` ✗ Xe.CI.FULL: failure " Patchwork

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-217024@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.