[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 05/11] xen/arm: Mark device as PCI while creating one



On Thu, 30 Sep 2021, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> 
> 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 <oleksandr_andrushchenko@xxxxxxxx>

I get a build failure without CONFIG_PCI on ARM64:

In file included from /local/repos/xen-upstream/xen/include/xen/pci.h:66:0,
                 from /local/repos/xen-upstream/xen/include/xen/iommu.h:25,
                 from /local/repos/xen-upstream/xen/include/xen/sched.h:12,
                 from arch/arm/arm64/asm-offsets.c:9:
/local/repos/xen-upstream/xen/include/asm/pci.h:127:46: error: ‘struct pci_dev’ 
declared inside parameter list will not be visible outside of this definition 
or declaration [-Werror]
 static inline void arch_pci_init_pdev(struct pci_dev *pdev) {}
                                              ^~~~~~~
cc1: all warnings being treated as errors


> ---
> Since v2:
>  - !! dropped Stefano's r-b because of the changes
>  - introduced arch_pci_init_pdev (Jan)
> Since v1:
>  - moved the assignment from iommu_add_device to alloc_pdev
> ---
>  xen/arch/arm/pci/pci.c        | 5 +++++
>  xen/drivers/passthrough/pci.c | 2 ++
>  xen/include/asm-arm/pci.h     | 5 +++++
>  xen/include/asm-x86/pci.h     | 2 ++
>  4 files changed, 14 insertions(+)
> 
> diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c
> index 9fc522e566a9..a8d10e869603 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 38eb451448a3..9f804a50e780 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 e6d4000e2ac8..566a9436a18e 100644
> --- a/xen/include/asm-arm/pci.h
> +++ b/xen/include/asm-arm/pci.h
> @@ -105,6 +105,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 { };
> @@ -121,5 +124,7 @@ static inline int pci_get_host_bridge_segment(const 
> struct dt_device_node *node,
>      return -EINVAL;
>  }
>  
> +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 61b940c91d4a..e7f10beb4eb8 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__ */
> -- 
> 2.25.1
> 

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.