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

Re: [PATCH v4 02/11] xen/arm: Add new device type for PCI


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Wed, 6 Oct 2021 10:15:24 +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=tj0NMbcGndmhhvAOxSOQixjWVF86tRL0WmY22Aij3fI=; b=cQFyyYnFPwBdrXcftkhfZgxsTKTWCNcY/wQLkxwyz6XPlyuxGxUTtfMzHTL1f1zlcluTzXerxfLElyUVXJURMESIbTRI7vSeNXcDbyQ/zfIRNsyXHMYFjnfbhkRv/H5qIyxP2HmnUS4kIDpYpNcbFdV24ihWsSrQGzVfJgDEA9iqCKJ6iV+8iXyyJ4fVUcb5/qui40NCz9r1MLYqeOqvJkrSuv2gkOGPSSu1bt8mzKJ0mkJt7QAolBDgybSWGwGi00FX/loqPq+XHHXOmOC66IhZnJXMGKWXjE4SXUBCE3/Cyhyuee36ad9kSxHEWws+0wKW7720cUKk/sQiY4l3qw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZvE6ajnvEcAUYc968s44jekB7OyQuaFXjaRte5KE4vXv+DpMXD4p7N9UoSw58/p1HaYif3fTd+VAAxYBcyACsTf7AVf7G82UWHtB4cl3sIFH/6nQyYcB7XJN8/5Xp9/U7wrljtJybHLsQq7dyOlsgIyzkRc0wTyAiGJ06diAvekpKlnTWbUHkBZGjkSXomVcD1RZDH12pLfkIqoHPWwh2SZ8xhb25MEonCgHyx95Z+gQqxXdGfCV+GOTgucm16R2YfRiFdpmbAF272cZzHWI1rSwwsHntCQQ8Y+pqoRaO4XJybRi2LpEqlWHkm61RseH9TuYj0IQGyUaPxDJsL5ZVw==
  • 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 <Artem_Mygaiev@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
  • Delivery-date: Wed, 06 Oct 2021 10:15:50 +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: AQHXuSnbiZmskKn6EUq1TwpRsFvaGKvFw9KA
  • Thread-topic: [PATCH v4 02/11] xen/arm: Add new device type for PCI

Hi Oleksandr,

> On 4 Oct 2021, at 3:11 pm, Oleksandr Andrushchenko <andr2000@xxxxxxxxx> wrote:
> 
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> 
> Add new device type (DEV_PCI) to distinguish PCI devices from platform
> DT devices, so some drivers, like IOMMU, can handle PCI devices
> differently.
> 
> Also add a helper which is when given a struct device returns the
> corresponding struct pci_dev which this device is a part of.
> 
> Because of the header cross-dependencies, e.g. we need both
> struct pci_dev and struct arch_pci_dev at the same time, this cannot be
> done with an inline.
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

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

Regards,
Rahul
> 
> Since v2:
> - !! dropped Stefano's r-b because of the changes
> - simplified dev_to_pci to use a single
>   container_of(dev, struct pci_dev, arch.dev) (Jan)
> Since v1:
> - Folded new device type (DEV_PCI) into this patch.
> ---
> xen/arch/arm/pci/pci.c       | 7 +++++++
> xen/include/asm-arm/device.h | 4 ++--
> xen/include/asm-arm/pci.h    | 7 +++++++
> 3 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c
> index 73540045d187..138da19284ab 100644
> --- a/xen/arch/arm/pci/pci.c
> +++ b/xen/arch/arm/pci/pci.c
> @@ -27,6 +27,13 @@ int arch_pci_clean_pirqs(struct domain *d)
>     return 0;
> }
> 
> +struct pci_dev *dev_to_pci(struct device *dev)
> +{
> +    ASSERT(dev->type == DEV_PCI);
> +
> +    return container_of(dev, struct pci_dev, arch.dev);
> +}
> +
> static int __init dt_pci_init(void)
> {
>     struct dt_device_node *np;
> diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h
> index ebe84ea853cd..7bf040560363 100644
> --- a/xen/include/asm-arm/device.h
> +++ b/xen/include/asm-arm/device.h
> @@ -4,6 +4,7 @@
> enum device_type
> {
>     DEV_DT,
> +    DEV_PCI,
> };
> 
> struct dev_archdata {
> @@ -25,8 +26,7 @@ typedef struct device device_t;
> 
> #include <xen/device_tree.h>
> 
> -/* TODO: Correctly implement dev_is_pci when PCI is supported on ARM */
> -#define dev_is_pci(dev) ((void)(dev), 0)
> +#define dev_is_pci(dev) ((dev)->type == DEV_PCI)
> #define dev_is_dt(dev)  ((dev)->type == DEV_DT)
> 
> enum device_class
> diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h
> index 7cb2e2f1edaf..603a1fc072d1 100644
> --- a/xen/include/asm-arm/pci.h
> +++ b/xen/include/asm-arm/pci.h
> @@ -26,6 +26,13 @@ struct arch_pci_dev {
>     struct device dev;
> };
> 
> +/*
> + * Because of the header cross-dependencies, e.g. we need both
> + * struct pci_dev and struct arch_pci_dev at the same time, this cannot be
> + * done with an inline here. Macro can be implemented, but looks scary.
> + */
> +struct pci_dev *dev_to_pci(struct device *dev);
> +
> /* Arch-specific MSI data for vPCI. */
> struct vpci_arch_msi {
> };
> -- 
> 2.25.1
> 




 


Rackspace

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