From patchwork Mon Oct 24 11:34:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555982wru; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6FzyYktpTgFFkdsDauv1TfIQi63A6rORIBVR14UauMp4pt5gMcmHguOzp6mWIpZQf0q67R X-Received: by 2002:a05:6a00:1c99:b0:562:6292:9e4e with SMTP id y25-20020a056a001c9900b0056262929e4emr34967044pfw.22.1666630858606; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630858; cv=none; d=google.com; s=arc-20160816; b=sawy2RQGAGk6xu03hbfztYFbGujaPmAgf5oRLmNXKKeV7D/v+D4njbG19vQGrnbb8g WhqTaAUUMC9n5m9AwjJwrFOH2kYpIf5EeKdA8Btno5ixs/ghlfA4vl6jzaueB05CgqH1 /RJ7oorXubATSi/QJcrT0W6AlGlbPXHDgdt++W4kMDnTKKXah2agbfMGfvOtvdZN1IVO NhSUjAdkXDfv6tqAOenlUp2+ofrfuNADUDTOUdS34L47aUshnLIlpcyy6Bt5U729TCo9 7uHglulalV+RyFJCFfS+rMEROfm5sj8TM59Yz6b+W0JA4PzH2zqTlBzjApnY2SQ6Zl5d nKng== 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=ANct6a9K15Q1KpV8swFzxyQnkMtO7Yx23Ui5NPwxQWs=; b=SP7e2a4r7nMRzznp4Ui7wqDdXWH9+Q61zqO6tMXDt0D4BM2eZfL/H+wq1Y30ph96/c 0KJf6Efcz7Ln06wdOWGgvWZhSlUybcDhOvideuB779v+U+FFH/JKT79YwoDmC6ix/9j8 MnTx5bQBwZbrJb7WA8i9wdCKh4ETzEEh26r3Pq3MHkFvMfA4G4TfPSCm+Dx2RWgyRrF1 6I27RNCapRm5lXtMbspwoVlw1SaxQeo/Mw7sHBqUw48kPVjQ9HbxuCOXf5syOr8OCv5y rAWP9Xk7U+0bgza8CDzRoeSfJQIm2+lvXk0MBdqvLDaeMFdHF2zUnI7+2iL+56p7Slbu qmZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k0MdIMOJ; 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 e16-20020a170902ef5000b00176e05275d1si34975170plx.423.2022.10.24.10.00.32; Mon, 24 Oct 2022 10:00:58 -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=k0MdIMOJ; 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 S234201AbiJXQxV (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235331AbiJXQtZ (ORCPT ); Mon, 24 Oct 2022 12:49:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D094415714; Mon, 24 Oct 2022 08:32:29 -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 C494DB81A0A; Mon, 24 Oct 2022 12:55:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B44DC433C1; Mon, 24 Oct 2022 12:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666616109; bh=wrATyctV2ohV737W7q/40WRodm8LvGQCPuOWW++0vFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k0MdIMOJYddAPzQsFg0bpGm6TaWnG3DS+3DwKkna9RTvz+gazc0kHL0GAtj/uDrrW WABJQ8hATg8jFKLLw1yrlCcWfQfe7YRNnfGDFOjmz/HBv/w0gGGH2mEkDAJYig+U3/ fFTr/AWP+dzHHX87dEmmJQAuLvYjJ+uz7nPCA6Rc= 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.15 505/530] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:34:09 +0200 Message-Id: <20221024113107.892532032@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747589118958973530?= X-GMAIL-MSGID: =?utf-8?q?1747589118958973530?= 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");