From: Oleksandr Andrushchenko Date: Fri, 8 Oct 2021 22:48:31 +0000 (-0700) Subject: xen/arm: Mark device as PCI while creating one X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~119 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e17abb28e80043346752f1e2b59ed34806c2144d;p=xen.git xen/arm: Mark device as PCI while creating one While adding a PCI device mark it as such, so other frameworks can distinguish it from DT devices. For that introduce an architecture defined helper which may perform additional initialization of the newly created PCI device. Signed-off-by: Oleksandr Andrushchenko [applicable parts] Acked-by: Jan Beulich Reviewed-by: Stefano Stabellini Reviewed-by: Rahul Singh Tested-by: Rahul Singh --- diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c index 138da19284..082c14e127 100644 --- a/xen/arch/arm/pci/pci.c +++ b/xen/arch/arm/pci/pci.c @@ -34,6 +34,11 @@ struct pci_dev *dev_to_pci(struct device *dev) return container_of(dev, struct pci_dev, arch.dev); } +void arch_pci_init_pdev(struct pci_dev *pdev) +{ + pci_to_dev(pdev)->type = DEV_PCI; +} + static int __init dt_pci_init(void) { struct dt_device_node *np; diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index e1b735d9e8..3aa8c3175f 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -329,6 +329,8 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn) *((u8*) &pdev->devfn) = devfn; pdev->domain = NULL; + arch_pci_init_pdev(pdev); + rc = pdev_msi_init(pdev); if ( rc ) { diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h index ed76508002..00ccc3161b 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -95,6 +95,9 @@ static always_inline bool is_pci_passthrough_enabled(void) { return pci_passthrough_enabled; } + +void arch_pci_init_pdev(struct pci_dev *pdev); + #else /*!CONFIG_HAS_PCI*/ struct arch_pci_dev { }; @@ -104,5 +107,9 @@ static always_inline bool is_pci_passthrough_enabled(void) return false; } +struct pci_dev; + +static inline void arch_pci_init_pdev(struct pci_dev *pdev) {} + #endif /*!CONFIG_HAS_PCI*/ #endif /* __ARM_PCI_H__ */ diff --git a/xen/include/asm-x86/pci.h b/xen/include/asm-x86/pci.h index e076951032..edd7c3e71a 100644 --- a/xen/include/asm-x86/pci.h +++ b/xen/include/asm-x86/pci.h @@ -38,4 +38,6 @@ static always_inline bool is_pci_passthrough_enabled(void) return true; } +static inline void arch_pci_init_pdev(struct pci_dev *pdev) {} + #endif /* __X86_PCI_H__ */