From patchwork Fri May 12 06:27:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Havalige, Thippeswamy" X-Patchwork-Id: 92957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4887834vqo; Thu, 11 May 2023 23:30:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7urpIyqs/BNpZVI3AIdNASNoYznv5HrfG2pwExvTqw+9ohOt4dO508jKYA6jAg5gPL2xba X-Received: by 2002:a17:902:ab8a:b0:1ac:b144:c796 with SMTP id f10-20020a170902ab8a00b001acb144c796mr8340095plr.34.1683873059204; Thu, 11 May 2023 23:30:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683873059; cv=pass; d=google.com; s=arc-20160816; b=B0Yu3K+XWlafqqZlPWSHe9zPHJjr0vpApxOmMU1TyoQUvmpHfRP5nlaN6XLiAdwels Y0F4g/TURRXItF639CjkbV56Rcx++KJ66Xg/esbkWky3zqjExlCkRpyhZJfTyRcVBKxY GnDefXwe/1LHPHUlYywCBM2WaNyrMPkryVz5Y4FAoaaClx2J+okDZtdMomfrNR37JvJ0 v76zHTye45jheHg9I28+PIN3ugJGNeNJw2LWFBx3ldiLIYPbDqYTlW17IL+7ZOJ+jGG7 yt+NJ6Pbh1B32jDeVjwgFqAL5g7cmUPOYfYhg1QzMYoRE2oB5dDCGNIBE9kxiRpZeXQF 09Ag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZMfd5zeAWPiO6U3xpBiHIWEGqsh1BgkQfzXu9Pz6u5w=; b=IpjS1hflbRSH5uzBD9OmV0B6XxgF3B7QeVg0BA/MX04VnGQOBPTqWxAABHVBuI86ol B5khSUaCc1q91VTG8d4iIjiVfs2V8MM+uC4mAiB9j02F+tZ6GC0UtGnZnJXtcRGl0s4+ 6uXpUZQLFFUDxXtBxD85owaRn6GJ+NKtCW+GM0nz7RIypi6KmcYE9lAW4lKn/I4jEaC0 qIT00jtQKFTIRTreXnpBzUqZIRXMTXDBXOsK2nERuXjnP6GF6z07dQtK3Mlsr1NxHWST rndVa2F2LJat4EB4yOz6wGCF/0c8iPEFezyeaGLWyC3Pc3U5xsGhkfT7h8ef0j4FQd0t NuIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=VffnGvsw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170903120d00b001a654cdcce0si8999554plh.103.2023.05.11.23.30.43; Thu, 11 May 2023 23:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=VffnGvsw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239940AbjELG17 (ORCPT + 99 others); Fri, 12 May 2023 02:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbjELG1y (ORCPT ); Fri, 12 May 2023 02:27:54 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2076.outbound.protection.outlook.com [40.107.223.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72DB21BDF; Thu, 11 May 2023 23:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gEqrUv5Wway6vTswXBw75eeKJSEwBMdfJefbbJ1hL0E9dyMU+3lQplY7KHw3HDFJqO8N1VfB0ZbHngj/OndzyTnvWWSF9n6vDkZBtPv7hM+1U0wclQZl6mqss+L37JvZDyCCjKCMuj35g+wyLD1C2d2dwNbuZw1kwpLwBEJLvSuUo7o3DxridTr9ADzYkLpCwVc4+KTqWEE3fthzgirSYjdg11udOC0f6GT5v13pTKCQKPdAFbOC8qlQUbmKvMY6Ou5jV5EQrQrjxdIJ0mY2s2P84rT8YLSbs2IY7UPsGNT/B8IBPGoR32FB8K1gppHLY6DQ2Hu/dgvV8fAL/9O/wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZMfd5zeAWPiO6U3xpBiHIWEGqsh1BgkQfzXu9Pz6u5w=; b=Q/4n2zcYvrLH4h9spVtHcEEas5JZovVkXe3IAC2mjC+yTYkwH1R2UumV14UPItL6amPUMM7Pemg2hB5LYrIaOfq7UxzbETXBPU8MKW4cZI5ShYkwT6W0Irk4cO655KtzYMM6OISHJlZOwml4Ez5+VECypLuZ5D8jaiDNp+H8S1yNWLuGx2oYKTIPuMWFLWl5/kUfin1trMosIZN92Ybp0VLmbXjNgcYrPeo31pPtxo6GyPfPkroqmIA85WzQjQIIgM+3ThylRcwhysRTytYT4wWSARYHr9eWx1Xb3WsqeMqs2wLhO/TcTbD/LiN/cM4DxoAu/0deNU44r3pkdYi3QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZMfd5zeAWPiO6U3xpBiHIWEGqsh1BgkQfzXu9Pz6u5w=; b=VffnGvswvGFUco1pmfdfINHQrZEINe+9xMWurjcISl4YDeL8+w+8EyAPM1b+DLRb5HKpJszXBsbGZY+fN24tCn7Yj7on6pPjVRPEX0nKlZj+dbN45tMG7jQxCuoBHmg7S0GnUMlebhXy41sg3zzu4brYwA1Ljqw72FNvUY5qkNY= Received: from MWH0EPF00056D0B.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:b) by CH3PR12MB8901.namprd12.prod.outlook.com (2603:10b6:610:180::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21; Fri, 12 May 2023 06:27:51 +0000 Received: from CO1NAM11FT109.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::204) by MWH0EPF00056D0B.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.5 via Frontend Transport; Fri, 12 May 2023 06:27:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT109.mail.protection.outlook.com (10.13.174.176) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6387.23 via Frontend Transport; Fri, 12 May 2023 06:27:50 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 12 May 2023 01:27:49 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 11 May 2023 23:27:49 -0700 Received: from xhdthippesw40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 12 May 2023 01:27:46 -0500 From: Thippeswamy Havalige To: , , , CC: , , , , , , Thippeswamy Havalige Subject: [PATCH v2 1/3] Move error interrupt bits to a common header. Date: Fri, 12 May 2023 11:57:23 +0530 Message-ID: <20230512062725.1208385-2-thippeswamy.havalige@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230512062725.1208385-1-thippeswamy.havalige@amd.com> References: <20230512062725.1208385-1-thippeswamy.havalige@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT109:EE_|CH3PR12MB8901:EE_ X-MS-Office365-Filtering-Correlation-Id: ae4af758-990c-4015-db75-08db52b202a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8b5qaQaehuBSI8nCXL4/KikOiJvrdeXX670zDIQGJfvUvIlEXRo/sLLwnWGv/A5kfqInlbnFQcj4faPC3KjK4rlXCx/HT4egLOKCdYz2IA2i2FDQYh+GlokNVlti8Cv5jtiU9kgMfa6aLv1Dk0YTC+qhzdibFOk25kWo6FFWq9PBbDeG4Gl+vos56DcfcvNHpVbiitj2HJ5MAHD/t0/3kRrUZUblOkvGF4+6F03/xi/6Isnk1y4+5CagUNpuOEbG8MwiyBeoyaCQCgUSN64rdDt4sv39KNd7+9G1409irpdSvkXCZjJUXGv8HKT1UR/8kvt8gjn8LqYqapLaeZi0t1j9yrMfWd5KvLjvE+KKTw/Ok3wxJIWtzW62i9tMiLF5GVASarcmd9R7Ks6cH/B8UekjUu5DOxpQZDOVDB+bURFHRLv1ArAVKfXvaZmSyPcp5tJrHSBD7R8z7JmGjpH79UbrASS0WrHTM9x9/bgw1TCCJHqHz0XTp8wKZ0rGxZUYWABBddDJJ8MaXH9/Qrxjkz4MnfD35aErRuRsW+tgdSvYecBDIelKKWBAdx93ql+oggU+jL/c2lQCs9zJnFeQoGmaL2PFfzDpWnsxwujha+si8bxSb1R4Zx1JjukgTHMeTSir6Hrbtpw1QXliqV3YPbCnP/cr1Q/503NHAR8TFuaVTxNVn0HyenBOZLwiPDpbNfGGbJqrkD8JLUzS1W+Bt346o8uk/8ueLTZUt1j8uYsySJWWC3lUSJImNI9ZV8fW1RcWsYbq6DXk/mW0iTBaaw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(396003)(136003)(346002)(451199021)(46966006)(40470700004)(36840700001)(36860700001)(2616005)(83380400001)(336012)(41300700001)(47076005)(6666004)(26005)(186003)(1076003)(426003)(478600001)(40460700003)(110136005)(54906003)(82740400003)(4326008)(40480700001)(70206006)(70586007)(316002)(81166007)(82310400005)(356005)(5660300002)(8936002)(44832011)(8676002)(36756003)(86362001)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 06:27:50.2844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae4af758-990c-4015-db75-08db52b202a1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT109.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8901 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765668876546822640?= X-GMAIL-MSGID: =?utf-8?q?1765668876546822640?= Moving error interrupt bit macros to a common header file for code reusability. Signed-off-by: Thippeswamy Havalige Signed-off-by: Bharat Kumar Gogada --- drivers/pci/controller/pcie-xilinx-common.h | 30 +++++++++++++++++++++++ drivers/pci/controller/pcie-xilinx-cpm.c | 38 ++++++----------------------- 2 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 drivers/pci/controller/pcie-xilinx-common.h diff --git a/drivers/pci/controller/pcie-xilinx-common.h b/drivers/pci/controller/pcie-xilinx-common.h new file mode 100644 index 0000000..015dba3 --- /dev/null +++ b/drivers/pci/controller/pcie-xilinx-common.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * (C) Copyright 2019 - 2020, Xilinx, Inc. + */ + +#include +#include +#include + +/* Interrupt registers definitions */ +#define XILINX_PCIE_INTR_LINK_DOWN 0 +#define XILINX_PCIE_INTR_HOT_RESET 3 +#define XILINX_PCIE_INTR_CFG_PCIE_TIMEOUT 4 +#define XILINX_PCIE_INTR_CFG_TIMEOUT 8 +#define XILINX_PCIE_INTR_CORRECTABLE 9 +#define XILINX_PCIE_INTR_NONFATAL 10 +#define XILINX_PCIE_INTR_FATAL 11 +#define XILINX_PCIE_INTR_CFG_ERR_POISON 12 +#define XILINX_PCIE_INTR_PME_TO_ACK_RCVD 15 +#define XILINX_PCIE_INTR_INTX 16 +#define XILINX_PCIE_INTR_PM_PME_RCVD 17 +#define XILINX_PCIE_INTR_SLV_UNSUPP 20 +#define XILINX_PCIE_INTR_SLV_UNEXP 21 +#define XILINX_PCIE_INTR_SLV_COMPL 22 +#define XILINX_PCIE_INTR_SLV_ERRP 23 +#define XILINX_PCIE_INTR_SLV_CMPABT 24 +#define XILINX_PCIE_INTR_SLV_ILLBUR 25 +#define XILINX_PCIE_INTR_MST_DECERR 26 +#define XILINX_PCIE_INTR_MST_SLVERR 27 +#define XILINX_PCIE_INTR_SLV_PCIE_TIMEOUT 28 diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c index 4a787a9..77d95e6 100644 --- a/drivers/pci/controller/pcie-xilinx-cpm.c +++ b/drivers/pci/controller/pcie-xilinx-cpm.c @@ -16,11 +16,9 @@ #include #include #include -#include -#include -#include #include "../pci.h" +#include "pcie-xilinx-common.h" /* Register definitions */ #define XILINX_CPM_PCIE_REG_IDR 0x00000E10 @@ -38,29 +36,7 @@ #define XILINX_CPM_PCIE_IR_ENABLE 0x000002A8 #define XILINX_CPM_PCIE_IR_LOCAL BIT(0) -/* Interrupt registers definitions */ -#define XILINX_CPM_PCIE_INTR_LINK_DOWN 0 -#define XILINX_CPM_PCIE_INTR_HOT_RESET 3 -#define XILINX_CPM_PCIE_INTR_CFG_PCIE_TIMEOUT 4 -#define XILINX_CPM_PCIE_INTR_CFG_TIMEOUT 8 -#define XILINX_CPM_PCIE_INTR_CORRECTABLE 9 -#define XILINX_CPM_PCIE_INTR_NONFATAL 10 -#define XILINX_CPM_PCIE_INTR_FATAL 11 -#define XILINX_CPM_PCIE_INTR_CFG_ERR_POISON 12 -#define XILINX_CPM_PCIE_INTR_PME_TO_ACK_RCVD 15 -#define XILINX_CPM_PCIE_INTR_INTX 16 -#define XILINX_CPM_PCIE_INTR_PM_PME_RCVD 17 -#define XILINX_CPM_PCIE_INTR_SLV_UNSUPP 20 -#define XILINX_CPM_PCIE_INTR_SLV_UNEXP 21 -#define XILINX_CPM_PCIE_INTR_SLV_COMPL 22 -#define XILINX_CPM_PCIE_INTR_SLV_ERRP 23 -#define XILINX_CPM_PCIE_INTR_SLV_CMPABT 24 -#define XILINX_CPM_PCIE_INTR_SLV_ILLBUR 25 -#define XILINX_CPM_PCIE_INTR_MST_DECERR 26 -#define XILINX_CPM_PCIE_INTR_MST_SLVERR 27 -#define XILINX_CPM_PCIE_INTR_SLV_PCIE_TIMEOUT 28 - -#define IMR(x) BIT(XILINX_CPM_PCIE_INTR_ ##x) +#define IMR(x) BIT(XILINX_PCIE_INTR_ ##x) #define XILINX_CPM_PCIE_IMR_ALL_MASK \ ( \ @@ -323,7 +299,7 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc) } #define _IC(x, s) \ - [XILINX_CPM_PCIE_INTR_ ## x] = { __stringify(x), s } + [XILINX_PCIE_INTR_ ## x] = { __stringify(x), s } static const struct { const char *sym; @@ -359,9 +335,9 @@ static irqreturn_t xilinx_cpm_pcie_intr_handler(int irq, void *dev_id) d = irq_domain_get_irq_data(port->cpm_domain, irq); switch (d->hwirq) { - case XILINX_CPM_PCIE_INTR_CORRECTABLE: - case XILINX_CPM_PCIE_INTR_NONFATAL: - case XILINX_CPM_PCIE_INTR_FATAL: + case XILINX_PCIE_INTR_CORRECTABLE: + case XILINX_PCIE_INTR_NONFATAL: + case XILINX_PCIE_INTR_FATAL: cpm_pcie_clear_err_interrupts(port); fallthrough; @@ -466,7 +442,7 @@ static int xilinx_cpm_setup_irq(struct xilinx_cpm_pcie *port) } port->intx_irq = irq_create_mapping(port->cpm_domain, - XILINX_CPM_PCIE_INTR_INTX); + XILINX_PCIE_INTR_INTX); if (!port->intx_irq) { dev_err(dev, "Failed to map INTx interrupt\n"); return -ENXIO; From patchwork Fri May 12 06:27:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Havalige, Thippeswamy" X-Patchwork-Id: 92958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4887854vqo; Thu, 11 May 2023 23:31:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Gt6o5vsDSzi3ntduc+rM2AMHrvHHk5MDdO+aisEhRHD+WEQQfLjNx3sWLuH1b9nR7xZLQ X-Received: by 2002:a05:6a20:4408:b0:101:6be3:f675 with SMTP id ce8-20020a056a20440800b001016be3f675mr15256021pzb.17.1683873062637; Thu, 11 May 2023 23:31:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683873062; cv=pass; d=google.com; s=arc-20160816; b=ElAeThGbLRW6vZS/Jd9xhpARvxaIuIWsa+sAgHufRvh6HcNgQn1XzR7RVZsXLG4MM+ GnW40EyxcZ6OW/RflpiBjEYq+NbK+1kp18l6t4hxZEiB4cT2+4+D+RQGXaaZ5hK1hBCN uvdpEL4jWCUBMeaEbkIMlExGGRCY+ur2dWNnsDIwBSaihZRbjCTRnWZKsyNklh/YT5S4 tEeLkp6XJTRc3dIE0cd8JZ8plxS8tjQ0D0o1tfsgNzK94yvadu/IEx5CQPaxAPEYdm2a U+N1V8fDxo9KANkTVOmw3HDD/VzBcIezsz/+BLsGesRdgYNIJnHJqhWqZ+K/wsEAq/Pr TwXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gQWiXBcXFSTLU09f/kaDstI7SlzJvuJ5p4kGuoiiI0I=; b=JAYcovydiNM3uGWH3cYqr328/IP6PwKcSAwqUEc4C78557tkofW+KpkdvDKv67qAcK +JmS/arAASYwR8AUOIzdGdHc+goPMGzJxcxDiTLOLeXtER0LjgrCm1rviN/HP76gS2Yk B2mU3RVIZ3yMN02ISMXDAoubPUU0VQl5wQPW+RP37AGT9Ny5FV6WvXjQY2fLRZ5UjW1j RbEydlNco0P6jIQ2u5m7iHF0xs5Azf56rzbtSxSu/WJB4mkk7hYXWENI4GgkV+tYFr2I ce25IcQKMSVhw5kIIXkQIW/0+qU+3dsg1u/iRBWY+iDghK4ow25Ao8ycsK+M1KaZKxgG xQ3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ITE3Z4OQ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a637e0f000000b0052c47df208dsi3929585pgc.326.2023.05.11.23.30.48; Thu, 11 May 2023 23:31:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ITE3Z4OQ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239964AbjELG2J (ORCPT + 99 others); Fri, 12 May 2023 02:28:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239967AbjELG2F (ORCPT ); Fri, 12 May 2023 02:28:05 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2062.outbound.protection.outlook.com [40.107.102.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F7785BB4; Thu, 11 May 2023 23:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O15TDzhEq+3N99t4fMoxhLayPDwC5cEG07wuNpL5abJd0pQvwxMtbKJI4pvkEo+w+xXXvx7gVHgKfQ6Kvr6RXlS/nZjBp3ihg3N3Iepf47t/t/HeBvylbCWJkyjfHvr2ju9UFrAD9XAf6kcvGOPy/EDHDvOUcZW/7TQMOj8czDFzLneeZy72at5Pq7U8o492y4UvvvqfuC6y/grEa+mtMUNDyOV436ooxUD8YsRPJty9kxVjn9+Iz3PSUVFZmQnY/uZBWrFD9TgwZYhkZyGs0/l+i/mMJo5hBKpNctRd31kQtqO3gKRstZDrRvKRqgfTlfxOcY4m/R+JpD5phfcAuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gQWiXBcXFSTLU09f/kaDstI7SlzJvuJ5p4kGuoiiI0I=; b=VMspdDu5N8I94Cq3HigUhXWZjkmQd/yLARUK33bAwfOc6CRLd4RlIpX+RHIFpag2ZYKtNCXC2XXLd7caGotshNJbgeF+aDVlkiXLLUTp9Xw3B0lRT2FOOj02bOs148G24Mgg3EW04QyRNHZc5qJNbFqgDEmpRPZLVoIpJaJKnH2K48GULPbIav2XwxhKRa8qntZn6GisHbTXxsGnv9DEJO22XTW1cVoea+bliaxus6HCyBklFdqzCaH/PiHfVEL/tPM2Aw+0cRoJ21ejbnkhSeM3sqylyS1QMEHFaqT2wPuorWKY61kOuGtsO3GFX+h/YpyXgJL1NePcZNJ67sBYWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gQWiXBcXFSTLU09f/kaDstI7SlzJvuJ5p4kGuoiiI0I=; b=ITE3Z4OQO5YXQmkDBts+g0AmFltoy/bQPSqXecdYnnMshqPYP7rDCEyC8RnrmVCeUHdG8anJVdmXGNLylrghN+y82LQTVHGPlNXzqctE6m6LBRP+v8D157wravwabLjnuVPmK58ZZHtrqMvaVCcccV09KF4jcn+hyQvLR1NPB7k= Received: from MW4PR03CA0171.namprd03.prod.outlook.com (2603:10b6:303:8d::26) by PH7PR12MB5619.namprd12.prod.outlook.com (2603:10b6:510:136::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Fri, 12 May 2023 06:27:56 +0000 Received: from CO1NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::27) by MW4PR03CA0171.outlook.office365.com (2603:10b6:303:8d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.24 via Frontend Transport; Fri, 12 May 2023 06:27:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT056.mail.protection.outlook.com (10.13.175.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6387.23 via Frontend Transport; Fri, 12 May 2023 06:27:55 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 12 May 2023 01:27:54 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 11 May 2023 23:27:54 -0700 Received: from xhdthippesw40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 12 May 2023 01:27:51 -0500 From: Thippeswamy Havalige To: , , , CC: , , , , , , Thippeswamy Havalige Subject: [PATCH v2 2/3] dt-bindings: PCI: xilinx-xdma: Add YAML schemas for Xilinx XDMA PCIe Root Port Bridge Date: Fri, 12 May 2023 11:57:24 +0530 Message-ID: <20230512062725.1208385-3-thippeswamy.havalige@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230512062725.1208385-1-thippeswamy.havalige@amd.com> References: <20230512062725.1208385-1-thippeswamy.havalige@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT056:EE_|PH7PR12MB5619:EE_ X-MS-Office365-Filtering-Correlation-Id: af417cf1-9431-4590-0184-08db52b205c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VZNv13vwZiIgw8cU4NAUkLGlXz9kTseL1kGG3PuYwha71+HeVbxxXU8rBQfvq3XZkL+MXJz1HkQq4HpBjQJlymsuTd7+8dl8CT+MpPAifwu1S43t9HwAPp+8S0XcI1/P9OfZHeQ1A2ZjTsO3J/RusuzLy6d1vVSMb6j4nNIEVZmq/dXUKZDRVNbUQd7IgDp3y7CWCIiI9ZrlaE9ESxLAePsCeyxXXL8pACXnkcWEzlyyOpnnkqObxNf/MTo6UYg8ROke/GbjL78SdH84AvCiAdI4p9aGRnZ3t/cZM0xVdzC76db6pya0fJT7YOuwNbNSRtTQnJ+OHbDeYJnxCPxcSJyO7DOQlMc1nb7rGclQxkpVnv3QWbcxKbLMAaOuVb7360puxLsG5Za6dklTd9+lWJabFqzINm+G3VLXx4fKtSp62kKaInMciaPAx+7q6wWxz9sxPRNYSOYle4aEmq6b+aMw9KPeKsf8gMyMgcjiO0FdGHrU4O3fnXcfyo4mPYIEc+2gGQjU0QZAMCGBLewyaf5A4tiFvesVIJXvZP3aCyKEoAAQIYuj55Y9OUFdNcOpxzr/s4SsKIRzZra+XghYWJ1I7kjXI4Qb2FkE5eMvD9UlQ3dT6bLnU7YRf+lTJEnV5Q84SKQCH0c/oYpgAgm/yqpROKcrhiSFYRLFyY/BVZHG20ycM7vKuUOhpGFV8SNbCXD4rz//UebkmPRQK8urC3OEFNsMArtbCWU7IWi4SZ2qNs+vzvcrRq3a0ctbR7n8Y2r/9CbpIoHl2vEaL8ifJnDD+fxjZeWj5XjIgQQtaXc= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(376002)(136003)(39860400002)(451199021)(46966006)(40470700004)(36840700001)(81166007)(44832011)(478600001)(1076003)(26005)(316002)(356005)(47076005)(36860700001)(41300700001)(70586007)(426003)(336012)(70206006)(4326008)(54906003)(110136005)(82740400003)(966005)(2616005)(8676002)(86362001)(6666004)(8936002)(82310400005)(2906002)(186003)(36756003)(40460700003)(40480700001)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 06:27:55.6169 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af417cf1-9431-4590-0184-08db52b205c6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5619 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765668880767238646?= X-GMAIL-MSGID: =?utf-8?q?1765668880767238646?= Add YAML dtschemas of Xilinx XDMA Soft IP PCIe Root Port Bridge dt binding. Signed-off-by: Thippeswamy Havalige Signed-off-by: Bharat Kumar Gogada --- .../devicetree/bindings/pci/xlnx,xdma-host.yaml | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/xlnx,xdma-host.yaml diff --git a/Documentation/devicetree/bindings/pci/xlnx,xdma-host.yaml b/Documentation/devicetree/bindings/pci/xlnx,xdma-host.yaml new file mode 100644 index 0000000..e3a1ef1 --- /dev/null +++ b/Documentation/devicetree/bindings/pci/xlnx,xdma-host.yaml @@ -0,0 +1,117 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/xlnx,xdma-host.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx XDMA PL PCIe Root Port Bridge + +maintainers: + - Thippeswamy Havalige + +allOf: + - $ref: /schemas/pci/pci-bus.yaml# + +properties: + compatible: + const: xlnx,xdma-host-3.0 + + reg: + maxItems: 1 + + ranges: + items: + - description: | + ranges for the PCI memory regions (I/O space region is not + supported by hardware) + + interrupts: + items: + - description: interrupt asserted when miscellaneous interrupt is received. + - description: msi0 interrupt asserted when an MSI is received. + - description: msi1 interrupt asserted when an MSI is received. + + interrupt-names: + items: + - const: misc + - const: msi0 + - const: msi1 + + interrupt-map-mask: + items: + - const: 0 + - const: 0 + - const: 0 + - const: 7 + + interrupt-map: + maxItems: 4 + + "#interrupt-cells": + const: 1 + + interrupt-controller: + description: identifies the node as an interrupt controller + type: object + properties: + interrupt-controller: true + + "#address-cells": + const: 0 + + "#interrupt-cells": + const: 1 + + required: + - interrupt-controller + - "#address-cells" + - "#interrupt-cells" + + additionalProperties: false + +required: + - compatible + - reg + - ranges + - interrupts + - interrupt-map + - interrupt-map-mask + - "#interrupt-cells" + - interrupt-controller + +unevaluatedProperties: false + +examples: + + - | + #include + #include + + soc { + #address-cells = <2>; + #size-cells = <2>; + pcie@a0000000 { + compatible = "xlnx,xdma-host-3.00"; + reg = <0x0 0xa0000000 0x0 0x10000000>; + #address-cells = <3>; + #size-cells = <2>; + #interrupt-cells = <1>; + device_type = "pci"; + interrupt-parent = <&gic>; + interrupts = , , + ; + interrupt-names = "misc", "msi0", "msi1"; + interrupt-map-mask = <0x0 0x0 0x0 0x7>; + interrupt-map = <0 0 0 1 &pcie_intc_0 0>, + <0 0 0 2 &pcie_intc_0 1>, + <0 0 0 3 &pcie_intc_0 2>, + <0 0 0 4 &pcie_intc_0 3>; + ranges = <0x2000000 0x0 0xb0000000 0x0 0xb0000000 0x0 0x1000000>, + <0x43000000 0x5 0x0 0x5 0x0 0x0 0x1000000>; + pcie_intc_0: interrupt-controller { + #address-cells = <2>; + #interrupt-cells = <1>; + interrupt-controller ; + }; + }; + }; From patchwork Fri May 12 06:27:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Havalige, Thippeswamy" X-Patchwork-Id: 92959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4888037vqo; Thu, 11 May 2023 23:31:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65c9ZMoV7h5Tq+sDcpjgA1vzVWvfR+B/4GtxSbOh6HnOw0RWna9YN0XbZpjU5CDgcYIKuO X-Received: by 2002:a17:90b:1d87:b0:247:9d19:311f with SMTP id pf7-20020a17090b1d8700b002479d19311fmr23729010pjb.30.1683873095308; Thu, 11 May 2023 23:31:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683873095; cv=pass; d=google.com; s=arc-20160816; b=rEqiPLP5jfy3wn4Nv1mYedBRkZzd1DDPSWrk3o3XGTgx/RFsS54O1yL/BRazVvN940 k/pmoUX+tWiK3aItX1AeO9R9IfmqVkLnzAVzIKz9kiUIgMZkuJloMKUa1qeOObcqu0rh yxdHZrVHkXypgVi+T++ZnhmWj+1eNzKkA3O1zfaTzyoKnKAbvX1QPOXFRFPWmI80NIGn KTyNrWOLk4Hk6YG99I0UACIiLUe8BMqQu5ZQTKOA0CSndk53ihZsOsSmPExsamYNzUp0 PFupBxMWn3I0Tt9Br4BJNRXn/hp4Fo2Yxx1VdzazTI7P08wR2YLk1SqwoEYkbF/SBGly dpiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ohBYGGaM/9R9L5te4wXQ9H+5PY04E+xoWjF6bDMs2o0=; b=EplcuYikTptWdkoLS2U23ax8sa6ej3eKzbp1Hg1ClzOsMNJFn/WEYo3FWioFt3t1zD 5b+a2VMCBIsER5HmJeql5ExtmASoDVfADEUQd+IKcvCaX50fvSMcwj0M4GcxyvGKlLzo OanIhYc1EV+U250QUgaJ2NbLw2KjHnfWfQxjRHArTGaaBnygw9cWe37VtbWiOAGrcZ7d R2U/9FJaerjw51IRE38JvMcagdSWK2pcK2BOv/IUfS9CrIO2yVSnWqd/qP3wtXcN5SFt DpHIaLiu53YMptGHzzYX4TtqoLjOKnAX6fZhdEdHe+SymTjm8eRyoS7MxJ+KUDjcM5HV /tKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=s1s40kOO; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a17090a128b00b002472cd8ded6si17069313pja.103.2023.05.11.23.31.20; Thu, 11 May 2023 23:31:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=s1s40kOO; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239955AbjELG2Z (ORCPT + 99 others); Fri, 12 May 2023 02:28:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239966AbjELG2V (ORCPT ); Fri, 12 May 2023 02:28:21 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2082.outbound.protection.outlook.com [40.107.92.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5EC330FF; Thu, 11 May 2023 23:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ypiv21GmpsV72ht8hs6sVmS8QHxlrmmUcV+gi1k4It8CYx9JG7vGlhFe+PtNorXMqD/WRwPt4h7PG9iVLZbi8P/ls4uZ6AVK22nmt5CdJvs4kwdDeycanITFy+7ydZarY2US6uYWrK3RZ25Fw2pzR9tX8gfOW7xz8QMK3Uxs7Xcead9N3vphw47epfMKuFxvg9MytpI4Szr1TjLxI/WppXyic9kb1/i18awSfM0lZ6uvQfPpwl0o4xe9mobPKyJ3o9+nd3pMrVz9NUyeaxmb1QQhebSYh4I673SFgQKQQnC1LEtgnhBpsVI8/wN5ulfjLaaDJTxQT88vHBxs4XkMIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ohBYGGaM/9R9L5te4wXQ9H+5PY04E+xoWjF6bDMs2o0=; b=WilyUFEz6TGelTt+bpAvhdhugGXTlfLoUXFfsp+YjjjcBEXcRwOqociPUp/XxdFDrw7L4YsQyb89ML1NTucDC42uH3yT36LnObmUXCo1arz9Ek1vZAGjXdC2gvmXyaEx6dywy4N1qNKGZjO/fFHyvvCm5/W6NNdnDFbMDogK4ILUEZL1IVawGtl5VLFyLhFtyEgd4iPu9JydKxovyc+7nuBes9AHZaBMIsiqdG2eDOip+dwKZuhATPrPiTy7WPUajQUX9giiVCu3qOo0v04KO22F8Kjn9wxKGE5OrIT+v8Iz9nM/Vs9CYbTBsUW3cb510VuqLvsmQlZfcQhuslA8hA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ohBYGGaM/9R9L5te4wXQ9H+5PY04E+xoWjF6bDMs2o0=; b=s1s40kOOIxbO6oToPDBsdATKrOsbjJxF3hJk7ok37GHX5uusYWYiVb9w/T9+bxacjTLzDSe+1p4f7/rxmocZrSr9uhD+9iXz277qxDU4eBWIBNQCRi6hBxMnQtvG4wvCYnwHbEYaHZPxeTuU0gbvfCM46ubSAy+CqspIk8Uld7s= Received: from MW2PR16CA0053.namprd16.prod.outlook.com (2603:10b6:907:1::30) by SA1PR12MB7271.namprd12.prod.outlook.com (2603:10b6:806:2b8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Fri, 12 May 2023 06:28:02 +0000 Received: from CO1NAM11FT087.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::3f) by MW2PR16CA0053.outlook.office365.com (2603:10b6:907:1::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.24 via Frontend Transport; Fri, 12 May 2023 06:28:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT087.mail.protection.outlook.com (10.13.174.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6387.23 via Frontend Transport; Fri, 12 May 2023 06:28:01 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 12 May 2023 01:28:00 -0500 Received: from xhdthippesw40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 12 May 2023 01:27:57 -0500 From: Thippeswamy Havalige To: , , , CC: , , , , , , Thippeswamy Havalige Subject: [PATCH v2 3/3] PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver Date: Fri, 12 May 2023 11:57:25 +0530 Message-ID: <20230512062725.1208385-4-thippeswamy.havalige@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230512062725.1208385-1-thippeswamy.havalige@amd.com> References: <20230512062725.1208385-1-thippeswamy.havalige@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT087:EE_|SA1PR12MB7271:EE_ X-MS-Office365-Filtering-Correlation-Id: 910e9abf-9a89-44c1-4066-08db52b20965 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PZBpHV2qWV0BcMPsUhcJ9ENE8gMGC9syi3NawktkN0ZLGFj7OgHyepvXvCRp+5CCfkTb6tUbsv1uUDEL8M2nmv/EajMqRUhrG15H8HTfMm7Y4jNcN5fwHhgaXUP+P1oQ9rF6Oi+5/oYpwVjt6GKH2EQ77glmsk0NrrStJr/zoOJrBEGW6SlpNHVw1d8dafec7DcH0qINN1OOTISqryojDPNM0mFg3x1VCAZ6oiEm2JpDby4lGZ7/NJt+AZJVtmI5QjxmvY1TthQ7Oqwra5D7qErbHRvMUnEY1lykOSAQU0jAeElbOzjpRcHG4GjJbplkoOsrp95JvGpYtSejxBWMJ/zK/wgfLCl4XCJTarU6c4ps8oZdyTHYvdW4Gkz394PLoGApFPJLww7XCv7zwuPVXKXPIHa4TAqwQPY+hA2Jiiwb9QtNHQNO7n3PxarNWGwFRg+hHZxu/WPoNnASOBySoJd4pt7Jz7iu5WdvjMe8ijn9fw3f57hiqodA+Bzqi2X6+NDGNE/PqzOOzxqf09Kie7bE2eEPQxJpm1PIQ8FKHAXIMsf3qK/zY//i4RLHYz8QUIIaTFK/w6i+f+YpDqSy0JjZrBZ9tRiP/VFUbuJn1LP6EYBTtrZXJdbRewtkRYvs558+SiECZGNN5ws8LmcbkNAA86PjWr01nx+AdsHLM0/6WUgabDq+tgif+eEb1bSJpsuogTHzfXqTVCKymunp/u/fHX0n2S+GDXliTF6RvbkpWfjac4BkBNUZo3R8PR8Vc/mSxK8msjGYTVao3jrDRA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(396003)(376002)(39860400002)(451199021)(46966006)(40470700004)(36840700001)(40480700001)(110136005)(83380400001)(336012)(36860700001)(2616005)(47076005)(426003)(70586007)(478600001)(36756003)(1076003)(70206006)(26005)(54906003)(186003)(4326008)(6666004)(2906002)(30864003)(86362001)(40460700003)(44832011)(5660300002)(82740400003)(356005)(41300700001)(81166007)(8676002)(316002)(8936002)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 06:28:01.6781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 910e9abf-9a89-44c1-4066-08db52b20965 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT087.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7271 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765668914867410578?= X-GMAIL-MSGID: =?utf-8?q?1765668914867410578?= Add support for Xilinx XDMA Soft IP core as Root Port. The Zynq UltraScale+ MPSoCs devices support XDMA soft IP module in programmable logic. The integrated XDMA soft IP block has integrated bridge function that can act as PCIe Root Port. Signed-off-by: Thippeswamy Havalige Signed-off-by: Bharat Kumar Gogada --- changes in v2: Remove unnecessary inclusion of headerfiles. Added a subset of interrupt error bits to common header files. Added pci_is_root_bus function. Removed kerneldoc comments of private function. Modified of_get_next_child API to of_get_child_by_name. Modified of_address_to_resource API to platform_get_resource. Modified return value. drivers/pci/controller/Kconfig | 10 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-xdma-pl.c | 800 ++++++++++++++++++++++++++++ drivers/pci/controller/pcie-xilinx-common.h | 1 + 4 files changed, 812 insertions(+) create mode 100644 drivers/pci/controller/pcie-xdma-pl.c diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig index 8d49bad..e088956 100644 --- a/drivers/pci/controller/Kconfig +++ b/drivers/pci/controller/Kconfig @@ -343,6 +343,16 @@ config PCIE_XILINX_CPM Say 'Y' here if you want kernel support for the Xilinx Versal CPM host bridge. +config PCIE_XILINX_DMA + bool "Xilinx DMA PL PCIe host bridge support" + depends on ARCH_ZYNQMP || COMPILE_TEST + depends on PCI_MSI + select PCI_HOST_COMMON + help + Say 'Y' here if you want kernel to enable support for the + XILINX PL PCIe host bridge support, this PCIe controller + includes DMA PL component. + source "drivers/pci/controller/cadence/Kconfig" source "drivers/pci/controller/dwc/Kconfig" source "drivers/pci/controller/mobiveil/Kconfig" diff --git a/drivers/pci/controller/Makefile b/drivers/pci/controller/Makefile index 37c8663..f96896f 100644 --- a/drivers/pci/controller/Makefile +++ b/drivers/pci/controller/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_PCI_HOST_THUNDER_PEM) += pci-thunder-pem.o obj-$(CONFIG_PCIE_XILINX) += pcie-xilinx.o obj-$(CONFIG_PCIE_XILINX_NWL) += pcie-xilinx-nwl.o obj-$(CONFIG_PCIE_XILINX_CPM) += pcie-xilinx-cpm.o +obj-$(CONFIG_PCIE_XILINX_DMA) += pcie-xdma-pl.o obj-$(CONFIG_PCI_V3_SEMI) += pci-v3-semi.o obj-$(CONFIG_PCI_XGENE) += pci-xgene.o obj-$(CONFIG_PCI_XGENE_MSI) += pci-xgene-msi.o diff --git a/drivers/pci/controller/pcie-xdma-pl.c b/drivers/pci/controller/pcie-xdma-pl.c new file mode 100644 index 0000000..7399fb4 --- /dev/null +++ b/drivers/pci/controller/pcie-xdma-pl.c @@ -0,0 +1,800 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * PCIe host controller driver for Xilinx XDMA PCIe Bridge + * + * Copyright (C) 2017 Xilinx, Inc. All rights reserved. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pcie-xilinx-common.h" + +#include "../pci.h" + +/* Register definitions */ +#define XILINX_PCIE_DMA_REG_IDR 0x00000138 +#define XILINX_PCIE_DMA_REG_IMR 0x0000013c +#define XILINX_PCIE_DMA_REG_PSCR 0x00000144 +#define XILINX_PCIE_DMA_REG_RPSC 0x00000148 +#define XILINX_PCIE_DMA_REG_MSIBASE1 0x0000014c +#define XILINX_PCIE_DMA_REG_MSIBASE2 0x00000150 +#define XILINX_PCIE_DMA_REG_RPEFR 0x00000154 +#define XILINX_PCIE_DMA_REG_IDRN 0x00000160 +#define XILINX_PCIE_DMA_REG_IDRN_MASK 0x00000164 +#define XILINX_PCIE_DMA_REG_MSI_LOW 0x00000170 +#define XILINX_PCIE_DMA_REG_MSI_HI 0x00000174 +#define XILINX_PCIE_DMA_REG_MSI_LOW_MASK 0x00000178 +#define XILINX_PCIE_DMA_REG_MSI_HI_MASK 0x0000017c + +#define IMR(x) BIT(XILINX_PCIE_INTR_ ##x) + +#define XILINX_PCIE_INTR_IMR_ALL_MASK \ + ( \ + IMR(LINK_DOWN) | \ + IMR(HOT_RESET) | \ + IMR(CFG_TIMEOUT) | \ + IMR(CORRECTABLE) | \ + IMR(NONFATAL) | \ + IMR(FATAL) | \ + IMR(INTX) | \ + IMR(MSI) | \ + IMR(SLV_UNSUPP) | \ + IMR(SLV_UNEXP) | \ + IMR(SLV_COMPL) | \ + IMR(SLV_ERRP) | \ + IMR(SLV_CMPABT) | \ + IMR(SLV_ILLBUR) | \ + IMR(MST_DECERR) | \ + IMR(MST_SLVERR) | \ + ) + +#define XILINX_PCIE_DMA_IMR_ALL_MASK 0x0FF30FE9 +#define XILINX_PCIE_DMA_IDR_ALL_MASK 0xFFFFFFFF +#define XILINX_PCIE_DMA_IDRN_MASK GENMASK(19, 16) + +/* Root Port Error Register definitions */ +#define XILINX_PCIE_DMA_RPEFR_ERR_VALID BIT(18) +#define XILINX_PCIE_DMA_RPEFR_REQ_ID GENMASK(15, 0) +#define XILINX_PCIE_DMA_RPEFR_ALL_MASK 0xFFFFFFFF + +/* Root Port Interrupt Register definitions */ +#define XILINX_PCIE_DMA_IDRN_SHIFT 16 + +/* Root Port Status/control Register definitions */ +#define XILINX_PCIE_DMA_REG_RPSC_BEN BIT(0) + +/* Phy Status/Control Register definitions */ +#define XILINX_PCIE_DMA_REG_PSCR_LNKUP BIT(11) + +/* Number of MSI IRQs */ +#define XILINX_NUM_MSI_IRQS 64 + +struct xilinx_msi { + struct irq_domain *msi_domain; + unsigned long *bitmap; + struct irq_domain *dev_domain; + struct mutex lock; /* protect bitmap variable */ + int irq_msi0; + int irq_msi1; +}; + +/** + * struct xilinx_pcie_dma - PCIe port information + * @reg_base: IO Mapped Register Base + * @irq: Interrupt number + * @cfg: Holds mappings of config space window + * @dev: Device pointer + * @phys_reg_base: Physical address of reg base + * @leg_domain: Legacy IRQ domain pointer + * @pldma_domain: PL DMA IRQ domain pointer + * @resources: Bus Resources + * @msi: MSI information + * @irq_misc: Legacy and error interrupt number + * @intx_irq: legacy interrupt number + * @lock: lock protecting shared register access + */ +struct xilinx_pcie_dma { + void __iomem *reg_base; + u32 irq; + struct pci_config_window *cfg; + struct device *dev; + phys_addr_t phys_reg_base; + struct irq_domain *leg_domain; + struct irq_domain *pldma_domain; + struct list_head resources; + struct xilinx_msi msi; + int irq_misc; + int intx_irq; + raw_spinlock_t lock; +}; + +static inline u32 pcie_read(struct xilinx_pcie_dma *port, u32 reg) +{ + return readl(port->reg_base + reg); +} + +static inline void pcie_write(struct xilinx_pcie_dma *port, u32 val, u32 reg) +{ + writel(val, port->reg_base + reg); +} + +static inline bool xilinx_pcie_dma_linkup(struct xilinx_pcie_dma *port) +{ + return (pcie_read(port, XILINX_PCIE_DMA_REG_PSCR) & + XILINX_PCIE_DMA_REG_PSCR_LNKUP) ? 1 : 0; +} + +static void xilinx_pcie_dma_clear_err_interrupts(struct xilinx_pcie_dma *port) +{ + unsigned long val = pcie_read(port, XILINX_PCIE_DMA_REG_RPEFR); + + if (val & XILINX_PCIE_DMA_RPEFR_ERR_VALID) { + dev_dbg(port->dev, "Requester ID %lu\n", + val & XILINX_PCIE_DMA_RPEFR_REQ_ID); + pcie_write(port, XILINX_PCIE_DMA_RPEFR_ALL_MASK, + XILINX_PCIE_DMA_REG_RPEFR); + } +} + +static bool xilinx_pcie_dma_valid_device(struct pci_bus *bus, unsigned int devfn) +{ + struct xilinx_pcie_dma *port = bus->sysdata; + + /* Check if link is up when trying to access downstream ports */ + if (!pci_is_root_bus(bus)) { + if (!xilinx_pcie_dma_linkup(port)) + return false; + } else if (devfn > 0) + /* Only one device down on each root port */ + return false; + + return true; +} + +static void __iomem *xilinx_pcie_dma_map_bus(struct pci_bus *bus, + unsigned int devfn, int where) +{ + struct xilinx_pcie_dma *port = bus->sysdata; + + if (!xilinx_pcie_dma_valid_device(bus, devfn)) + return NULL; + + return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where); +} + +/* PCIe operations */ +static struct pci_ecam_ops xilinx_pcie_dma_ops = { + .pci_ops = { + .map_bus = xilinx_pcie_dma_map_bus, + .read = pci_generic_config_read, + .write = pci_generic_config_write, + } +}; + +static void xilinx_pcie_dma_enable_msi(struct xilinx_pcie_dma *port) +{ + phys_addr_t msi_addr = port->phys_reg_base; + + pcie_write(port, upper_32_bits(msi_addr), XILINX_PCIE_DMA_REG_MSIBASE1); + pcie_write(port, lower_32_bits(msi_addr), XILINX_PCIE_DMA_REG_MSIBASE2); +} + +static void xilinx_mask_leg_irq(struct irq_data *data) +{ + struct xilinx_pcie_dma *port = irq_data_get_irq_chip_data(data); + unsigned long flags; + u32 mask; + u32 val; + + mask = BIT(data->hwirq + XILINX_PCIE_DMA_IDRN_SHIFT); + raw_spin_lock_irqsave(&port->lock, flags); + val = pcie_read(port, XILINX_PCIE_DMA_REG_IDRN_MASK); + pcie_write(port, (val & (~mask)), XILINX_PCIE_DMA_REG_IDRN_MASK); + raw_spin_unlock_irqrestore(&port->lock, flags); +} + +static void xilinx_unmask_leg_irq(struct irq_data *data) +{ + struct xilinx_pcie_dma *port = irq_data_get_irq_chip_data(data); + unsigned long flags; + u32 mask; + u32 val; + + mask = BIT(data->hwirq + XILINX_PCIE_DMA_IDRN_SHIFT); + raw_spin_lock_irqsave(&port->lock, flags); + val = pcie_read(port, XILINX_PCIE_DMA_REG_IDRN_MASK); + pcie_write(port, (val | mask), XILINX_PCIE_DMA_REG_IDRN_MASK); + raw_spin_unlock_irqrestore(&port->lock, flags); +} + +static struct irq_chip xilinx_leg_irq_chip = { + .name = "INTx", + .irq_mask = xilinx_mask_leg_irq, + .irq_unmask = xilinx_unmask_leg_irq, +}; + +static int xilinx_pcie_dma_intx_map(struct irq_domain *domain, unsigned int irq, + irq_hw_number_t hwirq) +{ + irq_set_chip_and_handler(irq, &xilinx_leg_irq_chip, handle_level_irq); + irq_set_chip_data(irq, domain->host_data); + irq_set_status_flags(irq, IRQ_LEVEL); + + return 0; +} + +/* INTx IRQ Domain operations */ +static const struct irq_domain_ops intx_domain_ops = { + .map = xilinx_pcie_dma_intx_map, +}; + +static void xilinx_pcie_dma_handle_msi_irq(struct xilinx_pcie_dma *port, + u32 status_reg) +{ + struct xilinx_msi *msi; + unsigned long status; + u32 bit; + u32 virq; + + msi = &port->msi; + + while ((status = pcie_read(port, status_reg)) != 0) { + for_each_set_bit(bit, &status, 32) { + pcie_write(port, 1 << bit, status_reg); + if (status_reg == XILINX_PCIE_DMA_REG_MSI_HI) + bit = bit + 32; + virq = irq_find_mapping(msi->dev_domain, bit); + if (virq) + generic_handle_irq(virq); + } + } +} + +static void xilinx_pcie_dma_msi_handler_high(struct irq_desc *desc) +{ + struct irq_chip *chip = irq_desc_get_chip(desc); + struct xilinx_pcie_dma *port = irq_desc_get_handler_data(desc); + + chained_irq_enter(chip, desc); + xilinx_pcie_dma_handle_msi_irq(port, XILINX_PCIE_DMA_REG_MSI_HI); + chained_irq_exit(chip, desc); +} + +static void xilinx_pcie_dma_msi_handler_low(struct irq_desc *desc) +{ + struct irq_chip *chip = irq_desc_get_chip(desc); + struct xilinx_pcie_dma *port = irq_desc_get_handler_data(desc); + + chained_irq_enter(chip, desc); + xilinx_pcie_dma_handle_msi_irq(port, XILINX_PCIE_DMA_REG_MSI_LOW); + chained_irq_exit(chip, desc); +} + +static void xilinx_pcie_dma_event_flow(struct irq_desc *desc) +{ + struct xilinx_pcie_dma *port = irq_desc_get_handler_data(desc); + struct irq_chip *chip = irq_desc_get_chip(desc); + unsigned long val; + int i; + + chained_irq_enter(chip, desc); + val = pcie_read(port, XILINX_PCIE_DMA_REG_IDR); + val &= pcie_read(port, XILINX_PCIE_DMA_REG_IMR); + for_each_set_bit(i, &val, 32) + generic_handle_domain_irq(port->pldma_domain, i); + + pcie_write(port, val, XILINX_PCIE_DMA_REG_IDR); + + chained_irq_exit(chip, desc); +} + +#define _IC(x, s) \ + [XILINX_PCIE_INTR_ ## x] = { __stringify(x), s } + +static const struct { + const char *sym; + const char *str; +} intr_cause[32] = { + _IC(LINK_DOWN, "Link Down"), + _IC(HOT_RESET, "Hot reset"), + _IC(CFG_TIMEOUT, "ECAM access timeout"), + _IC(CORRECTABLE, "Correctable error message"), + _IC(NONFATAL, "Non fatal error message"), + _IC(FATAL, "Fatal error message"), + _IC(INTX, "INTX error message"), + _IC(MSI, "MSI message received"), + _IC(SLV_UNSUPP, "Slave unsupported request"), + _IC(SLV_UNEXP, "Slave unexpected completion"), + _IC(SLV_COMPL, "Slave completion timeout"), + _IC(SLV_ERRP, "Slave Error Poison"), + _IC(SLV_CMPABT, "Slave Completer Abort"), + _IC(SLV_ILLBUR, "Slave Illegal Burst"), + _IC(MST_DECERR, "Master decode error"), + _IC(MST_SLVERR, "Master slave error"), +}; + +static irqreturn_t xilinx_pcie_dma_intr_handler(int irq, void *dev_id) +{ + struct xilinx_pcie_dma *port = (struct xilinx_pcie_dma *)dev_id; + struct device *dev = port->dev; + struct irq_data *d; + + d = irq_domain_get_irq_data(port->pldma_domain, irq); + switch (d->hwirq) { + case XILINX_PCIE_INTR_CORRECTABLE: + case XILINX_PCIE_INTR_NONFATAL: + case XILINX_PCIE_INTR_FATAL: + xilinx_pcie_dma_clear_err_interrupts(port); + fallthrough; + + default: + if (intr_cause[d->hwirq].str) + dev_warn(dev, "%s\n", intr_cause[d->hwirq].str); + else + dev_warn(dev, "Unknown IRQ %ld\n", d->hwirq); + } + + return IRQ_HANDLED; +} + +static struct irq_chip xilinx_msi_irq_chip = { + .name = "xilinx_pcie_dmapcie:msi", + .irq_enable = pci_msi_unmask_irq, + .irq_disable = pci_msi_mask_irq, + .irq_mask = pci_msi_mask_irq, + .irq_unmask = pci_msi_unmask_irq, +}; + +static struct msi_domain_info xilinx_msi_domain_info = { + .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | + MSI_FLAG_MULTI_PCI_MSI), + .chip = &xilinx_msi_irq_chip, +}; + +static void xilinx_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) +{ + struct xilinx_pcie_dma *pcie = irq_data_get_irq_chip_data(data); + phys_addr_t msi_addr = pcie->phys_reg_base; + + msg->address_lo = lower_32_bits(msi_addr); + msg->address_hi = upper_32_bits(msi_addr); + msg->data = data->hwirq; +} + +static int xilinx_msi_set_affinity(struct irq_data *irq_data, + const struct cpumask *mask, bool force) +{ + return -EINVAL; +} + +static struct irq_chip xilinx_irq_chip = { + .name = "Xilinx MSI", + .irq_compose_msi_msg = xilinx_compose_msi_msg, + .irq_set_affinity = xilinx_msi_set_affinity, +}; + +static int xilinx_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, + unsigned int nr_irqs, void *args) +{ + struct xilinx_pcie_dma *pcie = domain->host_data; + struct xilinx_msi *msi = &pcie->msi; + int bit; + int i; + + mutex_lock(&msi->lock); + bit = bitmap_find_free_region(msi->bitmap, XILINX_NUM_MSI_IRQS, + get_count_order(nr_irqs)); + if (bit < 0) { + mutex_unlock(&msi->lock); + return -ENOSPC; + } + + for (i = 0; i < nr_irqs; i++) { + irq_domain_set_info(domain, virq + i, bit + i, &xilinx_irq_chip, + domain->host_data, handle_simple_irq, + NULL, NULL); + } + mutex_unlock(&msi->lock); + return 0; +} + +static void xilinx_irq_domain_free(struct irq_domain *domain, unsigned int virq, + unsigned int nr_irqs) +{ + struct irq_data *data = irq_domain_get_irq_data(domain, virq); + struct xilinx_pcie_dma *pcie = irq_data_get_irq_chip_data(data); + struct xilinx_msi *msi = &pcie->msi; + + mutex_lock(&msi->lock); + bitmap_release_region(msi->bitmap, data->hwirq, + get_count_order(nr_irqs)); + mutex_unlock(&msi->lock); +} + +static const struct irq_domain_ops dev_msi_domain_ops = { + .alloc = xilinx_irq_domain_alloc, + .free = xilinx_irq_domain_free, +}; + +static void xilinx_pcie_dma_free_interrupts(struct xilinx_pcie_dma *port) +{ + irq_set_chained_handler_and_data(port->msi.irq_msi0, NULL, NULL); + irq_set_chained_handler_and_data(port->msi.irq_msi1, NULL, NULL); +} + +static void xilinx_pcie_dma_free_irq_domains(struct xilinx_pcie_dma *port) +{ + struct xilinx_msi *msi = &port->msi; + + if (port->leg_domain) { + irq_domain_remove(port->leg_domain); + port->leg_domain = NULL; + } + + if (msi->dev_domain) { + irq_domain_remove(msi->dev_domain); + msi->dev_domain = NULL; + } + + if (msi->msi_domain) { + irq_domain_remove(msi->msi_domain); + msi->msi_domain = NULL; + } +} + +static int xilinx_pcie_dma_init_msi_irq_domain(struct xilinx_pcie_dma *port) +{ + struct fwnode_handle *fwnode = of_node_to_fwnode(port->dev->of_node); + struct xilinx_msi *msi = &port->msi; + int size = BITS_TO_LONGS(XILINX_NUM_MSI_IRQS) * sizeof(long); + struct device *dev = port->dev; + + msi->dev_domain = irq_domain_add_linear(NULL, XILINX_NUM_MSI_IRQS, + &dev_msi_domain_ops, port); + if (!msi->dev_domain) + goto out; + + msi->msi_domain = pci_msi_create_irq_domain(fwnode, + &xilinx_msi_domain_info, + msi->dev_domain); + if (!msi->msi_domain) + goto out; + + mutex_init(&msi->lock); + msi->bitmap = kzalloc(size, GFP_KERNEL); + if (!msi->bitmap) + goto out; + + raw_spin_lock_init(&port->lock); + xilinx_pcie_dma_enable_msi(port); + + return 0; + +out: + xilinx_pcie_dma_free_irq_domains(port); + dev_err(dev, "Failed to allocate MSI IRQ domains\n"); + return -ENOMEM; +} + +static void xilinx_pcie_dma_intx_flow(struct irq_desc *desc) +{ + struct xilinx_pcie_dma *port = irq_desc_get_handler_data(desc); + struct irq_chip *chip = irq_desc_get_chip(desc); + unsigned long val; + int i; + + chained_irq_enter(chip, desc); + + val = FIELD_GET(XILINX_PCIE_DMA_IDRN_MASK, + pcie_read(port, XILINX_PCIE_DMA_REG_IDRN)); + + for_each_set_bit(i, &val, PCI_NUM_INTX) + generic_handle_domain_irq(port->leg_domain, i); + + chained_irq_exit(chip, desc); +} + +static void xilinx_pcie_dma_mask_event_irq(struct irq_data *d) +{ + struct xilinx_pcie_dma *port = irq_data_get_irq_chip_data(d); + u32 val; + + raw_spin_lock(&port->lock); + val = pcie_read(port, XILINX_PCIE_DMA_REG_IMR); + val &= ~BIT(d->hwirq); + pcie_write(port, val, XILINX_PCIE_DMA_REG_IMR); + raw_spin_unlock(&port->lock); +} + +static void xilinx_pcie_dma_unmask_event_irq(struct irq_data *d) +{ + struct xilinx_pcie_dma *port = irq_data_get_irq_chip_data(d); + u32 val; + + raw_spin_lock(&port->lock); + val = pcie_read(port, XILINX_PCIE_DMA_REG_IMR); + val |= BIT(d->hwirq); + pcie_write(port, val, XILINX_PCIE_DMA_REG_IMR); + raw_spin_unlock(&port->lock); +} + +static struct irq_chip xilinx_pcie_dma_event_irq_chip = { + .name = "RC-Event", + .irq_mask = xilinx_pcie_dma_mask_event_irq, + .irq_unmask = xilinx_pcie_dma_unmask_event_irq, +}; + +static int xilinx_pcie_dma_event_map(struct irq_domain *domain, + unsigned int irq, irq_hw_number_t hwirq) +{ + irq_set_chip_and_handler(irq, &xilinx_pcie_dma_event_irq_chip, + handle_level_irq); + irq_set_chip_data(irq, domain->host_data); + irq_set_status_flags(irq, IRQ_LEVEL); + return 0; +} + +static const struct irq_domain_ops event_domain_ops = { + .map = xilinx_pcie_dma_event_map, +}; + +/** + * xilinx_pcie_dma_init_irq_domain - Initialize IRQ domain + * @port: PCIe port information + * + * Return: '0' on success and error value on failure + */ +static int xilinx_pcie_dma_init_irq_domain(struct xilinx_pcie_dma *port) +{ + struct device *dev = port->dev; + struct device_node *node = dev->of_node; + struct device_node *pcie_intc_node; + int ret; + + /* Setup INTx */ + pcie_intc_node = of_get_child_by_name(node, "interrupt-controller"); + if (!pcie_intc_node) { + dev_err(dev, "No PCIe Intc node found\n"); + return PTR_ERR(pcie_intc_node); + } + + port->pldma_domain = irq_domain_add_linear(pcie_intc_node, 32, + &event_domain_ops, port); + if (!port->pldma_domain) + goto out; + + irq_domain_update_bus_token(port->pldma_domain, DOMAIN_BUS_NEXUS); + + port->leg_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, + &intx_domain_ops, + port); + if (!port->leg_domain) { + dev_err(dev, "Failed to get a legacy IRQ domain\n"); + return PTR_ERR(port->leg_domain); + } + + irq_domain_update_bus_token(port->leg_domain, DOMAIN_BUS_WIRED); + + ret = xilinx_pcie_dma_init_msi_irq_domain(port); + if (ret != 0) { + irq_domain_remove(port->leg_domain); + return -ENOMEM; + } + + of_node_put(pcie_intc_node); + raw_spin_lock_init(&port->lock); + + return 0; +out: + return -ENOMEM; +} + +static int xilinx_pcie_dma_setup_irq(struct xilinx_pcie_dma *port) +{ + struct device *dev = port->dev; + struct platform_device *pdev = to_platform_device(dev); + int i, irq; + + port->irq = platform_get_irq(pdev, 0); + if (port->irq < 0) + return port->irq; + + for (i = 0; i < ARRAY_SIZE(intr_cause); i++) { + int err; + + if (!intr_cause[i].str) + continue; + + irq = irq_create_mapping(port->pldma_domain, i); + if (!irq) { + dev_err(dev, "Failed to map interrupt\n"); + return -ENXIO; + } + + err = devm_request_irq(dev, irq, xilinx_pcie_dma_intr_handler, + 0, intr_cause[i].sym, port); + if (err) { + dev_err(dev, "Failed to request IRQ %d\n", irq); + return err; + } + } + + port->intx_irq = irq_create_mapping(port->pldma_domain, + XILINX_PCIE_INTR_INTX); + if (!port->intx_irq) { + dev_err(dev, "Failed to map INTx interrupt\n"); + return -ENXIO; + } + + /* Plug the INTx chained handler */ + irq_set_chained_handler_and_data(port->intx_irq, + xilinx_pcie_dma_intx_flow, port); + + /* Plug the main event chained handler */ + irq_set_chained_handler_and_data(port->irq, + xilinx_pcie_dma_event_flow, port); + + return 0; +} + +static void xilinx_pcie_dma_init_port(struct xilinx_pcie_dma *port) +{ + if (xilinx_pcie_dma_linkup(port)) + dev_info(port->dev, "PCIe Link is UP\n"); + else + dev_info(port->dev, "PCIe Link is DOWN\n"); + + /* Disable all interrupts */ + pcie_write(port, ~XILINX_PCIE_DMA_IDR_ALL_MASK, + XILINX_PCIE_DMA_REG_IMR); + + /* Clear pending interrupts */ + pcie_write(port, pcie_read(port, XILINX_PCIE_DMA_REG_IDR) & + XILINX_PCIE_DMA_IMR_ALL_MASK, + XILINX_PCIE_DMA_REG_IDR); + + /* Needed for MSI DECODE MODE */ + pcie_write(port, XILINX_PCIE_DMA_IDR_ALL_MASK, XILINX_PCIE_DMA_REG_MSI_LOW_MASK); + pcie_write(port, XILINX_PCIE_DMA_IDR_ALL_MASK, XILINX_PCIE_DMA_REG_MSI_HI_MASK); + + /* Enable the Bridge enable bit */ + pcie_write(port, pcie_read(port, XILINX_PCIE_DMA_REG_RPSC) | + XILINX_PCIE_DMA_REG_RPSC_BEN, + XILINX_PCIE_DMA_REG_RPSC); +} + +static int xilinx_request_msi_irq(struct xilinx_pcie_dma *port) +{ + struct device *dev = port->dev; + struct platform_device *pdev = to_platform_device(dev); + + port->msi.irq_msi0 = platform_get_irq_byname(pdev, "msi0"); + if (port->msi.irq_msi0 <= 0) { + dev_err(dev, "Unable to find msi0 IRQ line\n"); + return port->msi.irq_msi0; + } + + irq_set_chained_handler_and_data(port->msi.irq_msi0, + xilinx_pcie_dma_msi_handler_low, + port); + + port->msi.irq_msi1 = platform_get_irq_byname(pdev, "msi1"); + if (port->msi.irq_msi1 <= 0) { + irq_set_chained_handler_and_data(port->msi.irq_msi0, + NULL, NULL); + dev_err(dev, "Unable to find msi1 IRQ line\n"); + return port->msi.irq_msi1; + } + + irq_set_chained_handler_and_data(port->msi.irq_msi1, + xilinx_pcie_dma_msi_handler_high, + port); + + return 0; +} + +static int xilinx_pcie_dma_parse_dt(struct xilinx_pcie_dma *port, + struct resource *bus_range) +{ + struct device *dev = port->dev; + int err; + struct platform_device *pdev = to_platform_device(dev); + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(dev, "missing \"reg\" property\n"); + return -ENXIO; + } + port->phys_reg_base = res->start; + + port->cfg = pci_ecam_create(dev, res, bus_range, &xilinx_pcie_dma_ops); + if (IS_ERR(port->cfg)) + return PTR_ERR(port->cfg); + + port->reg_base = port->cfg->win; + + err = xilinx_request_msi_irq(port); + if (err) { + pci_ecam_free(port->cfg); + return err; + } + + return 0; +} + +static int xilinx_pcie_dma_probe(struct platform_device *pdev) +{ + struct xilinx_pcie_dma *port; + struct device *dev = &pdev->dev; + struct pci_host_bridge *bridge; + struct resource_entry *bus; + int err; + + bridge = devm_pci_alloc_host_bridge(dev, sizeof(*port)); + if (!bridge) + return -ENODEV; + + port = pci_host_bridge_priv(bridge); + + port->dev = dev; + + bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS); + if (!bus) + return -ENODEV; + + err = xilinx_pcie_dma_parse_dt(port, bus->res); + if (err) { + dev_err(dev, "Parsing DT failed\n"); + return err; + } + + xilinx_pcie_dma_init_port(port); + + err = xilinx_pcie_dma_init_irq_domain(port); + if (err) + goto err_irq_domain; + + err = xilinx_pcie_dma_setup_irq(port); + + bridge->sysdata = port; + bridge->ops = (struct pci_ops *)&xilinx_pcie_dma_ops.pci_ops; + + err = pci_host_probe(bridge); + if (err < 0) + goto err_host_bridge; + + return 0; + +err_host_bridge: + xilinx_pcie_dma_free_irq_domains(port); + +err_irq_domain: + pci_ecam_free(port->cfg); + xilinx_pcie_dma_free_interrupts(port); + return err; +} + +static const struct of_device_id xilinx_pcie_dma_of_match[] = { + { + .compatible = "xlnx,xdma-host-3.00", + }, + {} +}; + +static struct platform_driver xilinx_pcie_dma_driver = { + .driver = { + .name = "xilinx-xdma-pcie", + .of_match_table = xilinx_pcie_dma_of_match, + .suppress_bind_attrs = true, + }, + .probe = xilinx_pcie_dma_probe, +}; + +builtin_platform_driver(xilinx_pcie_dma_driver); diff --git a/drivers/pci/controller/pcie-xilinx-common.h b/drivers/pci/controller/pcie-xilinx-common.h index 015dba3..986e9bf 100644 --- a/drivers/pci/controller/pcie-xilinx-common.h +++ b/drivers/pci/controller/pcie-xilinx-common.h @@ -19,6 +19,7 @@ #define XILINX_PCIE_INTR_PME_TO_ACK_RCVD 15 #define XILINX_PCIE_INTR_INTX 16 #define XILINX_PCIE_INTR_PM_PME_RCVD 17 +#define XILINX_PCIE_INTR_MSI 17 #define XILINX_PCIE_INTR_SLV_UNSUPP 20 #define XILINX_PCIE_INTR_SLV_UNEXP 21 #define XILINX_PCIE_INTR_SLV_COMPL 22