From patchwork Sat Oct 22 07:29:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1161106wrr; Sat, 22 Oct 2022 04:29:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7f/4svG43rPC7cBWt41hH/H8S+9zTt6aKar1LqVg6o4cw5X8ulu9g+sO+ey44dzPuw5/ul X-Received: by 2002:a05:6a00:2305:b0:565:60b0:40d9 with SMTP id h5-20020a056a00230500b0056560b040d9mr23711851pfh.77.1666438178380; Sat, 22 Oct 2022 04:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438178; cv=none; d=google.com; s=arc-20160816; b=lYv5OWvK60pGb5CRRAK7mPY8BYd2PP/4naSyA+xjLw+PCb2q43AU7dCF2H2+LaphiO ZQb8kL51wcuxoE6zLeg4j3xWOsgHLz94gpoJx6j/0D3Nje42uB2IHinVfVnHF5GV/ir6 /kt6+VDPB21jDuZdCQ4J4vpmZgjPzGugBy5hJ86wXWrEUUGMXcNkbkFHEzLGpyfJhmvR FRze4/hWq+rZtgS01dvE7k2qX2hR9E3LvfvO42kvQpuui3bz9ruXOpZ2fpQqM35X2uO5 2cg2oXMHB15knRa/xTGQ4yugjXK7CLQ+4ZBpX53eZkKZFONM/TeLwt4rby/XU+BE4D6C 88xA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i2y/p7vxWmX9iOormToxEIsattVjo1I9VVd2Yv65t88=; b=t6wDvbOj6R0uC1vmet3x1/nQDRrWNukEvX7ufCJQwuc+9HypIZb02bexqjMWLnMrzS Hv5HwYiKkwJAAVmYRZ7BnQzrddR0HqbfF4OiXEzEX+BwKl55d+Ln0AnpGXD3/eivP+gP bsiuPTbnUHNziX/4o2X+67m06ft6Irwr3mVB7+uxWtBQeUxzMCpa0OUE1F7ypF5Ff2l8 9y8eOWvlOmj+ufkVyo7dhAF3TzuwwVRladzLGmXl5hrcX6CZf+YUTrLb7Gya+TnkRqrF YN/uIpJ7DpRHV5uIvhWfJ8nRssxTQYeXv5IUQJe3NVOuMVjCeqeI80fJ/VWmJt5eeuKC 2vtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wT4vddH4; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a17090a8d0400b0020038eb8b5asi9056309pjo.21.2022.10.22.04.29.26; Sat, 22 Oct 2022 04:29:38 -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=@linuxfoundation.org header.s=korg header.b=wT4vddH4; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbiJVLT2 (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbiJVLTD (ORCPT ); Sat, 22 Oct 2022 07:19:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1695F231; Sat, 22 Oct 2022 03:46:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4376FB82E45; Sat, 22 Oct 2022 08:07:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A074C433D7; Sat, 22 Oct 2022 08:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426053; bh=mfF7iVgzEiNCmdKqx1IbQXbWdrARJ0crLzZe8h5R+h0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wT4vddH4d0rJencWI6DWGxJReXc5bciO6T25XCibm5fNn3j1Z2ZmDeWcHnzEnNH1o wwW7kMcfymS7oxY0JQl275TiJGZaCmSNdK57EaAW+NFTGvHzoKMlxB7uDr4u+lL1rX IzHo6fzR9ofGUc4oaiOkVEIR1WWB1tG8RcI4WQ7E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Lien , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.19 686/717] nvme: copy firmware_rev on each init Date: Sat, 22 Oct 2022 09:29:25 +0200 Message-Id: <20221022072528.833925702@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747387079670526091?= X-GMAIL-MSGID: =?utf-8?q?1747387079670526091?= 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 47fd9d528c83..698e65883d82 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2796,7 +2796,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; @@ -3015,6 +3014,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");