[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/msi: Switch msi_info to using pci_sbdf_t
commit 1af4e0189f4ef65cb43d79440d71867aad6d3d44 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Aug 11 17:12:22 2022 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri Aug 12 13:25:40 2022 +0100 x86/msi: Switch msi_info to using pci_sbdf_t This reorders the fields in msi_info, but removes all the under-the-hood parameter shuffling required to call pci_get_pdev(). No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/hvm/vmsi.c | 4 +--- xen/arch/x86/include/asm/msi.h | 4 +--- xen/arch/x86/irq.c | 2 +- xen/arch/x86/msi.c | 4 ++-- xen/arch/x86/physdev.c | 10 +++++----- xen/drivers/char/ns16550.c | 4 ++-- xen/xsm/flask/hooks.c | 2 +- 7 files changed, 13 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c index 198fbd6708..75f92885dc 100644 --- a/xen/arch/x86/hvm/vmsi.c +++ b/xen/arch/x86/hvm/vmsi.c @@ -750,9 +750,7 @@ static int vpci_msi_enable(const struct pci_dev *pdev, unsigned int nr, paddr_t table_base) { struct msi_info msi_info = { - .seg = pdev->seg, - .bus = pdev->bus, - .devfn = pdev->devfn, + .sbdf = pdev->sbdf, .table_base = table_base, .entry_nr = nr, }; diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h index 117379318f..fe670895ee 100644 --- a/xen/arch/x86/include/asm/msi.h +++ b/xen/arch/x86/include/asm/msi.h @@ -59,9 +59,7 @@ #define FIX_MSIX_MAX_PAGES 512 struct msi_info { - u16 seg; - u8 bus; - u8 devfn; + pci_sbdf_t sbdf; int irq; int entry_nr; uint64_t table_base; diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index bf8b52d111..cd0c8a30a8 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -2162,7 +2162,7 @@ int map_domain_pirq( if ( !cpu_has_apic ) goto done; - pdev = pci_get_pdev(d, PCI_SBDF(msi->seg, msi->bus, msi->devfn)); + pdev = pci_get_pdev(d, msi->sbdf); if ( !pdev ) goto done; diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index 62c4fbcfbe..d0bf63df1d 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -1001,7 +1001,7 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc) struct msi_desc *old_desc; ASSERT(pcidevs_locked()); - pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn)); + pdev = pci_get_pdev(NULL, msi->sbdf); if ( !pdev ) return -ENODEV; @@ -1056,7 +1056,7 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc) struct msi_desc *old_desc; ASSERT(pcidevs_locked()); - pdev = pci_get_pdev(NULL, PCI_SBDF(msi->seg, msi->bus, msi->devfn)); + pdev = pci_get_pdev(NULL, msi->sbdf); if ( !pdev || !pdev->msix ) return -ENODEV; diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index 3a50d9d0c9..2f1d955a96 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -312,21 +312,21 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { case MAP_PIRQ_TYPE_MSI_SEG: map.type = MAP_PIRQ_TYPE_MSI; - msi.seg = map.bus >> 16; + msi.sbdf.seg = map.bus >> 16; break; case MAP_PIRQ_TYPE_MULTI_MSI: if ( map.table_base ) return -EINVAL; - msi.seg = map.bus >> 16; + msi.sbdf.seg = map.bus >> 16; break; default: - msi.seg = 0; + msi.sbdf.seg = 0; break; } - msi.bus = map.bus; - msi.devfn = map.devfn; + msi.sbdf.bus = map.bus; + msi.sbdf.devfn = map.devfn; msi.entry_nr = map.entry_nr; msi.table_base = map.table_base; ret = physdev_map_pirq(map.domid, map.type, &map.index, &map.pirq, diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index cd3573e43d..01a05c9aa8 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -435,8 +435,8 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port) if ( uart->msi ) { struct msi_info msi = { - .bus = uart->ps_bdf[0], - .devfn = PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2]), + .sbdf = PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1], + uart->ps_bdf[2]), .irq = rc = uart->irq, .entry_nr = 1 }; diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 8c9cd0f297..8bd56644ef 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -918,7 +918,7 @@ static int flask_map_domain_msi ( { #ifdef CONFIG_HAS_PCI_MSI const struct msi_info *msi = data; - uint32_t machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn; + uint32_t machine_bdf = msi->sbdf.sbdf; AVC_AUDIT_DATA_INIT(ad, DEV); ad->device = machine_bdf; -- generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |