From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f225.google.com (mail-pf1-f225.google.com [209.85.210.225]) (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 B8E32442392 for ; Fri, 7 Aug 2026 12:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.225 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786107378; cv=none; b=XOpSAm1UARKsaWces0D/NZ6lkYxCrkAabjJ2PGoyQCAXkxSyBIele02uGax0+Ry/hIgiwFYgnS47febf3n882+LdySkqdW47sY6LLCrfEyzoorX7xKIz7flQFISMmL349E6Kli6ITLIy1POyP2Eu8zM8tsq5Rz7OzkKJLjL9WEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786107378; c=relaxed/simple; bh=1hWnl65vm0hn6WYoxiP7MJ509E6RdQRfoAwRlZNmnrQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gYv46IQUlOJlc6kkq4F01gkgUvhYYr9KkAzIqzY4Hva1CSVtWgLyWILwtAIPVTrnWXMKszdx4aLFbn3lKlLZDxStCzlTv7AOh/Bjv5V/wH11AaGuJ/gusvWQ8mYqGORPL8J9vgiFaaXV29VHkSCUhXckfdDIoF3c2wzpvqVSDng= 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=Zw4zk2IG; arc=none smtp.client-ip=209.85.210.225 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="Zw4zk2IG" Received: by mail-pf1-f225.google.com with SMTP id d2e1a72fcca58-84a4d8fd6ecso4011066b3a.1 for ; Fri, 07 Aug 2026 05:56:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786107367; x=1786712167; 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=LCaPoace1M1MKoEICN/Ta74RJNy7OqGiKxb6iDGSJo4=; b=aJk+tg7n8Lv74vj+kbtpUvSx9yC0FTKb1xh/zMJh2w8MJCOG850nc803zBgxETvD5O Cx1ZzMYo0wt7fwh/eqkTSGlW4Go7+oVEt64x+HBM2yCPZnkV1dblZ17NE9F3IedSeJPu jX2xTwiKUX/recRAh7PtNf+FChpJI1f+au5IwLoVfUpcNviR9cQad7RUzD8hCyiTUrZI 9m6lk2HvAGRlzfeHhTPFRO0hP8TI81ODZ2uPy4stelM66Fr0pEFBEsARn3AO0AnDwvbg ftEfXbcfYwpZA5w3Hzs/Tc9shwbqErxH2njOsN5eHeM8zKx0C4+mDUzxJvjXeTXkgdfW CQ9w== X-Gm-Message-State: AOJu0YzzUz/sJqi4eA+1sll0DqKfMEojxkaodkryBoShD4MAWpJi4Xl0 iQCNEIHX6vUXhknyai9b/rxpUFXfxuyveP7eii/dd4yvID6ORThwtHo/wltVknPpiMRQqbtXipp 4tHXSUtziL10MZAMgoayO7obW2cuNwnYQvhtroB7Ko6rRjaJWXmp3ciOEjgK3p2NNXnTA6HFtnq k4juJXU7qYVdly7nJDWNYNpXCw0tBgIWtnz27aY7HKBLmgdUj4pll1M8fEw4zG0SbEIKViN9rMM sCHmKHoO/sfFhWpzihx5Q== X-Gm-Gg: AR+sD13bqZYu44w2FDPaonp7jmsofqaglyOxg3d6LeBIgNhQgLIx7rDwF9AjcgUFHRj vS6XB+V2RmbZaLx68gG4XhV/3EccClUaGlHaTgY5CdoBe+9TOTJ/WlnF/AXnx1OEGzEhzez0NFn rHlhOQ+YoVIOtGSjaL5UWdIlMNRI3rvys65DHma1Q7cgCDJBYTEv6+TeYO5e0fggBDN/eWTniqa FuyVDMlzunpU7LHbcwbHPDh1Ukm9dAQophQ9gRyjPSk166q51X16OcWBnV5jF11KHVHciWpTs63 tIssoSjWazbd290uOpG1jakUWt6wKtwcEpTScqMYnz5HYinTOzTT63vv5Nmtt846MeuUToM0V6h fuHk/Pvp0yVWxVWn2m4hu9RdeTlFJTyjJRx0hNOkUZYpy0d/+9sk2t2Z5U7ytBtq2ezNCsawWhs tvsfKtuahXu5tH6m/E2CwOk1Rb6xQwyq9b8eg= X-Received: by 2002:a05:6a00:10d3:b0:84a:2e5f:d69c with SMTP id d2e1a72fcca58-84f2e13a654mr23256341b3a.32.1786107367494; Fri, 07 Aug 2026 05:56:07 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-25.dlp.protect.broadcom.com. [144.49.247.25]) by smtp-relay.gmail.com with ESMTPS id d2e1a72fcca58-84f59fee2f4sm484948b3a.0.2026.08.07.05.56.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2026 05:56:07 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-84a67b16217so5534069b3a.3 for ; Fri, 07 Aug 2026 05:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1786107366; x=1786712166; 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=LCaPoace1M1MKoEICN/Ta74RJNy7OqGiKxb6iDGSJo4=; b=Zw4zk2IG9WWYf7rFlOZtHAut5N0gPsb7oeoGAP0OdcB3QpmeqSDvB0UjlrOaMGdW4O uVemDBJfKPU6Wio1XVFFqnv5j+yVbv9E8Vt2g+goZnkrmJ7CDqkt8AyAc/1T3VZn82yy olbb7flDyTCViRO3K97QTz7dht0lO7Z690Qf4= X-Received: by 2002:a05:6a21:138e:b0:3bf:5539:f93 with SMTP id adf61e73a8af0-3cbcea37675mr37974637.38.1786107365655; Fri, 07 Aug 2026 05:56:05 -0700 (PDT) X-Received: by 2002:a05:6a21:138e:b0:3bf:5539:f93 with SMTP id adf61e73a8af0-3cbcea37675mr37911637.38.1786107365199; Fri, 07 Aug 2026 05:56:05 -0700 (PDT) Received: from pc-hpe-top-git-sendmail-server.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315bebdf796sm7098792eec.22.2026.08.07.05.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 05:56:02 -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 v6 fwctl 0/2] fwctl/bnxt: DMA buffer support for HWRM commands Date: Fri, 7 Aug 2026 18:28:44 +0530 Message-ID: <20260807125846.45570-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. v6: Addressed additional comments from Jason as follows: - Look up each DMA command's required scope from the descriptor table - Fix type punning of a __le64 pointer over a __le32[2] struct field - Change loop counters to unsigned int - Optimize a manual length calculation with check_mul_overflow() - Require the request length to exactly match the expected struct size - Remove the separate userspace buffer descriptor uAPI entirely. This also helps drop the first patch of v5, making driver_data unnecessary - Replace the verbose descriptor table with a small set of macros 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 (2): bnxt_en: Update bnxt firmware spec fwctl/bnxt: add DMA buffer support for HWRM commands drivers/fwctl/bnxt/main.c | 396 +++++++++++++++++++++++++- include/linux/bnxt/hsi.h | 585 ++++++++++++++++++++++++++++++++++++++ include/uapi/fwctl/bnxt.h | 4 + 3 files changed, 980 insertions(+), 5 deletions(-) -- 2.52.0