Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1079179rdg; Fri, 13 Oct 2023 09:33:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtN5Wk92JwXqzezBB4m0tmXfX/mU2FX/7imkH3RDcF2Rv6JNo1yKQTaXWe0QPyPe2BWhna X-Received: by 2002:a17:902:ec87:b0:1c0:afda:7707 with SMTP id x7-20020a170902ec8700b001c0afda7707mr699932plg.34.1697214799180; Fri, 13 Oct 2023 09:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697214799; cv=none; d=google.com; s=arc-20160816; b=qk6wddJ+v9Nv/X/8Mi/87vtjxGEM3XUhFvIp16lnG6/ULC7HgzaWQ3vSCFVtNHZ/QF fkedSnThhtPPtnv7TmCCABkCHgXK4PQaQAh3csLpwwgcUJ4nR4e+AgOvannaq0sMNpgg BRiZ7bftddKLL89F2I4H7HtUWq952B0a9B0+n++LcfSiweqD5teXO3g4X/cO/wWwiOWU k/F+i9ejYBMfhvB8ADOyOtEqgJGwuxp+k6MqPbv5SR8oAKUjxjd5IoR9Ny6qmPFjIINT 6iuMmuMuDRT85Qn96jMspqNpldq+BECr78n45rAUD21RxqCY4jSt0T9QzS5Uv3Evc+iG cHdw== 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=xjo9Xl3dXS4rFlLLnUY7vOZqEKJrLj4p7tYgG9NZ6xs=; fh=y18LZfenZEWKaXfvX5UX+EWGZCaPZS2yh2hLlxumw68=; b=GsT/051225arjuME/XB7TfIDCJJz63Ol4hdwzqoM9AOuBDX1lUdwpLK+bRXfR77Dlr DWzOy0504BG2J0PmXvRk0JJIB77h2bDbL5rrU6Fwi+8uBczrIxCxPAztAPirOEqUXZrr K/lg4RWjB9n8BjFjVx9Y8F7GwiXJZGQEjT55tBbzWMiiUAZ3JyzAr+iTLS6NfQ2xHdyU wpjak6BobodfN4ETELpoWnq5UjhhadsTR+XIAKNYIuRGNrMseXniVGb4vahy71f8R7dD /2VJmwdIXUiJc0Mm2JEi4ukWLkx3hx7eCKyPGaOyv/+nrWikJo0cbc3Aza9R6XxDXOcp 3nyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=c54Z3lYA; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=ueCXVZSa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y20-20020a170902ed5400b001c9fe071f2esi1611113plb.128.2023.10.13.09.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 09:33:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=c54Z3lYA; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=ueCXVZSa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 13AB28331E3A; Fri, 13 Oct 2023 09:33:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbjJMQdP (ORCPT + 99 others); Fri, 13 Oct 2023 12:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbjJMQdM (ORCPT ); Fri, 13 Oct 2023 12:33:12 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E6B3DD for ; Fri, 13 Oct 2023 09:33:10 -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 01D0F21A1E; Fri, 13 Oct 2023 16:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697214789; 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=xjo9Xl3dXS4rFlLLnUY7vOZqEKJrLj4p7tYgG9NZ6xs=; b=c54Z3lYA/WQevQjKlzJYBqGQ+CWNEFTivoPhZOC+JOfO4RVGKUy7FriAzbXBTz0Xd2vAZA TPBb6dVBSmRTChW3H6pUmJpUSUYTa7Wu8sh+qg2JfMaWMagKF4kp+hih32wzKQlBiOtoFa 7Ns01pr7LMKxXQs7NvyYUBOuSQcCqyg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697214789; 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=xjo9Xl3dXS4rFlLLnUY7vOZqEKJrLj4p7tYgG9NZ6xs=; b=ueCXVZSaVgSQ2tMcdMu/yMoWL7Y1ZxV0amB9SSNDvB7ZjY0qwUi4qvC15PnZ8Yed1Qq6Fu uYwl7yfC2q+2S+DA== 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 D98D01358F; Fri, 13 Oct 2023 16:33:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LvkPNURxKWU/bQAAMHmgww (envelope-from ); Fri, 13 Oct 2023 16:33:08 +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 v2] nvme: update firmware version after commit Date: Fri, 13 Oct 2023 18:34:20 +0200 Message-ID: <20231013163420.3097-1-dwagner@suse.de> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: 0.85 X-Spamd-Result: default: False [0.85 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[7]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.05)[60.48%]; FREEMAIL_CC(0.00)[vger.kernel.org,kernel.org,lst.de,wdc.com,suse.de,gmail.com] X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 13 Oct 2023 09:33:18 -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. So you might want to wait until I am back from my vacation. drivers/nvme/host/core.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 21783aa2ee8e..686478555585 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4067,14 +4067,29 @@ static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl) static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl) { struct nvme_fw_slot_info_log *log; + u64 afi; log = kmalloc(sizeof(*log), GFP_KERNEL); if (!log) 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; + } + + afi = le64_to_cpu(log->afi); + if (afi & 0x30) { + dev_info(ctrl->device, + "Firmware is activated after next Controller Level Reset\n"); + goto out_free_log; + } + + memcpy(ctrl->subsys->firmware_rev, &log->frs[afi & 0x3], + sizeof(ctrl->subsys->firmware_rev)); + +out_free_log: kfree(log); } -- 2.42.0