From: "Roger Pau Monné" <roger@xenproject.org>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@vates.tech>,
Teddy Astie <teddy.astie@vates.tech>,
Stewart Hildebrand <stewart.hildebrand@amd.com>,
Jason Andryuk <jason.andryuk@amd.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xen/vpci: allow unaligned accesses by the hardware domain
Date: Thu, 6 Aug 2026 15:26:32 +0200 [thread overview]
Message-ID: <anSLiMyyONR26e1m@macbook.local> (raw)
In-Reply-To: <eb219e1f-39a0-46b9-9035-2b156cea684c@suse.com>
On Thu, Aug 06, 2026 at 02:15:02PM +0200, Jan Beulich wrote:
> On 06.08.2026 13:48, Andrew Cooper wrote:
> > On 06/08/2026 12:04 pm, Roger Pau Monne wrote:
> >> --- a/xen/arch/x86/x86_64/pci.c
> >> +++ b/xen/arch/x86/x86_64/pci.c
> >> @@ -26,7 +26,7 @@ uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg)
> >>
> >> uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg)
> >> {
> >> - if ( sbdf.seg || reg > 255 )
> >> + if ( sbdf.seg || reg > 255 || !IS_ALIGNED(reg, 2) )
> >> {
> >> uint32_t value;
> >>
> >
> > Personally, I think this is making a bad situation worse.
> >
> > Baring quirks (i.e. K10 era), there is never a case where we want to use
> > the IO Ports when we've got ECAM. Furthermore, on AMD systems when
> > we're lacking ECAM we can still access Extended Config Space; something
> > which Xen currently gets wrong in several ways.
> >
> > The IO ports require a global spinlock in Xen, and then a global
> > resource in hardware just to be able to translate the IO access back
> > into the ECAM access we passed on originally. i.e. from a safety
> > non-interference point of view, you want to veto any use of the IO ports
> > by Xen.
> >
> > Xen needs to use ECAM, and only fall back to IO Ports if we think there
> > isn't ECAM covering the target sbdf. This will cause (mis)alignment to
> > get fixed automatically. It will also be a substantial perf boost in
> > the general case; all the MSI/MSI-X editing we do (far too frequently)
> > is in Legacy Config Space just uses IO Ports.
>
> While I agree, that's a bigger change which likely is going to be unsuitable
> for (immediate) backporting. Nevertheless the cross-device access that the
> changes as presented could cause needs preventing, by altering the checks at
> the start of pci_mmcfg_{read,write}().
Hm, OK. I was planning to be a bit mire strict in
vpci_access_allowed(), but I can also adjust pci_mmcfg_{read,write}().
Thanks, Roger.
next prev parent reply other threads:[~2026-08-06 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 11:04 [PATCH] xen/vpci: allow unaligned accesses by the hardware domain Roger Pau Monne
2026-08-06 11:48 ` Andrew Cooper
2026-08-06 12:15 ` Jan Beulich
2026-08-06 13:26 ` Roger Pau Monné [this message]
2026-08-06 13:20 ` Roger Pau Monné
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=anSLiMyyONR26e1m@macbook.local \
--to=roger@xenproject.org \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jason.andryuk@amd.com \
--cc=jbeulich@suse.com \
--cc=stewart.hildebrand@amd.com \
--cc=teddy.astie@vates.tech \
--cc=xen-devel@lists.xenproject.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 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.