From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f226.google.com (mail-qk1-f226.google.com [209.85.222.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 417C83D9690 for ; Tue, 7 Jul 2026 09:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.226 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783418312; cv=none; b=W2glSPK/GWAb6a+848CbP2lMFFAKrf8YVEXgKDoh004n3EmOzAg8RMTbvcVST9al3lwxo5qcKuqaYoql07JKOY4AyMirE8QN/7GKj2hhnyNct0P0LZbFLlV0TOV6eVoFS1cDcdn7uz4xx+ZiNWQjzBGZjLGwTLdmI5E3Go9xmko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783418312; c=relaxed/simple; bh=LvSFSiRS8lVfzjfG7e9+n4WibVvkIufGa3Sq11DrG+w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aBntrsKLKol5rYV1240a6oiL7FtTw3s34A97L3ZANWv1tMBxJnU3rB+fKLLMOpik01IGDKILzQ3Y/yzj4VlclHaNSSg3ysEq33Lif4x8eaFMOz/zUhFNu+7vTLCWkcyz8gb1a0iUuF60F+g+FYrJPEk0PZ7+bL8wrOKJWc8GxY8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Ke/ynuAg; arc=none smtp.client-ip=209.85.222.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Ke/ynuAg" Received: by mail-qk1-f226.google.com with SMTP id af79cd13be357-92e67555e24so183240885a.3 for ; Tue, 07 Jul 2026 02:58:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783418309; x=1784023109; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=nyMKthavL9ZQtXp9yT1Wtro1HJfZnaulbJ/WLktnSXc=; b=YsLAeii9FwxGkm4ws6TK74pWT2j4Xqpi1Sby6jyaMaNN1DaLNStDyQLV5gX81X1n3t /JCMst31S+ih9rsYu1o9w3RxBXTWCTac7s2Tk3+74FUTO/ATQ1UvWy3ucPdtPXC4pwGm /+qX0XpEu8iASWBp/DAR0qyoWygISAAeE8FEGpDt6PBneI+hD4Q9nt2gNTswfxcVUSpt p3x6HWogcP0ckOl+EUNo+UGWNJTnmnrcLFNaPHQ1MSTDA4xKnOYzJurmHezz6rn5Twgp Oi3ShNzHjKzEOYto5Dc1cxbluFqlSMXRid2YxqmKA5hDjvkGQP2x1uTDCaX1eQPJR+7/ ub1Q== X-Gm-Message-State: AOJu0YwrMj43Jg6Z3I3o9D1qXuSDAIVkanqJIHkgkMZqSOaVQ6NDLKni yHlvixycDr+o4UnzsxzrT0qYmyKUqWDE+JlfP6SPVf9WrkoBXCrJXYzmsnMe6ZATIKDw4h/50y1 8qWyP/BxIvVXZHaW+p37JlS/Hoe5PmLDji2KqiB6NTbLoqQ5a+InEwi9Fw6GFGzcsgOKMwAqRF+ SIU+iVDfQkBG6DdpblYDz59/zvhzatPkV+8VR7SlG3p+77X5z6UaHNX8iFbNM8uhY+Z9RLJwVEH Tv9pAAhB0sY4Eh9Ojs= X-Gm-Gg: AfdE7cnM0XX+RSUk77rKmIbEfu1KDfhA7nKVS3aMwRqCR1SmkWpdFbOH/W8LdRlDoDi XoDpRAPwLfOWlltIrBGGdlxbZWw4TAaojMzTY/d461sqv39sTpDOwSRdKiE9iUvR0mFVfh5KsuS pNyLa44RuJjfc4wAibICJxDSN0X+AG9YQrB2qe92t6TMvmLS4hCRV1JSMAzzZe8Edy5PQmpb/iH bs088Y/lPJt4kZKv+09K4Y2WecyC8HkcXr/b0XFc1YHWfKZ0NsNafrDskNfOUV4JD8IW4yQwbzr f48TY8p0Ib8eLV3RYfOif2bwlyQE60zMKFM+TcXDfmb6zggwOdtlc6TZdemilw2tV7BoZki4qcl 8gDH5aI79t33exXeaCxI6qHZfSQzAMIc+2+UzpKrul69tdzmaHIZsgMSA+OVBYoAus9GEsl2tOC Cm6qhU2tkOt7OeYhKwH2j8JM+2oWc1p9jYOLbVXhZ23IJXkg== X-Received: by 2002:a05:620a:8399:b0:92b:6805:919b with SMTP id af79cd13be357-92ebb5a7401mr506351685a.67.1783418309013; Tue, 07 Jul 2026 02:58:29 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-11.dlp.protect.broadcom.com. [144.49.247.11]) by smtp-relay.gmail.com with ESMTPS id af79cd13be357-92e90ca002asm67764585a.5.2026.07.07.02.58.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2026 02:58:29 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-847a225cd91so4189218b3a.2 for ; Tue, 07 Jul 2026 02:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1783418308; x=1784023108; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=nyMKthavL9ZQtXp9yT1Wtro1HJfZnaulbJ/WLktnSXc=; b=Ke/ynuAg3XHUBPlCiThu7P5R0XsrkmS1P+/sh0i0+8g0ym949phySp/Ttvhe5ClTbr hQkg09VTCEeYx5/RGAlbmbSBjLUgQOdHcMczJ1jVubWXrFViBCWeEYsChvqvHwEAlimQ AycrrIwE7UDU2M4RAvyMXk7LEKmwtff4k0HTw= X-Received: by 2002:a05:6a21:62c6:b0:3b4:85db:1bdc with SMTP id adf61e73a8af0-3c08ee362f8mr5359513637.34.1783418307743; Tue, 07 Jul 2026 02:58:27 -0700 (PDT) X-Received: by 2002:a05:6a21:62c6:b0:3b4:85db:1bdc with SMTP id adf61e73a8af0-3c08ee362f8mr5359487637.34.1783418307293; Tue, 07 Jul 2026 02:58:27 -0700 (PDT) Received: from pc-hpe-top-git-sendmail-server.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13b659666e7sm8407566c88.7.2026.07.07.02.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2026 02:58:26 -0700 (PDT) From: Pavan Chebbi To: jgg@ziepe.ca, michael.chan@broadcom.com Cc: linux-kernel@vger.kernel.org, dave.jiang@intel.com, saeedm@nvidia.com, jic23@kernel.org, gospo@broadcom.com, selvin.xavier@broadcom.com, leon@kernel.org, kalesh-anakkur.purayil@broadcom.com, Pavan Chebbi Subject: [PATCH v5 fwctl 0/3] fwctl/bnxt: DMA buffer support for HWRM commands Date: Tue, 7 Jul 2026 15:30:16 +0530 Message-ID: <20260707100019.60553-1-pavan.chebbi@broadcom.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e Several HWRM (HardWare Resource Manager) commands used for diagnostics, firmware management, and NVM access carry one or more DMA address fields in their input structures. Until now these commands could not be issued through the fwctl interface because the driver had no mechanism to safely broker the host-side DMA buffers on userspace's behalf. This series adds that mechanism in three steps. In patch #1, the fwctl core UAPI adds a new driver_data field in struct fwctl_rpc. Drivers that need a driver_data payload receive the value and are free to interpret it. Drivers that do not define one will reject any non-zero value with -EOPNOTSUPP. Existing mlx5 and pds fwctl drivers are updated accordingly. In patch #2, the bnxt HSI header is updated to add the missing struct definitions for the HWRM commands that the bnxt fwctl driver will support. In patch #3, the bnxt fwctl driver consumes driver_data as a pointer to a new bnxt UAPI struct fwctl_bnxt_driver_data, which describes indirect DMA buffers. v5: In patch #3, addressed the issues found by sashiko and Jason as follows: - Simplify the DMA buffer uAPI: drop the len field from struct fwctl_bnxt_buf. The driver will derive each buffer's required length from the HWRM command itself, either the transfer-length field named in the request, or a fixed/maximum size. - Tighten the condition to do a exact match for the DMA buffers' count - Validate in_len against each command's actual HWRM input struct size - Switch DMA bounce buffers from kvzalloc() + dma_map_single() to dma_alloc_coherent() - Use kvzalloc() instead of kzalloc() for response buffer - Reduce FWCTL_BNXT_MAX_DMABUF to 64k as that is sufficient for the commands we are supporting v4: Collected Rb tag from Dave for patch #1. Thanks Dave v3: In patch #3, remove include of linux/sizes.h from UAPI header bnxt.h v2: In patch #1, update all the drivers that implement fw_rpc to check driver_data. In patch #2, add another HWRM command that I had missed in v1. In patch #3, update the allow-list and timeout tables for the additional commands. Pavan Chebbi (3): fwctl: Add driver_data field to fwctl_rpc bnxt_en: Update bnxt firmware spec fwctl/bnxt: add DMA buffer support for HWRM commands drivers/cxl/core/features.c | 6 +- drivers/fwctl/bnxt/main.c | 483 ++++++++++++++++++++++++++++- drivers/fwctl/main.c | 3 +- drivers/fwctl/mlx5/main.c | 6 +- drivers/fwctl/pds/main.c | 6 +- include/linux/bnxt/hsi.h | 585 ++++++++++++++++++++++++++++++++++++ include/linux/fwctl.h | 8 +- include/uapi/fwctl/bnxt.h | 35 +++ include/uapi/fwctl/fwctl.h | 3 + 9 files changed, 1125 insertions(+), 10 deletions(-) -- 2.52.0