Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp224971rwi; Wed, 12 Oct 2022 19:08:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UnKEnjxvdkPl/bzMnME2DOZfqMaabQbjuboFzvKKnwQL9kXXZ2iQEt4tDwZUnbX5hbGKo X-Received: by 2002:a17:907:a43:b0:77b:ba98:d2f with SMTP id be3-20020a1709070a4300b0077bba980d2fmr24473923ejc.270.1665626908325; Wed, 12 Oct 2022 19:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665626908; cv=none; d=google.com; s=arc-20160816; b=x1t4Ohh8+kY99pUkdgy6nRrJgP2d++JMnj7qTCZ8XkMOWdLdmf0PBqKfzfCY5OsY3g q1v8meNTskBYriZ9oUnmSf8XdY6EaVySluEpFAPclD3ldXLvfeU8AKWYn8ExtVYvlCuF C2RVzbNrS5R+ApGur5nyZs99GQ+g77LcCdOx7hj8a4HNS+ZvTEurDnFN+rsIwcF+NFAQ 7VNIPAwK1/HAnXiU0WD5UxjkCyo95vZkEF3GSYWbQsUOroSOdCPSyRT6lptOrFh5/naT 6mrSsnprOQWOtQeI748GUtLV7+XfiOv/4JIrIyd2uPq7C7FczYS3Z1awBW9b5XLPhQJ1 cxsg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ANct6a9K15Q1KpV8swFzxyQnkMtO7Yx23Ui5NPwxQWs=; b=ZPf4GyowKWIk0mYS6baMnZl/73FkxWcJEqxi7ooDrDb1LvyOYjJzkVgvQELWvxHu3U wx3HIhvhjvT5QKJQdB5VfLvTkb5i4mR2HgCb3QYOM3yOtw+QQyCDo6uNzgnHHp6yi1d1 MTu56YpK6Ffqix4q0fGFfR20BoJkhwo7xiLIq7guGCPAliibfV0MfHVAvhw8Ix8EnnAQ /7zHuWga2KAboV2KhLgk53K/+b+/yPdYnSHpw1uc/jafsFHG32CSBw58+FtWcVTB/CmC t5hCdfHZDiQJ+7uxmyQ7BDIGiLmYn9dUJzhpMKWIjDLPNSTsOSCAha+2EDsUaRFecdkc 6akQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XxXF7tK8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz20-20020a0564021d5400b0045ce40540ebsi784800edb.269.2022.10.12.19.08.03; Wed, 12 Oct 2022 19:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XxXF7tK8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232375AbiJMBCi (ORCPT + 99 others); Wed, 12 Oct 2022 21:02:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232220AbiJMBCF (ORCPT ); Wed, 12 Oct 2022 21:02:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8A9F24BDC; Wed, 12 Oct 2022 17:59:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91B65616BC; Thu, 13 Oct 2022 00:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2BA4C433B5; Thu, 13 Oct 2022 00:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620596; bh=wrATyctV2ohV737W7q/40WRodm8LvGQCPuOWW++0vFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XxXF7tK8dzgPfW2k5xFYJ4rxjzyWqUrUn4+A3wwF64aNWC3gVI0jnXdHpIwwUwpWJ +qxUH1gjR6P/6U0a7njpVWiJENnhsEsQUa++l0KAmhSbpuuSNTSfBsVKBEl1e/R5gz BLgebmIJyFa7knIQvtzBnl2Vs1ct/RBLdAlJGo0CW2Q68i/O4kV3lVQYHVV8RnEpaC fUIgKVZu6jlucVSyxD/Mc0JXfT5cCjSEUQ51Wx7H33im/V9dKmPMmneAlzNq+tl1kM ujj7kR9q8zp3ggqui8LFhgx1Ruzg2eo2xj8Fbr7SezLJrIh3u7pm318KN1dCLSI6F5 lJXqiEDQWV+DA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Keith Busch , Jeff Lien , Sagi Grimberg , Chaitanya Kulkarni , Chao Leng , Christoph Hellwig , Sasha Levin , axboe@fb.com, linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.15 41/47] nvme: copy firmware_rev on each init Date: Wed, 12 Oct 2022 20:21:16 -0400 Message-Id: <20221013002124.1894077-41-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013002124.1894077-1-sashal@kernel.org> References: <20221013002124.1894077-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Keith Busch [ Upstream commit a8eb6c1ba48bddea82e8d74cbe6e119f006be97d ] The firmware revision can change on after a reset so copy the most recent info each time instead of just the first time, otherwise the sysfs firmware_rev entry may contain stale data. Reported-by: Jeff Lien Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Reviewed-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 76d8a72f52e2..3527a0667568 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2732,7 +2732,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) nvme_init_subnqn(subsys, ctrl, id); memcpy(subsys->serial, id->sn, sizeof(subsys->serial)); memcpy(subsys->model, id->mn, sizeof(subsys->model)); - memcpy(subsys->firmware_rev, id->fr, sizeof(subsys->firmware_rev)); subsys->vendor_id = le16_to_cpu(id->vid); subsys->cmic = id->cmic; subsys->awupf = le16_to_cpu(id->awupf); @@ -2939,6 +2938,8 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n"); -- 2.35.1