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

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


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Wed, 6 Oct 2021 10:33:25 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MfyxK1MI+C5wxh9crqmrSeuy3mwY834Ev4S35PnVlmQ=; b=hHhca9T9q1iZPr5yxXPGi5AbVAAMmeOJWGn+YKqgfLP3U7/aZjDjzvY3/DlZlO5V25hticZh6ZroKVnonABPJYo4J64wXJXTYBpOYpTygedNVWakMBJyZtHG4GIANwk2uMojhNOr8GsqmD0GAlwGZaT/J1DAdcLkdouNjQWv+8kQ19KnU437BnhAMoTg5Q21mTGNgc15I0DyQOv+w0Yof6sRmnHSC472tgSxEDrj6ofTmXZZaw0FY+5/RzvzCT3Gc+GNgwtdUcqq1RJCLy3n+uOKrt7/uWvSdXS8Q2CeNQZJOjYJmi2DGVvcz73wNCzDKlwNqCKz9r+A2MnAOthn7A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=blpv3tbyS8Z40FdPzgMZPhLb578NzPUrTjIg7xfzFUzw2acROK97mNhaptJRlcw/j8VbFdTElqjHQQSXncuwYHQOzvIbr0P6mpv50Yy9A483mYudUIMzVeb6+wGIl40nJ6X/bAzNLbE++Wmfib6NlBEQZMHBbzQBoEs1GgQHPRS6L1jdpUgqqBhvL1DqIslw3LGfJKVPA1tX7ZLSkhu2wWrb2MiCGWWDW2uCRIm3pImLH1lbz+o9en6Gq63pSwwYc1gKlgdyCVwnKsuV/xLwtfBmcYjXqW+HBEpiEInYl9Q+OrQJPKlbkCjx2xXQXqHfH1eAseP/Sfq3gYxKkUhxzQ==
  • Authentication-results-original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "oleksandr_tyshchenko@xxxxxxxx" <oleksandr_tyshchenko@xxxxxxxx>, "volodymyr_babchuk@xxxxxxxx" <volodymyr_babchuk@xxxxxxxx>, "Artem_Mygaiev@xxxxxxxx" <Artem_Mygaiev@xxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
  • Delivery-date: Wed, 06 Oct 2021 10:33:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXuSnU8lwk1ustVUiU0ubosHwi/6vFyNuA
  • Thread-topic: [PATCH v4 05/11] xen/arm: Mark device as PCI while creating one

Hi Oleksandr,

> On 4 Oct 2021, at 3:11 pm, Oleksandr Andrushchenko <andr2000@xxxxxxxxx> 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.
> 
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: Paul Durrant <paul@xxxxxxx>
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> [applicable parts]
> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>
Tested-by: Rahul Singh <rahul.singh@xxxxxxx>

Regards,
Rahul

> ---
> Since v3:
> - fixed Arm build without CONFIG_HAS_PCI
> 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     | 7 +++++++
> xen/include/asm-x86/pci.h     | 2 ++
> 4 files changed, 16 insertions(+)
> 
> diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c
> index 138da19284ab..082c14e127a8 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 b36d5a481162..9e6246afeef5 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..ea87ec6006fc 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,9 @@ static inline int pci_get_host_bridge_segment(const 
> struct dt_device_node *node,
>     return -EINVAL;
> }
> 
> +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 c4a4fdcbc239..443f25347d08 100644
> --- a/xen/include/asm-x86/pci.h
> +++ b/xen/include/asm-x86/pci.h
> @@ -36,4 +36,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®.