@@ -766,6 +766,7 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
ret = iommu_add_device(pdev);
if ( ret )
{
+ vpci_remove_device(pdev);
pdev->domain = NULL;
goto out;
}
@@ -813,6 +814,7 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
if ( pdev->bus == bus && pdev->devfn == devfn )
{
+ vpci_remove_device(pdev);
pci_cleanup_msi(pdev);
ret = iommu_remove_device(pdev);
if ( pdev->domain )
@@ -230,6 +230,8 @@ static inline int vpci_add_handlers(struct pci_dev *pdev)
return 0;
}
+static inline void vpci_remove_device(struct pci_dev *pdev) { }
+
static inline void vpci_dump_msi(void) { }
static inline uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg,
Add missing vpci handlers cleanup during pci_device_remove and in case of error with iommu during pci_device_add. Add empty static inline for vpci_remove_device when CONFIG_VPCI is not defined. Fixes: d59168dc05 ("xen/arm: Enable the existing x86 virtual PCI support for ARM") Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com> --- xen/drivers/passthrough/pci.c | 2 ++ xen/include/xen/vpci.h | 2 ++ 2 files changed, 4 insertions(+)