From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2966C4332F for ; Thu, 13 Oct 2022 00:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mxIMaErCXLQ6SGlus45arc5+X5f7tGiN8FqdqXx1cUY=; b=ieKdJdRYDUv7DbKrnhKuQvi0QW psgjLpWvlgwtRobwGy6V68p9zp9/iKL7i8p9xE2gdsuvr8fGg2X9K+ymx9HMZ2DCwuDXsmtLW+Pgw tJy0Kt4dibqtAl4CtFOe3A0+zDA2MdP4+MmhUhSubqany1KQ0f+WQOncGQoripBfpUYqSVYATOl19 zf2Ly3nXuTjb5qZzAO1D96PnvzKnC0ehEhN0MuCd0j3LqzNKURRrTy/L34Af7GWJ4aRnVbOtSvAYR 3eFk8PAFSqMKONklX2V/iy3gKtL68tkNtp6R832lcbKu0HzdaQxacmRKAFkeQSxpFJhvODXNr2rYX 7OrmsRvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oimFC-009wgv-W2; Thu, 13 Oct 2022 00:38:39 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oim1o-009qEe-Vy for linux-nvme@lists.infradead.org; Thu, 13 Oct 2022 00:24:50 +0000 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 ECD1C6170C; Thu, 13 Oct 2022 00:24:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F3E8C433C1; Thu, 13 Oct 2022 00:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620687; bh=kpCVKSVx4edmN/FF2ES1UPayu/qR0i3LiEngz2CZ+Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=auzLM9j43/8KS4m87n+YYvoqurHEmwV7l+A7OolRcTC1KrjxPc7JmIjXXrjIiLC4G 925898uV9TMvxmfkNBts06L2i/YrTppKwkCfPbxwUMtLh0KW9xaFD69XBVySZTqJ3e OaqMn5HGnAK3mdLVdQmMWWxUhkGljRuRRWKCzvYnHP98cRqmC+QdVR0TL6w10H2eQu QrJtR++pEWhfZ8ahFjVU/reHAwDXLsONeeb15zT1X7oF7UFKSgaGoTiocvoFZZY44U gsuZt7fmLPdpRSWqiTYZ768ty+5dOL+UT7qpv56UjRzKcrC+CkpDXKb51I+kRg1Auy Cn46ePt/8YKIg== 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.10 28/33] nvme: copy firmware_rev on each init Date: Wed, 12 Oct 2022 20:23:27 -0400 Message-Id: <20221013002334.1894749-28-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013002334.1894749-1-sashal@kernel.org> References: <20221013002334.1894749-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221012_172449_141211_42533073 X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.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 265d9199b657..e9c13804760e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2949,7 +2949,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); @@ -3110,6 +3109,8 @@ 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