From patchwork Wed Oct 6 17:40:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Singh X-Patchwork-Id: 12539987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBBB9C433EF for ; Wed, 6 Oct 2021 17:42:07 +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 A974260F6C for ; Wed, 6 Oct 2021 17:42:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A974260F6C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.202993.358074 (Exim 4.92) (envelope-from ) id 1mYAvY-0006Od-Fb; Wed, 06 Oct 2021 17:42:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 202993.358074; Wed, 06 Oct 2021 17:42:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mYAvY-0006OT-Bx; Wed, 06 Oct 2021 17:42:00 +0000 Received: by outflank-mailman (input) for mailman id 202993; Wed, 06 Oct 2021 17:41: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 1mYAvW-0004uL-8A for xen-devel@lists.xenproject.org; Wed, 06 Oct 2021 17:41:58 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id f3328121-f096-40b5-8408-5b1a5cd4830e; Wed, 06 Oct 2021 17:41:49 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CD1F5ED1; Wed, 6 Oct 2021 10:41:48 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B1ADF3F70D; Wed, 6 Oct 2021 10:41:47 -0700 (PDT) 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: f3328121-f096-40b5-8408-5b1a5cd4830e From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, rahul.singh@arm.com, Andre.Przywara@arm.com, Oleksandr Andrushchenko , Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH v5 05/11] xen/arm: Add support for Xilinx ZynqMP PCI host controller Date: Wed, 6 Oct 2021 18:40:31 +0100 Message-Id: <104266db7156a4740615c6a5b4e058e7c492c78c.1633540842.git.rahul.singh@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 From: Oleksandr Andrushchenko Add support for Xilinx ZynqMP PCI host controller to map the PCI config space to the XEN memory. Patch helps to understand how the generic infrastructure for PCI host-bridge discovery will be used for future references. Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Rahul Singh Reviewed-by: Bertrand Marquis Reviewed-by: Stefano Stabellini --- Change in v5: - Added Reviewed-by: Stefano Stabellini Change in v4: - Add __initconstrel and __init for struct and functions - Added Reviewed-by: Bertrand Marquis Change in v3: - nwl_cfg_reg_index(..) as static function - Add support for pci_host_generic_probe() Change in v2: - Add more info in commit msg --- --- xen/arch/arm/pci/Makefile | 1 + xen/arch/arm/pci/pci-host-zynqmp.c | 65 ++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 xen/arch/arm/pci/pci-host-zynqmp.c diff --git a/xen/arch/arm/pci/Makefile b/xen/arch/arm/pci/Makefile index 6f32fbbe67..1d045ade01 100644 --- a/xen/arch/arm/pci/Makefile +++ b/xen/arch/arm/pci/Makefile @@ -3,3 +3,4 @@ obj-y += pci-access.o obj-y += pci-host-generic.o obj-y += pci-host-common.o obj-y += ecam.o +obj-y += pci-host-zynqmp.o diff --git a/xen/arch/arm/pci/pci-host-zynqmp.c b/xen/arch/arm/pci/pci-host-zynqmp.c new file mode 100644 index 0000000000..61a9807d3d --- /dev/null +++ b/xen/arch/arm/pci/pci-host-zynqmp.c @@ -0,0 +1,65 @@ +/* + * Based on Linux drivers/pci/controller/pci-host-common.c + * Based on Linux drivers/pci/controller/pci-host-generic.c + * Based on xen/arch/arm/pci/pci-host-generic.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include + +static int __init nwl_cfg_reg_index(struct dt_device_node *np) +{ + return dt_property_match_string(np, "reg-names", "cfg"); +} + +/* ECAM ops */ +const struct pci_ecam_ops nwl_pcie_ops = { + .bus_shift = 20, + .cfg_reg_index = nwl_cfg_reg_index, + .pci_ops = { + .map_bus = pci_ecam_map_bus, + .read = pci_generic_config_read, + .write = pci_generic_config_write, + } +}; + +static const struct dt_device_match __initconstrel nwl_pcie_dt_match[] = +{ + { .compatible = "xlnx,nwl-pcie-2.11" }, + { }, +}; + +static int __init pci_host_generic_probe(struct dt_device_node *dev, + const void *data) +{ + return pci_host_common_probe(dev, &nwl_pcie_ops); +} + +DT_DEVICE_START(pci_gen, "PCI HOST ZYNQMP", DEVICE_PCI) +.dt_match = nwl_pcie_dt_match, +.init = pci_host_generic_probe, +DT_DEVICE_END + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */