From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 07/19] drm/i915/vga: Avoid VGA arbiter during intel_vga_disable() for iGPUs
Date: Tue, 9 Dec 2025 14:17:16 +0200 [thread overview]
Message-ID: <aTgTTD7Yha80zRmy@intel.com> (raw)
In-Reply-To: <753969c83db9890a3556088630c9f079c584280a@intel.com>
On Tue, Dec 09, 2025 at 12:35:15PM +0200, Jani Nikula wrote:
> On Mon, 08 Dec 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Avoid using the VGA arbiter during intel_vga_get() for iGPUs because
> > that will clobber the VGA routing for whatever external GPU is the
> > current VGA device. That will cause all reads from VGA memory to
> > come back as 0xff/white, and thus we get a white rectangle on screen
> > when the external GPU switches from vgacon to fbcon.
> >
> > The iGPU has the highest VGA decode priority so it will steal all
> > VGA register accesses whenever its IO decoding is enabled. We'll only
> > keep the IO decode enabled for a short time so hopefully we don't
> > end up eating too many unrelated VGA register accesses.
> >
> > For discrete GPUs we need all the bridges to have their VGA forwarding
> > bits correctly configured so we can't really avoid the VGA arbiter
> > there. Although we only do this stuff on dGPUs when the VGA plane was
> > actaully enabled, so the dGPU should be the current VGA device
> > and thus have VGA routed to it already anyway.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Again, I'll take your word for it.
>
> Acked-by: Jani Nikula <jani.nikula@intel.com>
>
After sleeping on this, I think the proper thing would be to
change the VGA arbiter to be able to restore the previous VGA
routing after the put(). But that'll be quite a bit of work,
so this seems fine for now.
>
> > ---
> > drivers/gpu/drm/i915/display/intel_vga.c | 54 ++++++++++++++++++++++--
> > 1 file changed, 50 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
> > index 6a19fb242248..a2a1c33d053e 100644
> > --- a/drivers/gpu/drm/i915/display/intel_vga.c
> > +++ b/drivers/gpu/drm/i915/display/intel_vga.c
> > @@ -58,11 +58,58 @@ static bool has_vga_pipe_sel(struct intel_display *display)
> > return DISPLAY_VER(display) < 7;
> > }
> >
> > +static bool intel_pci_set_io_decode(struct pci_dev *pdev, bool enable)
> > +{
> > + u16 old = 0, cmd;
> > +
> > + pci_read_config_word(pdev, PCI_COMMAND, &old);
> > + cmd = old & ~PCI_COMMAND_IO;
> > + if (enable)
> > + cmd |= PCI_COMMAND_IO;
> > + pci_write_config_word(pdev, PCI_COMMAND, cmd);
> > +
> > + return old & PCI_COMMAND_IO;
> > +}
> > +
> > +static bool intel_vga_get(struct intel_display *display)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(display->drm->dev);
> > +
> > + /* WaEnableVGAAccessThroughIOPort:ctg+ */
> > +
> > + /*
> > + * Bypass the VGA arbiter on the iGPU and just enable
> > + * IO decode by hand. This avoids clobbering the VGA
> > + * routing for an external GPU when it's the current
> > + * VGA device, and thus prevents the all 0xff/white
> > + * readout from VGA memory when taking over from vgacon.
> > + *
> > + * The iGPU has the highest VGA decode priority so it will
> > + * grab any VGA IO access when IO decode is enabled, regardless
> > + * of how any other VGA routing bits are configured.
> > + */
> > + if (display->platform.dgfx)
> > + vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> > +
> > + return intel_pci_set_io_decode(pdev, true);
> > +}
> > +
> > +static void intel_vga_put(struct intel_display *display, bool io_decode)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(display->drm->dev);
> > +
> > + /* see intel_vga_get() */
> > + intel_pci_set_io_decode(pdev, io_decode);
> > +
> > + if (display->platform.dgfx)
> > + vga_put(pdev, VGA_RSRC_LEGACY_IO);
> > +}
> > +
> > /* Disable the VGA plane that we never use */
> > void intel_vga_disable(struct intel_display *display)
> > {
> > - struct pci_dev *pdev = to_pci_dev(display->drm->dev);
> > i915_reg_t vga_reg = intel_vga_cntrl_reg(display);
> > + bool io_decode;
> > u8 msr, sr1;
> > u32 tmp;
> >
> > @@ -106,8 +153,7 @@ void intel_vga_disable(struct intel_display *display)
> > goto reset_vgacntr;
> > }
> >
> > - /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
> > - vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> > + io_decode = intel_vga_get(display);
> >
> > outb(0x01, VGA_SEQ_I);
> > sr1 = inb(VGA_SEQ_D);
> > @@ -129,7 +175,7 @@ void intel_vga_disable(struct intel_display *display)
> > msr &= ~VGA_MIS_COLOR;
> > outb(msr, VGA_MIS_W);
> >
> > - vga_put(pdev, VGA_RSRC_LEGACY_IO);
> > + intel_vga_put(display, io_decode);
> >
> > udelay(300);
>
> --
> Jani Nikula, Intel
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-12-09 12:17 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 18:26 [PATCH 00/19] drm/i915/vga: Try to sort out the VGA decode mess Ville Syrjala
2025-12-08 18:26 ` [PATCH 01/19] drm/i915/vga: Register vgaarb client later Ville Syrjala
2025-12-09 10:23 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 02/19] drm/i915/vga: Get rid of intel_vga_reset_io_mem() Ville Syrjala
2025-12-09 10:26 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 03/19] drm/i915/power: Remove i915_power_well_desc::has_vga Ville Syrjala
2025-12-09 10:27 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 04/19] drm/i915/vga: Extract intel_gmch_ctrl_reg() Ville Syrjala
2025-12-09 10:28 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 05/19] drm/i915/vga: Don't touch VGA registers if VGA decode is fully disabled Ville Syrjala
2025-12-09 10:29 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 06/19] drm/i915/vga: Clean up VGA registers even if VGA plane is disabled Ville Syrjala
2025-12-09 10:32 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 07/19] drm/i915/vga: Avoid VGA arbiter during intel_vga_disable() for iGPUs Ville Syrjala
2025-12-09 10:35 ` Jani Nikula
2025-12-09 12:17 ` Ville Syrjälä [this message]
2025-12-08 18:26 ` [PATCH 08/19] drm/i915/vga: Stop trying to use GMCH_CTRL for VGA decode control Ville Syrjala
2025-12-09 10:39 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 09/19] drm/i915/vga: Assert that VGA register accesses are going to the right GPU Ville Syrjala
2025-12-09 10:40 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 10/19] drm/i915/de: Simplify intel_de_read8() Ville Syrjala
2025-12-09 10:47 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 11/19] drm/i915/de: Add intel_de_write8() Ville Syrjala
2025-12-09 10:49 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 12/19] drm/i915/vga: Introduce intel_vga_{read,write}() Ville Syrjala
2025-12-09 10:52 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 13/19] drm/i915/vga: Use MMIO for VGA registers on pre-g4x Ville Syrjala
2025-12-09 10:53 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 14/19] video/vga: Add VGA_IS0_R Ville Syrjala
2025-12-08 21:07 ` kernel test robot
2025-12-08 21:18 ` kernel test robot
2025-12-08 22:22 ` kernel test robot
2025-12-09 7:55 ` [PATCH v2 " Ville Syrjala
2025-12-09 10:55 ` Jani Nikula
2025-12-18 16:56 ` Ville Syrjälä
2025-12-30 8:30 ` Helge Deller
2025-12-10 14:13 ` [PATCH " kernel test robot
2025-12-10 14:24 ` kernel test robot
2025-12-08 18:26 ` [PATCH 15/19] drm/i915/crt: Use IS0_R instead of VGA_MIS_W Ville Syrjala
2025-12-09 10:56 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 16/19] drm/i915/crt: Extract intel_crt_sense_above_threshold() Ville Syrjala
2025-12-09 10:57 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 17/19] drm/i915: Get rid of the INTEL_GMCH_CTRL alias Ville Syrjala
2025-12-09 10:58 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 18/19] drm/i915: Clean up PCI config space reg defines Ville Syrjala
2025-12-09 11:00 ` Jani Nikula
2025-12-09 11:01 ` Jani Nikula
2025-12-08 18:26 ` [PATCH 19/19] drm/i915: Document the GMCH_CTRL register a bit Ville Syrjala
2025-12-09 11:03 ` Jani Nikula
2025-12-08 19:11 ` ✗ Fi.CI.BUILD: failure for drm/i915/vga: Try to sort out the VGA decode mess Patchwork
2025-12-08 20:19 ` ✗ CI.KUnit: " Patchwork
2025-12-09 8:52 ` ✓ CI.KUnit: success for drm/i915/vga: Try to sort out the VGA decode mess (rev2) Patchwork
2025-12-09 9:07 ` ✗ CI.checksparse: warning " Patchwork
2025-12-09 9:35 ` ✓ Xe.CI.BAT: success " Patchwork
2025-12-09 11:31 ` ✗ i915.CI.BAT: failure " Patchwork
2025-12-09 15:57 ` ✗ Xe.CI.Full: " Patchwork
2025-12-10 19:14 ` ✓ i915.CI.BAT: success for drm/i915/vga: Try to sort out the VGA decode mess (rev3) Patchwork
2025-12-11 3:23 ` ✓ i915.CI.Full: " 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=aTgTTD7Yha80zRmy@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@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 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.