Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1849168lql; Wed, 13 Mar 2024 09:45:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBvPfpW1oOqanU2PpWMlVvOE0a5Jr86WbKrOVY2sQO0NnyCrgfB9/H3/xvZbF7p9kW0NtKmxSclh/jGvS1ZKD1osZ+Sj2s8LaQIe19Lw== X-Google-Smtp-Source: AGHT+IGv65Q0Y4bgkmRWfMbEUsKudNBCaSCFdDSpCYclndEuYhloa+xqYN2AIsvN9O2WJ95LCOVk X-Received: by 2002:a17:903:189:b0:1dd:88b6:ce0d with SMTP id z9-20020a170903018900b001dd88b6ce0dmr4669307plg.25.1710348327262; Wed, 13 Mar 2024 09:45:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710348327; cv=pass; d=google.com; s=arc-20160816; b=ehb33DN9v/3PYwL5U7yeJoNsJXGBT8vNcgaxMTCySLacz5myTbd7q9wDVMomF0PiW4 SpbWMnO/3oKZZL2Dd2wDaJ/OwuVdwEh6t7fjZbXG/uU5BGpETH6v/VCSig4d/C0p61r+ 3uwYK/3PpHrWdzJo2y8CPYVU1PffZ50YDJkgVEkVqMVOcyFu/lEn+fcLvH5tzln2RxJw QMnCKbJqmhXVu1rKtVIc6FviiXYq44CFfgpujDFJdE/s+8wFBM+kudnRevB3q0BYxiYc Hggj9foke+HmLzpv26dQvjdFRpfrqSKEEi9gbMrPMZUcszB5S8bXCfMI9zAWTrV0Jotu ming== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yrz4nAuuL7jKfPAEYWKjTlLs+e/Hkd0w05hQ4/wwjZY=; fh=tbYEm21Lmhx8htv/39/GsFbaa2IFPH+9+eUYKkCH4Z0=; b=s7xZ+4DBEfQp/HuwDB4duWzXkM1jR+AZkZTFQ49Jl0qaTG9mOp95iTDWLtI8fTA582 0JYwyC8c4ZfrLRIxd1X/dw3WUBOj1bgFzrK9kHlzH+twVZ8eIcj3u356yK30UZJpZcXo lCj44Dpo+1kB6LQhgvuwXTa9F4MzQ0lgSWSn5Wq62LvrJtFQ1IpEAZ8SRn4XhyZrKDjR E/GO4M3HOyjdtxC0gBKKHCieiFdFnCJ0BwRMrN9mIFGcBChQpYW9umofPJgyBH/nIIXf su0LS5OXVgTin3TSNHNvQAD4RCrpSTat3E7SEtxEVOhH94sJWHnm3TO2/pRAQuBC18Wy PSIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UuK77dnf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i1-20020a170902cf0100b001d8a9162f22si9399961plg.60.2024.03.13.09.45.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 09:45:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UuK77dnf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8D26C283677 for ; Wed, 13 Mar 2024 16:37:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 265115F54C; Wed, 13 Mar 2024 16:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UuK77dnf" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B3065F46F; Wed, 13 Mar 2024 16:33:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347583; cv=none; b=ghw5oSj7YBzmUpTKycOmTztwffasTLiYNcscjnEvnqUCnD3PZ8oZPenQOuIZVhHMi50wYXuirO5O6RQSOoF1RbkpQMsoEke4Wbs6Q0l1VThnrxrrsu6K21kBLZjbB3D2P+brXpi1+QDUIvZAV+5S9PsNZq45L5z5kqfUXpAfU1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347583; c=relaxed/simple; bh=YxLfOxqWoZu1HZCDFjZG3zm3hmSaWH2+oX/3G87+5RE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hjabq4Bg6x205u/5VxSGORrtXsIKXIuZNzvH0aWiwBHeT9vwMs/EB+cB01i5OvMOO41zbujhyOVrYmVcuCTrupdEYVZ4MBeRFuScaN74LNh7tEEEdKZtFYjezbLb71EysPTniYeptpxY/0lMJ1yMpdqHvv+F4/Qe6D80WaHvnHY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UuK77dnf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4652BC433F1; Wed, 13 Mar 2024 16:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710347583; bh=YxLfOxqWoZu1HZCDFjZG3zm3hmSaWH2+oX/3G87+5RE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UuK77dnfiQlSHTsBcjPc/KR4mHoCUIvbnnfFviHE2QyoaqzrP+cMsB7ll5Jf68wsJ qU7c0BWjr4PH4p0ddC86rge0PrWeYgjQ1X+Qi2NyBBmIQAvhj+NGFvpVbXUDEy3UwG SZgVylF7IStXoJkQ6IKTCmiBnSk1m5TuMOiZRxImIndxhuUmB1Whj1pb8BtKg+d9Ni HLgMaRnXAbL2cTzkn46oSrENmIMKYVqM6hDp9OG5CdUbnCzADLHsXi4iG4pIl6X1Zy dLedKlHbVZvNRNlChMHKXN3o5qiq/vJbjwCqED8ooFijk6BqJ5Tk1HDjM434x6HcpK 5lv9n5Tccb2Ww== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Moshe Shemesh , Aya Levin , Saeed Mahameed , Sasha Levin Subject: [PATCH 6.7 20/61] net/mlx5: Check capability for fw_reset Date: Wed, 13 Mar 2024 12:31:55 -0400 Message-ID: <20240313163236.613880-21-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163236.613880-1-sashal@kernel.org> References: <20240313163236.613880-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.7.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.7.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.7.10-rc1 X-KernelTest-Deadline: 2024-03-15T16:32+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Moshe Shemesh [ Upstream commit 5e6107b499f3fc4748109e1d87fd9603b34f1e0d ] Functions which can't access MFRL (Management Firmware Reset Level) register, have no use of fw_reset structures or events. Remove fw_reset structures allocation and registration for fw reset events notifications for these functions. Having the devlink param enable_remote_dev_reset on functions that don't have this capability is misleading as these functions are not allowed to influence the reset flow. Hence, this patch removes this parameter for such functions. In addition, return not supported on devlink reload action fw_activate for these functions. Fixes: 38b9f903f22b ("net/mlx5: Handle sync reset request event") Signed-off-by: Moshe Shemesh Reviewed-by: Aya Levin Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- .../net/ethernet/mellanox/mlx5/core/devlink.c | 6 +++++ .../ethernet/mellanox/mlx5/core/fw_reset.c | 22 +++++++++++++++++-- include/linux/mlx5/mlx5_ifc.h | 4 +++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c index 3e064234f6fe9..98d4306929f3e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -157,6 +157,12 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, return -EOPNOTSUPP; } + if (action == DEVLINK_RELOAD_ACTION_FW_ACTIVATE && + !dev->priv.fw_reset) { + NL_SET_ERR_MSG_MOD(extack, "FW activate is unsupported for this function"); + return -EOPNOTSUPP; + } + if (mlx5_core_is_pf(dev) && pci_num_vf(pdev)) NL_SET_ERR_MSG_MOD(extack, "reload while VFs are present is unfavorable"); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c index c4e19d627da21..3a9cdf79403ae 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -679,19 +679,30 @@ void mlx5_fw_reset_events_start(struct mlx5_core_dev *dev) { struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; + if (!fw_reset) + return; + MLX5_NB_INIT(&fw_reset->nb, fw_reset_event_notifier, GENERAL_EVENT); mlx5_eq_notifier_register(dev, &fw_reset->nb); } void mlx5_fw_reset_events_stop(struct mlx5_core_dev *dev) { - mlx5_eq_notifier_unregister(dev, &dev->priv.fw_reset->nb); + struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; + + if (!fw_reset) + return; + + mlx5_eq_notifier_unregister(dev, &fw_reset->nb); } void mlx5_drain_fw_reset(struct mlx5_core_dev *dev) { struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; + if (!fw_reset) + return; + set_bit(MLX5_FW_RESET_FLAGS_DROP_NEW_REQUESTS, &fw_reset->reset_flags); cancel_work_sync(&fw_reset->fw_live_patch_work); cancel_work_sync(&fw_reset->reset_request_work); @@ -709,9 +720,13 @@ static const struct devlink_param mlx5_fw_reset_devlink_params[] = { int mlx5_fw_reset_init(struct mlx5_core_dev *dev) { - struct mlx5_fw_reset *fw_reset = kzalloc(sizeof(*fw_reset), GFP_KERNEL); + struct mlx5_fw_reset *fw_reset; int err; + if (!MLX5_CAP_MCAM_REG(dev, mfrl)) + return 0; + + fw_reset = kzalloc(sizeof(*fw_reset), GFP_KERNEL); if (!fw_reset) return -ENOMEM; fw_reset->wq = create_singlethread_workqueue("mlx5_fw_reset_events"); @@ -747,6 +762,9 @@ void mlx5_fw_reset_cleanup(struct mlx5_core_dev *dev) { struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; + if (!fw_reset) + return; + devl_params_unregister(priv_to_devlink(dev), mlx5_fw_reset_devlink_params, ARRAY_SIZE(mlx5_fw_reset_devlink_params)); diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 77cd2e13724e7..bfc8320fb46cb 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -10215,7 +10215,9 @@ struct mlx5_ifc_mcam_access_reg_bits { u8 regs_63_to_46[0x12]; u8 mrtc[0x1]; - u8 regs_44_to_32[0xd]; + u8 regs_44_to_41[0x4]; + u8 mfrl[0x1]; + u8 regs_39_to_32[0x8]; u8 regs_31_to_10[0x16]; u8 mtmp[0x1]; -- 2.43.0