From nobody Tue Jul 16 20:37:34 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WNrV70B7Pz5QC84; Tue, 16 Jul 2024 20:37:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WNrV6679Hz4Dw6; Tue, 16 Jul 2024 20:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721162254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ArIdOYL1RhyXC6+IyFIxUdgVIlvqq5+edPNTjJEoFXU=; b=M2lGNB1YrJsXNJDSuuW3CGojivoAQBFTsHfTIvRDAq1qkT07K+3edlVxCe48tmkbu+uJoO odn+1f/dZhZSh1WNeCKP5IDKtIcQjMWkiZWm/dADeI4vGnbhuVKQ91RmtwcmjPf7aObqyN EgALM/YuLSqv/v1g55HiDa24ooPYHrnd4nqHwp9y82w0faEOrequp3NNjA9bjn7wL2Ktbr sb7wSKDzbb5u1oO27a9qwXnIGj38fPXZ6Aa/NjJDhh+4nGIRqs6z7FJOaZcimuMQUG9elz pKpDRJqlVU7JLWxvS0zA9dGA1hCyZydI5ZbZ5Nzvbu4TzZaA4vvQCCXHW+Gp7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721162254; a=rsa-sha256; cv=none; b=R/c8Y5C5HJ3l0IlCsoa2G7fPdwEg1FudcQ1nXRZYyjKD7YxnzgbAB401GpI3jTaRDaDhv+ zXPPp9sbjuLqxSPETAjMt247YftnljcML/DPvvvD+qVr9TWXcD9lG3gV5eAsGvH7Q5E8dl H55ejXa3zb+nYTLb5vt6+GQMAJQjIdw4jjn1mTADDF1yLQTXfdAY3mN5CBPS1WKB0D7Fcg esOhCgPm95PDFlw3ZYgRHglmf2is5qAsgBcRNM0n/BnS72HPs9zJl09JMd4iKH73lmU8ZF STygkh+TyaRwSeHY6AlL6lhrmViFWEovWbdJdiy26PBRowJesFuQQuXlKlXHkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721162254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ArIdOYL1RhyXC6+IyFIxUdgVIlvqq5+edPNTjJEoFXU=; b=v3kyCFc+Zu2xdyN4DuxXgJMb1sAixtYbJt1+3ji90Wosjeq56k1E0Spjsy6DEU8BcHjOeD 2Yk9IU3PW161eYGCcZCWBTkTCO0LDJXB3gRmc2tztK+bzgCol33qI9l3WhRULxvgZrEXv7 o9p2U/ihsQPQnMmVadn1lm6fkFpdZXabH/3hZHmizPG+3nJBYiEXBh0IVPTSW9SNMitGIb Crpd+A/S/DawNporkXgGuE3a9Ut3Qtlhunkexy2afhAsPZ9MHdETOPuk5XtJ2w0TYON98x L7h+u5fqM/vY6xrPxW9ea1e7K4p/BbMzVBoyQiRtKJBpYA351n4eU/Utt4LM2g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WNrV65kqczqpr; Tue, 16 Jul 2024 20:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46GKbYOJ017857; Tue, 16 Jul 2024 20:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46GKbYWm017854; Tue, 16 Jul 2024 20:37:34 GMT (envelope-from git) Date: Tue, 16 Jul 2024 20:37:34 GMT Message-Id: <202407162037.46GKbYWm017854@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Kenneth D. Merry" Subject: git: 12f7f57bc07d - stable/13 - Add an isp(4) tunable to default to ispfw(4) firmware. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ken X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 12f7f57bc07d85158e67c61b83a4269c9d269fdf Auto-Submitted: auto-generated The branch stable/13 has been updated by ken: URL: https://cgit.FreeBSD.org/src/commit/?id=12f7f57bc07d85158e67c61b83a4269c9d269fdf commit 12f7f57bc07d85158e67c61b83a4269c9d269fdf Author: Kenneth D. Merry AuthorDate: 2024-06-24 19:42:41 +0000 Commit: Kenneth D. Merry CommitDate: 2024-07-16 20:36:32 +0000 Add an isp(4) tunable to default to ispfw(4) firmware. ispfw(4) recently gained firmware for Qlogic 27XX and 28XX FC controllers, and isp(4) now selects the newer of firmware in flash or in ispfw(4) to load for those controllers. This differs from the previous behavior (which remains for older controllers), which was to always load the ispfw(4) firmware if it is available. This adds a loader tunable, hint.isp.N.fwload_force to default to loading the ispfw(4) firmware, whether or not it is newer than the firmware in flash. This allows the user to always use the known firmware version included with the kernel. Note that there is an existing fwload_disable tunable that tells the driver to always load the firmware from flash and ignore ispfw(4). If fwload_disable is set, fwload_force will be ignored. So users with existing fwload_disable tunables will have the same behavior. If a user specifies both fwload_force and fwload_disable for the same controller, the isp(4) driver prints a warning message, and fwload_disable will be honored. The user can see which firmware is active through the dev.isp.N.fw_version* sysctl variables. share/man/man4/isp.4: Document the new loader tunable. sys/dev/isp/isp.c: In isp_load_risc_flash(), changet the decision logic to also consider ISP_CFG_FWLOAD_ONLY. Load the flash firmware and get the version, so the user knows what it is, but if the user set fwload_force, honor that. If the user didn't set fwload_force, the behavior remains to select the newer firmware version. sys/dev/isp/isp_pci.c: Add a new fwload_force tunable. Print out a warning if the user sets both fwload_disable and fwload_force. sys/dev/isp/ispvar.h: Add a new ISP_CFG_FWLOAD_FORCE configuration bit. Reviewed by: mav MFC after: 1 week Sponsored by: Spectra Logic Differential Revision: (cherry picked from commit 31354813f3c6e87532189be77c2f10a017c55472) --- share/man/man4/isp.4 | 17 ++++++++++++++++- sys/dev/isp/isp.c | 18 +++++++++++++++++- sys/dev/isp/isp_pci.c | 9 +++++++++ sys/dev/isp/ispvar.h | 1 + 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/share/man/man4/isp.4 b/share/man/man4/isp.4 index 350a0ea59a64..dc6a6dbd5d2b 100644 --- a/share/man/man4/isp.4 +++ b/share/man/man4/isp.4 @@ -24,7 +24,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 27, 2023 +.Dd June 24, 2024 .Dt ISP 4 .Os .Sh NAME @@ -141,6 +141,21 @@ Limit on number of Extended Message Signaled Interrupts (MSI-X) to be used. .It Va hint.isp. Ns Ar N Ns Va .fwload_disable A hint value to disable loading of firmware provided by .Xr ispfw 4 . +.It Va hint.isp. Ns Ar N Ns Va .fwload_force +A hint value to prefer firmware provided by +.Xr ispfw 4 , +even if it is older than the firmware in flash on the board. +If fwload_disable is also specified, fwload_force will be ignored. +.Pp +By default, with 27XX and newer controllers, the +.Xr isp 4 +driver will use the newer +firmware. +For older controllers, the +.Xr isp 4 +driver will use the firmware provided by +.Xr ispfw 4 +if it is available, and otherwise use the firmware in flash on the board. .It Va hint.isp. Ns Ar N Ns Va .ignore_nvram A hint value to ignore board NVRAM settings for. Otherwise use NVRAM settings. diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index 7246ea8031ac..14d8147c3562 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -457,7 +457,10 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults) if (IS_27XX(isp)) { switch (isp_load_risc(isp, 0)) { case ISP_ABORTED: - /* download ispfw(4) as it's newer than flash */ + /* + * download ispfw(4) as it's newer than flash, or + * the user requested it. + */ dodnld = 1; break; case ISP_SUCCESS: @@ -5223,7 +5226,20 @@ isp_load_risc_flash(ispsoftc_t *isp, uint32_t *srisc_addr, uint32_t faddr) /* If ispfw(4) is loaded compare versions and use the newest */ if (isp->isp_osinfo.ispfw != NULL) { + int ispfw_newer = 0; + if (ISP_FW_NEWER_THANX(fcp->fw_ispfwrev, fcp->fw_flashrev)) { + ispfw_newer = 1; + } + + if (isp->isp_confopts & ISP_CFG_FWLOAD_FORCE) { + isp_prt(isp, ISP_LOGCONFIG, + "Loading RISC with %s ispfw(4) firmware %s", + (ispfw_newer == 0) ? "older" : "newer", + "because fwload_force is set"); + return (ISP_ABORTED); + } + if (ispfw_newer != 0) { isp_prt(isp, ISP_LOGCONFIG, "Loading RISC with newer ispfw(4) firmware"); return (ISP_ABORTED); diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index f0496bd1fed2..1f3acfdd011d 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -291,6 +291,15 @@ isp_get_generic_options(device_t dev, ispsoftc_t *isp) isp->isp_confopts |= ISP_CFG_NORELOAD; } tval = 0; + if (resource_int_value(device_get_name(dev), device_get_unit(dev), "fwload_force", &tval) == 0 && tval != 0) { + isp->isp_confopts |= ISP_CFG_FWLOAD_FORCE; + } + if ((isp->isp_confopts & (ISP_CFG_NORELOAD|ISP_CFG_FWLOAD_FORCE)) == + (ISP_CFG_NORELOAD|ISP_CFG_FWLOAD_FORCE)) { + device_printf(dev, "WARNING: both fwload_disable and " + "fwload_force set, ispfw(4) loading disabled\n"); + } + tval = 0; if (resource_int_value(device_get_name(dev), device_get_unit(dev), "ignore_nvram", &tval) == 0 && tval != 0) { isp->isp_confopts |= ISP_CFG_NONVRAM; } diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h index 6c3430246b29..abb712a395c1 100644 --- a/sys/dev/isp/ispvar.h +++ b/sys/dev/isp/ispvar.h @@ -612,6 +612,7 @@ struct ispsoftc { #define ISP_CFG_16GB 0x8000 /* force 16Gb connection (26XX only) */ #define ISP_CFG_32GB 0x10000 /* force 32Gb connection (27XX only) */ #define ISP_CFG_64GB 0x20000 /* force 64Gb connection (28XX only) */ +#define ISP_CFG_FWLOAD_FORCE 0x40000 /* Prefer ispfw(4) even if older */ /* * For each channel, the outer layers should know what role that channel