From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.201.69 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796296120; b=dE1qxNNP1HFs6NPxTXikUqoFzwUzeJ/+XYwpJifFFHq0wBufP9HOfE+SQHyNqeMsi5w6 enc2epk81SZSy7haYAS+aqM3z+pq7zO9oPfFlb+FVU9h876mhJA/X7HZmrLMvC7BOH+mX ZzYQe03a744khNp62cyECjK7Zk2MSrpVw4Fg2NF2bo6gyz/g8WkpJa44gthfoq1yHiizK Uds3SCx7DBeyjdpYrlmEhaeJlTcR2YAU001BUuCWj3c1/MzK9Ih98R4FO4TYEVBEW+X+/ qoBjyKkxEQqfOoqQ+IhBjt20xzEZ65uJa3kcQz4ilJTGHKL0FzTfdthVSYV17qmTUMg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796296120; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type: X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=yWx4gwW+kPFrI3weAxOl6MIN46WoutkPK1uNladR0XI=; b=Qzu8fy0ERFVoHpqtcgjq1ShdWFZn2AZUowlsuvOFRRyfoPUfTTmcxgS4tz7UEQXTdH22 lcKWzsx+9JvJOvOr/fqHstrP3VQf7GtRQQLlh6//KxIEQVobFc0O16R+kBYccswrTbJwS usrMrZfVcMOkYmUPbHbwPNG9Lz2+DGXJQ61bJaaNZg8nYlqH8RtpdpQCumQauxmz/QG0L yvilb3JQ6ScGZPhhiKrN8A7ESITyvjryVBcbNkh4wm9iVwvbuEfGkTKdc2Yznpjqp+IlP p5toC/Fo6iBETtdU4V5Dhe01OCgL7lNd4FHDqkiJQ+3+/ndvg4/swPgpRoGz3vb/9yg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=nt2M1sV2; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.201.69 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010069.outbound.protection.outlook.com [52.101.201.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48AE5606A32C; Thu, 3 Dec 2026 11:08:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 48AE5606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=nt2M1sV2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Zhmr/1GSIVJCJ1ID6MIeCp3m4dY8shHNv5EzoczQBVbgXLWmFbJ5Kik98OYiENhws34x1csoJ2TWYKasgGP7eyiOE9TfzaNBk6Y4u52CcpE6/s6+/W+xetqrp8bW1T3xcW5Qw7I38AygCg9Sa9JQGOY3wYu83qYzkBRZGsgAQAeqR+ezsZ/dlT75vrkwJLvlxq0xYJom2erIyPqg62CB9pKmgA1WMf/JJQCjul6l8PywckcwTwyzZ2eiwDGMidXe3pc1ZOS9lcmDMo8bvyegHvqQeq370474ugKjAeoSpuA02XhRt7CaloA7NbxiQ+YfBhZJSV/oQZKzx8JnJ9YMtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=yWx4gwW+kPFrI3weAxOl6MIN46WoutkPK1uNladR0XI=; b=f4kL7v7qXM3BS/OEivFNWuP9PROr8r7iUylGuIAwvCUVNiUZEPLnnvX70zyHNq+mOAni+HeWAvIx5BwXDddVUnQ8P0RjnGVw7ByYx5Q+FyW4/Lg7aN11eCJOMR6bkQSTktMBU03RvaHCL4AUqM/aJ1499y3JclSQ68bpd2SNp11XphaN7CBy8hrovtxg9/g40ddpELJXxpBVC4+51jjrzgAJ6J1on+U4Gfp8Eztux0iCZwoeNECdBdaj7IwjGBEws0d1qFxSMzXR4fG6J/oDGcncoUR8BuXFnE4/eN+0CLf5RiDxpilLiPkHBp4zr5ZQOOlU4yC8UAhL2sQs8q+fgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ziepe.ca 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 (0) 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=yWx4gwW+kPFrI3weAxOl6MIN46WoutkPK1uNladR0XI=; b=nt2M1sV2GKQ84l7FGbXfuMskK3wbQhR72guXVcFkXhwLS88X4kqkeG3/oASrfwWPoiscNfS2EJD5E9efwjbOHObW/FYRRH+dM1VNgMjnT/e2OLo0bCbvQ4kCesUbleqj9615Eopj+TyeBzCs+7wJnrPSXvCzgOWhsJ9o2bTDpEc= Received: from CH2PR18CA0059.namprd18.prod.outlook.com (2603:10b6:610:55::39) by PH7PR12MB5854.namprd12.prod.outlook.com (2603:10b6:510:1d5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Thu, 3 Dec 2026 11:08:35 +0000 Received: from DSM2EPF0000000C.namprd02.prod.outlook.com (2603:10b6:610:55:cafe::a9) by CH2PR18CA0059.outlook.office365.com (2603:10b6:610:55::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.12 via Frontend Transport; Thu, 3 Dec 2026 11:08:34 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DSM2EPF0000000C.mail.protection.outlook.com (10.167.23.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Thu, 3 Dec 2026 11:08:34 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 05:08:31 -0600 Received: from xhdipdslab46.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Thu, 3 Dec 2026 05:08:29 -0600 From: Abhijit Gangurde To: , CC: , , , , "Abhijit Gangurde" Subject: [for-next v4 4/4] RDMA/ionic: Accept QP SQ and RQ rings as ioctl umem attributes Date: Thu, 3 Dec 2026 16:38:05 +0530 Message-ID: <20261203110805.2577721-5-abhijit.gangurde@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261203110805.2577721-1-abhijit.gangurde@amd.com> References: <20261203110805.2577721-1-abhijit.gangurde@amd.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DSM2EPF0000000C:EE_|PH7PR12MB5854:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f28bf2d-9ed5-47d0-2dc8-08df512dc5ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|376014|23010399003|1800799024|82310400026|10067099003|56012099006|261021123027099003|261009223027099003|261021135927099003|261021121427099003|261102123227099003|261026121527099003|18002099003|22082099003|5023799004|11063799006; X-Microsoft-Antispam-Message-Info: 4nE/IG2jhJk6qnxGxWClegas3uNG9ML8Xe5zqLpVv9F1gEvN++iA8Bo/NF4HEgSrWwpvQHzIoIryFtfktrd8UIpFjhWZgK1T6SKj8cO9niEDgR4rlMfgJdF/GXnZ0pA4l7aRlValYiyS0z0yaSpRUdCHKZ6yFsIRvWZZ1cO770OpRg+o6eS5suFgj1/On++KCw7jqANxs/FPeS/eOp5lAVFDocAMOk23mjgRaETXsWnhdJTh9o6szLx50gLXQVG+cM9q+gv7DhZn72i/48u+hc8oc3ssQaP8euk5LlNgRR2cZTi5fOTt7ChWleOtf6+kOurloYGOqge8fuFo0c6kzrRfo85hlcoj6SFvjLX7Qrx1wUgxmGElCK/c5T9nxWjm9InqwkI7BGfljx+gcpopHdSNs/d3HEsmhpj+Kbw34O29kijjYOASWHmmTyF22iP4VTSA5VLigDcU1yEdmIh64jcFXTqyqFYm5ojY9umVxQcakyPX1TTHDoT1+KbT5UpAU49lk8AJ0msJjCxD3mN2vFLf269Lb4zHEjaV/OHYF3x2d5oguJ5RaEWhzwLFUxfExwVKqrbvAa0dArcicMQiHDWmIc/6Q89eTokcSoNSzYQwjInCBVd5o3Pjaq8eDDFUeCxFPL9CVqJir9fdoIZggpfcYNYtVZGsMHnDgePTxz5Kb63mcprZpE684aplWxXBPF6dyuxntvRLWBao9CtXyw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(376014)(23010399003)(1800799024)(82310400026)(10067099003)(56012099006)(261021123027099003)(261009223027099003)(261021135927099003)(261021121427099003)(261102123227099003)(261026121527099003)(18002099003)(22082099003)(5023799004)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vcvCiWYXYm6mKrRydIH81rfezOJ7vwvcgTcQJpV3Fp0cTf8DyFZppsjmufabEPMibhRRlTpZ/WVge7+n3rMY3GN4SHm6TDbAIOE4EH+Cw2usO6LGZ5x7THnRJ+KlTlSeZPWw2rofnR2rHJ8x6AmwA2qluCOo6NUlkCnxxjjBBCZgZJOR2ZbrGC/8pU9THpB0OggABcynIPtiBO3FKKh8+f7uSq30aHTe1imiIUDpzJejB/eGyvB19IAhqQxbJdVkTAZ6FhTndAvx/adLgwDeNlE75MB5MGUFudT7Jp0nufeKELFvDWlcty6a7ZsszazBQfNxCYvrm/PWgd65lrmEbJ6d1z/E6DtFeP/ulO4WFTTfk7Y8pFP5nIZ9IVewIT88Yy5NEYzgRZBVr7ECen9onVLt+rPsiNxss2aZT7RTTC8CZecwgPdgHfQ3maq4roUA X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 11:08:34.6690 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f28bf2d-9ed5-47d0-2dc8-08df512dc5ff 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DSM2EPF0000000C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5854 Userspace passes each QP ring to create_qp as a struct ib_uverbs_buffer_desc on the core attributes UVERBS_ATTR_CREATE_QP_SQ_BUF_UMEM and UVERBS_ATTR_CREATE_QP_RQ_BUF_UMEM. Those attributes are already optional on UVERBS_METHOD_QP_CREATE. The get_context bit IONIC_CTX_CMASK_CQ_QP_BUF_UMEM tells userspace it may send them. ionic_get_user_q_umem() now pins a ring with ib_umem_get_attr_or_va(). The core resolves the descriptor, so the ring can be a virtual address or a dma-buf and the driver does not look inside it. The qdesc address is not used when the attribute is present. Without the attribute the ring is pinned from the qdesc address, as before. A ring passed in the attribute must be exactly the qdesc size, so the page table given to the device covers the ring and nothing else. Any other length is rejected with -EINVAL. Access is 0, so the VA mapping direction stays DMA_TO_DEVICE. SRQ creation passes no attribute bundle and still pins the qdesc address. An SRQ QP still only checks that the RQ qdesc is zero. ionic_qp_req is not changed, so a provider that does not send the attributes still creates a QP on the write path. Signed-off-by: Abhijit Gangurde --- .../infiniband/hw/ionic/ionic_controlpath.c | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c index c3a47aa108e4..a2a191f2af78 100644 --- a/drivers/infiniband/hw/ionic/ionic_controlpath.c +++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c @@ -2009,7 +2009,8 @@ static void ionic_qp_sq_destroy_cmb(struct ionic_ibdev *dev, } static int ionic_get_user_q_umem(struct ionic_ibdev *dev, struct ionic_qdesc *q, - struct ib_umem **umem_out) + const struct uverbs_attr_bundle *attrs, + u16 attr_id, struct ib_umem **umem_out) { struct ib_umem *umem; int rc; @@ -2018,12 +2019,13 @@ static int ionic_get_user_q_umem(struct ionic_ibdev *dev, struct ionic_qdesc *q, if (rc) return rc; - umem = ib_umem_get_va(&dev->ibdev, q->addr, q->size, 0); + umem = ib_umem_get_attr_or_va(&dev->ibdev, attrs, attr_id, + q->addr, q->size, 0); if (IS_ERR(umem)) return PTR_ERR(umem); - /* The ring is given to the device as whole pages */ - if (ib_umem_offset(umem)) { + /* The device is given whole pages, and only those of the ring */ + if (umem->length != q->size || ib_umem_offset(umem)) { ib_umem_release(umem); return -EINVAL; } @@ -2035,7 +2037,8 @@ static int ionic_get_user_q_umem(struct ionic_ibdev *dev, struct ionic_qdesc *q, static int ionic_qp_sq_init(struct ionic_ibdev *dev, struct ionic_ctx *ctx, struct ionic_qp *qp, struct ionic_qdesc *sq, struct ionic_tbl_buf *buf, int max_wr, int max_sge, - int max_data, int sq_spec, struct ib_udata *udata) + int max_data, int sq_spec, struct ib_udata *udata, + const struct uverbs_attr_bundle *attrs) { u32 wqe_size; int rc = 0; @@ -2079,7 +2082,9 @@ static int ionic_qp_sq_init(struct ionic_ibdev *dev, struct ionic_ctx *ctx, return rc; if (udata) { - rc = ionic_get_user_q_umem(dev, sq, &qp->sq_umem); + rc = ionic_get_user_q_umem(dev, sq, attrs, + UVERBS_ATTR_CREATE_QP_SQ_BUF_UMEM, + &qp->sq_umem); if (rc) return rc; @@ -2294,7 +2299,8 @@ static void ionic_rq_destroy_cmb(struct ionic_ibdev *dev, static int ionic_rq_init(struct ionic_ibdev *dev, struct ionic_ctx *ctx, struct ionic_rq *rq, struct ionic_qdesc *qdesc, struct ionic_tbl_buf *buf, int max_wr, int max_sge, - int rq_spec, struct ib_udata *udata) + int rq_spec, struct ib_udata *udata, + const struct uverbs_attr_bundle *attrs) { u32 wqe_size; int rc = 0; @@ -2312,7 +2318,9 @@ static int ionic_rq_init(struct ionic_ibdev *dev, struct ionic_ctx *ctx, return rc; if (udata) { - rc = ionic_get_user_q_umem(dev, qdesc, &rq->umem); + rc = ionic_get_user_q_umem(dev, qdesc, attrs, + UVERBS_ATTR_CREATE_QP_RQ_BUF_UMEM, + &rq->umem); if (rc) return rc; @@ -2410,6 +2418,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, struct ionic_qp *qp = to_ionic_qp(ibqp); struct ionic_ctx *ctx = rdma_udata_to_drv_context(udata, struct ionic_ctx, ibctx); + const struct uverbs_attr_bundle *attrs = NULL; struct ionic_qp_resp resp = {}; struct ionic_qp_req req = {}; struct ionic_cq *cq; @@ -2418,6 +2427,8 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, int rc; if (udata) { + attrs = rdma_udata_to_uverbs_attr_bundle(udata); + rc = ib_copy_validate_udata_in(udata, req, rsvd); if (rc) return rc; @@ -2496,7 +2507,8 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, rc = ionic_qp_sq_init(dev, ctx, qp, &req.sq, &sq_buf, attr->cap.max_send_wr, attr->cap.max_send_sge, - attr->cap.max_inline_data, req.sq_spec, udata); + attr->cap.max_inline_data, req.sq_spec, udata, + attrs); if (rc) goto err_sq; @@ -2515,7 +2527,7 @@ int ionic_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, qp->rq.qid = qp->qpid; rc = ionic_rq_init(dev, ctx, &qp->rq, &req.rq, &rq_buf, attr->cap.max_recv_wr, attr->cap.max_recv_sge, - req.rq_spec, udata); + req.rq_spec, udata, attrs); } if (rc) goto err_rq; @@ -3122,7 +3134,7 @@ int ionic_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *attr, rc = ionic_rq_init(dev, ctx, &srq->rq, &req.rq, &buf, attr->attr.max_wr, attr->attr.max_sge, - req.rq_spec, udata); + req.rq_spec, udata, NULL); if (rc) return rc; -- 2.43.0