Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5530769rwp; Mon, 17 Jul 2023 05:51:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHPp7fBj1i4rQGIg0p5B0JiJSGIlb1Fcz7DuqMm5Ro7r7h81I7kLz+a7VT38Ae4aN9BHT3D X-Received: by 2002:a17:907:3da3:b0:98e:738c:6d39 with SMTP id he35-20020a1709073da300b0098e738c6d39mr11920701ejc.36.1689598271882; Mon, 17 Jul 2023 05:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689598271; cv=none; d=google.com; s=arc-20160816; b=kee5HTjSyJciF3daVMZCN3urTTo1bBsyXOun2AgEf9nkenL+xaeLoEFgkgb+tcz3yy LNIvJDbweY89OH+koVc4yAw/KZbL2v9SEXDZ5hSUA0jXY2GuYbgxZsH4vjoSwIDmYoh6 NYyGDonhoWLQdPwhSz3cscqMN7r9pJwQUUX05xm+7YmDg7nWMfHyqsDkN5BpYSSmkJmb 1K5wrCw46TXjYbdFcrAoZXEGHCpFUa1AODfve/IxOrA1v/peDKnIgorumacvHD3UTp/u xzXVm5Gva03auzJMN7HtBdsGkFjLsHXGYsrjGXPp51aTX+JhdI75yxdfMFAcf58KQcUn X3Gw== 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=7/rlENRwBX/s8n0FTMoBrQ4BZgrvGgHfRpv5FTOCNDg=; fh=NpwdKdN5sTj4ps9qahiqMiuTuotURdqq+CVLYflMz9g=; b=DmWFFeBmppFSqGr2nNtQLHwuoZc7PVik0d4ryGRNjWKfYaGndPefphnX2CtjY7zWlx gu4CDodzD8/2OpMeIr8S+JkC2gIox1OqjZrG1NVBP11vFx/bi9pErYMuniqA1jz54maB s/o9hzw7tQcpG2GVttfwtPMRXvsibKRufyLARmRCDIyRa8i0llDBPDmG9w45Uj4yMUQM 1FGWweeyPCd7MKHwu9vcVkAhP2hwKuqnca9sKN02e+8u38IkzWjYtHHUrtvsuTdpj9/C MW8vHolIS4SF2K4WoSZFaklStpSBNPvfpEhuXANJ9wlgsf3t9nhhbatRsoKaHnJYvV8q rldg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cLNXM8HV; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a170906140900b00993689daad1si13769394ejc.116.2023.07.17.05.50.47; Mon, 17 Jul 2023 05:51:11 -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=@intel.com header.s=Intel header.b=cLNXM8HV; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjGQMHT (ORCPT + 99 others); Mon, 17 Jul 2023 08:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231184AbjGQMHP (ORCPT ); Mon, 17 Jul 2023 08:07:15 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F65810E4; Mon, 17 Jul 2023 05:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689595609; x=1721131609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=32kRKfdMgDzPzA7zG83cMwuqvw0HkhDshGCOND8kKRk=; b=cLNXM8HVveJmjjSca+UcMMTJr4JrX8zXGbXCLtVlWVmrdcKa2J1+uMu3 APQZ0opFu2faKy5HomRcwvU1n1AFrjeOEbnnrpOUcK4Z5BU7TDmLEt3q/ e/L9xSJcbQHwscBwxM3on8/WN7e3rsV3R/gs7JFYio5EdUq9QORSnW31N yRSjAb08G6aT9zHzUuT4MUfDFsGoIQRz21e0CZOnMfnI7mddLNZ+m2/Mx 3PfoU0KVMtHDbqAeoTg4KkGBGilr3ARkfdUK2sxMDDqWy2CP8a15qqIzq OQ0qY2hBLqajtU6NEx8wKzCF3cO7xZqnoJicH6cmX8qF9gYvhL4Z8l+VP w==; X-IronPort-AV: E=McAfee;i="6600,9927,10773"; a="432081825" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="432081825" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 05:06:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10773"; a="752876275" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="752876275" Received: from dkravtso-mobl1.ccr.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.45.233]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 05:06:34 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Emmanuel Grumbach , "Rafael J . Wysocki" , Heiner Kallweit , Lukas Wunner , Andy Shevchenko , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Moshe Shemesh , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dean Luick , =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Moshe Shemesh , Simon Horman , stable@vger.kernel.org Subject: [PATCH v5 07/11] net/mlx5: Use RMW accessors for changing LNKCTL Date: Mon, 17 Jul 2023 15:04:59 +0300 Message-Id: <20230717120503.15276-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230717120503.15276-1-ilpo.jarvinen@linux.intel.com> References: <20230717120503.15276-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Don't assume that only the driver would be accessing LNKCTL of the upstream bridge. ASPM policy changes can trigger write to LNKCTL outside of driver's control. Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value. Fixes: eabe8e5e88f5 ("net/mlx5: Handle sync reset now event") Suggested-by: Lukas Wunner Signed-off-by: Ilpo Järvinen Reviewed-by: Moshe Shemesh Reviewed-by: Simon Horman Cc: stable@vger.kernel.org --- drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c index 4804990b7f22..99dcbd006357 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -384,16 +384,11 @@ static int mlx5_pci_link_toggle(struct mlx5_core_dev *dev) pci_cfg_access_lock(sdev); } /* PCI link toggle */ - err = pci_read_config_word(bridge, cap + PCI_EXP_LNKCTL, ®16); - if (err) - return err; - reg16 |= PCI_EXP_LNKCTL_LD; - err = pci_write_config_word(bridge, cap + PCI_EXP_LNKCTL, reg16); + err = pcie_capability_set_word(bridge, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_LD); if (err) return err; msleep(500); - reg16 &= ~PCI_EXP_LNKCTL_LD; - err = pci_write_config_word(bridge, cap + PCI_EXP_LNKCTL, reg16); + err = pcie_capability_clear_word(bridge, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_LD); if (err) return err; -- 2.30.2