From patchwork Mon Jun 5 13:26:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Nipun" X-Patchwork-Id: 128141 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF59042BF1; Mon, 5 Jun 2023 15:26:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33B784021F; Mon, 5 Jun 2023 15:26:35 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2059.outbound.protection.outlook.com [40.107.95.59]) by mails.dpdk.org (Postfix) with ESMTP id 4A30D4003C for ; Mon, 5 Jun 2023 15:26:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K2uLeLKxSenhCN77rmxVrcpuiTOGM9zL87pVBLaZTJKDIbPpQzmQnNA6RGpbQyeis6pv1J5TTV0GUxMbm18R5y548LqjUV5On49mT5hqpfSo+wneBTcJtDgdkQNw+47BvT0JXNuEXh1qThI80ktLy9x+XkyHygI1XA/DrdToEOGvZ0cqx7k+wtKTtkgGkjWOiE++fPeyGikBpawdLZCvae0ZMwD3TP4nCV0FYpL24+MSFsm3PijB8aiZzZbyMXVEbAr7OMjRD80nLYkSODAtNqfooziakM0hAhxap5Qp20GkZ/mXT8uTCU2XB0UFxn00Lzzdf7EzDxoMkXvBepIBbA== 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=kgKDHUF1wLDeKaLuNC01pNFtEhbMnbNldDhIUzHyX3M=; b=IT3rS6c+7sluBhMBjDEC1lac1O6A7hlA6kTFW94n/snaogyO4ol+q7OsRdKkGYiThYmqfUSehEm1UadF+PcREuXDMmvNd0LgAbPV5CjhMv8vulyw3ZsRaqPYqNZO0TQdwQ+sCED2Hx+lFZrJNhFrsQRFwnBkHN+3Zjuis0RVEUv6+8/2pDbkBl/WfRzaZ96nY8SPoHrexbHY7mWw45CrITGfnPoq66lkd4p3fzcHC6kvSzJpb4Ff4HAtpyQBtQa+iS+D17VvMT28UTtqq9NLi8sfXiVx7Wc9J33X3xDJ2PfnIpNwQgXq8RmlTbgDTsdiDwAxcpN+xQxJisvyHEBHwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.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=kgKDHUF1wLDeKaLuNC01pNFtEhbMnbNldDhIUzHyX3M=; b=sZ5D7BEKZwlmSo0TmaZ8qGNB8BRta8NYE6KBgsnGMbSOkYhj/mrED0n85mNgRgXgdl1EsYQdzlQKai6ONeXp4YZsUHuTmiZMxJy5BiQ9/avPoEUpaUQmHOszZcUl7KjzkTW8S9kqEE0+KPhF4ZaOxH/cOhbFTXWotUYR4dljnc0= Received: from SJ0PR13CA0172.namprd13.prod.outlook.com (2603:10b6:a03:2c7::27) by IA1PR12MB6209.namprd12.prod.outlook.com (2603:10b6:208:3e7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Mon, 5 Jun 2023 13:26:32 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10b6:a03:2c7:cafe::e8) by SJ0PR13CA0172.outlook.office365.com (2603:10b6:a03:2c7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Mon, 5 Jun 2023 13:26:31 +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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Mon, 5 Jun 2023 13:26:30 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Mon, 5 Jun 2023 08:26:30 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 5 Jun 2023 08:26:30 -0500 Received: from xhdipdslab41.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; Mon, 5 Jun 2023 08:26:27 -0500 From: Nipun Gupta To: , , , , , CC: , , , Nipun Gupta Subject: [PATCH v6 0/4] Support AMD CDX bus Date: Mon, 5 Jun 2023 18:56:20 +0530 Message-ID: <20230605132624.8626-1-nipun.gupta@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230124140746.594066-1-nipun.gupta@amd.com> References: <20230124140746.594066-1-nipun.gupta@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|IA1PR12MB6209:EE_ X-MS-Office365-Filtering-Correlation-Id: 31e28cbb-c27d-4d79-0d14-08db65c8798c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HyAssGfD7fWhkDXIJs/QKUFWcACpxaEOxdC6Mkh/GR994fE2jDebTMTWN9Xp6HHrio6jZ3FF3gexxKCTrEQc0xxZ9JhHWNJ8lzvzQAOz/Cgw5RLio9L1br4RIQ7lgRfW1rUv5BdsWi/gCvS0vG530BYRgyQ9/9oYayRG8m1QhfUojWTdlPGBVaXFn2CNGSh9AF65Vwwxxh+kerwSQ6/1artd3lB9TuK647nllazjnAvNWYDLQD5FatQqVa7C/AU2OHEJ5wUPSLxQz1ZNVKNVPyk+f1x+mWOyOz5qAjzJDK/rraD02hUGDlpqOZXIfsSQZ/OTQPHyN0GA+9gCxya/KWoRCOgXs43FU8yZUbAoMq4phVEIegUgcVb1JhiIQVM5Wqp4NH7JAautozDQaVlAYAM63e/LK4c+loo/gG7u8boBLmGcKbZ0c+CMed0VVE3OvyIj89EHnCQLZTN8m63waGiMVoifbD0I6YtmsDh8DPbuDkG+8Oh+049bjQ0L4SZFt88WmOaBPIdMLCqIfLGXUzETSN1dhflBGGW2Wo3QNN/35A/aBKfhneB+r7NjUyO/OI8Ex+V+ynKu1qscM4+6MLDQ8GsGZLRjJkZ26+Ft01rpG+V4zrHgo0SZOe4Bvp4UT2jPPsumsccbpDmYU8xJ1IIoAvnx90X35/3yKwYvGDlY25ah7ZnzG0DEaleenzH4wVCvRBGVuwsXr282FCoQ9SlvBz8YuaLZuMEqixWC4onpoIYzaUjg8GsKut2NPXR4 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)(396003)(136003)(39860400002)(346002)(376002)(451199021)(46966006)(40470700004)(36840700001)(54906003)(110136005)(40460700003)(478600001)(40480700001)(5660300002)(8936002)(8676002)(44832011)(36756003)(2906002)(86362001)(82310400005)(4326008)(70206006)(70586007)(316002)(81166007)(356005)(82740400003)(41300700001)(2616005)(1076003)(26005)(36860700001)(186003)(47076005)(966005)(83380400001)(6666004)(336012)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2023 13:26:30.9518 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31e28cbb-c27d-4d79-0d14-08db65c8798c 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6209 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The CDX devices are memory mapped on system bus for embedded CPUs. It uses sysfs interface and the vfio-cdx driver to discover and initialize the CDX devices. The CDX bus and VFIO support is available at Xilinx/AMD open source tree: https://github.com/Xilinx/linux-xlnx (drivers/cdx/ and drivers/vfio/cdx) Linux AMD CDX bus patches has been added into linux tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/cdx VFIO patches are also submitted in upstream: https://www.spinics.net/lists/kvm/msg310623.html CDX is a Hardware Architecture designed for AMD FPGA devices. It consists of mechanism for interaction between FPGA, Firmware and the APUs (Application CPUs). Firmware resides on RPU (Realtime CPUs) which interacts with the FPGA program manager and the APUs. The RPU provides memory-mapped interface (RPU if) which is used to communicate with APUs. VFIO CDX driver provides the CDX device resources like MMIO and interrupts to map to user-space. DPDK CDX bus uses sysfs interface and the vfio-cdx driver to discover and initialize the CDX devices for user-space applications. Changes v5->v6 - Removed newly introduce irq_count parameter, and use num_intr instead. - Removed rte_cdx_sysfs_path(), and directly used the macro for the sysfs path. - Removed few unrequired param checks in multiple APIs - add name variable in rte_cdx_device - moved rte_cdx_bus from bus_cdx_driver.h to private.h - Other code cleanup Changes v4->v5 - Split patch and have a separate commit for eal interrupt field (irq_count) and corresponding set/get APIs (rte_intr_irq_count_set, rte_intr_irq_count_get) - Renamed "CDX bus" to "AMD CDX bus" in documentation/commit headings - Removed unnecessary headers Changes v3->v4: - removed platform specific patch (adding config for ARM CDX) from this series Changes v2->v3: - merged cdx bus compilation enablement in the first patch - fixed issue reported by check-git-log.sh - updated release notes - updated offset to uint64_t instead of off_t in cdx_map_resource Changes v1->v2: - Moved file rte_cdx_bus.h to internal bus_cdx_driver.h and added this file to deivce_cdx_headers - Moved cdx.h to private.h - Removed rte_ prefix from the static symbols in .c files. Changes RFC->v1: - Marked few API's as internal which were not required to be provided to user. Nipun Gupta (4): bus/cdx: introduce AMD CDX bus bus/cdx: add DMA map and unmap support bus/cdx: add support for MSI bus/cdx: support plug unplug and dev iterator MAINTAINERS | 5 + doc/guides/rel_notes/release_23_07.rst | 6 + drivers/bus/cdx/bus_cdx_driver.h | 201 ++++++++ drivers/bus/cdx/cdx.c | 666 +++++++++++++++++++++++++ drivers/bus/cdx/cdx_logs.h | 37 ++ drivers/bus/cdx/cdx_vfio.c | 598 ++++++++++++++++++++++ drivers/bus/cdx/meson.build | 13 + drivers/bus/cdx/private.h | 53 ++ drivers/bus/cdx/version.map | 13 + drivers/bus/meson.build | 1 + 10 files changed, 1593 insertions(+) create mode 100644 drivers/bus/cdx/bus_cdx_driver.h create mode 100644 drivers/bus/cdx/cdx.c create mode 100644 drivers/bus/cdx/cdx_logs.h create mode 100644 drivers/bus/cdx/cdx_vfio.c create mode 100644 drivers/bus/cdx/meson.build create mode 100644 drivers/bus/cdx/private.h create mode 100644 drivers/bus/cdx/version.map