Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ville Syrjala" <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 4/7] drm/i915/de: Use raw readl()/writel()/etc for register access in display
Date: Tue, 01 Dec 2026 19:43:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-244100@kernel.org> (raw)
In-Reply-To: <20261201192737.13451-5-ville.syrjala@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/i915/de: missing Wa_15015404425 flush in ptl_mmio_funcs
  on PTL A-step
- [Low] drm/i915/de: missing assert_display_rpm_held() in 8-bit and
  16-bit MMIO helpers
--

commit e8135e4c35609a69906e1d35188298d3836a144f
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm/i915/de: Use raw readl()/writel()/etc for register access in display

This commit replaces the remaining intel_uncore_{read,write}*() calls in
the display MMIO helpers with direct readb()/writeb()/readw()/readl()/
writel() accesses and implements Wa_15015404425 in intel_de.c for Lunar
Lake.

> diff --git a/drivers/gpu/drm/i915/display/intel_de.c b/drivers/gpu/drm/i915/display/intel_de.c
> index 658380cb8973b..d65f68b649d1d 100644
> --- a/drivers/gpu/drm/i915/display/intel_de.c
> +++ b/drivers/gpu/drm/i915/display/intel_de.c
[ ... ]
> @@ -149,6 +144,12 @@ int intel_de_wait_for_clear_ms(struct intel_display *display, intel_reg_t reg,
>  	return intel_de_wait_ms(display, reg, mask, 0, timeout_ms, NULL);
>  }
>  
> +static __always_inline void __iomem *
> +__intel_de_mmio_for_reg(struct intel_display *display, intel_reg_t reg)
> +{
> +	return display->mmio.regs + intel_reg_offset(reg);
> +}
> +
>  u8 intel_de_read8(struct intel_display *display, intel_reg_t reg)
>  {
>  	u8 val;
> @@ -156,7 +157,7 @@ u8 intel_de_read8(struct intel_display *display, intel_reg_t reg)
>  	/* this is only used on VGA registers (possible on pre-g4x) */
>  	drm_WARN_ON(display->drm, DISPLAY_VER(display) >= 5 || display->platform.g4x);
>  
> -	val = intel_uncore_read8(__to_uncore(display), reg);
> +	val = readb(__intel_de_mmio_for_reg(display, reg));
>  	trace_intel_reg_rw(false, reg, val, sizeof(val));
>  
>  	return val;
> @@ -167,7 +168,7 @@ void intel_de_write8(struct intel_display *display, intel_reg_t reg, u8 val)
>  	drm_WARN_ON(display->drm, DISPLAY_VER(display) >= 5 || display->platform.g4x);
>  
>  	trace_intel_reg_rw(true, reg, val, sizeof(val));
> -	intel_uncore_write8(__to_uncore(display), reg, val);
> +	writeb(val, __intel_de_mmio_for_reg(display, reg));
>  }
>  
>  u16 intel_de_read16(struct intel_display *display, intel_reg_t reg)
> @@ -177,7 +178,7 @@ u16 intel_de_read16(struct intel_display *display, intel_reg_t reg)
>  	/* this is only used on MCHBAR registers on pre-SNB */
>  	drm_WARN_ON(display->drm, DISPLAY_VER(display) >= 6);
>  
> -	val = intel_uncore_read16(__to_uncore(display), reg);
> +	val = readw(__intel_de_mmio_for_reg(display, reg));
>  	trace_intel_reg_rw(false, reg, val, sizeof(val));
>  
>  	return val;

[Severity: Low]
Should intel_de_read8(), intel_de_write8(), and intel_de_read16() call
assert_display_rpm_held(display) like __intel_de_read() and
__intel_de_write() do?

Previously, intel_uncore_read8(), intel_uncore_write8(), and
intel_uncore_read16() checked assert_rpm_wakelock_held() via
GEN2_READ_HEADER and GEN2_WRITE_HEADER, so replacing them directly with
readb(), writeb(), and readw() drops the runtime PM wakelock assertion for
8-bit VGA and 16-bit MCHBAR accesses.

[ ... ]

