x86/pci: Update pci_conf_write_intercept() to use pci_sbdf_t

... rather than splitting across two parameters.

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 04670075bc
commit f3a525c259
4 files changed
+10 -14

No files matched your search

+2 -3
View File
@@ -36,9 +36,8 @@ struct arch_pci_dev {
struct page_list_head pgtables_list;
};
int pci_conf_write_intercept(unsigned int seg, unsigned int bdf,
unsigned int reg, unsigned int size,
uint32_t *data);
int pci_conf_write_intercept(
pci_sbdf_t sbdf, unsigned int reg, unsigned int size, uint32_t *data);
int pci_msi_conf_write_intercept(struct pci_dev *pdev, unsigned int reg,
unsigned int size, uint32_t *data);
bool pci_mmcfg_decode(unsigned long mfn, unsigned int *seg,
+2 -4
View File
@@ -72,11 +72,9 @@ void pci_conf_write(uint32_t cf8, uint8_t offset, uint8_t bytes, uint32_t data)
spin_unlock_irqrestore(&pci_config_lock, flags);
}
int pci_conf_write_intercept(unsigned int seg, unsigned int bdf,
unsigned int reg, unsigned int size,
uint32_t *data)
int pci_conf_write_intercept(
pci_sbdf_t sbdf, unsigned int reg, unsigned int size, uint32_t *data)
{
pci_sbdf_t sbdf = PCI_SBDF(seg, bdf);
struct pci_dev *pdev;
int rc = xsm_pci_config_permission(XSM_HOOK, current->domain, sbdf.sbdf,
reg, reg + size - 1, true);
+5 -5
View File
@@ -228,7 +228,7 @@ static bool admin_io_okay(unsigned int port, unsigned int bytes,
static bool pci_cfg_ok(struct domain *currd, unsigned int start,
unsigned int size, uint32_t *write)
{
uint32_t machine_bdf;
pci_sbdf_t sbdf = {}; /* Seg always 0 for IO port CFG accesses. */
if ( !is_hardware_domain(currd) )
return false;
@@ -236,12 +236,12 @@ static bool pci_cfg_ok(struct domain *currd, unsigned int start,
if ( !CF8_ENABLED(currd->arch.pci_cf8) )
return true;
machine_bdf = CF8_BDF(currd->arch.pci_cf8);
sbdf.bdf = CF8_BDF(currd->arch.pci_cf8);
if ( write )
{
const unsigned long *ro_map = pci_get_ro_map(0);
if ( ro_map && test_bit(machine_bdf, ro_map) )
if ( ro_map && test_bit(sbdf.bdf, ro_map) )
return false;
}
start |= CF8_ADDR_LO(currd->arch.pci_cf8);
@@ -259,9 +259,9 @@ static bool pci_cfg_ok(struct domain *currd, unsigned int start,
}
return !write ?
xsm_pci_config_permission(XSM_HOOK, currd, machine_bdf,
xsm_pci_config_permission(XSM_HOOK, currd, sbdf.sbdf,
start, start + size - 1, false) == 0 :
pci_conf_write_intercept(0, machine_bdf, start, size, write) >= 0;
pci_conf_write_intercept(sbdf, start, size, write) >= 0;
}
static uint32_t guest_io_read(unsigned int port, unsigned int bytes,
+1 -2
View File
@@ -329,8 +329,7 @@ static int cf_check mmcfg_intercept_write(
}
offset &= 0xfff;
if ( pci_conf_write_intercept(mmio_ctxt->sbdf.seg, mmio_ctxt->sbdf.bdf,
offset, bytes, p_data) >= 0 )
if ( pci_conf_write_intercept(mmio_ctxt->sbdf, offset, bytes, p_data) >= 0 )
pci_mmcfg_write(mmio_ctxt->sbdf, offset, bytes, *(uint32_t *)p_data);
return X86EMUL_OKAY;
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.