From nobody Mon May 6 16:38:57 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=1630658058; cv=none; d=zohomail.com; s=zohoarc; b=n9viSIdTKBctV9HGaUil1A311VmjJ2skBZ9EZnTb6cr8HjeQ/3FOccmrjNuIN7MC2lPq7Jgr5VC3wbqKms0+O03afuoyyeP+zgs6eFzwfK+CbXE25tpwTCNeY9H9ZGOJ7600YFH3yunp92dIqw/iMIuCOfErdgEd130wzE/+fOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658058; 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=zjlQkuHh6kZKwoZ8mUieXYtJ9esYGLvw5t0GDKDUbQk=; b=VGqftIeje8D2o/A2PgW4a2TFkeEXP464PBNHViwtIbJwQAWZ2gOhP14iT6KquLgPKigVDpB2oF+KN2BYpGCYYofkgOiga0VUklByLYUCj7KgyuvFigLhVwxQUPKk21hYFLSzw5C7WnkecAj2XD5Zk2CKjfQKWQ7yfzOWoz4c0wM= 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 1630658058986663.4943837518205; Fri, 3 Sep 2021 01:34:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177836.323555 (Exim 4.92) (envelope-from ) id 1mM4e5-00071E-GG; Fri, 03 Sep 2021 08:33:57 +0000 Received: by outflank-mailman (output) from mailman id 177836.323555; Fri, 03 Sep 2021 08:33:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4e5-000711-Ca; Fri, 03 Sep 2021 08:33:57 +0000 Received: by outflank-mailman (input) for mailman id 177836; Fri, 03 Sep 2021 08:33:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4e4-0006kQ-CN for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:33:56 +0000 Received: from mail-ed1-x52d.google.com (unknown [2a00:1450:4864:20::52d]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 53a80e4d-17ef-4a2f-8cff-1eaa68946a8d; Fri, 03 Sep 2021 08:33:51 +0000 (UTC) Received: by mail-ed1-x52d.google.com with SMTP id z19so6890788edi.9 for ; Fri, 03 Sep 2021 01:33:51 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:49 -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: 53a80e4d-17ef-4a2f-8cff-1eaa68946a8d 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=zjlQkuHh6kZKwoZ8mUieXYtJ9esYGLvw5t0GDKDUbQk=; b=Xgp3IkxX/SfY/PfG+BOgIO+ADKUy/5Rb8UIuqEw2MjrDLDSn+HntfDhndHbMQEaScL FjmrDAnyZcW6+xVcPZwu1EP7ndImdZ0KeimUQLoaibXp19/yI5ifx9Mgd4XDHmgSsifl DEvRHIV40w0i9zsWwxea2m9bOGHPSDHt24SoDK7stOg+g1Tdc/9POfAGzlMJ9dfQ3CHs Di8p521g87IwoOeOcp2ltO9kq52QKbjG70LiiCsYOZqXZK9/EjouzbmL5WtPRAbiWcCF lxvSO0V1GfTAsxF6og3u/5lCxROSkhvfw5FJOZueqx+bwmhq+i8/2CAFs7DUgsQ90wSm 4KEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zjlQkuHh6kZKwoZ8mUieXYtJ9esYGLvw5t0GDKDUbQk=; b=UdVccc3g9rFVrXh81QNyHCPyMbdBIJTX7yfPGXxwB1o5FwwNVs2xqTL7hK2836W9M2 35TtrgD+FzboohBUYt9XoxABD8ZjoRPHnejIO1eFgiyprFBi/mKMOvhy/EYoZWvnPEzj TmdmGEMGmoHoRTynt3ZY7X7jYsON2SrK/6UPq5u9CY39jk6e1KOvOqBu8kKOCiyXP1wX rp/IplvkD4uYtLTDmuwv8m2z9Sqy2mXSqrEplRVV3ZQ29r80+TGdVgMaRuL62IV7YQGC 70QtshEMrGWbHKpTv6hN0Ep04QyFB+AAkgY/tkAbgAiHxNB+dvjIBciiltTAWZwtDKGe k+sg== X-Gm-Message-State: AOAM530+wApQVPgt820BrvHk0yNdDbrcYVAx4xOuJjqbepovzBkHapVl nMDXIPzA7Spq0OXfBKNT+lCyNJPyikI= X-Google-Smtp-Source: ABdhPJwdIkQ8KNRmfmDrpt7oR/v1jpWaKOTo/d+eapgA54xtdvm5mj3qW6yJP5PMshdGxMxg314tWA== X-Received: by 2002:a05:6402:1cb4:: with SMTP id cz20mr2815841edb.0.1630658030445; Fri, 03 Sep 2021 01:33:50 -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 01/11] xen/arm: Add new device type for PCI Date: Fri, 3 Sep 2021 11:33:37 +0300 Message-Id: <20210903083347.131786-2-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658060504100005 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko Add new device type (DEV_PCI) to distinguish PCI devices from platform DT devices, so some drivers, like IOMMU, can handle PCI devices differently. While at it fix dev_is_dt macro. Signed-off-by: Oleksandr Andrushchenko --- xen/include/asm-arm/device.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h index 5ecd5e7bd15e..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, }; =20 struct dev_archdata { @@ -25,9 +26,8 @@ typedef struct device device_t; =20 #include =20 -/* TODO: Correctly implement dev_is_pci when PCI is supported on ARM */ -#define dev_is_pci(dev) ((void)(dev), 0) -#define dev_is_dt(dev) ((dev->type =3D=3D DEV_DT) +#define dev_is_pci(dev) ((dev)->type =3D=3D DEV_PCI) +#define dev_is_dt(dev) ((dev)->type =3D=3D DEV_DT) =20 enum device_class { --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658056; cv=none; d=zohomail.com; s=zohoarc; b=TD4FR8LWu1zBodtr+EuEfgwE43uxJoXM6BKM/WdppQDlyJGiP8PrmTlzMXKHnNmYMYj+JXZsKUpEQE46rAC8nQU2oSg9hdm1qSipXT1okZJTO1u60Zt8Mqgn2rviLHc1X6l/F+khOGMv9KlXp7c4rY7a/+nJi8F55F0suOmD+0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658056; 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=e6QStZ2WIeXjyjg6BwJ+X2ETh+SFauYaLcc7bbXleUI=; b=Vgkml0Hb3glugkPJxF1ybQjn7atcNcDFZF7yr4zujY+9/Dz32vm/+g0QDyt9/twCi3xSBmPZ9xmTybaIwdmXmEtQlFOSNjJ62IgBNfFjN5q6ShAk20JCZZYqRznezRZb6/9eWfE7L6ct9r3ngWpcxehT9D9p55XFgkXg0E91BPw= 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 1630658056283151.499525346699; Fri, 3 Sep 2021 01:34:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177837.323566 (Exim 4.92) (envelope-from ) id 1mM4eA-0007LT-Nx; Fri, 03 Sep 2021 08:34:02 +0000 Received: by outflank-mailman (output) from mailman id 177837.323566; Fri, 03 Sep 2021 08:34:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eA-0007LH-KJ; Fri, 03 Sep 2021 08:34:02 +0000 Received: by outflank-mailman (input) for mailman id 177837; Fri, 03 Sep 2021 08:34:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4e9-0006kQ-Ce for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:01 +0000 Received: from mail-ej1-x629.google.com (unknown [2a00:1450:4864:20::629]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 24e6dbd2-53dd-4a2f-b109-cd7d7a4e1bc1; Fri, 03 Sep 2021 08:33:52 +0000 (UTC) Received: by mail-ej1-x629.google.com with SMTP id mf2so10484692ejb.9 for ; Fri, 03 Sep 2021 01:33:52 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:51 -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: 24e6dbd2-53dd-4a2f-b109-cd7d7a4e1bc1 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=e6QStZ2WIeXjyjg6BwJ+X2ETh+SFauYaLcc7bbXleUI=; b=nWqFogticuAbAM8eSH4t1N6ThkVzCw+SXxxF9K1ll2yiZMh1ba0KqHkEcuIICyZxA+ SzrMGymV0AEdKm8ZZ/3WuQ6zOTDzu3Qxl2rYf1kjguYpIH6KYlhCyq4IRG8TfcKBRTEa iMEDEVpEa1K4k9kdeisup0kiYmqigISQlt8BUksAZ9OhIz75hqYC7L9u4YBATeJvnifO b13khRAluSa+dJjLlvArcmT+T3oNHIcHa6lln6cGdZNaR3DGxhgy9yz1WLBpn0CaTKgf JKlqdN0FSVOjxPDLSx+rh4zcWbdqnO+Fq6F81ZteVy6jV9HuhiWHdOcfUqqsdjHTdnlT suoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e6QStZ2WIeXjyjg6BwJ+X2ETh+SFauYaLcc7bbXleUI=; b=DqfUBp3HYqyVJuvEWaAbOqwC+iP0kKM/BtDXEVHjL6xQ2EfXLT3VuN0ZFMiZ+SAzPs Moa683XQnMe0Xi8Erj6k69B5Pu6kd3hQVL0vD9jcAB4EQ6oK4YdrGWTsJ+3UUyVIazwE Xqgl56ITOKzRi0jItqS/W/TYqs7KWadXopTG5Dx0nrJVFWiEAxQMH3xKU8fsg805fRNV O9mUCJ2o4vAYxzTxCWuaRdUDiD93AVNdlAnPKG/SEzv5GO18QwEGM17T2hR8/G9SVUpp H1/an6zN52wDlP+iAFUudlGDxdULP1maooWYPv/L0au+vpqZJO/8+VJVl/XPVVvzOMZT C1dQ== X-Gm-Message-State: AOAM532EVpJhMEJNMXKgNeiEuN+lD15r3Kf80L4/AiQdmRGklpph2xqw J6gNBPYL4kU14A7sBvyYlg0FOW8cayg= X-Google-Smtp-Source: ABdhPJyTGMDmf4scjKeBebTeFdkThiwTB1tUX8NLSvZRs7ZtFuZfBJOLUJ5uJ8kRB25bkqYfTjUf0g== X-Received: by 2002:a17:907:2721:: with SMTP id d1mr2923277ejl.24.1630658031656; Fri, 03 Sep 2021 01:33:51 -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 02/11] xen/arm: Add dev_to_pci helper Date: Fri, 3 Sep 2021 11:33:38 +0300 Message-Id: <20210903083347.131786-3-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658058704100002 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko 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. Macro can be implemented, but looks scary: #define dev_to_pci_dev(dev) container_of((container_of((dev), \ struct arch_pci_dev, dev), struct pci_dev, arch) Signed-off-by: Oleksandr Andrushchenko --- xen/arch/arm/pci/pci.c | 10 ++++++++++ xen/include/asm-arm/pci.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c index dc63bbc2a2c1..6573f179af55 100644 --- a/xen/arch/arm/pci/pci.c +++ b/xen/arch/arm/pci/pci.c @@ -26,6 +26,16 @@ int arch_pci_clean_pirqs(struct domain *d) return 0; } =20 +struct pci_dev *dev_to_pci(struct device *dev) +{ + struct arch_pci_dev *arch_dev; + + ASSERT(dev->type =3D=3D DEV_PCI); + + arch_dev =3D container_of((dev), struct arch_pci_dev, dev); + return container_of(arch_dev, struct pci_dev, arch); +} + static int __init dt_pci_init(void) { struct dt_device_node *np; diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h index 2d4610a23a25..e1aa05190bda 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -27,6 +27,13 @@ struct arch_pci_dev { struct device dev; }; =20 +/* + * 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 { }; --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658060; cv=none; d=zohomail.com; s=zohoarc; b=XJ44OnN+XI2Dmf1Tj6Wmqn+z7QpH6EgHmu6Ztu1x/s2d137+XOcULs1uwef5xw2QEFuxf90yOyQ+aaERDknUvS9yQNTKnFJeXFHMcxDuD3BaLQWmtHZ9mmiU5qpMd/5ix4FfEaB9XtJUYCdi2Ol0PD1qjmekwuT9ZbGRASXUSxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658060; 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=LGWgNsGMc39sVj5QGdwU3RC9MH61fd0rOAc+HjnetL4=; b=Pk6rXRPaPMzP/if2a2s5+I63x5AmxhB2DQwXG4WY3xTR4B2fL3le6blHBhoG1/G5h+KzPssSdKoD3Y4GGzR15w6g7Hc4Jq3pPk/nbp4ryyC6kgLQ0fmjm00APYpT8xFuObSDvtyfxs4JCcrCPxFUgU8ppqRILhgza5hgwkw7b8w= 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 1630658060733467.87820567725635; Fri, 3 Sep 2021 01:34:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177838.323577 (Exim 4.92) (envelope-from ) id 1mM4eG-0007k4-23; Fri, 03 Sep 2021 08:34:08 +0000 Received: by outflank-mailman (output) from mailman id 177838.323577; Fri, 03 Sep 2021 08:34:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eF-0007jr-UN; Fri, 03 Sep 2021 08:34:07 +0000 Received: by outflank-mailman (input) for mailman id 177838; Fri, 03 Sep 2021 08:34:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eE-0006kQ-Cm for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:06 +0000 Received: from mail-ed1-x529.google.com (unknown [2a00:1450:4864:20::529]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d791cd72-1871-4ccf-817a-e51d3db5b6c3; Fri, 03 Sep 2021 08:33:53 +0000 (UTC) Received: by mail-ed1-x529.google.com with SMTP id r7so6926076edd.6 for ; Fri, 03 Sep 2021 01:33:53 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:52 -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: d791cd72-1871-4ccf-817a-e51d3db5b6c3 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=LGWgNsGMc39sVj5QGdwU3RC9MH61fd0rOAc+HjnetL4=; b=jzF3nEIJXkuxIUCpc0qM5Oiu8hLlldWQ+Lz0hhNI2Ub1RMF3Qbrij1SFl/emQEQscX OctS5kVKgfSmIlkAEokYDlh7KTdaWXM0wDAYf9/2NdD6neoTsa3t2DKhbRd5ZdUKiPOx S2PsK64LPXN+uZeNXjPPxgQjMJjKSFc6YGWqsQVbMF6xtxnZDnoHezWhH2nT/vwym0Yv 0CNidcd1Mx+4PJKuDXmrq2uXK50XYtdBR/DUdsISNvXiS0MjoUtZx7LKVdsMWZlTQkxu ruWxAhOgTOoVzm1FC+ANk+ZBh3e633gonZWlfdEMs3pAoxm7xgjBcF1AwkgxVuzftbjM lmoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LGWgNsGMc39sVj5QGdwU3RC9MH61fd0rOAc+HjnetL4=; b=gFEF3vI+84Y3nriEaeUXr/5nOWigp71+vuqb1g44w9QEEMom02M9m8dU9IVlOyNYhN AWRc1uk4LSOfu3GqcZwGnvreAVYrqjp7b1N6Kacs5p3hkVCgNPPtb6JF6d2hk1k9d5iw lYZfj4mx7X4+yEMowDQzY2EeXQYF5XQpuZ66Yw5Gv/9GRf864HTgAOEUbtk+t1AyY//c bvvWAiye7e1aNAQigt4y0UVP/CL/QACcniAUFHLhHZhHtgxDXBdvSATthqFlqO8V8lfy Cn0XzcsvgWI1LYYyBGMmCZqTeSU4/+ZaMw94Az14P/p+jCCc8in/H00i4t0K+jI/TxjW 0JDA== X-Gm-Message-State: AOAM533T29VmwjjdpxeGBjsIw1GF/1YGfe5TF4KSgBNOw6Q+nUGLh3O7 OLuWyYoVesOzLVpY14INbxAW2qVrYXQ= X-Google-Smtp-Source: ABdhPJzoCD96lMsn4O6MjQ9c1RPiG7IXqQPjSOWYZAYm2R5Ns/eebk9CaPXrFjkNmkqhirqr1Rp1sg== X-Received: by 2002:a05:6402:4d:: with SMTP id f13mr2792315edu.275.1630658032768; Fri, 03 Sep 2021 01:33:52 -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 03/11] xen/arm: Introduce pci_find_host_bridge_node helper Date: Fri, 3 Sep 2021 11:33:39 +0300 Message-Id: <20210903083347.131786-4-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658062648100001 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 --- 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 5e34252deb9d..d2fef5476b8e 100644 --- a/xen/arch/arm/pci/pci-host-common.c +++ b/xen/arch/arm/pci/pci-host-common.c @@ -301,6 +301,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 e1aa05190bda..7dc4c8dc9026 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -105,6 +105,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 #else /*!CONFIG_HAS_PCI*/ =20 --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658065; cv=none; d=zohomail.com; s=zohoarc; b=nTWooYPM+h8r+FMqXOvE1oENdknRsy40eXBXBiHwfYKmGjfWMgQezfO1FZPM71ISeZYbPwxHiljlVwaX9SocDGsXFq4ONOs09JVvrD65U9OPI5oPGRF5H07V5Crhb3Mg+KHKRPMnlg/VWwpO0R0Mwf7Y5u5z9xykbuZJXxnGip4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658065; 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=gT/ZFZNUCDilPZAOY4tWpXuhNvzOpcakatBoOBy/O1k=; b=bhF2doSa2fvdrj9uXa6f/nwuKp1T+9SYUtt+vW356DA2cXBu7sh2zxIx2Kl/sTWIg9PiY87IWFqugjVmcEZnOROnGAKuYBK52BxQp+pK0bpphcySXvtqpscXDpsXiMWunNzA2lIODnB2wTDCzR1mAugn4Pme/UOvnBU1qhnU22s= 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 1630658065279746.9514113265934; Fri, 3 Sep 2021 01:34:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177840.323588 (Exim 4.92) (envelope-from ) id 1mM4eL-0008Ff-CR; Fri, 03 Sep 2021 08:34:13 +0000 Received: by outflank-mailman (output) from mailman id 177840.323588; Fri, 03 Sep 2021 08:34:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eL-0008FR-82; Fri, 03 Sep 2021 08:34:13 +0000 Received: by outflank-mailman (input) for mailman id 177840; Fri, 03 Sep 2021 08:34:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eJ-0006kQ-Cz for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:11 +0000 Received: from mail-ed1-x531.google.com (unknown [2a00:1450:4864:20::531]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id abac851f-78b0-46af-ba55-f6067286fe72; Fri, 03 Sep 2021 08:33:55 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id g22so6893686edy.12 for ; Fri, 03 Sep 2021 01:33:55 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:53 -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: abac851f-78b0-46af-ba55-f6067286fe72 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=gT/ZFZNUCDilPZAOY4tWpXuhNvzOpcakatBoOBy/O1k=; b=AeeHVvoDQgATpWSZNB/AO4OIyw4Mg9oLVflwbPYmCY/dNrU1qFSQB6Db3RqYWroQIm 7dL4DAlFEW2GS7PnIsgS7gE9t4WMgwHb0M5oO5gEtI/deFPJO4ufJeIIE6jGpdTIuNXv HO3CaROk5N0KkNEEdY7x1NBl3FxGPdgHarce5VLXc0j0PuLaobvKmi3gSljvQcSX+aPc //aaqhRjf3R96XiFwTYuAJ4GXlwIF3VVYkQFUG2Fu1uqXBJPRpNuEPYYXKO2Xf6aeIxP zG8rAY1KwYJ2z5GY75QLpNcSi/kpSMO3mJAHsjUmpyFmB7ff8JMJd20fYfkj258kxD4V PMSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gT/ZFZNUCDilPZAOY4tWpXuhNvzOpcakatBoOBy/O1k=; b=AKT9Qirdlz2Tnu9mJr/AmWdARIaR25QIApx9cutv45Bb8poD82/RxZ+GlwzIWWK/jN vwH8m6sZI1dOy9tWslgbkcPUfjFkdXf/028gzwqLHU3N8EvrlBeGusD9iRJC4YyaDzYr ibmj6MAF23RwNDdatmZ5QKlYkPnTikZS5jTe3lxS1NFhPLwiT0spVHuhLSbMydSznAA3 y2Nupp/ycyftCrSsBpYimh3hRpN4QPUrfwGmETZo7ldY324LnAeYB6VQbPxDzaORkEfK O+PecLffVpdYBV8Uj+cgaYzP7EtrQZ7KnHLZtm6Y/y1cev/RIbr5pYbGhoDiAy5nKaHK cEsQ== X-Gm-Message-State: AOAM531b95LbkD8D/U3k/TYzb2/vrmJ7a8/LrjtzlF8XrJDv464yiVDU fWc4zqUnUhEkVvt/LHw8+E62ttNAkn4= X-Google-Smtp-Source: ABdhPJwY8ZltlgwVhwjnryt/5IUzAOzh/IBbZ1FvlM/J72PFOBmQxVLdVpjv5yPJL3sHkLXKtBoe/g== X-Received: by 2002:a05:6402:b9c:: with SMTP id cf28mr2924531edb.356.1630658034045; Fri, 03 Sep 2021 01:33:54 -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 04/11] xen/device-tree: Make dt_find_node_by_phandle global Date: Fri, 3 Sep 2021 11:33:40 +0300 Message-Id: <20210903083347.131786-5-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658067040100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko Make dt_find_node_by_phandle globally visible, so it can be re-used by other frameworks. Signed-off-by: Oleksandr Andrushchenko --- xen/common/device_tree.c | 2 +- xen/include/xen/device_tree.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 03d25a81cea8..c2e33b99832f 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -986,7 +986,7 @@ int dt_for_each_range(const struct dt_device_node *dev, * * Returns a node pointer. */ -static struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle) +struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle) { struct dt_device_node *np; =20 diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index b02696be9416..07393da1df90 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -776,6 +776,8 @@ int dt_count_phandle_with_args(const struct dt_device_n= ode *np, const char *list_name, const char *cells_name); =20 +struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle); + #ifdef CONFIG_DEVICE_TREE_DEBUG #define dt_dprintk(fmt, args...) \ printk(XENLOG_DEBUG fmt, ## args) --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658071; cv=none; d=zohomail.com; s=zohoarc; b=BIDNx5GV2uVFKhiduZuKXAksqoyh19W9mB5XcVqKQxkj60ceKW+hoH6SU9C0TzkwpspfSnOEFuIw2l4hosYSWL8OoK+Wd1LC9ZXHooyHpJrM9Ga7rSt+ORIMLVhIyF24Im1HjT/7Cbv/V23XbH12Hc10nTTXGhGbZbNh/CoHo3g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658071; 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=zEaEEkjSVbLwgqZ2cO/SvSyYHTCsAuDtk1o9tcPz34M=; b=ejpqpfRiY2KYi17Sr31/9lU6a3YTZ7ohST2dktxvzrmvakYOsL0DHAZLgyz3O3H3bQqOHGXsdXIpPudmj9jst5g0BCGzzpesrrPxEGyHbjjFOqocpU/S8h5flwj8jNkKZIFFS7rGbNotJIm6wNYZfpCb9Dn8g1sYaUtCZqXgpCI= 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 1630658071943626.3702242491858; Fri, 3 Sep 2021 01:34:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177845.323599 (Exim 4.92) (envelope-from ) id 1mM4eP-0000Nh-Rt; Fri, 03 Sep 2021 08:34:17 +0000 Received: by outflank-mailman (output) from mailman id 177845.323599; Fri, 03 Sep 2021 08:34:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eP-0000MS-Lw; Fri, 03 Sep 2021 08:34:17 +0000 Received: by outflank-mailman (input) for mailman id 177845; Fri, 03 Sep 2021 08:34:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eO-0006kQ-DJ for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:16 +0000 Received: from mail-ej1-x62f.google.com (unknown [2a00:1450:4864:20::62f]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 27e92245-e9a7-4d08-b7db-06c719470729; Fri, 03 Sep 2021 08:33:56 +0000 (UTC) Received: by mail-ej1-x62f.google.com with SMTP id x11so10579940ejv.0 for ; Fri, 03 Sep 2021 01:33:56 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:54 -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: 27e92245-e9a7-4d08-b7db-06c719470729 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=zEaEEkjSVbLwgqZ2cO/SvSyYHTCsAuDtk1o9tcPz34M=; b=HOEWMOzgAHfhqGy9RD08ptIgiNJDtfBpZENO+7wmukitpCXKU/tg2fBV+y4B5GPbeZ nc617mYgWSgBkpaW4vuo16HZ9MEpN6RQrgWJ6q05CQtakHUM9tZgI3oY9+bCavK6RfvD /Z5kGtwMD+pBzSNmg8rVMzrHjsh3Ac/qSBRoejs561XlEe8rtWJROHH3P8toAYjpOg0u GC5NtpzMwvW+z9I37LMc3EWyZY+bAC5A7dznB6kxyhp8224v3H81NjGIfPkG4Ng//ZK9 jmNQ+aYz/U+d5xKG/+qYldB4flk+vPZS3BIDdQ7TKOzfrfzmsoFflWkGBScLO5yZ2+dc LL0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zEaEEkjSVbLwgqZ2cO/SvSyYHTCsAuDtk1o9tcPz34M=; b=DdGy+TRLNw447nRDWa8eJGApCfFbQfReNvgW8pH60UiCN/SorZTs60lprwxoqtb4hs rmgP1lGzTtV2swotSG1xTKz9qnrfWW/fDrQ9sj8KSea4C84Jqfm5NdtYq2JGrGbCm8fL fG805Mgc3AUF1E2QTo88vuwvadMZXvX2IQKpZkNYtYobbkYGN90hEL34gJrjxGHgrgAz I8WIIqLWAI2Ii3/BaOZnzSouaSc0YRFQQ3zD9UJF2xMRcDMuooDYCvQG+UFgNI6JwzTW mmApM5Ap2CcM5SZ6RbiO1a/5WKpxT5VRU1rk5mULWN0vjkr3MUQJJt48ANSvqLRzrocA u8eQ== X-Gm-Message-State: AOAM530l5Uu+nBzJSIgtyQkQA41cdnN7ZvTYnI2/5urjS4An/BSc8jhD QrgONB206CkZ7AO4HjjL4+SqUNh3dO8= X-Google-Smtp-Source: ABdhPJwRW77fMud+VU+y2+UHwAx3A+siV93Yru3KtspqID6C5FmqhT1A5wFmO04G72SDTjkT5t52Uw== X-Received: by 2002:a17:906:ff41:: with SMTP id zo1mr2759320ejb.525.1630658035099; Fri, 03 Sep 2021 01:33:55 -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 05/11] xen/arm: Mark device as PCI while creating one Date: Fri, 3 Sep 2021 11:33:41 +0300 Message-Id: <20210903083347.131786-6-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658073557100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko While adding a PCI device mark it as such, so other frameworks can distinguish it form DT devices. Signed-off-by: Oleksandr Andrushchenko --- xen/drivers/passthrough/pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 56e261e9bd08..25304dbe9956 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1301,6 +1301,9 @@ static int iommu_add_device(struct pci_dev *pdev) if ( !is_iommu_enabled(pdev->domain) ) return 0; =20 +#ifdef CONFIG_ARM + pci_to_dev(pdev)->type =3D DEV_PCI; +#endif rc =3D hd->platform_ops->add_device(pdev->devfn, pci_to_dev(pdev)); if ( rc || !pdev->phantom_stride ) return rc; --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658074; cv=none; d=zohomail.com; s=zohoarc; b=OBn/FUjpocfXRD0RJaOctvbonFkvj3oBBPpoBnSsCEaimpxmqEXVoQClnogOT3XQh4PdnjPKKo5GEiSzK0iR25soZOx7jM8IZ/8B5bSWrkjL6jlCb0kCaMYlI+0KUroba6nEm+Xht5gKGuXubvjp69kTZhh72SpIvGkUkotf3Ic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658074; 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=/iiGZOLolgjA2ZPldrvDxiQ5Z5+rXkMHlrxZBGQ1V6g=; b=iO4WDn0fBl5lN42w5QBBPJLgtJER62GeUt6ZrMvohX0wYMt+l2mIdpxB34Y9j3byRKU2pMsv+oKbueu20JBrDzwDEVhNFpdA69CilhOAI5e/NyONqXlgPSGrQul15sehSv2kx3u6whQmuyVP/Hghz5vuSOWdtNYA3Q5N7DpWxOA= 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 1630658074856908.7005133715011; Fri, 3 Sep 2021 01:34:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177848.323610 (Exim 4.92) (envelope-from ) id 1mM4eV-0000uw-AO; Fri, 03 Sep 2021 08:34:23 +0000 Received: by outflank-mailman (output) from mailman id 177848.323610; Fri, 03 Sep 2021 08:34:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eV-0000ue-67; Fri, 03 Sep 2021 08:34:23 +0000 Received: by outflank-mailman (input) for mailman id 177848; Fri, 03 Sep 2021 08:34:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eT-0006kQ-DN for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:21 +0000 Received: from mail-ed1-x52e.google.com (unknown [2a00:1450:4864:20::52e]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fdf50016-d48a-46db-8d04-c3242be972e1; Fri, 03 Sep 2021 08:33:57 +0000 (UTC) Received: by mail-ed1-x52e.google.com with SMTP id n11so6903634edv.11 for ; Fri, 03 Sep 2021 01:33:57 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:55 -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: fdf50016-d48a-46db-8d04-c3242be972e1 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=/iiGZOLolgjA2ZPldrvDxiQ5Z5+rXkMHlrxZBGQ1V6g=; b=Thp1SViWRIliiAx3L7i8dGQs8jHSK15JDP1ZAcNVhPgnWdIyDDHzN7LnytjXMbIJGT 2aj1NBBC9Fu1xWxM0uHHq4g2BnsU8a/mnvbjF5ljWBOSqkyfveqsDXi0U8D5UwEzaL+c CEj7XN/MJOAGR2zNbfqHuzkpEq2avwghGsdsSVSbRe7N2V4EIwDJsbOWGfI6CSgqlxeb mcHWEL6UK8lF5q/wFWsS0s5Kq9z5yV8KKrpO5t0pufBbczyE4q+Gw2WE96KobfzMF2BS lSpWrUci/mFJPcibc3S1lKaxt7Y7SV2Q08CoJNTxpxXB2eDudckd2zo5dQ76y5qmNNa2 YJEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/iiGZOLolgjA2ZPldrvDxiQ5Z5+rXkMHlrxZBGQ1V6g=; b=aTKcGwa9+82WQZhK8PxotLTJGD5bJdp/YKJmn6ttLaDFvAPQ/W5PuhrCI5PrXDMD9c 4MLYRzzcs6/2CtCYVWVtTeMNUq2pnVeTRVi01/tbXVAc6n+PITQR3H9fwvCDdq/pwqnU zRJ8q8FTFzxCVmOtKWN3k1GjYVOrOLW6g208FTYnkvjkv1yqaUyFASmtc92slpNrU3S6 GU7DqzvchSdfAyNy3MyRIxHEj9gUPJ0DCpICkXlpNF75piWYIFbTR2G46ec+mZSIURMt zAyOd75zuNEiBDd+ph5429G34WkCIVVl9+/GnDIHUEKD6JAXkvIXbgIqY/W4hhpBGwTF kijA== X-Gm-Message-State: AOAM533j4pWEUlFIHjIEKFwB35po1xJXQZA9VKe1K4XrNP96LOZI5fuN CGi8JjQjg0mRC9nYjKJr3bgCpCoxHag= X-Google-Smtp-Source: ABdhPJy4fYHKLqSsXdIUKB/e5T2+22yYDBhCrp7iQB/x8B/pbhcNDDdtAnMUCrCtYVr2mtO64vRMIA== X-Received: by 2002:aa7:c94c:: with SMTP id h12mr2776075edt.378.1630658036325; Fri, 03 Sep 2021 01:33:56 -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 Subject: [PATCH 06/11] xen/domain: Call pci_release_devices() when releasing domain resources Date: Fri, 3 Sep 2021 11:33:42 +0300 Message-Id: <20210903083347.131786-7-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658075844100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Tyshchenko This is the very same what we do for DT devices. What is more that x86 already calls pci_release_devices(). Signed-off-by: Oleksandr Tyshchenko --- xen/arch/arm/domain.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index d99c653626e4..4e40c4098280 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -985,7 +985,8 @@ static int relinquish_memory(struct domain *d, struct p= age_list_head *list) * function which may return -ERESTART. */ enum { - PROG_tee =3D 1, + PROG_pci =3D 1, + PROG_tee, PROG_xen, PROG_page, PROG_mapping, @@ -1022,6 +1023,12 @@ int domain_relinquish_resources(struct domain *d) #ifdef CONFIG_IOREQ_SERVER ioreq_server_destroy_all(d); #endif +#ifdef CONFIG_HAS_PCI + PROGRESS(pci): + ret =3D pci_release_devices(d); + if ( ret ) + return ret; +#endif =20 PROGRESS(tee): ret =3D tee_relinquish_resources(d); --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658080; cv=none; d=zohomail.com; s=zohoarc; b=UIXNbS6PzA/k4soWgok4wfOg8ppQMCi6/m4oF7vD/aXSFegkrbsp8DOyWkz7SIgC2cAroeXt9eI2Y5t3fBWumjtQZPyQBBcsEkVFnMg6ZwwIFoTHcZUpVCEc+nunKH2fQPYA0H2hAXhLt2owumZBMnTyEfwAtP+UtwRPYmMQ7DI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658080; 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=kD50gSwDk757eJ2CQu1b9/IhYMvfHenQQYtu99uRv54=; b=I1NnQkoPpXSEUIIcnoyLqpRup0EcGc3lhSa6AG4sCKBU6oJq1xBZGnkbRauTAdZcQl6UvPbW0Pmo42PVlcYF187hZ4Yl2hn4XNBU9Lb8sj+6PMMsMQkhc198yvIkuAlzCa3CwDQi8fSBofBRvaLxVdXuQhWC0m7ZlyUT5G9O4WE= 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 1630658080794370.2004646519754; Fri, 3 Sep 2021 01:34:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177852.323621 (Exim 4.92) (envelope-from ) id 1mM4eZ-0001TH-Kf; Fri, 03 Sep 2021 08:34:27 +0000 Received: by outflank-mailman (output) from mailman id 177852.323621; Fri, 03 Sep 2021 08:34:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eZ-0001T7-Gj; Fri, 03 Sep 2021 08:34:27 +0000 Received: by outflank-mailman (input) for mailman id 177852; Fri, 03 Sep 2021 08:34:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4eY-0006kQ-Df for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:26 +0000 Received: from mail-ej1-x62e.google.com (unknown [2a00:1450:4864:20::62e]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0898630a-f5e4-4ab6-8354-bf16210b9e36; Fri, 03 Sep 2021 08:33:58 +0000 (UTC) Received: by mail-ej1-x62e.google.com with SMTP id me10so10462374ejb.11 for ; Fri, 03 Sep 2021 01:33:58 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:57 -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: 0898630a-f5e4-4ab6-8354-bf16210b9e36 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=kD50gSwDk757eJ2CQu1b9/IhYMvfHenQQYtu99uRv54=; b=G9YXRhru3uNLxB1PDUiun9J9pMrCuA67iL9Y2S0hbpXL6f5CH2X0QxIT5S1a9tUVI0 ngdOqG5buY4ynepqOc4Mqw/59P8H5sjq34iVC/u0iXKce95prSaaImHKqsL0PaYH7vcE D1V6AOs2vm4fw/w3cgP9IhSPze4c2q6V0JyGGMv/a3ElMGbTNF0S7auFCdB0/MVNyqHt MSsg6wqzDA1lelto4azizexS43392uIQej/nGbEwF7OGVlS74cihi3/3uWxljNDqJhHU wFIzTiQMGRpJzgDNE4+dQa/3yv3zMkXoX1BmCUXGm3S/B7/wgbcEBjWuZCJOL6udh3zY kX1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kD50gSwDk757eJ2CQu1b9/IhYMvfHenQQYtu99uRv54=; b=AP9HIzrCzQkFkZvqieTGE4tmU+0QANe3qh/xgxiywNDWgviFk0YWP8YwbWKO5e0JoX 7VfKO2dAT/dMkoNTCtzWwwdLHfKWWK9qIBrtnVuc1WTKjhyrob7hDBMRVYIXhABpeDui C9bvM3qArCy6hfhVIwyLJUw9EAfE+v1q7JQuFVXI9MX1vQyqzM/lrU8wt+dbj6+sVh7g 6aqrsJZro0owjPWvFQUmw8zcltCArkgxX/pJmMnAXF91fxajQYfnItw2bHbm3S0fzuKi B8cGRUudIGaoFiJC5fUQqCop5n7MuaTYiGmiGPbjEN0EtEHQWASH645RT5eWuhp1ZAVq eKhA== X-Gm-Message-State: AOAM533KzecWeoojC2rWm7Gni1Du+O0rT40VNhGHm+p+LhXB8GYxfmoQ XtAkmYVHree4A9HaC2c44t8VqYf/cMs= X-Google-Smtp-Source: ABdhPJzGKTmhAkRttkjaVwij4GDfdpVmfRmx6aBuBdUijcAaoOwlRu3VoW1BGbNMMqkWyy5d8+/pYQ== X-Received: by 2002:a17:906:9b1:: with SMTP id q17mr2879682eje.546.1630658037434; Fri, 03 Sep 2021 01:33:57 -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 , Ian Jackson , Juergen Gross Subject: [PATCH 07/11] libxl: Allow removing PCI devices for all types of domains Date: Fri, 3 Sep 2021 11:33:43 +0300 Message-Id: <20210903083347.131786-8-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658082460100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko The PCI device remove path may now be used by PVH on ARM, so the assert is no longer valid. Signed-off-by: Oleksandr Andrushchenko Cc: Ian Jackson Cc: Juergen Gross --- tools/libs/light/libxl_pci.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c index 1a1c2630803b..59f3686fc85e 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c @@ -1947,8 +1947,6 @@ static void do_pci_remove(libxl__egc *egc, pci_remove= _state *prs) goto out_fail; } } else { - assert(type =3D=3D LIBXL_DOMAIN_TYPE_PV); - char *sysfs_path =3D GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/resource",= pci->domain, pci->bus, pci->dev, pci->func); FILE *f =3D fopen(sysfs_path, "r"); --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658086; cv=none; d=zohomail.com; s=zohoarc; b=drgd5VN8w9Xei+Mba0rMtHknbYamWKL7K1vRAWkCiytvbJJMol9e8j0hqH7VHr2wfdlXKeiZlgF9Alk2AjxCO+QhbJQLNolGn23BjzblXLwG1y1mC+9x/OYTPxwlLTiTZaT1txM46gmhfNrb7B5e/R0v+BHdhhHgqnckakxUbfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658086; 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=Hx54vdgUoheVTz/8kdwndGE5xFCEvdbxwnx2M5LV2vg=; b=OSNSkDzp1IVMqtDmH8x6gvlVxhXMt1CH7EnlvIZbV3/5/SzNO5lVTXGtjHmDWtpk3asyhBRGB2tYdV0FhtVs6DSsP3nTPyB/LYq2K4Sa5Hdv0OWAZ1bqEadmY9WS4AItZTPuoJpZkA/dCQXihaPSGnlkUTdKP27H1c1GfEIgMhg= 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 1630658086090382.51967570855334; Fri, 3 Sep 2021 01:34:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177859.323632 (Exim 4.92) (envelope-from ) id 1mM4ee-00025Z-WA; Fri, 03 Sep 2021 08:34:32 +0000 Received: by outflank-mailman (output) from mailman id 177859.323632; Fri, 03 Sep 2021 08:34:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4ee-00025O-S0; Fri, 03 Sep 2021 08:34:32 +0000 Received: by outflank-mailman (input) for mailman id 177859; Fri, 03 Sep 2021 08:34:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4ed-0006kQ-Dn for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:31 +0000 Received: from mail-ej1-x633.google.com (unknown [2a00:1450:4864:20::633]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fcfff0c5-87bc-448e-bd89-368f58f11371; Fri, 03 Sep 2021 08:33:59 +0000 (UTC) Received: by mail-ej1-x633.google.com with SMTP id jg16so7370339ejc.1 for ; Fri, 03 Sep 2021 01:33:59 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:58 -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: fcfff0c5-87bc-448e-bd89-368f58f11371 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=Hx54vdgUoheVTz/8kdwndGE5xFCEvdbxwnx2M5LV2vg=; b=RdDtLXI6Rg8R+9WLRJYoNMq8UIn9C9UYiKM3atwuaiVC9bWq2G1D1gEb8701s40UoB q3Vkp/Q+AaXXiFaOTz5uyjQxEyJLgSw8QJB7PO+sZnWNbsk2QivJXAbq5fg+Jqbdfysp +QSpl4wnAMWZmYNE5OUiwggYvVyrZQF2WSlhbdngi69rmyZVt6LY3os3UdU+56o7z0Qz aXLK85ahPpB0tLKxrNsEPTzR/jIdjbVD9jnl5/AcTadm4B0eFB/U0iKObJlOH+vNr5El RDPi9bmWAmk9pV5ibKbmzIYJq18buRGok9BqADlAyv9Sraqe2G5UHaYHUFkzWsJQvwxk vQEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hx54vdgUoheVTz/8kdwndGE5xFCEvdbxwnx2M5LV2vg=; b=ZU935E9As03e8TxEeil25qhW+riYm6XE9eWITrr/ZJ9UU6It0Y8jMfSb27gbCyZYQH 7rVTysvwC+z+PqfePhYlj9jhf8iLKqItd5YCy/pp6AwTvmRxvSNdGRr8bw+AQ09xauuC aOg4wIrhnSUkmfE//8coPTDi1QWx1XoPJCDGAzhgqSsscpeuoyHZM93lvn+7p+tgkGCi tpLceNS3iPxbtrDhEmKVVVO/HGnb84qfctwWpCLdxhnV3eSyXNmGgI264Bg354M5o7g3 KKqrCyHRhrobvkbroh5XCSw5ojMMTlDPWV22YeF7t3kwE3lpR6pbSAwVAN2wMIvsW1KJ aenw== X-Gm-Message-State: AOAM5307TcEyC4GgLUAmz5c86aiXM/0OKVw8x0dRJJCxgTU1kneIREPD tkiVI4TVLaedressSxtb1tk39/tniUM= X-Google-Smtp-Source: ABdhPJxbTzY7zXsW8PjrsejxN3DPMeW22l0e+skzCHi5HgMf4ECl+/PSNQ7TpHFwniDROzLZHbVUSw== X-Received: by 2002:a17:906:a01:: with SMTP id w1mr2947033ejf.117.1630658038658; Fri, 03 Sep 2021 01:33:58 -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 , Ian Jackson , Juergen Gross Subject: [PATCH 08/11] libxl: Only map legacy PCI IRQs if they are supported Date: Fri, 3 Sep 2021 11:33:44 +0300 Message-Id: <20210903083347.131786-9-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658086856100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko Arm's PCI passthrough implementation doesn't support legacy interrupts, but MSI/MSI-X. This can be the case for other platforms too. For that reason introduce a new CONFIG_PCI_SUPP_LEGACY_IRQ and add it to the CFLAGS and compile the relevant code in the toolstack only if applicable. Signed-off-by: Oleksandr Andrushchenko Cc: Ian Jackson Cc: Juergen Gross --- tools/libs/light/Makefile | 4 ++++ tools/libs/light/libxl_pci.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile index 7d8c51d49242..bd3f6be2a183 100644 --- a/tools/libs/light/Makefile +++ b/tools/libs/light/Makefile @@ -46,6 +46,10 @@ CFLAGS +=3D -Wno-format-zero-length -Wmissing-declaratio= ns \ -Wno-declaration-after-statement -Wformat-nonliteral CFLAGS +=3D -I. =20 +ifeq ($(CONFIG_X86),y) +CFLAGS +=3D -DCONFIG_PCI_SUPP_LEGACY_IRQ +endif + SRCS-$(CONFIG_X86) +=3D libxl_cpuid.c SRCS-$(CONFIG_X86) +=3D libxl_x86.c SRCS-$(CONFIG_X86) +=3D libxl_psr.c diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c index 59f3686fc85e..cd4fea46c3f7 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c @@ -1434,6 +1434,7 @@ static void pci_add_dm_done(libxl__egc *egc, } } fclose(f); +#ifndef CONFIG_PCI_SUPP_LEGACY_IRQ sysfs_path =3D GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain, pci->bus, pci->dev, pci->func); f =3D fopen(sysfs_path, "r"); @@ -1460,6 +1461,7 @@ static void pci_add_dm_done(libxl__egc *egc, } } fclose(f); +#endif =20 /* Don't restrict writes to the PCI config space from this VM */ if (pci->permissive) { @@ -1471,7 +1473,9 @@ static void pci_add_dm_done(libxl__egc *egc, } } =20 +#ifndef CONFIG_PCI_SUPP_LEGACY_IRQ out_no_irq: +#endif if (!isstubdom) { if (pci->rdm_policy =3D=3D LIBXL_RDM_RESERVE_POLICY_STRICT) { flag &=3D ~XEN_DOMCTL_DEV_RDM_RELAXED; @@ -1951,7 +1955,9 @@ static void do_pci_remove(libxl__egc *egc, pci_remove= _state *prs) pci->bus, pci->dev, pci->func); FILE *f =3D fopen(sysfs_path, "r"); unsigned int start =3D 0, end =3D 0, flags =3D 0, size =3D 0; +#ifndef CONFIG_PCI_SUPP_LEGACY_IRQ int irq =3D 0; +#endif int i; =20 if (f =3D=3D NULL) { @@ -1983,6 +1989,7 @@ static void do_pci_remove(libxl__egc *egc, pci_remove= _state *prs) } fclose(f); skip1: +#ifndef CONFIG_PCI_SUPP_LEGACY_IRQ sysfs_path =3D GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domai= n, pci->bus, pci->dev, pci->func); f =3D fopen(sysfs_path, "r"); @@ -2001,8 +2008,14 @@ skip1: } } fclose(f); +#else + /* Silence error: label at end of compound statement */ + ; +#endif } +#ifndef CONFIG_PCI_SUPP_LEGACY_IRQ skip_irq: +#endif rc =3D 0; out_fail: pci_remove_detached(egc, prs, rc); /* must be last */ --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658091; cv=none; d=zohomail.com; s=zohoarc; b=N4xZ8uaHqi2ZHG/QAKDm1hFVX+CxC+KIGPaQmIvXigIg15LSAkj0PKQQ/qX5iIUM2yInPIHFol4RkXzUCtFac7PvMR7+DaHpjhwNa8j+6xDTwa+/taBN4FMSO2VDFT8cgSTseW1Q7BgeMUTO6FsHDSALsG3wqXIWcAG/iyx+vGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658091; 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=/GHtMwVtwcasyb8hly1Zcy56jKyqF6v6oGi9z4wXBlU=; b=ktd30QKD6k/dgNAipxph9k0+b0pfWR2N4uFu2EdQToKhsalgqXDmgCbQn3G6DqzuF4BryQ4wNaVFPQuiMZe2oshaF2ov/6UaofDlPBzMEvWgvaorFjx1rjrbsI2e36rDRUbZ7vgPO9FnIfm+WGy06Tx6NORtzb4oVFxBMaMNa8o= 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 1630658091659731.8748119308358; Fri, 3 Sep 2021 01:34:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177865.323642 (Exim 4.92) (envelope-from ) id 1mM4ek-0002hQ-B6; Fri, 03 Sep 2021 08:34:38 +0000 Received: by outflank-mailman (output) from mailman id 177865.323642; Fri, 03 Sep 2021 08:34:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4ek-0002hH-7X; Fri, 03 Sep 2021 08:34:38 +0000 Received: by outflank-mailman (input) for mailman id 177865; Fri, 03 Sep 2021 08:34:36 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4ei-0006kQ-E5 for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:36 +0000 Received: from mail-ej1-x630.google.com (unknown [2a00:1450:4864:20::630]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3bb67d0b-f39f-4b34-9864-f3691fc81bea; Fri, 03 Sep 2021 08:34:00 +0000 (UTC) Received: by mail-ej1-x630.google.com with SMTP id mf2so10485515ejb.9 for ; Fri, 03 Sep 2021 01:34:00 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:33:59 -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: 3bb67d0b-f39f-4b34-9864-f3691fc81bea 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=/GHtMwVtwcasyb8hly1Zcy56jKyqF6v6oGi9z4wXBlU=; b=mQ3lDyAu7ulppaS1JJy+SWOFwu+RvtpP1zI3cgCUuBtIuinOwyvLCIG9MxewYdI7wb dV/QNQp9gaBilxa1L3saoMIiNAKa4GjxcPpTanA20hGKCzz5QpJAiNHS/6eiO+aEby+f l7w6stPig8p506HVXOzw2BgAPYcOwkZ+OD0tZuyYui/AU5k+tg6rbLKS49n75aRhxpxL FFVTa9P9ikuYd6dbk2C9zfDC/kBVTCpJCMhTRepxDPdAUW12LYD4QcV3R1ooZ2wQyzED /H+subTI7EzgC9RApqZqRkYcedmNM4JZlibRP0m4S+GaRm+tZmLehtpvYwPU05nhGVEk 4LLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/GHtMwVtwcasyb8hly1Zcy56jKyqF6v6oGi9z4wXBlU=; b=O4lfH5P6mjh536gva7arPTU9Frb1mcd1r2huTLL9NwRMe4CMVErcHhWA1YyUz1Gn8F tWfkw4jaYubWiEFKwx6qq7PfIWMfh3MD4b+gmG5TbpkKLeHzxcAHMD8Elrjo7PNIUkrf H5cMpYSQSQfTGWG2V2unKdAlXz2FgOFAj6TtXZQol9SqCt3ULYAbvE/PYzawRwWMsMvj nrO9aLXEqip9GkQlLsUeqsJ7kojKilNOv3gnZ+7ULWhIniUF9ewwtlG0kNAqCJUjT7Yf c7rucReZ9HOS56umrG5LTZqKfPlceVAGC5FhP7KHWZidf1iVy9oGKU4S3aYtvP7iNLvJ 02+w== X-Gm-Message-State: AOAM532JkJfQzvOgGj6QtsslnH1vxGZEAnffzrJ39RlJGKs5sgjk4mFU wGuCSbTMJ19X/nPsKqJSSQtMf6X5OsU= X-Google-Smtp-Source: ABdhPJzkdXq4/oqy7sAR6jAHLZTgcQFNU12ssgRybTwH6NU5CgLqCQqqVvZtmbSCS+UTenNgcBH03A== X-Received: by 2002:a17:906:2a8e:: with SMTP id l14mr2909109eje.321.1630658039681; Fri, 03 Sep 2021 01:33:59 -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 09/11] xen/arm: Setup MMIO range trap handlers for hardware domain Date: Fri, 3 Sep 2021 11:33:45 +0300 Message-Id: <20210903083347.131786-10-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658093284100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko In order vPCI to work it needs all access to PCI configuration space (ECAM) to be synchronized among all entities, e.g. hardware domain and guests. For that implement PCI host bridge specific callbacks to properly setup those ranges depending on particular host bridge implementation. Signed-off-by: Oleksandr Andrushchenko --- xen/arch/arm/pci/ecam.c | 11 +++++++++++ xen/arch/arm/pci/pci-host-common.c | 16 ++++++++++++++++ xen/arch/arm/vpci.c | 13 +++++++++++++ xen/include/asm-arm/pci.h | 8 ++++++++ 4 files changed, 48 insertions(+) diff --git a/xen/arch/arm/pci/ecam.c b/xen/arch/arm/pci/ecam.c index 91c691b41fdf..92ecb2e0762b 100644 --- a/xen/arch/arm/pci/ecam.c +++ b/xen/arch/arm/pci/ecam.c @@ -42,6 +42,16 @@ void __iomem *pci_ecam_map_bus(struct pci_host_bridge *b= ridge, return base + (PCI_DEVFN(sbdf_t.dev, sbdf_t.fn) << devfn_shift) + wher= e; } =20 +static int pci_ecam_register_mmio_handler(struct domain *d, + struct pci_host_bridge *bridge, + const struct mmio_handler_ops *o= ps) +{ + struct pci_config_window *cfg =3D bridge->sysdata; + + register_mmio_handler(d, ops, cfg->phys_addr, cfg->size, NULL); + return 0; +} + /* ECAM ops */ const struct pci_ecam_ops pci_generic_ecam_ops =3D { .bus_shift =3D 20, @@ -49,6 +59,7 @@ const struct pci_ecam_ops pci_generic_ecam_ops =3D { .map_bus =3D pci_ecam_map_bus, .read =3D pci_generic_config_read, .write =3D pci_generic_config_write, + .register_mmio_handler =3D pci_ecam_register_mmio_handler, } }; =20 diff --git a/xen/arch/arm/pci/pci-host-common.c b/xen/arch/arm/pci/pci-host= -common.c index d2fef5476b8e..a89112bfbb7c 100644 --- a/xen/arch/arm/pci/pci-host-common.c +++ b/xen/arch/arm/pci/pci-host-common.c @@ -318,6 +318,22 @@ struct dt_device_node *pci_find_host_bridge_node(struc= t device *dev) } return bridge->dt_node; } + +int pci_host_iterate_bridges(struct domain *d, + int (*clb)(struct domain *d, + struct pci_host_bridge *bridge)) +{ + struct pci_host_bridge *bridge; + int err; + + list_for_each_entry( bridge, &pci_host_bridges, node ) + { + err =3D clb(d, bridge); + if ( err ) + return err; + } + return 0; +} /* * Local variables: * mode: C diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c index da8b1ca13c07..258134292458 100644 --- a/xen/arch/arm/vpci.c +++ b/xen/arch/arm/vpci.c @@ -74,11 +74,24 @@ static const struct mmio_handler_ops vpci_mmio_handler = =3D { .write =3D vpci_mmio_write, }; =20 +static int vpci_setup_mmio_handler(struct domain *d, + struct pci_host_bridge *bridge) +{ + if ( bridge->ops->register_mmio_handler ) + return bridge->ops->register_mmio_handler(d, bridge, + &vpci_mmio_handler); + return 0; +} + int domain_vpci_init(struct domain *d) { if ( !has_vpci(d) ) return 0; =20 + if ( is_hardware_domain(d) ) + return pci_host_iterate_bridges(d, vpci_setup_mmio_handler); + + /* Guest domains use what is programmed in their device tree. */ register_mmio_handler(d, &vpci_mmio_handler, GUEST_VPCI_ECAM_BASE, GUEST_VPCI_ECAM_SIZE, NULL= ); =20 diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h index 7dc4c8dc9026..2c7c7649e00f 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -17,6 +17,8 @@ #ifndef __ARM_PCI_H__ #define __ARM_PCI_H__ =20 +#include + #ifdef CONFIG_HAS_PCI =20 #define pci_to_dev(pcidev) (&(pcidev)->arch.dev) @@ -77,6 +79,9 @@ struct pci_ops { uint32_t reg, uint32_t len, uint32_t *value); int (*write)(struct pci_host_bridge *bridge, uint32_t sbdf, uint32_t reg, uint32_t len, uint32_t value); + int (*register_mmio_handler)(struct domain *d, + struct pci_host_bridge *bridge, + const struct mmio_handler_ops *ops); }; =20 /* @@ -107,6 +112,9 @@ 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 +int pci_host_iterate_bridges(struct domain *d, + int (*clb)(struct domain *d, + struct pci_host_bridge *bridge)); #else /*!CONFIG_HAS_PCI*/ =20 struct arch_pci_dev { }; --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658515; cv=none; d=zohomail.com; s=zohoarc; b=lsR/1uWL7G2wd+ozlehz2+5jRO2PIQuGTWxrc5KlHxb6bub3pY1iTB6a9Vcvqg7n87KpFjP6Y530MpPZUuU3LE4Tt3rTh7XChRvr1yog0l++psPrLOA0uZxBInN5omqAo85op2vLjdnv/OZQGjxxW9lg+DvtYT/geUgElaSKkOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658515; 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=RKj8rEW+uLzxBa1xS9FCgER2pVUMxy97v84H9BueJo8=; b=QHRXIB1RvwGMcEi7EsKa6LjsmjC2r2ZEzVNO5bkEWDssVTnI2JkHVd/OMcOxeTxsWChuP/YOv8a+UCtx1+y16selDafIouYxLDZYEkOw46aq0L76lwpzUK+jY9LqbmaheZSanZ+3K/gp+u3H8uIa6ECL2qprvPO/Cr7cPf93uF4= 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 1630658515219929.0377555510541; Fri, 3 Sep 2021 01:41:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177903.323664 (Exim 4.92) (envelope-from ) id 1mM4la-0005z8-Il; Fri, 03 Sep 2021 08:41:42 +0000 Received: by outflank-mailman (output) from mailman id 177903.323664; Fri, 03 Sep 2021 08:41:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4la-0005z1-Fe; Fri, 03 Sep 2021 08:41:42 +0000 Received: by outflank-mailman (input) for mailman id 177903; Fri, 03 Sep 2021 08:41:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4en-0006kQ-E9 for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:41 +0000 Received: from mail-ed1-x531.google.com (unknown [2a00:1450:4864:20::531]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3cbf0903-612d-4e40-aaea-917bad9342ef; Fri, 03 Sep 2021 08:34:01 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id v5so1613984edc.2 for ; Fri, 03 Sep 2021 01:34:01 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:34:00 -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: 3cbf0903-612d-4e40-aaea-917bad9342ef 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=RKj8rEW+uLzxBa1xS9FCgER2pVUMxy97v84H9BueJo8=; b=Cc7VjnWxryLAC/tqYxNfb0Vqq0sB/g3r4rmDDY0lS2y4ND5fCxj+3AtTH0jMf3UD7I lArRxEur0IpiP8IRmM5bMXAd2tDTqstoOHd1vrOJQB+pAYbF+caMEs1aDP0y6JUJoUAC xEaHLm1ca7cVFaDLT1hlicqg/QeFfEAaQY7S1SpqIHJhYw6d6GtxExLoUnpq0E0zuH+m 4NCp+Ya/PMN9z0TzuqE1T/2/rlEnc8XJFLpeu56yU2FZu5xlOk5bPOVjQrgrStQv7HvU TwhRciy77N17AemdAXrbaCnjfawSj07zHK5ot06VaJwpM/HtZHOSN1AfqKhUFuuc/1HO ob5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RKj8rEW+uLzxBa1xS9FCgER2pVUMxy97v84H9BueJo8=; b=oBLpbapiCNQnIjv9Mo/sSyhL3oVakBxi1XwL1Wi7m4raUtBsNmjtGeWCoq7dTXXeTC KhocmQ1iynUJWKyuksEXh1BgFK/jRTRPbFN9qbQGg3QpeHcER3uNfb0r1fulY1GJFamB 62zgQyF5dXtDweUZgg+/rJfYhR1agFpdUJtTWRgPVyZ8E3dkOV4MxOj72N2h1gVKp5b9 vw15weokEfFftha6EM7IAETNzYpDgpzrZhG6Te4CYpQzeWncKy3llziRgqTWuOUkSF5w +q8Ng9ouUhGTopIjWQh/VhFVLNkp8wFO1HvkvKKBqNBPjPXhP9sPPQc9MbI4DGh/0pTk Kzfg== X-Gm-Message-State: AOAM533uKOsAif0Gr5pPehfRtIiQNwbwfBJWC0recNqto4ZX7hQfZS3k Xjt3APquPw91Bq5Rgk6LA7LYf07qXZs= X-Google-Smtp-Source: ABdhPJwyyY+X4Ff7jtwDvNQrMZN78ZPm6ovgltm1mRQGeZ/mmH2TfThaCYtmDMf1K+WgzeKR4mkDAg== X-Received: by 2002:aa7:c9d6:: with SMTP id i22mr605692edt.307.1630658040780; Fri, 03 Sep 2021 01:34:00 -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 10/11] xen/arm: Do not map PCI ECAM space to Domain-0's p2m Date: Fri, 3 Sep 2021 11:33:46 +0300 Message-Id: <20210903083347.131786-11-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658516568100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko Host bridge controller's ECAM space is mapped into Domain-0's p2m, thus it is not possible to trap the same for vPCI via MMIO handlers. For this to work we need to not map those while constructing the domain. Note, that during Domain-0 creation there is no pci_dev yet allocated for host bridges, thus we cannot match PCI host and its associated bridge by SBDF. Use dt_device_node field for checks instead. Signed-off-by: Oleksandr Andrushchenko --- xen/arch/arm/domain_build.c | 3 +++ xen/arch/arm/pci/ecam.c | 17 +++++++++++++++++ xen/arch/arm/pci/pci-host-common.c | 22 ++++++++++++++++++++++ xen/include/asm-arm/pci.h | 12 ++++++++++++ 4 files changed, 54 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index da427f399711..76f5b513280c 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1257,6 +1257,9 @@ static int __init map_range_to_domain(const struct dt= _device_node *dev, } } =20 + if ( need_mapping && (device_get_class(dev) =3D=3D DEVICE_PCI) ) + need_mapping =3D pci_host_bridge_need_p2m_mapping(d, dev, addr, le= n); + if ( need_mapping ) { res =3D map_regions_p2mt(d, diff --git a/xen/arch/arm/pci/ecam.c b/xen/arch/arm/pci/ecam.c index 92ecb2e0762b..d32efb7fcbd0 100644 --- a/xen/arch/arm/pci/ecam.c +++ b/xen/arch/arm/pci/ecam.c @@ -52,6 +52,22 @@ static int pci_ecam_register_mmio_handler(struct domain = *d, return 0; } =20 +static int pci_ecam_need_p2m_mapping(struct domain *d, + struct pci_host_bridge *bridge, + uint64_t addr, uint64_t len) +{ + struct pci_config_window *cfg =3D bridge->sysdata; + + if ( !is_hardware_domain(d) ) + return true; + + /* + * We do not want ECAM address space to be mapped in domain's p2m, + * so we can trap access to it. + */ + return cfg->phys_addr !=3D addr; +} + /* ECAM ops */ const struct pci_ecam_ops pci_generic_ecam_ops =3D { .bus_shift =3D 20, @@ -60,6 +76,7 @@ const struct pci_ecam_ops pci_generic_ecam_ops =3D { .read =3D pci_generic_config_read, .write =3D pci_generic_config_write, .register_mmio_handler =3D pci_ecam_register_mmio_handler, + .need_p2m_mapping =3D pci_ecam_need_p2m_mapping, } }; =20 diff --git a/xen/arch/arm/pci/pci-host-common.c b/xen/arch/arm/pci/pci-host= -common.c index a89112bfbb7c..c04be636452d 100644 --- a/xen/arch/arm/pci/pci-host-common.c +++ b/xen/arch/arm/pci/pci-host-common.c @@ -334,6 +334,28 @@ int pci_host_iterate_bridges(struct domain *d, } return 0; } + +bool pci_host_bridge_need_p2m_mapping(struct domain *d, + const struct dt_device_node *node, + uint64_t addr, uint64_t len) +{ + struct pci_host_bridge *bridge; + + list_for_each_entry( bridge, &pci_host_bridges, node ) + { + if ( bridge->dt_node !=3D node ) + continue; + + if ( !bridge->ops->need_p2m_mapping ) + return true; + + return bridge->ops->need_p2m_mapping(d, bridge, addr, len); + } + printk(XENLOG_ERR "Unable to find PCI bridge for %s segment %d, addr %= lx\n", + node->full_name, bridge->segment, addr); + return true; +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h index 2c7c7649e00f..9c28a4bdc4b7 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -82,6 +82,8 @@ struct pci_ops { int (*register_mmio_handler)(struct domain *d, struct pci_host_bridge *bridge, const struct mmio_handler_ops *ops); + int (*need_p2m_mapping)(struct domain *d, struct pci_host_bridge *brid= ge, + uint64_t addr, uint64_t len); }; =20 /* @@ -115,9 +117,19 @@ struct dt_device_node *pci_find_host_bridge_node(struc= t device *dev); int pci_host_iterate_bridges(struct domain *d, int (*clb)(struct domain *d, struct pci_host_bridge *bridge)); +bool pci_host_bridge_need_p2m_mapping(struct domain *d, + const struct dt_device_node *node, + uint64_t addr, uint64_t len); #else /*!CONFIG_HAS_PCI*/ =20 struct arch_pci_dev { }; =20 +static inline bool +pci_host_bridge_need_p2m_mapping(struct domain *d, + const struct dt_device_node *node, + uint64_t addr, uint64_t len) +{ + return true; +} #endif /*!CONFIG_HAS_PCI*/ #endif /* __ARM_PCI_H__ */ --=20 2.25.1 From nobody Mon May 6 16:38:57 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=1630658492; cv=none; d=zohomail.com; s=zohoarc; b=IqhC/rf+pMmk0vLGeyBdITnocb0bQGT7e0hQRmgaFcs45AwE4rX+08pbXt5phnKQumrO3umEFMfvvUi+KEIQhB1kJt8kJgLerJxjzlQbjFgOV6AT2UuuV7xmY/fJ6ieLN2+8LfhcDXoYFL+hOgk0jHXLBejyJbOjkDoAk0lQaqs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630658492; 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=Xy7BJSB6xaM30OyXxkPFQIY2JXEW71Y3R+/OfIHEOBE=; b=hifpFRj6CwybM3SYaaBRozYB1rCcsobzkshRoWXdKpyN38tvoTOD/Jw+R6raxXrivNm9lqvAz/QdRSJNGPSDFFXkBXpxteldJf8CqQVMhNX9tn3wrPBxotwy8FGejzHix24HBa9kuESSK71906LUQSct1MysN/I5vyaywmuxMK0= 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 1630658492979249.73260992893483; Fri, 3 Sep 2021 01:41:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177892.323653 (Exim 4.92) (envelope-from ) id 1mM4lA-0005HT-4D; Fri, 03 Sep 2021 08:41:16 +0000 Received: by outflank-mailman (output) from mailman id 177892.323653; Fri, 03 Sep 2021 08:41:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4lA-0005HM-1J; Fri, 03 Sep 2021 08:41:16 +0000 Received: by outflank-mailman (input) for mailman id 177892; Fri, 03 Sep 2021 08:41:14 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4es-0006kQ-EK for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:34:46 +0000 Received: from mail-ej1-x631.google.com (unknown [2a00:1450:4864:20::631]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1d926dc1-80ff-4ebb-a723-1fd24234f40a; Fri, 03 Sep 2021 08:34:02 +0000 (UTC) Received: by mail-ej1-x631.google.com with SMTP id lc21so10503499ejc.7 for ; Fri, 03 Sep 2021 01:34:02 -0700 (PDT) Received: from a2klaptop.epam.com (host-176-36-245-220.b024.la.net.ua. [176.36.245.220]) by smtp.gmail.com with ESMTPSA id i7sm2311932ejx.73.2021.09.03.01.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 01:34:01 -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: 1d926dc1-80ff-4ebb-a723-1fd24234f40a 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=Xy7BJSB6xaM30OyXxkPFQIY2JXEW71Y3R+/OfIHEOBE=; b=pnUw4Mlz8wE01ctr0MxVIgMnhwLnYDb2XDSr3Mz0utU10pdqiieFvIuxCCByexKtyf B06Oyzl54Te+zID2si0YkZIjwWSmkUavw3mR3hfVyzP1prT4JWTQ2NTIK4x6xtbcRpqc KxtBQtIPNwv9OGv7Awvjre3ntebXcDrWFI2SG529YegtLTDoGtS7s1bc/D2jQxUVo3N7 BdhYDhJHI86NLX1Mc5Y1L3MlkT/LPFTYKEkS5Mb0pAz3/VB/Hn65DqjDFmLtvlvBfV5r z6WPuzwT0gYxxiczN3UQkXeeK6u22iH64pxd2K8aSWXJ8LKEUvYiJdgFvuoa8TTDahw0 xKfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xy7BJSB6xaM30OyXxkPFQIY2JXEW71Y3R+/OfIHEOBE=; b=Tb8crlNetyA6rFLsr9BPepDhb+mT9n9jfsUBW8A0hc7C/6FqN8EkpaSUFDLxZx5Bm0 EFyPIyQ/FBKiqjBTGdcEYbw27nAms0HXXuw4ith3GQIZT8uX8g1CEoOKpjrOVvimfx5H VFMdHmp7LNZHQUWt6F++n7mtvjQ/iZ8tJxutQaf0Kz6YLSq1dX3aT0TA8EMRT1vHN9rG 0SszP9zXs6zXvrFAGNX6T38VwiduYKf+EWML+ycm9J+wssNO5DKunxRWtf/kP9F0INQM XVNDV/9u0aMfmHpyMCkGGxpYEBsyY5xUaq+gFNREXGgYvoPUo+WA5dUXo5WPfPCrtixp oKOw== X-Gm-Message-State: AOAM5308j4Iig0X44JLaWCBB9ZOGEhuPoZvkJFtBcA9wOI/JQwhpGQ33 8s99qzGcnqNjJqAC3WcSHIWGHWQ1amo= X-Google-Smtp-Source: ABdhPJyJcdfQj9c9044SVO6J1UJQYGNr5fMQWFYrfhn9ETnMa9xx30aD81J57K8Jf8DgGximyczXvQ== X-Received: by 2002:a17:907:2174:: with SMTP id rl20mr2987996ejb.199.1630658041886; Fri, 03 Sep 2021 01:34:01 -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 11/11] xen/arm: Process pending vPCI map/unmap operations Date: Fri, 3 Sep 2021 11:33:47 +0300 Message-Id: <20210903083347.131786-12-andr2000@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210903083347.131786-1-andr2000@gmail.com> References: <20210903083347.131786-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1630658495019100003 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko vPCI may map and unmap PCI device memory (BARs) being passed through which may take a lot of time. For this those operations may be deferred to be performed later, so that they can be safely preempted. Run the corresponding vPCI code while switching a vCPU. Signed-off-by: Oleksandr Andrushchenko --- xen/arch/arm/traps.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 219ab3c3fbde..1571fb8afd03 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -34,6 +34,7 @@ #include #include #include +#include =20 #include #include @@ -2304,6 +2305,11 @@ static bool check_for_vcpu_work(void) } #endif =20 + local_irq_enable(); + if ( has_vpci(v->domain) && vpci_process_pending(v) ) + raise_softirq(SCHEDULE_SOFTIRQ); + local_irq_disable(); + if ( likely(!v->arch.need_flush_to_ram) ) return false; =20 --=20 2.25.1