> @@ -533,11 +568,31 @@ static void lnl_mmio_write(struct intel_display *display, intel_reg_t reg, u32 v
>  #undef LNL_MMIO_FLAGS
>  
>  static const struct intel_mmio_funcs lnl_mmio_funcs = {
> -	.read_fw = i9xx_mmio_read_fw,
> +	.read_fw = lnl_mmio_read_fw,
>  	.read = lnl_mmio_read,
>  	.write = lnl_mmio_write,
>  };
>  
> +#define PTL_MMIO_FLAGS __MMIO_WAKELOCK
> +
> +static u32 ptl_mmio_read(struct intel_display *display, intel_reg_t reg)
> +{
> +	return __intel_de_read(display, reg, PTL_MMIO_FLAGS);
> +}
> +
> +static void ptl_mmio_write(struct intel_display *display, intel_reg_t reg, u32 val)
> +{
> +	__intel_de_write(display, reg, val, PTL_MMIO_FLAGS);
> +}
> +
> +#undef PTL_MMIO_FLAGS
> +
> +static const struct intel_mmio_funcs ptl_mmio_funcs = {
> +	.read_fw = i9xx_mmio_read_fw,
> +	.read = ptl_mmio_read,
> +	.write = ptl_mmio_write,
> +};
> +
[ ... ]
> @@ -571,7 +630,9 @@ void intel_de_init(struct intel_display *display)
>  		else
>  			display->mmio.funcs = &i9xx_mmio_funcs;
>  	} else {
> -		if (DISPLAY_VER(display) >= 20)
> +		if (DISPLAY_VER(display) >= 30)
> +			display->mmio.funcs = &ptl_mmio_funcs;
> +		else if (DISPLAY_VER(display) >= 20)
>  			display->mmio.funcs = &lnl_mmio_funcs;
>  		else
>  			display->mmio.funcs = &i9xx_mmio_funcs;

[Severity: Medium]
Does selecting ptl_mmio_funcs unconditionally for DISPLAY_VER(display) >= 30
drop Wa_15015404425 on Panther Lake systems where XE_DEVICE_WA(xe,
15015404425) is active?

In xe_device_wa_oob.rules and xe_wa_oob.rules, 15015404425 is enabled for
PLATFORM(PANTHERLAKE) and only disabled once media_gt is at least stepping
B0 (and after xe_display_init_early() runs during probe):

drivers/gpu/drm/xe/xe_device.c:xe_device_probe() {
	...
	err = xe_display_init_early(xe);
	if (err)
		return err;
	...
	if (xe->tiles->media_gt &&
	    XE_GT_WA(xe->tiles->media_gt, 15015404425_disable))
		XE_DEVICE_WA_DISABLE(xe, 15015404425);
}

Before this change, display reads went through xe_mmio_read32() ->
mmio_flush_pending_writes(), which checked XE_DEVICE_WA(mmio->tile->xe,
15015404425).  With ptl_mmio_funcs omitting __MMIO_READ_AFTER_WRITE_WA,
non-posted display reads on Panther Lake with an A-step media/compute die
(or during early display init) can overtake pending posted writes and
return stale register values.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201192737.13451-1-ville.syrjala@linux.intel.com?part=4

  reply	other threads:[~2026-12-01 19:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 19:27 [PATCH v2 0/7] drm/i915/de: Nuke uncore Ville Syrjala
2026-12-01 19:27 ` [PATCH v2 1/7] drm/i915/de: Move the register tracepoint to display Ville Syrjala
2026-12-01 19:27 ` [PATCH v2 2/7] drm/i915/de: Pimp the intel_reg_rw tracepoint printf format Ville Syrjala
2026-12-01 19:27 ` [PATCH v2 3/7] drm/i915/de: Convert intel_de_read_fw() into a vfunc Ville Syrjala
2026-12-01 19:27 ` [PATCH v2 4/7] drm/i915/de: Use raw readl()/writel()/etc for register access in display Ville Syrjala
2026-12-01 19:43   ` sashiko-bot [this message]
2026-12-01 19:27 ` [PATCH v2 5/7] drm/i915/de: Add intel_parent_mmio_regs() interface Ville Syrjala
2026-12-01 19:27 ` [PATCH v2 6/7] drm/xe: Nuke the compat uncore stuff Ville Syrjala
2026-12-01 19:27 ` [PATCH v2 7/7] drm/i915/de: Document intel_de_write8()'s usage restrictions Ville Syrjala

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-244100@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=ville.syrjala@linux.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