From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Teddy Astie" <teddy.astie@vates.tech>
Subject: [PATCH 1/3] x86/pv: Convert struct mmio_ro_emulate_ctxt to use pci_sbdf_t
Date: Tue, 8 Sep 2026 22:57:19 +0100 [thread overview]
Message-ID: <20260908215721.3346842-2-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20260908215721.3346842-1-andrew.cooper3@citrix.com>
This will be used to simplify some call chains. Reposition the new field to
avoid creating a interior hole.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
---
xen/arch/x86/pv/ro-page-fault.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index d89306d34fc6..e70e09a6a6a1 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -301,10 +301,10 @@ static int ptwr_do_page_fault(struct x86_emulate_ctxt *ctxt,
struct mmio_ro_emulate_ctxt {
unsigned long cr2;
- /* Used only for mmcfg case */
- unsigned int seg, bdf;
/* Used only for non-mmcfg case */
mfn_t mfn;
+ /* Used only for mmcfg case */
+ pci_sbdf_t sbdf;
};
static int cf_check mmcfg_intercept_write(
@@ -329,10 +329,10 @@ static int cf_check mmcfg_intercept_write(
}
offset &= 0xfff;
- if ( pci_conf_write_intercept(mmio_ctxt->seg, mmio_ctxt->bdf,
+ if ( pci_conf_write_intercept(mmio_ctxt->sbdf.seg, mmio_ctxt->sbdf.bdf,
offset, bytes, p_data) >= 0 )
- pci_mmcfg_write(mmio_ctxt->seg, PCI_BUS(mmio_ctxt->bdf),
- PCI_DEVFN(mmio_ctxt->bdf), offset, bytes,
+ pci_mmcfg_write(mmio_ctxt->sbdf.seg, mmio_ctxt->sbdf.bus,
+ mmio_ctxt->sbdf.devfn, offset, bytes,
*(uint32_t *)p_data);
return X86EMUL_OKAY;
@@ -390,6 +390,7 @@ static int mmio_ro_do_page_fault(struct x86_emulate_ctxt *ctxt,
unsigned long addr, l1_pgentry_t pte)
{
struct mmio_ro_emulate_ctxt mmio_ro_ctxt = { .cr2 = addr };
+ unsigned int seg, bdf;
mfn_t mfn = l1e_get_mfn(pte);
if ( mfn_valid(mfn) )
@@ -404,8 +405,12 @@ static int mmio_ro_do_page_fault(struct x86_emulate_ctxt *ctxt,
}
ctxt->data = &mmio_ro_ctxt;
- if ( pci_ro_mmcfg_decode(mfn_x(mfn), &mmio_ro_ctxt.seg, &mmio_ro_ctxt.bdf) )
+ if ( pci_ro_mmcfg_decode(mfn_x(mfn), &seg, &bdf) )
+ {
+ mmio_ro_ctxt.sbdf = PCI_SBDF(seg, bdf);
+
return x86_emulate(ctxt, &mmcfg_intercept_ops);
+ }
mmio_ro_ctxt.mfn = mfn;
--
2.39.5
next prev parent reply other threads:[~2026-09-08 21:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 21:57 [PATCH 0/3] x86: Fixes for not-quite-XSA in pci_conf_write_intercept() Andrew Cooper
2026-09-08 21:57 ` Andrew Cooper [this message]
2026-09-08 21:57 ` [PATCH 2/3] x86/pci: Convert pci_mmcfg_{read,write}() to use pci_sbdf_t Andrew Cooper
2026-09-08 21:57 ` [PATCH 3/3] x86/pci: Update pci_conf_write_intercept() " Andrew Cooper
2026-09-09 6:39 ` [PATCH 0/3] x86: Fixes for not-quite-XSA in pci_conf_write_intercept() Jan Beulich
2026-09-09 8:59 ` Andrew Cooper
2026-09-09 7:16 ` [PATCH 4/3] x86/PCI: use pci_sbdf_t also for pci_dev_base() Jan Beulich
2026-09-09 7:22 ` Roger Pau Monné
2026-09-09 8:26 ` Teddy Astie
2026-09-09 9:59 ` Andrew Cooper
2026-09-09 8:26 ` [PATCH 0/3] x86: Fixes for not-quite-XSA in pci_conf_write_intercept() Teddy Astie
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=20260908215721.3346842-2-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger@xenproject.org \
--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.