|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/3] 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@xxxxxxxxxx>
---
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
CC: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
xen/arch/x86/include/asm/pci.h | 5 ++---
xen/arch/x86/pci.c | 6 ++----
xen/arch/x86/pv/emul-priv-op.c | 10 +++++-----
xen/arch/x86/pv/ro-page-fault.c | 3 +--
4 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/xen/arch/x86/include/asm/pci.h b/xen/arch/x86/include/asm/pci.h
index 0b98081aeaa4..8d8e66928d7f 100644
--- a/xen/arch/x86/include/asm/pci.h
+++ b/xen/arch/x86/include/asm/pci.h
@@ -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,
diff --git a/xen/arch/x86/pci.c b/xen/arch/x86/pci.c
index 4c279875517b..0731f7e762b8 100644
--- a/xen/arch/x86/pci.c
+++ b/xen/arch/x86/pci.c
@@ -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);
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index dc21515e447b..fd9b533e57c7 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -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,
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index c10541709e8b..34349e9437eb 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -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;
--
2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |