public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Simon Richter <Simon.Richter@hogyros.de>
Cc: linux-pci@vger.kernel.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 4/5] pci: check if VGA decoding was really activated
Date: Tue, 10 Mar 2026 17:19:45 +0200	[thread overview]
Message-ID: <abA2kQScB-m2ka3K@intel.com> (raw)
In-Reply-To: <1a7a9d17-5086-4fdb-83e7-56d5ddaaadbd@hogyros.de>

On Tue, Mar 10, 2026 at 11:08:40PM +0900, Simon Richter wrote:
> Hi,
> 
> On 3/10/26 8:37 PM, Ville Syrjälä wrote:
> 
> > Maybe this should also have a comment or spec quote to explain
> > that it's legal behavior?
> 
> The PCI-to-PCI Bridge Specification version 1.1 has in chapter 4.5 "VGA 
> Support":
> 
>      Bridges are not required to implement the VGA support mechanisms
>      described in the following sections.
> 
> So this has always been optional.
> 
> What is a bit annoying is that I cannot find an explicit sentence 
> allowing the VGAEnable bit to be hardwired to zero in that specification.
> 
> It is explicitly allowed to hardwire the VGASnoopEnable bit to zero if 
> VGA palette snooping is not supported for downstream devices (Table 3-2 
> "Command Register"):
> 
>      Implementation of VGA palette snooping by a bridge is optional. If
>      VGA palette snooping is not supported, this bit must be implemented
>      as read-only with a value of 0
> 
> That is the command register though, not the bridge control register.
> 
> The bridge control register documentation (Table 3-9) does not 
> explicitly say what should be done if VGA support is not available, but 
> the behaviour of the VGAEnable bit is a superset of the VGASnoopEnable 
> bit, and the VGASnoopEnable bit becomes a Don't Care if VGAEnable is 
> set, so "the bit must be hardwired to zero if unsupported" appears to be 
> the only valid interpretation.
> 
> This seems to be the behaviour of all the devices I have available:
> 
>   - IBM PowerNV PCIe root bridge (POWER9)
>   - SiFive VisionFive2 PCIe root bridge (PLDA XpressRich-AXI Ref Design)
> 
> Both read back this bit as zero when written via setpci:
> 
> # setpci -s 0000:00:00.0 BRIDGE_CONTROL
> 0002
> # setpci -s 0000:00:00.0 BRIDGE_CONTROL=0xa
> # setpci -s 0000:00:00.0 BRIDGE_CONTROL
> 0002
> 
> There is also a question in the Altera support forum for their PCIe Root 
> Bridge IP at https://community.altera.com/kb/knowledge-base/-/345837 .

Yeah, looks like the exact explanation was only added in the PCIe
bridge spec. Before that it was somewhat ambiguous.

> 
> > The slightly bigger concern I have is whether we need to unwind
> > the previous steps if this fails? Looks like we don't update
> > vgadev->owns on failure (even though we may have partially
> > enabled things). But since the bridge should never forward any
> > VGA accesses, leaving some extra PCI_COMMAND enable(s) set on
> > the device shouldn't matter in practice.
> 
> I was thinking the same, but because we're going upwards in the 
> hierarchy, the bridges we leave enabled are downstream of the bridge 
> that refused to forward.
> 
> I can add this for completeness though, that should be fairly easy.
> 
> > So I guess this should
> > work even without unwinding. Well, not sure about
> > arch_set_vga_state() since that's 100% magic...
> 
> It's not entirely magic, because after success from arch_set_vga_state() 
> we still go through all the bridges. I believe uv uses it for some kind 
> of paravirtualization.
> 
>     Simon

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-03-10 15:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-07 17:35 [PATCH v3 0/5] Bridges without VGA support Simon Richter
2026-03-07 17:35 ` [PATCH v3 1/5] vgaarb: pass vga_get_uninterruptible() errors to userspace Simon Richter
2026-03-24 19:37   ` Bjorn Helgaas
2026-03-25  6:52     ` Simon Richter
2026-03-25 18:29       ` Bjorn Helgaas
2026-03-07 17:35 ` [PATCH v3 2/5] vgaarb: pass errors from pci_set_vga_state() up Simon Richter
2026-03-10 11:37   ` Ville Syrjälä
2026-03-07 17:35 ` [PATCH v3 3/5] vgaarb: mark vga_get() and wrappers as __must_check Simon Richter
2026-03-10 20:07   ` Bjorn Helgaas
2026-03-11 22:51     ` Simon Richter
2026-03-11 23:14       ` Bjorn Helgaas
2026-03-11 23:29         ` Simon Richter
2026-03-07 17:35 ` [PATCH v3 4/5] pci: check if VGA decoding was really activated Simon Richter
2026-03-10 11:37   ` Ville Syrjälä
2026-03-10 14:08     ` Simon Richter
2026-03-10 15:19       ` Ville Syrjälä [this message]
2026-03-10 20:22   ` Bjorn Helgaas
2026-03-11  7:07     ` Simon Richter
2026-03-07 17:35 ` [PATCH v3 5/5] pci: mark pci_set_vga_state() as __must_check Simon Richter
2026-03-10 19:36   ` Bjorn Helgaas
2026-03-11 23:23     ` Simon Richter
2026-03-24 19:34 ` [PATCH v3 0/5] Bridges without VGA support Bjorn Helgaas

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=abA2kQScB-m2ka3K@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Simon.Richter@hogyros.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-pci@vger.kernel.org \
    /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