Message ID | 20230511131441.45704-8-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:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4368631vqo; Thu, 11 May 2023 06:24:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RKUljjrPPbHpeZEMcsd+e0yPF3JoJkicJ2wufwJbSMQtiSsrOjIUUI21dV76snWeTwTd6 X-Received: by 2002:a17:90b:4c06:b0:246:5f9e:e4cf with SMTP id na6-20020a17090b4c0600b002465f9ee4cfmr21156685pjb.43.1683811439919; Thu, 11 May 2023 06:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683811439; cv=none; d=google.com; s=arc-20160816; b=lW73pn8ghUciXls4oJHLV+boqirc0SpoLv7VL1g89EpbONa20ht3NUWUy8YBUU7Hta Be9Wq73G2sW+RfzHHzWAgqqbMlXoLk3GPb2RLA+O7LcGXZpCblKYjD6t3rlIwq9++Y/b 6dyTxQeRpzQXkJq+Z0UD8sAaxk30g/qoIQwFZIutNb2oTGRYE9JH1mVMUm09QvHL1s4M i6nLPYi3zUQj7lsLQaGqr31TeUMjPqxqfusgR12wlTeqsh7GmOuU/XiKVKuEeKToSZvF ckNRu+zGHHD4pIPbPSHtGTlZyotEG/Z9gs4qGBARNjrty4M+1iPwlNRHhZ0stbqVXXz9 C3Mg== 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=lGlHc9eYBGA7O2Ay2ZnwYOrmxSnuOpgg8hTNweWYwPk=; b=LM96C8RfsN1MsoLGdw0K0vO7in6r301L6vek0mQD7WVOyQ4deJ2sH0AqqzDGxpZCTN 51u03vnR0/bD9Q8i9rOXr75dICuhfnS5Nu8nPoWwZn85cUGggklP5OB2bcCgvzqwJiL+ ekJNC73GND/JM4Ol98++aWJhkTAO1GBrmRmpN3EG/zortyRkhEmuhX6KG0tgC+uu0chu 7TcY3sZ2zk8dOlw5Xh/rCJXIpMOsVAgEDraFdS3ONqKxrAfJ5eufi6VRf6tjuPUmAHa2 2AnxcEQMI+IAyACP91WRs5FSZbYkmASXAm+libBTwYwLKR5QMUX3/FrEQizVg5Sr9syW uO9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ePJobaBI; 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 t20-20020a17090ae51400b00250cb2a2003si4923678pjy.164.2023.05.11.06.23.45; Thu, 11 May 2023 06:23:59 -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=ePJobaBI; 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 S238124AbjEKNQu (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Thu, 11 May 2023 09:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238094AbjEKNQQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 11 May 2023 09:16:16 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B552659D; Thu, 11 May 2023 06:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683810920; x=1715346920; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W5cLSAaV+r+1ItVRXAcJDtR+e/em1mtYJ7N6Iy6IoQc=; b=ePJobaBID6ILaQVr5Io5+Iu+GVB12lTrgz4rukTjEhIxsIerpfyDPsPp M/e+QGn1AhWHh47t8MooBVvcB++0ecU+hkp3qxWhn0ZYq9oPioz3cgSyl oUUK84dVhZZ/DRCoSzNG/iT6tow5mKJcEPwphHsDZd8K9ATBFd+kx9iwQ cij3str8fF+we798MRVVtzVrTz29zagqG2X1eRExLBPdh2RdHEvra0qeT qeFJ2nk92D92Cq3Pea1B+4bXHynZcjXT1gwfvUpZJ5O/2OEryzzaLo9CK lHKaqzxRmAHHHlYlWZ3ZZBEwa7p6ZWGBwhMVdUbTa2hn8JrK4NIN2+1QN A==; X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="378619458" X-IronPort-AV: E=Sophos;i="5.99,266,1677571200"; d="scan'208";a="378619458" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2023 06:15:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="650169748" X-IronPort-AV: E=Sophos;i="5.99,266,1677571200"; d="scan'208";a="650169748" Received: from jsanche3-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.39.112]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2023 06:15:15 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> To: linux-pci@vger.kernel.org, Bjorn Helgaas <helgaas@kernel.org>, Rob Herring <robh@kernel.org>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kw@linux.com>, Lukas Wunner <lukas@wunner.de>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> Subject: [PATCH 07/17] e1000e: Use pcie_lnkctl_clear_and_set() for changing LNKCTL Date: Thu, 11 May 2023 16:14:31 +0300 Message-Id: <20230511131441.45704-8-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230511131441.45704-1-ilpo.jarvinen@linux.intel.com> References: <20230511131441.45704-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 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?1765604264544707855?= X-GMAIL-MSGID: =?utf-8?q?1765604264544707855?= |
Series |
PCI: Improve LNKCTL & LNKCTL2 concurrency control
|
|
Commit Message
Ilpo Järvinen
May 11, 2023, 1:14 p.m. UTC
Don't assume that only the driver would be accessing LNKCTL. ASPM
policy changes can trigger write to LNKCTL outside of driver's control.
And in the case of upstream (parent), the driver does not even own the
device it's changing LNKCTL for.
Use pcie_lnkctl_clear_and_set() which does proper locking to avoid
losing concurrent updates to the register value.
Suggested-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index bd7ef59b1f2e..29d50aeb2c3e 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -6829,11 +6829,9 @@ static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state, int locked) /* Both device and parent should have the same ASPM setting. * Disable ASPM in downstream component first and then upstream. */ - pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, aspm_dis_mask); - + pcie_lnkctl_clear_and_set(pdev, aspm_dis_mask, 0); if (parent) - pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, - aspm_dis_mask); + pcie_lnkctl_clear_and_set(parent, aspm_dis_mask, 0); } /**