From patchwork Mon Oct 24 11:32:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp466597wru; Mon, 24 Oct 2022 06:55:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6z7kTtDaj0M4sFhVb5W0YiuCcbVvQ/M89IzGrz+lrRipiMZtqu/e4MvxNwwc1oDe1Gj6Ma X-Received: by 2002:a05:6a00:301c:b0:567:6e2c:45f0 with SMTP id ay28-20020a056a00301c00b005676e2c45f0mr30037798pfb.84.1666619729371; Mon, 24 Oct 2022 06:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619729; cv=none; d=google.com; s=arc-20160816; b=WgtZ5PpUhlkMm8+CdXiMoxa/C/UdvjY4IKvcLE0NgH17jmzvPfI/voKEiJaF/W/8wH +NisGGhGq5AG9Y5JZ9reAf2KmsCqeMA2oFKqRifiQJgdUGmjdaAuFhiIarKZlElgLYjN BNmbYAowoQQ3OO1vbdQT82Qt3fgD4c6M/ty/d5Ppfwk1nMtLDwWGbJ3T3me8Des+YVlW cgy1yfAcbfLCYn7keP/j45esRp6w9c6PiGaO4IqasbvNTyGKexwhxqolVd+CHJlObAZ4 /xWkFvOZJSxfZm7K2HwOx9xxhtoqqboz8znAi5R6hcILR/CN04qlsQPGqOpDlxLrjFWY X51w== 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=mxIMaErCXLQ6SGlus45arc5+X5f7tGiN8FqdqXx1cUY=; b=CgMM9PpCVAq+AR6XCPgLk7mN4mfMC+hluWkSJcYpfGAAKGnjruZhTOpQTkZZqRfXhS m1XU7vOrrpbUwsJFmjIaZMErKwRgy1EGKzch7c7C0W5jvB6tdXpSYWM8Eay5FBrjgeaV jFY8QDOxLb9Yags7xZ5eWbVQ0t73vmZxCkR1I1yQ2DNrFzuKTyCt0hK+oteYXHUics+b tvqhhUSoGcYhE8/jUX7o37ltNqHLsUTWaq5J6yUJQoQ4fUGO3/i7fCdTiv2P5OPdMSNx 14A7dkOCGGkyr8qA2MDQIUYIYES3BXitJdKA7rfMgmTFVrH6vU449tgvJsGAlFpKNynF 3v5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x0J0TAJc; 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 d4-20020a655ac4000000b0043c5d3dc0d4si36529277pgt.332.2022.10.24.06.55.15; Mon, 24 Oct 2022 06:55: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=x0J0TAJc; 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 S236426AbiJXNzA (ORCPT + 99 others); Mon, 24 Oct 2022 09:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236545AbiJXNxS (ORCPT ); Mon, 24 Oct 2022 09:53:18 -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 E28B0BC447; Mon, 24 Oct 2022 05:43:28 -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 3C37F6131A; Mon, 24 Oct 2022 12:32:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A45C433D6; Mon, 24 Oct 2022 12:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614730; bh=kpCVKSVx4edmN/FF2ES1UPayu/qR0i3LiEngz2CZ+Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x0J0TAJcjN6INNx6uzzCZ+bJtqCGjpkWSiojqgxGPLMVnWipLpVmyl+ChJYm1JWRI ygpGDg1UJs9ditKm8V0Cu/oqM/mvxGCGbgNRyqUgHCQCrIOgOW44aSHVVPCE3hhl/5 /X1nbWM8PxlbBbA1D5HYxJI8q5qpNECZ1WwZUdHA= 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.10 372/390] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:49 +0200 Message-Id: <20221024113038.861652338@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747577449166586156?= X-GMAIL-MSGID: =?utf-8?q?1747577449166586156?= 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");