Message ID | 20230620134624.99688-3-ilpo.jarvinen@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3678849vqr; Tue, 20 Jun 2023 06:51:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Uf7FwpLrMmfR0EszNYCjaIm6oTg/qkW5Avlu+C3UoUXBdeRG/+D/kLmG9VkJS6TjjQB/b X-Received: by 2002:a17:903:11c6:b0:1b3:ea47:7972 with SMTP id q6-20020a17090311c600b001b3ea477972mr9510082plh.38.1687269064380; Tue, 20 Jun 2023 06:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687269064; cv=none; d=google.com; s=arc-20160816; b=KjSjFwd4Yzswc5RE/uv1ATIgbfrhDWOkhW9D0wsRd+zqRP/Yew8H6NEzf7qr1wkK7H BilyU0opPRAzAnMGSVdVQvpL00alQCOv4OMcb1kS6yaKiB3Vu0HVRi70UER90kTM92Qc iTusgdVdcH4Lxg601b6hOqquZrWLWjakYyzl3nAHM9UnJQ4Y1T0rlVFOgqTEUs+Xkku6 hV14jBCKVkpRtkrTUhVyrv6NzsAv231Bkzf36ERoFdhLAsvYG2qUg/psL4KATL+qSncY 8yO0+ve6p+mgga7YFWf4Ym0ftnAW61SUNgRC+NmHlQVrvEV4sKeIfgX1gOBRxduOl7Pj ugZA== 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=RY9H7f+HA2nB/MP0NfXiZrELBxj3WSm9ezM2t0PL+3E=; b=gMSWh+hvjWuPVnr1jp4vmxKLQEO5TtEZNaUDmVUuzZRQs27hmqw0NbOYjQACwiJIqP mfIat9/NteUGfZnDBgfXFzD4obPbeqo/SG04GLR65H3MH9wsuoU2PVp64AmL02y/5dXB hsOT8s+2weyiRZ+OOYr8i/eLozMCnbPQbggxYktH3MJKARRu81RNZZrA2VB9lJbveZ/v v+gaBYGVYpd7yXfcQBjNVz+MdPTC30PfNHLjAT2yS1ZKD6OJzgsj138fsrOgGhiet+jq xNw3Ft23KrPLxsPqSat7N4AwAA36k/P9iZKieDqbU8A4jAG9cg6J9qVnUZL+KyYyuZ16 V+hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="P4/FsBZl"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a170902bcc100b001b55070e154si1877830pls.96.2023.06.20.06.50.49; Tue, 20 Jun 2023 06:51:04 -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="P4/FsBZl"; 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 S233147AbjFTNrJ (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Tue, 20 Jun 2023 09:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233113AbjFTNrB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 20 Jun 2023 09:47:01 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 328081718; Tue, 20 Jun 2023 06:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687268820; x=1718804820; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KdmhiibePV/4HK2zA0Ez8F9OGPcYXPdUzaI7QpnJGNs=; b=P4/FsBZlHyVOaEJtgqAg4UNZ4xqE8j1jZRIR54NTfLKppB1T9eUlOqnJ oG97zokji7wSHQrygYrqaDA6uURyegJqi+mHRDD9ZgjIL3WQPZ771BVnr 8Rcc1QTcfsNFtHWNgXGgczWzc/YcArkRoK5r8PK2uPQd2wdPv1YT1psWN IFYGPU5jaxc9a4SfTFV6yRCvPwzn3Gua9mlm/puQGHbPTBffMuuYXzVm6 uqSufbws1T11rGSUcS7bpjPr579oODsRGUw/EXZCNkg6OzT/BZLtkTOWC ARUHJojnerEMq9YD7xGXnLmvQiNv+vz0mz6WGXaFeelPeVeUfGcaUfE3V A==; X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="362401341" X-IronPort-AV: E=Sophos;i="6.00,257,1681196400"; d="scan'208";a="362401341" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 06:46:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="827006663" X-IronPort-AV: E=Sophos;i="6.00,257,1681196400"; d="scan'208";a="827006663" Received: from eshaanan-mobl.ger.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.61.137]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 06:46:54 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> To: linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Rob Herring <robh@kernel.org>, =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kw@linux.com>, Emmanuel Grumbach <emmanuel.grumbach@intel.com>, "Rafael J . Wysocki" <rafael@kernel.org>, Heiner Kallweit <hkallweit1@gmail.com>, Lukas Wunner <lukas@wunner.de>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, =?utf-8?q?Stefan_M?= =?utf-8?q?=C3=A4tje?= <stefan.maetje@esd.eu>, Shaohua Li <shaohua.li@intel.com>, Greg Kroah-Hartman <gregkh@suse.de>, linux-kernel@vger.kernel.org Cc: Dean Luick <dean.luick@cornelisnetworks.com>, =?utf-8?q?Ilpo_J=C3=A4rvin?= =?utf-8?q?en?= <ilpo.jarvinen@linux.intel.com>, stable@vger.kernel.org Subject: [PATCH v3 02/10] PCI: Make link retraining use RMW accessors for changing LNKCTL Date: Tue, 20 Jun 2023 16:46:16 +0300 Message-Id: <20230620134624.99688-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230620134624.99688-1-ilpo.jarvinen@linux.intel.com> References: <20230620134624.99688-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769229846650334286?= X-GMAIL-MSGID: =?utf-8?q?1769229846650334286?= |
Series |
PCI: Improve PCIe Capability RMW concurrency control
|
|
Commit Message
Ilpo Järvinen
June 20, 2023, 1:46 p.m. UTC
Don't assume that the device is fully under the control of PCI core. Use RMW capability accessors in link retraining which do proper locking to avoid losing concurrent updates to the register values. Fixes: 4ec73791a64b ("PCI: Work around Pericom PCIe-to-PCI bridge Retrain Link erratum") Fixes: 7d715a6c1ae5 ("PCI: add PCI Express ASPM support") Suggested-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Cc: stable@vger.kernel.org --- pci/enumeration branch moves the link retraining code into PCI core and also conflicts with a link retraining fix in pci/aspm. The changelog (and patch splitting) takes the move into account by not referring to ASPM while the change itself is not based on pci/enumeration (as per Bjorn's preference). --- drivers/pci/pcie/aspm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 66d7514ca111..50e32bda4656 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -199,17 +199,14 @@ static bool pcie_retrain_link(struct pcie_link_state *link) unsigned long end_jiffies; u16 reg16; - pcie_capability_read_word(parent, PCI_EXP_LNKCTL, ®16); - reg16 |= PCI_EXP_LNKCTL_RL; - pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16); + pcie_capability_set_word(parent, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_RL); if (parent->clear_retrain_link) { /* * Due to an erratum in some devices the Retrain Link bit * needs to be cleared again manually to allow the link * training to succeed. */ - reg16 &= ~PCI_EXP_LNKCTL_RL; - pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16); + pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_RL); } /* Wait for link training end. Break out after waiting for timeout */