From nobody Fri Nov 29 19:30:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1632401711; cv=none; d=zohomail.com; s=zohoarc; b=bzrPAPopdKZPFrta7kxbUC2ShdlocCMPa/6dPfwkUD5ji6jX2Upazk2A7e79Ws2uvVmPyuaZiF1Hzw/+eviQbD107fgEqSDLQXN4DPbv/S0URlyvVttyxeoYOuoUPB1YJTfbPFFk6YlVv5f1XQZ4b15pgS0npiLcAYy17scbOUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632401711; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ywsVgZmg0atZGESTkNZBQfqFY254EfvmFk14qbemHso=; b=W2MxBLAB/JN5vjI1VCYgzYPPaEXGXjdWM6xFcdK/cQUgPBiUmSZS9Ow2iCQ7DyuJokToP45izLtGMDKpVwIu9OdPSRCgSC2Ci51J4+h4nQURRyqHLQ2ZyKW7KW0sRi6JGbo9H5hclDOWvemG5EDERUb4puFi99iTciJ6UyJYUaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632401711161906.2496332934483; Thu, 23 Sep 2021 05:55:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.194102.345776 (Exim 4.92) (envelope-from ) id 1mTOFe-0005ek-Hd; Thu, 23 Sep 2021 12:54:58 +0000 Received: by outflank-mailman (output) from mailman id 194102.345776; Thu, 23 Sep 2021 12:54:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTOFe-0005ed-E9; Thu, 23 Sep 2021 12:54:58 +0000 Received: by outflank-mailman (input) for mailman id 194102; Thu, 23 Sep 2021 12:54:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mTOFe-0004it-2w for xen-devel@lists.xenproject.org; Thu, 23 Sep 2021 12:54:58 +0000 Received: from mail-lf1-x12b.google.com (unknown [2a00:1450:4864:20::12b]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a781f2b3-ebc0-47c6-9470-1f1b9209b024; Thu, 23 Sep 2021 12:54:45 +0000 (UTC) Received: by mail-lf1-x12b.google.com with SMTP id i4so26246242lfv.4 for ; Thu, 23 Sep 2021 05:54:45 -0700 (PDT) Received: from localhost.localdomain ([185.199.97.5]) by smtp.gmail.com with ESMTPSA id l7sm453584lfk.52.2021.09.23.05.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Sep 2021 05:54:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: a781f2b3-ebc0-47c6-9470-1f1b9209b024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ywsVgZmg0atZGESTkNZBQfqFY254EfvmFk14qbemHso=; b=S/31GUMsxvRrP1XF6wl+HRwUSizur6tWU9DOrgB+Ip6QXSpropykEsQM6TJxFL5L9y 8QMiKwqJExoqZMiRbA3aft4VOtivvFty7EZPZK1bWVH/Qw2q3KRqDQdvpNKnpH7zKX6I IPNHkrWWsbvafPdYrmNnfkJIe3jaSVS5w3433LAQNq0Hgas1sPNNFWL7jrQcHVxW3/h0 4frBJ80C9L0z7cTC1nYENtGaOrJq4R7IdXFN4m2P9uwPJywJeF/eLCiXOQsbFvimVN4V 2LBMK3iCwNMhBapteKX76nLE/2XSbnLWL32t6hu/9UwQm+4A8n2BhbVEeOO6MlK9LbMU 87HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ywsVgZmg0atZGESTkNZBQfqFY254EfvmFk14qbemHso=; b=eljRRZvQYD+1irFffV2anWJG3uoNLDSmcif609iBaRvAzvbPCN6NPGDovNabXKx1P+ ZYx+QsjFNBbto220gIDZOUvGzxHWN8x6Pqlqy6qPuAoQIEyZq4AWMQRt/EsHmrHYvjF0 fJbBk5CDMqXsvbMYdZcJzxn42+tbF+nppMeAB7e/A6jTcN/lbLRqHfXT/9gp8+4qc806 zBchb1d4KjwIxgws2zgZhQ5M0UTJ5HC+/yambqji2uOPuE9CBomSa0aKdtjeDM1NOOom l+16HOS4tzAb8M/L6RgLTRnkTgMDbO3lMCBUOvaSrEr9JSA8qK0M4gP6z8Uc7sBNSqzr P4ig== X-Gm-Message-State: AOAM530Kv9TZySRdR6g+rCcWRSedvnOWoSUOxXKi//cLqUO7OrQCHVOC slJ4+FGaN6WkpTJzXG3Bdc18jSI407wzmg== X-Google-Smtp-Source: ABdhPJx2xtdoiUQBwDDZezKg8Zgt46DrsOL+/EVGJ+gC9vZkBAAVXbSkfyKXTZZgyCDRekfYMXmE+A== X-Received: by 2002:a2e:7c0a:: with SMTP id x10mr4967251ljc.455.1632401683981; Thu, 23 Sep 2021 05:54:43 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org Cc: julien@xen.org, sstabellini@kernel.org, oleksandr_tyshchenko@epam.com, volodymyr_babchuk@epam.com, Artem_Mygaiev@epam.com, roger.pau@citrix.com, bertrand.marquis@arm.com, rahul.singh@arm.com, Oleksandr Andrushchenko Subject: [PATCH v2 03/11] xen/arm: Introduce pci_find_host_bridge_node helper Date: Thu, 23 Sep 2021 15:54:30 +0300 Message-Id: <20210923125438.234162-4-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210923125438.234162-1-andr2000@gmail.com> References: <20210923125438.234162-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1632401712173100003 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko Get host bridge node given a PCI device attached to it. This helper will be re-used for adding PCI devices by the subsequent patches. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Oleksandr Tyshchenko Reviewed-by: Stefano Stabellini --- xen/arch/arm/pci/pci-host-common.c | 17 +++++++++++++++++ xen/include/asm-arm/pci.h | 1 + 2 files changed, 18 insertions(+) diff --git a/xen/arch/arm/pci/pci-host-common.c b/xen/arch/arm/pci/pci-host= -common.c index a88f20175ea9..1567b6e2956c 100644 --- a/xen/arch/arm/pci/pci-host-common.c +++ b/xen/arch/arm/pci/pci-host-common.c @@ -283,6 +283,23 @@ int pci_get_host_bridge_segment(const struct dt_device= _node *node, return -EINVAL; } =20 +/* + * Get host bridge node given a device attached to it. + */ +struct dt_device_node *pci_find_host_bridge_node(struct device *dev) +{ + struct pci_host_bridge *bridge; + struct pci_dev *pdev =3D dev_to_pci(dev); + + bridge =3D pci_find_host_bridge(pdev->seg, pdev->bus); + if ( unlikely(!bridge) ) + { + printk(XENLOG_ERR "Unable to find PCI bridge for "PRI_pci"\n", + pdev->seg, pdev->bus, pdev->sbdf.dev, pdev->sbdf.fn); + return NULL; + } + return bridge->dt_node; +} /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h index 9e366ae67e83..5b100556225e 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -103,6 +103,7 @@ void __iomem *pci_ecam_map_bus(struct pci_host_bridge *= bridge, struct pci_host_bridge *pci_find_host_bridge(uint16_t segment, uint8_t bus= ); int pci_get_host_bridge_segment(const struct dt_device_node *node, uint16_t *segment); +struct dt_device_node *pci_find_host_bridge_node(struct device *dev); =20 static always_inline bool is_pci_passthrough_enabled(void) { --=20 2.25.1