x86/pv: Convert struct mmio_ro_emulate_ctxt to use pci_sbdf_t

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>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
This commit is contained in:
Andrew Cooper committed 2026-09-09 18:07:32 +01:00
1 parent 1ff8c6e289
commit e1ddc74203
1 file changed
+11 -6
+11 -6
View File
@@ -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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.