From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE0B6C433F5 for ; Wed, 22 Sep 2021 23:50:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 752DE61038 for ; Wed, 22 Sep 2021 23:50:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 752DE61038 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.193193.344101 (Exim 4.92) (envelope-from ) id 1mTC0J-0005p6-Fe; Wed, 22 Sep 2021 23:50:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 193193.344101; Wed, 22 Sep 2021 23:50:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTC0J-0005oz-Bz; Wed, 22 Sep 2021 23:50:19 +0000 Received: by outflank-mailman (input) for mailman id 193193; Wed, 22 Sep 2021 23:50:18 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTC0I-0005ot-5u for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 23:50:18 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d6409e82-1bff-11ec-b9f3-12813bfff9fa; Wed, 22 Sep 2021 23:50:17 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 2EECE61131; Wed, 22 Sep 2021 23:50:16 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d6409e82-1bff-11ec-b9f3-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632354616; bh=zJ3WjaxN2JEd2pJJPs4Gnnct7HIdWR52lI2GSPP+WLE=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=oJSmAMxa7gzi9zCa0oLEOKeUvFaJRnGSedKeD8Wwl6kMSUv6FadQZrM1J3iL5YGU4 hM4/iLN+I/JWkYBJ46Lig3jnskWa84rKnquadlZildMSG7RnvKEqqnEGWJwmAYwjjt /o69tZt09JZIhh7qLVRfoqDpz7n2KdAquzTDvGZ6cPU+KN9SSBoUTbib0jZI+pOyFn 7E+Bj/6yzMa2vDcGIy3uLyAugoqNOzk4I0bH+Flg8lHVca0T4m/qJq5uU68C+aXPrP Y12ujGBaFb/a0h1D8Iaqe3V4jyPj3cLI5IInKw/B9+dSeaDndmO6/hw4eako76baJM xB+WSnUH5EMLg== Date: Wed, 22 Sep 2021 16:50:14 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Rahul Singh cc: xen-devel@lists.xenproject.org, bertrand.marquis@arm.com, andre.przywara@arm.com, Stefano Stabellini , Julien Grall Subject: Re: [PATCH v2 08/17] xen/device-tree: Add dt_get_pci_domain_nr helper In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Wed, 22 Sep 2021, Rahul Singh wrote: > Based on tag Linux v5.14.2 commit bbdd3de144fc142f2f4b9834c9241cc4e7f3d3fc Please use an upstream commit id > 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 > --- > 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 > + * 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 >