From patchwork Mon Oct 24 11:32:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457762wru; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50EsSXiJ3QIEn8yA2kbPx/yT4TRW/+w+tkkjfVEEYmckVM5x5jDYBRLvJMGw+AJes7B8E/ X-Received: by 2002:a17:907:7f20:b0:7aa:acf9:c07f with SMTP id qf32-20020a1709077f2000b007aaacf9c07fmr1433808ejc.559.1666618589609; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618589; cv=none; d=google.com; s=arc-20160816; b=VXp3U2Ge6niZF+ZSc77VOp7kGkFBT9AwYEhoIwHGPbsGNUwUqht8F5Ptk1N2qpHD8/ jmQBn8xd99WVYGOaPcIv1sVgX5NjCi0bwRPI9yh4eVakUceeWSGtxCuj/fbtwCVxOM74 8wVb9CKktmGC/VvDI6yC0DC5NfuHUdVONwdmqBP3JdPrRZ/2IkY1oP3N199IiMX/EixO XyfUp1SxlderPz+gtsj+jSWB2fkO/mYS8pv74zeF74kSCDaidOYTqZPmg7Djg9vgQR+2 Q8VtncUonpRC587d4N070889voDjRjxtFH45/RAGbxKn26ensPXuzGpP44m9jctglZeT oTdg== 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=bbQqD09h0kMDWH3J0zUV/OlX+1yLdEhK5ckTWLr8oks=; b=Ah1ssCRrQZrjOgsjfCjDVrue8IC1IeindtxHB5RONEoApaJAuJbU7gJYHlBUqoEo3g kcZBz3GCGTeotq7EWiF/wFqZXKa5X5J8N6GEUA10Ivi7tsOBKVK47dwTfOdA9bKmp7vv wVgxHXBfPDHi1UUP6A/jmVhtc248rcQg9QG1ToKzRwjIfQYz6MoY6z41q9xhsyr9S4HH sqQGiNRR3ZsWGjGo3LB33nhWYAPjvvmzvJNaK//C+03cK+vt2Ikvv7YkQZJSJ2npa3dE MP4tWT+CPuQ081V62x5XWq6UQbBw9EVrSu7ZNnBkqEHiakHyZaHDerT9qYlp46jxxis/ utVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OxWhS+te; 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 g17-20020a1709065d1100b007316ac034acsi26691414ejt.834.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36:29 -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=OxWhS+te; 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 S235935AbiJXNV6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236471AbiJXNUd (ORCPT ); Mon, 24 Oct 2022 09:20:33 -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 01B2F87681; Mon, 24 Oct 2022 05:29:07 -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 D6964612C4; Mon, 24 Oct 2022 12:04:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1A8C433D7; Mon, 24 Oct 2022 12:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613077; bh=QU5vmXNJ3Gr1SJU1WZy8eaBaS35TPYAliopPzIIp1pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OxWhS+teHRx/gFvEFDfccYRp9yl7x2hiN87EhtYxn9hAZcN7YNs0hZMzdeNzAwmdn HR1yFsbSvkjo2RtF3ODaWVhKoP9VZamhqVPOg8jddNKUzUuxxSSmeZj6eS7mKyua6O C0AvBDCg+aej92p+76AGn7kgsyyhEVG2GuNLWpiY= 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 4.19 218/229] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:17 +0200 Message-Id: <20221024113006.299576645@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747576253855266905?= X-GMAIL-MSGID: =?utf-8?q?1747576253855266905?= 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 582c3b190418..986912e680d8 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2320,7 +2320,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; @@ -2481,6 +2480,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");