From patchwork Mon Oct 24 11:32:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp443070wru; Mon, 24 Oct 2022 06:08:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rpjmhhPZ7HjimS55pAJ//b61T9HDvNa0bNZSmRqUAcNQYv020VngvAGne8E83PG4uxnyE X-Received: by 2002:a17:90b:1d0e:b0:20d:a61f:84b1 with SMTP id on14-20020a17090b1d0e00b0020da61f84b1mr65365637pjb.172.1666616924143; Mon, 24 Oct 2022 06:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616924; cv=none; d=google.com; s=arc-20160816; b=0CTSNu0Qutdg73C6HW2PZ/vzmN1dWPdRX/KA821nMOXZ+JEEOh6+QubKvmmSNta5yZ sFXwnSJEoVsKugNDMqXju5nglaZw/Lwvq+ZuQNzX8PBKKP4Wl8DneXEMgT9taHF1I7+A qphiyBp3jqljidpGQbE6zfNHQjOroNMJa4lDu85ysEtLGyxiOZotwqrBpQ1RbAfOXN6x ow2bnTpDbU0Fm40waP9ILzk63dp2Ucnb1I/3hIgrkJ+rYp4dvocOszGFNLQKic3URsNx 6uAaSpKxUVWsrm1pfEBbkhsWfDwgpBrI4yI+McwWlyyt9h7oK0XaZLnldbE/3VqDNIfG nL6w== 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=g68N+8WEOflW10ZQeX8CKTsTZZiLJOjQ1Rr2ylmkeEM=; b=HM+0KWsK4ZxGM3xDr/wk7w0d5LriXFeZFV7MdToiHSQ8hXSm01P5OpDrfPHrjaagAn Tx+6rT/VC0HjZVJT9RQ48Md/sftEzvlQD1ozJVNkQUOkXE7INVYB65B7jqM45QZ211j8 7ePF7SCeIxr+A5EyxzyjsDF5wEXhPRm50O+f3hLNZK5Jas8FNq0acSJIgLAt67mAoH4K I6pYEmbqN7BUZzXglOcklsIvLqF6rUf1oXp5vaz5oTMIiuhFvsFNLVtod2ibuV6JWgKq iiXlIuy5UCLtsq2qkh8Whnb7sV645o8WorG5lO5SzS32VtiXkV331KHekylbwg7l7xvi 9eCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZnI8Rdn6; 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 rj1-20020a17090b3e8100b00200e221e9a0si10263449pjb.149.2022.10.24.06.08.27; Mon, 24 Oct 2022 06:08:44 -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=ZnI8Rdn6; 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 S235213AbiJXNHQ (ORCPT + 99 others); Mon, 24 Oct 2022 09:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235219AbiJXNFN (ORCPT ); Mon, 24 Oct 2022 09:05:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2ABB9AFFC; Mon, 24 Oct 2022 05:20:52 -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 72947B81622; Mon, 24 Oct 2022 12:15:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C18E0C433D6; Mon, 24 Oct 2022 12:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613716; bh=HWJFCQPIjhn238FA1JB7Bz47RZsjflnrkViylqrq2ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnI8Rdn6eMKAFOVprNLZ5pyKoIm6P/ypLqvzG5EPUxqrmVSvmitNW0nz7/z5+xW0c wrGNEV9zC8Jmn+1nJ55OlzHbrgIdR/YHMujasq4ZzTv3nvwubSsqoTU2YEhJ4iDbGl 33G0zo5/PCQMWLxB9IDxuZ0nobh9/l9cCdM7YvXY= 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.4 242/255] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:32 +0200 Message-Id: <20221024113011.284523202@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747574507738494482?= X-GMAIL-MSGID: =?utf-8?q?1747574507738494482?= 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 f1717f34b2f3..6627fb531f33 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2671,7 +2671,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); @@ -2824,6 +2823,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");