Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp181296rwi; Wed, 12 Oct 2022 18:14:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JEY4KKvBIaIX2NHeNWxvW5qhwZPn6+qy1RF4b/i/lJGxgzcT5UXBjljR0PJW81hUohCz1 X-Received: by 2002:a17:907:2712:b0:78d:a223:729b with SMTP id w18-20020a170907271200b0078da223729bmr16906318ejk.443.1665623641318; Wed, 12 Oct 2022 18:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665623641; cv=none; d=google.com; s=arc-20160816; b=pU1WByaidY1kqinUTEBHm5fROj6tz8kq3yxK9eoOF6/F/Vv07mWFbG5vv3EkdI3WdG 1ylfm/x1SSWZ+rvhMpw++OzApI2p1AFbf+SraEICf9hIgPxeBbcalyp0BDY6KlpvgRzw BQyH4WmsTf3IwKadaNZezzyAuVqahLys7dIcPKmzhnKKgqsPrDNuvINI7vwmrnobpfEB ONmjyocMfi88fk0DknWeqdx8hH0Rm6e3vHHbXGKG1pti+HAIOdazpC6dcss4NTqS1rd1 +NOiOy7rFsVt+5cEBaxL4MdhxAOesWptwAGzbWzJ/8sxgQh7xFatJof3iEm/pew7Xb76 kWvA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jlfuvXWu5SeTxVzVxrBULOJJVXhL5e/8NFuwjavM7A0=; b=iR+yWBKvjdp2VJEKP2YAVFBu/Y66W1rXrKOYPvd0s2nyL2WhqC2lxdqdDWvz/5VroV ilkx3+6sQ1Ce/+hYQRJsi4bxH3cPnMv46X6a+zrtOK6yHGJ+3uFH1EkTiVXqkc5ChbuK bQMTtNfqAkP9yYdUcMtj9lLvdnLMqpspm2gk8qKr2PDM85dfOH+z1Ro8muOIACAKtNWM oqvPf2zn8c2cVEX0wFbxmrpHNxL7JXU9ON+HQ912XuslcXV7aTMGOlFcAzITyX2xRhgd yE3lG3i9UWTmKwUASFvurFeMGBY0BuuBYmPXlXZkI9tN5K8D96tUH+PVNMsRwRhyHyQ8 140g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l8Ay+Nfb; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a056402440400b004568a20128asi20029894eda.339.2022.10.12.18.13.36; Wed, 12 Oct 2022 18:14:01 -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=@kernel.org header.s=k20201202 header.b=l8Ay+Nfb; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbiJMAVk (ORCPT + 99 others); Wed, 12 Oct 2022 20:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbiJMAUx (ORCPT ); Wed, 12 Oct 2022 20:20:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4988AE6F54; Wed, 12 Oct 2022 17:18:05 -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 55367616B5; Thu, 13 Oct 2022 00:18:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A029EC43141; Thu, 13 Oct 2022 00:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620284; bh=5qt8H4mypo9d3J9EVjpniftXE2g7dQ0BL2h2ZP4cgy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l8Ay+NfbXlOGvPtzEXzHRS2yCaKx5YR7ewDRDwybGXaxPaAYRJtYCmlmcNaBvyY4l So5pnjdK12IhrrKT5xaatG11GUaFtOwGJecy6ANX0/8v5fHHa4UU2Rc0scP9BQxdju fkWfH2eh9xVpcPu+uNMQqivVT1qR/NEBlMWSt3ADGtQFJjfz9A6PmaYx+t98mi1dgH 1BpXdo+v8xA7eUeWbEYD/aRfP1LB44pZNQDH2WcpS+jkGduwSAXMpSlc+47f2tgZo4 mSsZGo2nIyXkVoVUqeb/IPJ+RrK23dfoCZdKYTf29C428TWOXmcdt7WA3aWpVhISCe 2KvxC23lGMieQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Keith Busch , Jeff Lien , Sagi Grimberg , Chaitanya Kulkarni , Chao Leng , Christoph Hellwig , Sasha Levin , axboe@fb.com, linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 6.0 53/67] nvme: copy firmware_rev on each init Date: Wed, 12 Oct 2022 20:15:34 -0400 Message-Id: <20221013001554.1892206-53-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013001554.1892206-1-sashal@kernel.org> References: <20221013001554.1892206-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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 7991d28e6a6a..59e4b188fc71 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2889,7 +2889,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; @@ -3108,6 +3107,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"); -- 2.35.1