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

Re: [PATCH v3 08/17] xen/device-tree: Add dt_get_pci_domain_nr helper


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 29 Sep 2021 07:35:20 +0000
  • Accept-language: en-GB, 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; bh=QIjdK7QjOT4c/q9rcaKd2cg7zUzTEW/PNV6L3CcU7c0=; b=QI/RH4cPetgIlDEZXxtJj/jVhzzi10SP2FQXvs4W3iTVFOGdM0pjdHDTy+Y8Fu2KCgQhjbz+zvpqVFqozL9SacX3PVl7q9+w5mc67hl6apGMgJqvsLI9L0RKZigL8KKJ1spSpw43NKzrLZHj2464drlVtrnHi5nFlHQ+9O43ntgZ9awKcXKLLirQKB9Sxe+/msQdYS5RLqTO2W1Ys8Lh6ZXaaVfqOfUGEjJhs7aBIhJLME7PF5vkO8g699ihGSDqx5TSUnxLxmrxBvw07Tm8w5dSAU+AxOl8JeSEvMVDO0MVki/T5aqX3Z5zxA6moCs3hHeJ4Nnf1CXj0KMdqeVziA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GAkSt+PBMqep8Zg3IF8IT5ZCrRABLADc1PRUtQsL/yAANg+chU3Oh3wHD37aeNQS2U7V+4P+LJoGxXYJ5nTJ4+TKX5xisQRnug2iY1yxyOyFdQa91YEwSUutG3VMZUWkOg5fefDXRVYQXIweejKd93dWNhxUau/+7Bamamb7jDSwsI8Qz53A5qogIu8DL8BShIFB2i5WMNm5TRsS2pk8T9oW8rTf56dPAkK9Wwt5VsIXpUh7DXLj5Gcj2LvRfQIwaHewMgLaXPVFZnMoCQ+lub5bLRQ0gl71wVj0xL4Qme7w2BUPjxlYNQ3NbwLsyqV7v+kqadf2jpYfzSWiVWKSXQ==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andre Przywara <Andre.Przywara@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Wed, 29 Sep 2021 07:35:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXtJW4akzPy06fZESxWckJ42Gz9au6n/AA
  • Thread-topic: [PATCH v3 08/17] xen/device-tree: Add dt_get_pci_domain_nr helper

Hi Rahul,

> On 28 Sep 2021, at 19:18, Rahul Singh <rahul.singh@xxxxxxx> wrote:
> 
> Based Linux commit 41e5c0f81d3e676d671d96a0a1fafb27abfbd9d7
> 
> Import the Linux helper of_get_pci_domain_nr. This function will try to
> obtain the host bridge domain number by finding a property called
> "linux,pci-domain" of the given device node.
> 
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> Change in v3:
> - Modify commit message to include upstream Linux commit-id not stable
>  Linux commit-id
> - Remove return value as those are not valid for XEN
> Change in v2: Patch introduced in v2
> ---
> xen/common/device_tree.c      | 12 ++++++++++++
> xen/include/xen/device_tree.h | 17 +++++++++++++++++
> 2 files changed, 29 insertions(+)
> 
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 53160d61f8..ea93da1725 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -2183,6 +2183,18 @@ void __init dt_unflatten_host_device_tree(void)
>     dt_alias_scan();
> }
> 
> +int dt_get_pci_domain_nr(struct dt_device_node *node)
> +{
> +    u32 domain;
> +    int error;
> +
> +    error = dt_property_read_u32(node, "linux,pci-domain", &domain);
> +    if ( !error )
> +        return -EINVAL;
> +
> +    return (u16)domain;
> +}
> +
> /*
>  * Local variables:
>  * mode: C
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index 3ffe3eb3d2..2297c59ce6 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -832,6 +832,23 @@ int dt_count_phandle_with_args(const struct 
> dt_device_node *np,
>                                const char *list_name,
>                                const char *cells_name);
> 
> +/**
> + * dt_get_pci_domain_nr - Find the host bridge domain number
> + *            of the given device node.
> + * @node: Device tree node with the domain information.
> + *
> + * This function will try to obtain the host bridge domain number by finding
> + * a property called "linux,pci-domain" of the given device node.
> + *
> + * Return:
> + * * > 0    - On success, an associated domain number.
> + * * -EINVAL    - The property "linux,pci-domain" does not exist.
> + *
> + * Returns the associated domain number from DT in the range [0-0xffff], or
> + * a negative value if the required property is not found.
> + */
> +int dt_get_pci_domain_nr(struct dt_device_node *node);
> +
> #ifdef CONFIG_DEVICE_TREE_DEBUG
> #define dt_dprintk(fmt, args...)  \
>     printk(XENLOG_DEBUG fmt, ## args)
> -- 
> 2.17.1
> 




 


Rackspace

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