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

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


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Thu, 23 Sep 2021 11:52:39 +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; bh=XrA1IBMBSCWmY0iQLpEx6FUR9pt03y1bOEHFTxWBqag=; b=nJbdv3lNm4RNnxpjBfPtcrs0PiIJ4FFN5tcea/nzWrE5++Rq62kznKmTQCa2lZ17F6ZVjmVvjn45ODQIYWohpgyHAaD8gM/pOTXuHEs83HT9IhvsYPIVKjkxcuXU9ftBrEW0Xyxmku5UIRlhnhaz9zSS6D3szXvg/4byapm+rfvxe59L+g7Bpkg3+6F9Dlr5t7pPpfTpqLaOePaFi8hb77h5Up976eXz6RHuw0TwQYO+GhK2RfKxhbb82Pewy9rsbO73HnpQaJSoc3bW2DOTOa5UFDoqcMKKBW9bylRAE297g5Dbt69iUT0fgLJK/Xp5f0/yakAyiI6h6zd/kZQGow==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZELO0Fsh22IzcAWmmIFrMhJ1x8ZxEtk5H7aqubMWalBn0qUM9KDFECcLd2QW4D9xT1QyaBYlrKXyC8noENBBmBrFI1iAn511vVUhJXaGYB3vzx3RkVAST+CgqQ73Qxd/RUhyeZ/5WPlxeolNEUXT9FzGfCcNYlE18lqtUzT2fbKMIuMEx3MfozQjmXoNjD+9IdJ1U6j9d7K6nbpfB+4dRTHs8LdeEWB1qOwcTTqMXNTZwjA1FuaKwko93T2BnZiBzhZdduCKqDp5fe+NUHOuncfPkn/+NBF1o879echsqKOZ0q1Rd9hcwxaMKh/Y1GNWClXtmgD5JU8r5lTLeFr82Q==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andre Przywara <Andre.Przywara@xxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Thu, 23 Sep 2021 11:53:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXr6ZY75EobBA4I0aERqDKzahV06uwueAAgADJ1gA=
  • Thread-topic: [PATCH v2 08/17] xen/device-tree: Add dt_get_pci_domain_nr helper

Hi Stefano,

> On 23 Sep 2021, at 12:50 am, Stefano Stabellini <sstabellini@xxxxxxxxxx> 
> wrote:
> 
> On Wed, 22 Sep 2021, Rahul Singh wrote:
>> Based on tag Linux v5.14.2 commit bbdd3de144fc142f2f4b9834c9241cc4e7f3d3fc
> 
> Please use an upstream commit id
Ack.
> 
> 
>> 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>
>> ---
>> Change in v2: Patch introduced in v2
>> ---
>> xen/common/device_tree.c      | 12 ++++++++++++
>> xen/include/xen/device_tree.h | 19 +++++++++++++++++++
>> 2 files changed, 31 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 497144b8a7..9069040ef7 100644
>> --- a/xen/include/xen/device_tree.h
>> +++ b/xen/include/xen/device_tree.h
>> @@ -831,6 +831,25 @@ 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.
>> + * * -ENODATA   - The linux,pci-domain" property does not have value.
>> + * * -EOVERFLOW - Invalid "linux,pci-domain" property value.
> 
> This doesn't match reality for us because it can only return EINVAL

I will remove in next version.

Regards,
Rahul
> 
>> + * 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®.