From patchwork Tue Jun 6 10:02:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Nipun" X-Patchwork-Id: 128193 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 84B3542C3E; Tue, 6 Jun 2023 12:03:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E68840697; Tue, 6 Jun 2023 12:03:14 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by mails.dpdk.org (Postfix) with ESMTP id ED2CB40223 for ; Tue, 6 Jun 2023 12:03:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZAHXfYf52qRyYB8CijqanF+nD1kmhYH9ISS3I6onR2eJlHR0LUilQK5hAbJHUI+csdRil5gYXhCK4qbpwF6IUxTDwhuDMua5oP5QjXG3CiLv7I73WocvybG6K+hxQ2PVhuTdISNDPO7auayZgXD4cqg1SixjoIJldVbY8WDnIKE/lxLMmxit2HRsv8VEQz5tJHQglfsnYzCXweshP0QGzrFXkyy2GwxuYt+zsrg0rRaE69+0UoeuuE7dMzYbimpTmT2Zw8GoYpYpmxia37HBkSDZq0Bo1K1CmQPHo799xBdxOOHbp7JpD/4pFa15pNDUxGMrs+D9GHEcGoQbwlrPbg== 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=0wR+ohPh7z4tx15NkTaiJCEDZQFPvhc8LoRgkBezQJI=; b=EYS5X1+cQmq6ubhaH+y3T/zEYtOEvgqZ8Ld9yR/8CVrpH0qBEBkZp/s/DSdx/OsxYnIJhsLh4F9tKEuVGzizjxsdWOuaTqSn8J6av/RJczCv/e6Tm0NN7fwTAaNiD93zk/OmtfhW04p59wId3XlPZLi/6kHgf31FFe4uPQY5acYS2I1ox4r1CCnh9zlmvAcm7lQSH+5/CB8KNA9JefiRhM90e0rD2e03Q1Yc1UcKN+iWqbBW8GXr53oh+Y7ZE/t6gNs2Dqw2u7HItb3eAyFjzNkm7zHEejzbKzBqjM+/CfePhvv1I5upm2HXkta+a1N/YuNnClZ38N4yfOgaVTu9jA== 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=0wR+ohPh7z4tx15NkTaiJCEDZQFPvhc8LoRgkBezQJI=; b=CN2E9rVP1Jm5dbkUJjkW9TJ+m8cz2CAkdWAzGFOLGm/w0mlTP2W4jwZy2lNW2VurCSmP1XkaAGs6WAijA9JgkjwA8DOKMqYef0llwT2OY6BgV7L5K2K5L53fktQ06eJNA8wD5aCv0njUlqRreiVoF8CEGyNy1GmjmuS56P2Wjg8= Received: from SA9PR13CA0088.namprd13.prod.outlook.com (2603:10b6:806:23::33) by DM6PR12MB4250.namprd12.prod.outlook.com (2603:10b6:5:21a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 10:03:09 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10b6:806:23:cafe::43) by SA9PR13CA0088.outlook.office365.com (2603:10b6:806:23::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 10:03:09 +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 SA2PEPF00001507.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Tue, 6 Jun 2023 10:03:08 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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; Tue, 6 Jun 2023 05:03:08 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 6 Jun 2023 03:03:08 -0700 Received: from xhdipdslab41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 05:03:05 -0500 From: Nipun Gupta To: , , , , , CC: , , , Nipun Gupta Subject: [PATCH v7 0/4] Support AMD CDX bus Date: Tue, 6 Jun 2023 15:32:54 +0530 Message-ID: <20230606100258.26532-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: SA2PEPF00001507:EE_|DM6PR12MB4250:EE_ X-MS-Office365-Filtering-Correlation-Id: d1f63e04-4a03-44a8-4df1-08db66753b03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qqPwnlwgI7T1s4FBl5n881e8bC84VvuOeZESa/rs4xEpnVd2jRHIVk2uc7tMIH/8zZC+KDijnK/CF0g+llTlw6S3edB14h2TgR6fEn8820d+bsZ2hrAdd8UGwhfYgadSEo0nkJTEzdpf9jJaTWp7T8WtDaCkpOrFavHoKF3vUNZk6W9ZkzlZY28+9Ne6NG9z/i6+VmAspX2W5BhLL/Y2FBrGdR3/Mi99sQbzKlRvoj3PS7jaa9yqjHAbVmhgdK9vb8dDUhRWm85j8kpRn2I1/JtJXvXSdrzxWLaPsIQbzhh7D6Dm8cdwJwxvSYU99Hn1l0mjMxzzDO5JnkIt1zp+fHTlnrzyHvOff+cvMZZ7Svr5K34z8E8Snu4pJpCtnJns/12t/oSQhBLrEgoMvcyrDeNOBcjEVB32CurRHp/dWBcYayO5jCK+X9J9c5UhfcHS8yriw9ZfTuocuB1K6tm7Lsbp+cziynmoACjHwkWt9Y88Xji3bW3MadCTjwMwvLF9/yOShohv1vwa5sRVrCAaV9QULoRoNTtWlj+cSv15w6o6VHt/ocMyQltVmzOaH9nQ2HcOCnr5k8gvmaHrKVNddipe8MAVRPW0KPmu0VfOICqj8gUNXnam+jMWGvLHbRDeQuVHFLO/M9uUQegYxXnQTz9TzbTumTl2SzIeBrYRp+eN9rNJDIi8QW22Fl/K02/d+Cb1pY2LbwJC+rvtI2VnTOV9/mQ2saWOjvgWwa0QAL1lTzXdWFNNXBV6KsPBOL8n86EoDxlnatRJ1R3gkmmI8G+lU1w8UMBzTiIQtU8RDcdeiSoZfBUBE52KcP546f6DB5Vj23VUZzuFIyzv8ilvQQ== 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)(376002)(346002)(39860400002)(136003)(396003)(451199021)(36840700001)(46966006)(40470700004)(8936002)(478600001)(6666004)(70586007)(426003)(83380400001)(70206006)(2616005)(4326008)(41300700001)(336012)(8676002)(316002)(54906003)(110136005)(5660300002)(966005)(86362001)(36860700001)(47076005)(1076003)(186003)(26005)(36756003)(40460700003)(40480700001)(44832011)(2906002)(82740400003)(82310400005)(81166007)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 10:03:08.9554 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1f63e04-4a03-44a8-4df1-08db66753b03 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: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4250 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 v6->v7 - removed redundant references to rte_cdx_sysfs_path(). - Fixed naming of cdx_vfio_setup_device() API from the first patch itself. - Added dot after few sentences in comments. 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 | 192 +++++++ 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 | 12 + drivers/bus/meson.build | 1 + 10 files changed, 1583 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