mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/pci: Use pci_sbdf_t in pci_prepare_msix()
Also take the opportunity to clean up a bit PHYSDEVOP_{prepare,release}_msix.
Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
388ce1472d
commit
00af54ff6a
3 files changed
+12
-10
No files matched your search
@@ -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);
|
||||
|
||||
+2
-2
@@ -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 )
|
||||
|
||||
@@ -512,15 +512,17 @@ 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;
|
||||
|
||||
ret = -EFAULT;
|
||||
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);
|
||||
break;
|
||||
|
||||
sbdf = PCI_SBDF(dev.seg, dev.bus, dev.devfn);
|
||||
|
||||
ret = xsm_resource_setup_pci(XSM_PRIV, sbdf.sbdf);
|
||||
if ( !ret )
|
||||
ret = pci_prepare_msix(sbdf, cmd != PHYSDEVOP_prepare_msix);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||