From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D7CC44317C; Mon, 16 Oct 2023 11:16:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DE4F402D6; Mon, 16 Oct 2023 11:16:50 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) by mails.dpdk.org (Postfix) with ESMTP id C7922402BD for ; Mon, 16 Oct 2023 11:16:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXNsOLnxKHRZPoSloKODaQC7pjAQWGcAFilEm8OhTt9FotdKx81nXoYtsfK/ixLjmIxcrZTjpPrTPtfaxT6I1UWGFviDPjFwn4tHKQZLZ1vzu4Qb2u5YOTswaVd7LoN09J6bVjao7Q6ufirbfEPoqu0WNZLcoEy6hLFaiTotl287lpfB1esIqcfAGb88K5r5nOgVUZoYePZ4OOV48itTzPjBNPs/qwPXo17BV2vCWnybLXxAByXCnal9KjmGKNdlNoYw+5xiKy5hjeFsk+qRPzdUWEE508xZlHZanuysEzT43EXAJmGUYSxt25DZPLjplZhFvRf/RJrDHjsDuuXX6w== 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=Fmh18bSUetn5cvIdaGuQdoZLG3L8LlRn/y0cHbEmzxQ=; b=OL9auHKMnxRGWT7jQ8lK9nv4v6DUFBVzR4y12mb5GhrXWSEbd7NX/BcgEXQZ4KurpZ1GKsE9JCCHdLNaI7ygsUkvvf0EQQPiMjOvS60LPofkE5UHWiQwsRPIzplwzH5/QBStBPX1r5fIfuAG4Zmg/Ke3flf5xEvSNOwAf05Ff8OHkwcN57po2RBHWKjmyGJW2wY8PmJr3IxKXl71kRAbPtDlzcIW9/j8Elvi7ZMWnLU3+5jhPuXfpHLmJmkamKamV739hWR8PPRK/qLePx0o+VsbpNgqWXLB92HVY8EBFkqM9iZTaiQ4e/UoV9aIsiRlSQbKnDNQbBLhUqWVg8hzsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com 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=Fmh18bSUetn5cvIdaGuQdoZLG3L8LlRn/y0cHbEmzxQ=; b=1XRKy3Ac2Av/DtCupQ5jYOWv96yEu/BKH8I5dBWBkQWPUNrsKQ1rrJtOBr8lIa0vbojgAuVYOQqF46F4gk4NfSAo0R0lPLOMCICVYx+v0deirfIUYLUqk7JpNL4RNOz0vuZe1+QxIPJMKZQQuaQsNqWYggd30Vg7vfobATIURuM= Received: from SA1PR04CA0012.namprd04.prod.outlook.com (2603:10b6:806:2ce::15) by DS0PR12MB8502.namprd12.prod.outlook.com (2603:10b6:8:15b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 09:16:47 +0000 Received: from SN1PEPF0002BA4C.namprd03.prod.outlook.com (2603:10b6:806:2ce:cafe::7) by SA1PR04CA0012.outlook.office365.com (2603:10b6:806:2ce::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 09:16:46 +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 SN1PEPF0002BA4C.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 09:16:46 +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.2507.27; Mon, 16 Oct 2023 04:16:46 -0500 Received: from xhdipdslab61.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 16 Oct 2023 04:16:44 -0500 From: Abhijit Gangurde To: , , CC: , , , "Abhijit Gangurde" Subject: [PATCH v4 1/1] bus/cdx: provide driver flag for optional resource mapping Date: Mon, 16 Oct 2023 14:46:34 +0530 Message-ID: <20231016091634.2770946-1-abhijit.gangurde@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626103958.3139-1-abhijit.gangurde@amd.com> References: <20230626103958.3139-1-abhijit.gangurde@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4C:EE_|DS0PR12MB8502:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ef72a15-9aeb-484e-668e-08dbce289f35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1VHyoGa5uV1+uvx31gn1TU1OdQws7Y2tnCa8ZKqR7vEddsjNiSzY+SXI+p7fvl5iU7v3iQtlVCNWMRzlFGqpjMsaSj7Zj8ICDomrRvpRX7NA7ncMP+3oBxs483UMh2Mdu+hsLoZW4NZE6nSe9cA5eeBIiSSTpnJb/6n8wjf1FAaoqmlvdJHGDkBnqfAEBdEljqs36byNWrq1C/ZvWQE5rqEgtUp1pjtrSmD2FQjLUg80aSlu5bRyyCZq+Q/OkzG7EEBqcQSz3iu9vE74vu0BBFEdcsXl1UEIH4EvYHCokC1CFyw+loXQmewBmEsbZo0saxPbiyJd4VM1Jqhgy+mjn4QaQyQ1IZCWzXhmXUJxg2HJk+n5y8fodnUEO0vunMMriZQmDhQbe5H/ZoYb9qgfp0O2uCVcsS84NEdHBsewqFnAmSv1cojvMPPcdXjoAAGl4VLo8vD+q5WG1N3uG08Xg1EhGSOmEjEGKtrC0j+jw0fxaH7Q1cucLPv4tZp9gsnxyzUEZTwntHowWu5UbljYb5RUp83l4tBgcIpmuqvGmCIfaeY72A6ztGAhxgN/xoG98JNbOAWTrkYfjpzgDfFdDWf65VhjgkdyI1rbLG4n2KhO4TQHCfHwo7q67N4hJ8nmlDEHiz6mWcPAeSXUaqg4PFOlNxBAlMHsbkFh1yNfZO7HDT+rXSjtxDvWlc2Qfp/EFh6usOqraJ4AGBHBUVo1ZDauWGJ7xfY2XgNgDPl0M0XlbJL8y4raxH/l31+uHu2caLPubCxswbyic9v9BIx+hQ== 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:(13230031)(4636009)(39860400002)(346002)(396003)(376002)(136003)(230922051799003)(64100799003)(82310400011)(451199024)(186009)(1800799009)(40470700004)(46966006)(36840700001)(40480700001)(44832011)(41300700001)(4326008)(8936002)(8676002)(5660300002)(2906002)(40460700003)(86362001)(36756003)(82740400003)(26005)(81166007)(1076003)(2616005)(356005)(83380400001)(6666004)(426003)(478600001)(336012)(36860700001)(47076005)(110136005)(316002)(54906003)(70586007)(6636002)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 09:16:46.7522 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ef72a15-9aeb-484e-668e-08dbce289f35 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: SN1PEPF0002BA4C.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8502 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 Provide driver flag which gives an option to map the cdx device resource before probing the device driver. External driver can use rte_cdx_map_device() and rte_cdx_unmap_device() APIs to map/ unmap device resource separately. Signed-off-by: Abhijit Gangurde --- v4: - rte_cdx_map_device() and rte_cdx_unmap_device() APIs are kept as internal APIs. v3: - Changed APIs to __rte_experimental. v2: - Corrected _RTE_BUS_CDX_H_ to RTE_BUS_CDX_H - Improved code comments. drivers/bus/cdx/bus_cdx_driver.h | 3 +++ drivers/bus/cdx/cdx.c | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/bus/cdx/bus_cdx_driver.h b/drivers/bus/cdx/bus_cdx_driver.h index fcacdb5896..1c9a64c87a 100644 --- a/drivers/bus/cdx/bus_cdx_driver.h +++ b/drivers/bus/cdx/bus_cdx_driver.h @@ -37,6 +37,9 @@ struct rte_cdx_bus; static const char DRV_EXP_TAG(name, cdx_tbl_export)[] __rte_used = \ RTE_STR(table) +/** Device needs resource mapping */ +#define RTE_CDX_DRV_NEED_MAPPING 0x0001 + /** * A structure describing an ID for a CDX driver. Each driver provides a * table of these IDs for each device that it supports. diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c index f9526e08cc..541aae76c3 100644 --- a/drivers/bus/cdx/cdx.c +++ b/drivers/bus/cdx/cdx.c @@ -383,10 +383,12 @@ cdx_probe_one_driver(struct rte_cdx_driver *dr, CDX_BUS_DEBUG(" probe device %s using driver: %s", dev_name, dr->driver.name); - ret = cdx_vfio_map_resource(dev); - if (ret != 0) { - CDX_BUS_ERR("CDX map device failed: %d", ret); - goto error_map_device; + if (dr->drv_flags & RTE_CDX_DRV_NEED_MAPPING) { + ret = cdx_vfio_map_resource(dev); + if (ret != 0) { + CDX_BUS_ERR("CDX map device failed: %d", ret); + goto error_map_device; + } } /* call the driver probe() function */ -- 2.34.1