|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 06/15] pci: Use pci_sbdf_t in pci_prepare_msix()
Also take the opportunity to clean up a bit PHYSDEVOP_{prepare,release}_msix.
No functional change intended.
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
Cc: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
xen/arch/x86/include/asm/msi.h | 2 +-
xen/arch/x86/msi.c | 4 ++--
xen/arch/x86/physdev.c | 11 ++++++-----
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 00059d4a3a..6fb663b2e7 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -83,7 +83,7 @@ struct msi_desc;
extern int pci_enable_msi(struct pci_dev *pdev, struct msi_info *msi,
struct msi_desc **desc);
extern void pci_disable_msi(struct msi_desc *msi_desc);
-extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
+extern int pci_prepare_msix(pci_sbdf_t sbdf, bool off);
extern void pci_cleanup_msi(struct pci_dev *pdev);
extern void pci_disable_msi_all(void);
extern int setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 3fe22b3b6d..8831ce068c 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1153,7 +1153,7 @@ static void __pci_disable_msix(struct msi_desc *entry)
_pci_cleanup_msix(dev->msix);
}
-int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off)
+int pci_prepare_msix(pci_sbdf_t sbdf, bool off)
{
int rc;
struct pci_dev *pdev;
@@ -1162,7 +1162,7 @@ int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off)
return 0;
pcidevs_lock();
- pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn));
+ pdev = pci_get_pdev(NULL, sbdf);
if ( !pdev )
rc = -ENODEV;
else if ( pdev->msix->used_entries != !!off )
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 5bbcf3b530..984fb99aa8 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -512,15 +512,16 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void)
arg)
case PHYSDEVOP_prepare_msix:
case PHYSDEVOP_release_msix: {
struct physdev_pci_device dev;
+ pci_sbdf_t sbdf;
if ( copy_from_guest(&dev, arg, 1) )
ret = -EFAULT;
else
- ret = xsm_resource_setup_pci(XSM_PRIV,
- (dev.seg << 16) | (dev.bus << 8) |
- dev.devfn) ?:
- pci_prepare_msix(dev.seg, dev.bus, dev.devfn,
- cmd != PHYSDEVOP_prepare_msix);
+ {
+ sbdf = PCI_SBDF(dev.seg, dev.bus, dev.devfn);
+ ret = xsm_resource_setup_pci(XSM_PRIV, sbdf.sbdf) ?:
+ pci_prepare_msix(sbdf, cmd != PHYSDEVOP_prepare_msix);
+ }
break;
}
--
2.54.0
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |