Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2834127rdh; Mon, 30 Oct 2023 08:59:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGr1N6z3lBlFDIdqmxpLSRFvKTgh5wVr+XbR15wM3i+XMd1L5wFjrdL81h1TmTqplrqgbP1 X-Received: by 2002:a05:6a20:2694:b0:161:2df0:eadf with SMTP id h20-20020a056a20269400b001612df0eadfmr6015320pze.24.1698681569884; Mon, 30 Oct 2023 08:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698681569; cv=none; d=google.com; s=arc-20160816; b=A5Gawj5cVC14JIozpgdARkJHqFJzY1cgAaYZo3gkHVAmPvGS1XyMTx2Sri4lI7ygn7 JBXKTC668Nav7+PN37QbZ/cHiZ5joJRfHlC/kQiN0I3pgYLt9Y7NyVuk73ACBa3G8g81 9L2GiKSLj9wX/9jnDvrnbPPomuSZvP6ccSJccJ9v5RA5fMe5wzccxum9amUJHYKoFcLM i+SUhcMl1nGOtHvoeqYqTBuXCpFU7AQTcFBtvPIHPe43HBS8e7rrU1GMy9TTdBrEf8iq mct0weObOJpiW5nFtd6I/X+MjsMYoQFk8VGJM63GYWUfquEz4VOgWN8BrRBCRctPHPaE bPqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=ZeP5LZNPVgCOVDKGuBqMoGJSW7piHcySROsgnm697W0=; fh=y18LZfenZEWKaXfvX5UX+EWGZCaPZS2yh2hLlxumw68=; b=mj17rYbQocUfLeJsqxLg/UBFBvXVjZPkJY+KjaSfShVF53GaMUPxO7zbF0xhE+exQN YBiPS1nTfNRdicvBkAxIA01FzQXWH5c2CE6zbSU2Yr0AAVcoDlYA7P6MvDcLZBN++/zO qd0gyVxWA33+s8i3IOsh+tOc9Kpij7+abdMyB5hUnDFLTssXgtB4pMhxvI+PaHhfqd62 bYyzbqKzmxENrCvS+Pfgt7Y6dBLZ2BZhleSjfD7wBnNLDcRNdD0yRPn2ZaPA9wjBgbeC vXbDZiBQbuoszUfaqVP1LCxFSoJEmhymJIZLVjVHpKRnoJnRjGi4/hOnAWEXamfKalJ3 Pt2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=J44VmEqc; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bs7-20020a632807000000b005b902b61cbbsi5063929pgb.125.2023.10.30.08.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 08:59:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=J44VmEqc; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 073F280AD12C; Mon, 30 Oct 2023 08:59:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233763AbjJ3P7S (ORCPT + 99 others); Mon, 30 Oct 2023 11:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233311AbjJ3P7Q (ORCPT ); Mon, 30 Oct 2023 11:59:16 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B597CE4 for ; Mon, 30 Oct 2023 08:59:13 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4B1DA210E7; Mon, 30 Oct 2023 15:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698681552; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZeP5LZNPVgCOVDKGuBqMoGJSW7piHcySROsgnm697W0=; b=J44VmEqcZrDXMGx1wOc89obvtxfjsdVZFguVq7pP3N+MPb0pe0B/voCzU/h48z6UYLdqAd JrrwBBdSJ51wGxjcU52tTozeIPOTIeYO6K83LJsE13UrBkjW7gzzBTIHZuleo5PHBsWSPr mc4LXuvDuRtO7cv1vo31gEo+5jM37Wc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698681552; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZeP5LZNPVgCOVDKGuBqMoGJSW7piHcySROsgnm697W0=; b=YL7UvprAyY6BY8MIOhFh0wB9Pj1IPK/1X6jXBIm7IGrFc6sByhq8KnPHL77tJtfMmX9QmM b2DtEclQYbF7nDCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3D9F3138EF; Mon, 30 Oct 2023 15:59:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id HV0FD9DSP2WufAAAMHmgww (envelope-from ); Mon, 30 Oct 2023 15:59:12 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Keith Busch , Christoph Hellwig , Niklas Cassel , Daniel Wagner , Kenji Tomonaga Subject: [PATCH v3] nvme: update firmware version after commit Date: Mon, 30 Oct 2023 17:00:44 +0100 Message-ID: <20231030160044.20355-1-dwagner@suse.de> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 08:59:25 -0700 (PDT) The firmware version sysfs entry needs to be updated after a successfully firmware activation. nvme-cli stopped issuing an Identify Controller command to list the current firmware information and relies on sysfs showing the current firmware version. Reported-by: Kenji Tomonaga Signed-off-by: Daniel Wagner --- Only compile tested. Asked for testing. changes: v3: - use afi variable directly, no _to_cpu helper - fix bit mask size v2: - use fw slot info instead issuing another identify controller command - https://lore.kernel.org/linux-nvme/20231013163420.3097-1-dwagner@suse.de v1: - initial version - https://lore.kernel.org/linux-nvme/20231013062623.6745-1-dwagner@suse.de/ drivers/nvme/host/core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 37b6fa746662..e8511bff78d2 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4053,8 +4053,21 @@ static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl) return; if (nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_FW_SLOT, 0, NVME_CSI_NVM, - log, sizeof(*log), 0)) + log, sizeof(*log), 0)) { dev_warn(ctrl->device, "Get FW SLOT INFO log error\n"); + goto out_free_log; + } + + if (log->afi & 0x70) { + dev_info(ctrl->device, + "Firmware is activated after next Controller Level Reset\n"); + goto out_free_log; + } + + memcpy(ctrl->subsys->firmware_rev, &log->frs[log->afi & 0x7], + sizeof(ctrl->subsys->firmware_rev)); + +out_free_log: kfree(log); } -- 2.42.0