From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33F7ACDB482 for ; Thu, 12 Oct 2023 10:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377995AbjJLKeI (ORCPT ); Thu, 12 Oct 2023 06:34:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234170AbjJLKeI (ORCPT ); Thu, 12 Oct 2023 06:34:08 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960AC90; Thu, 12 Oct 2023 03:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697106846; x=1728642846; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ji8x2F8u0U0ggxefEbWPL9IJWQlQGGYyAuJIBploLj8=; b=bN3f4Qk6kxsqtiPEdc7hozzc/lHyjyLmT9hB1THfw7cBEeXlPkp2ydv4 A5RWqQuNNWZM4AHxz7lFg/5vYZlLPnq3fbNSRje7q8fucWjt+5h6iHSUq lV2n0tt63s27D4mcreO06tcglJUm++kPYTWNkmUiUTT9Su1BNqB0btepP v2x/eCjoYn4Z/KmXkMXUfrnzCL0uqLlTPy7VYz2lRVcyCOX1YVtOgi8hz PXk3wjIBqd57RZhJI714m3FQ9sIPDHK0wEz4wFbNmHdxX/NDdcpf5ZU/a IrodtZrjUd3H3whvPsp1yjwKL187hu6QXV/0zKS3Pt5cD0Ws99XtR3TbB Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="388748393" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="388748393" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="870527710" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="870527710" Received: from asroczyn-mobl.ger.corp.intel.com ([10.249.36.107]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:00 -0700 Date: Thu, 12 Oct 2023 13:29:49 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, Lorenzo Pieralisi , Rob Herring , =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , Lukas Wunner , "Rafael J . Wysocki" , Heiner Kallweit , Emmanuel Grumbach , LKML , Bjorn Helgaas , ath10k@lists.infradead.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, Netdev Subject: Re: [PATCH v2 04/13] PCI/ASPM: Move L0S/L1/sub states mask calculation into a helper In-Reply-To: <20231011193206.GA1039708@bhelgaas> Message-ID: References: <20231011193206.GA1039708@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1380828921-1697106845=:1692" Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 11 Oct 2023, Bjorn Helgaas wrote: > On Mon, Sep 18, 2023 at 04:10:54PM +0300, Ilpo Järvinen wrote: > > ASPM service driver does the same L0S / L1S / sub states allowed > > calculation in __pci_disable_link_state() and > > pci_set_default_link_state(). > > Is there a typo or something here? This patch only adds a call to > __pci_disable_link_state(), not to pci_set_default_link_state(). This was because one of the changes that got included in the meantime made the state handling in those two functions to differ so I removed the call from the code but forgot to update the changelog to match the code. I'll fix the changelog. -- i. > > Create a helper to calculate the mask for the allowed states. > > > > Signed-off-by: Ilpo Järvinen > > --- > > drivers/pci/pcie/aspm.c | 33 +++++++++++++++++++++------------ > > 1 file changed, 21 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > > index ec6d7a092ac1..91dc95aca90f 100644 > > --- a/drivers/pci/pcie/aspm.c > > +++ b/drivers/pci/pcie/aspm.c > > @@ -1034,6 +1034,26 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev) > > return bridge->link_state; > > } > > > > +static u8 pci_link_state_mask(int state) > > +{ > > + u8 result = 0; > > + > > + if (state & PCIE_LINK_STATE_L0S) > > + result |= ASPM_STATE_L0S; > > + if (state & PCIE_LINK_STATE_L1) > > + result |= ASPM_STATE_L1; > > + if (state & PCIE_LINK_STATE_L1_1) > > + result |= ASPM_STATE_L1_1; > > + if (state & PCIE_LINK_STATE_L1_2) > > + result |= ASPM_STATE_L1_2; > > + if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > + result |= ASPM_STATE_L1_1_PCIPM; > > + if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > + result |= ASPM_STATE_L1_2_PCIPM; > > + > > + return result; > > +} > > + > > static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > { > > struct pcie_link_state *link = pcie_aspm_get_link(pdev); > > @@ -1063,18 +1083,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > if (sem) > > down_read(&pci_bus_sem); > > mutex_lock(&aspm_lock); > > - if (state & PCIE_LINK_STATE_L0S) > > - link->aspm_disable |= ASPM_STATE_L0S; > > - if (state & PCIE_LINK_STATE_L1) > > - link->aspm_disable |= ASPM_STATE_L1; > > - if (state & PCIE_LINK_STATE_L1_1) > > - link->aspm_disable |= ASPM_STATE_L1_1; > > - if (state & PCIE_LINK_STATE_L1_2) > > - link->aspm_disable |= ASPM_STATE_L1_2; > > - if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_1_PCIPM; > > - if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_2_PCIPM; > > + link->aspm_disable |= pci_link_state_mask(state); > > pcie_config_aspm_link(link, policy_to_aspm_state(link)); > > > > if (state & PCIE_LINK_STATE_CLKPM) --8323329-1380828921-1697106845=:1692-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63E78C41513 for ; Thu, 12 Oct 2023 10:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Message-ID:In-Reply-To:Subject:cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7My+bXo/L+WXkN4jEfeAHCsYytSjPBkfeaCCzTXy6Eo=; b=qtOnbcLJw6r1c72baqT79WhS02 DOtVxRp2Gzrogn4ehFsoHnnYkYEc8cFSOjawJfvBdl8nnuo5jIRqBJ8cnQMZYvBeWoUmDxOogJNTr 8B5gfobeDP00eIQJLhe7L8WRajfIwZUnJA+NcAB+sfDDmqDdKC4LCtALgdhgChbKY9NlSpJbi0WCv /9598RB+1e+OwuvUFYZR2J9iCfG71satpdVwJnZqnhHouOcEl5V7OCMVPN/q/o7+wQecCIAbDE1Jk Xoqn3O0Rj0PhMSG2sfUUGPDSiNCLmdEN/+yNSpilrQR1cb0rVRFd9n9m9Sr4Hw7DYl9vkLSbyl0Fk E/CxXHBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqt19-000fsW-0R for ath12k@archiver.kernel.org; Thu, 12 Oct 2023 10:34:11 +0000 Received: from mgamail.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqt16-000frW-0B; Thu, 12 Oct 2023 10:34:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697106847; x=1728642847; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ji8x2F8u0U0ggxefEbWPL9IJWQlQGGYyAuJIBploLj8=; b=OE6l4ddimoxfTTVOsME1Ja2Z6eAVv26IaC2lwruRl14aUM5heMpEg3Ak CagCWlpu1rNj5EcUqEnMeR6UfLWfZUYY7YisY7dgi2dq06nUESQeOR9Cg F8Jw1MAY4NJsADNMSi4ulyPEN/QRxbEXf2RgxajbM7b/up7Omw3YXK8Ga 6VP1raw8rj32AYbXTbu418+kyouaQvOIvycmIUllEfOIUxXzbb3hT1t2M oT5EJ8FUl6nWMFRWBX/0GzdjB1Ca1phtz4viwcSdJhpEBIh/4R1C+iW17 llMvqFq3/KMza3RXFjbnA3+8HyAU/QrIQWu3tNKK5vHhd5RczzaxnwdxH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="388748390" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="388748390" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="870527710" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="870527710" Received: from asroczyn-mobl.ger.corp.intel.com ([10.249.36.107]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:00 -0700 Date: Thu, 12 Oct 2023 13:29:49 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, Lorenzo Pieralisi , Rob Herring , =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , Lukas Wunner , "Rafael J . Wysocki" , Heiner Kallweit , Emmanuel Grumbach , LKML , Bjorn Helgaas , ath10k@lists.infradead.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, Netdev Subject: Re: [PATCH v2 04/13] PCI/ASPM: Move L0S/L1/sub states mask calculation into a helper In-Reply-To: <20231011193206.GA1039708@bhelgaas> Message-ID: References: <20231011193206.GA1039708@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1380828921-1697106845=:1692" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231012_033408_156430_889AE8E8 X-CRM114-Status: GOOD ( 23.16 ) X-BeenThere: ath12k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath12k" Errors-To: ath12k-bounces+ath12k=archiver.kernel.org@lists.infradead.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 11 Oct 2023, Bjorn Helgaas wrote: > On Mon, Sep 18, 2023 at 04:10:54PM +0300, Ilpo Järvinen wrote: > > ASPM service driver does the same L0S / L1S / sub states allowed > > calculation in __pci_disable_link_state() and > > pci_set_default_link_state(). > > Is there a typo or something here? This patch only adds a call to > __pci_disable_link_state(), not to pci_set_default_link_state(). This was because one of the changes that got included in the meantime made the state handling in those two functions to differ so I removed the call from the code but forgot to update the changelog to match the code. I'll fix the changelog. -- i. > > Create a helper to calculate the mask for the allowed states. > > > > Signed-off-by: Ilpo Järvinen > > --- > > drivers/pci/pcie/aspm.c | 33 +++++++++++++++++++++------------ > > 1 file changed, 21 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > > index ec6d7a092ac1..91dc95aca90f 100644 > > --- a/drivers/pci/pcie/aspm.c > > +++ b/drivers/pci/pcie/aspm.c > > @@ -1034,6 +1034,26 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev) > > return bridge->link_state; > > } > > > > +static u8 pci_link_state_mask(int state) > > +{ > > + u8 result = 0; > > + > > + if (state & PCIE_LINK_STATE_L0S) > > + result |= ASPM_STATE_L0S; > > + if (state & PCIE_LINK_STATE_L1) > > + result |= ASPM_STATE_L1; > > + if (state & PCIE_LINK_STATE_L1_1) > > + result |= ASPM_STATE_L1_1; > > + if (state & PCIE_LINK_STATE_L1_2) > > + result |= ASPM_STATE_L1_2; > > + if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > + result |= ASPM_STATE_L1_1_PCIPM; > > + if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > + result |= ASPM_STATE_L1_2_PCIPM; > > + > > + return result; > > +} > > + > > static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > { > > struct pcie_link_state *link = pcie_aspm_get_link(pdev); > > @@ -1063,18 +1083,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > if (sem) > > down_read(&pci_bus_sem); > > mutex_lock(&aspm_lock); > > - if (state & PCIE_LINK_STATE_L0S) > > - link->aspm_disable |= ASPM_STATE_L0S; > > - if (state & PCIE_LINK_STATE_L1) > > - link->aspm_disable |= ASPM_STATE_L1; > > - if (state & PCIE_LINK_STATE_L1_1) > > - link->aspm_disable |= ASPM_STATE_L1_1; > > - if (state & PCIE_LINK_STATE_L1_2) > > - link->aspm_disable |= ASPM_STATE_L1_2; > > - if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_1_PCIPM; > > - if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_2_PCIPM; > > + link->aspm_disable |= pci_link_state_mask(state); > > pcie_config_aspm_link(link, policy_to_aspm_state(link)); > > > > if (state & PCIE_LINK_STATE_CLKPM) --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- ath12k mailing list ath12k@lists.infradead.org https://lists.infradead.org/mailman/listinfo/ath12k --8323329-1380828921-1697106845=:1692-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14594CDB485 for ; Thu, 12 Oct 2023 10:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Message-ID:In-Reply-To:Subject:cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=05xCIvZJuIulUK4003HJo45dpEsGTbi1ZcXNySlF7as=; b=GuMhutmKSm9yTKc37l6tWQEyL5 pUDdu+0YPmiDbRMx1EysFajpRt5mA5K66fX766gAZjeOWNBd+hsx1LcNSbtUWv5WHP/kIK15YMMy+ 5+n27Wj++GU5JFHfZCQj0FXQFakII9sua6eSlUpOqAoU3+ykHf5ANJJqG8MrTsOeOJWlBOeHPhRBl WNIJ/GesmzuR12zIlbEV5xLQRMSwdZYvvco+6i75GmAKUTv5+kTIXe16G+Nft36IudVSJRd8ODKOw 4eLetvuPeoopYkOu5wUBadHO1uNT3RMa7fRiFaSxQeqPtG9durbXlqEHi+b/1n5C0VRHdwj2tn0UH A7IAyycQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqt1A-000ftU-1q; Thu, 12 Oct 2023 10:34:12 +0000 Received: from mgamail.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqt16-000frW-0B; Thu, 12 Oct 2023 10:34:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697106847; x=1728642847; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ji8x2F8u0U0ggxefEbWPL9IJWQlQGGYyAuJIBploLj8=; b=OE6l4ddimoxfTTVOsME1Ja2Z6eAVv26IaC2lwruRl14aUM5heMpEg3Ak CagCWlpu1rNj5EcUqEnMeR6UfLWfZUYY7YisY7dgi2dq06nUESQeOR9Cg F8Jw1MAY4NJsADNMSi4ulyPEN/QRxbEXf2RgxajbM7b/up7Omw3YXK8Ga 6VP1raw8rj32AYbXTbu418+kyouaQvOIvycmIUllEfOIUxXzbb3hT1t2M oT5EJ8FUl6nWMFRWBX/0GzdjB1Ca1phtz4viwcSdJhpEBIh/4R1C+iW17 llMvqFq3/KMza3RXFjbnA3+8HyAU/QrIQWu3tNKK5vHhd5RczzaxnwdxH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="388748390" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="388748390" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="870527710" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="870527710" Received: from asroczyn-mobl.ger.corp.intel.com ([10.249.36.107]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:00 -0700 Date: Thu, 12 Oct 2023 13:29:49 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, Lorenzo Pieralisi , Rob Herring , =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , Lukas Wunner , "Rafael J . Wysocki" , Heiner Kallweit , Emmanuel Grumbach , LKML , Bjorn Helgaas , ath10k@lists.infradead.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, Netdev Subject: Re: [PATCH v2 04/13] PCI/ASPM: Move L0S/L1/sub states mask calculation into a helper In-Reply-To: <20231011193206.GA1039708@bhelgaas> Message-ID: References: <20231011193206.GA1039708@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1380828921-1697106845=:1692" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231012_033408_156430_889AE8E8 X-CRM114-Status: GOOD ( 23.16 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath11k" Errors-To: ath11k-bounces+ath11k=archiver.kernel.org@lists.infradead.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 11 Oct 2023, Bjorn Helgaas wrote: > On Mon, Sep 18, 2023 at 04:10:54PM +0300, Ilpo Järvinen wrote: > > ASPM service driver does the same L0S / L1S / sub states allowed > > calculation in __pci_disable_link_state() and > > pci_set_default_link_state(). > > Is there a typo or something here? This patch only adds a call to > __pci_disable_link_state(), not to pci_set_default_link_state(). This was because one of the changes that got included in the meantime made the state handling in those two functions to differ so I removed the call from the code but forgot to update the changelog to match the code. I'll fix the changelog. -- i. > > Create a helper to calculate the mask for the allowed states. > > > > Signed-off-by: Ilpo Järvinen > > --- > > drivers/pci/pcie/aspm.c | 33 +++++++++++++++++++++------------ > > 1 file changed, 21 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > > index ec6d7a092ac1..91dc95aca90f 100644 > > --- a/drivers/pci/pcie/aspm.c > > +++ b/drivers/pci/pcie/aspm.c > > @@ -1034,6 +1034,26 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev) > > return bridge->link_state; > > } > > > > +static u8 pci_link_state_mask(int state) > > +{ > > + u8 result = 0; > > + > > + if (state & PCIE_LINK_STATE_L0S) > > + result |= ASPM_STATE_L0S; > > + if (state & PCIE_LINK_STATE_L1) > > + result |= ASPM_STATE_L1; > > + if (state & PCIE_LINK_STATE_L1_1) > > + result |= ASPM_STATE_L1_1; > > + if (state & PCIE_LINK_STATE_L1_2) > > + result |= ASPM_STATE_L1_2; > > + if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > + result |= ASPM_STATE_L1_1_PCIPM; > > + if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > + result |= ASPM_STATE_L1_2_PCIPM; > > + > > + return result; > > +} > > + > > static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > { > > struct pcie_link_state *link = pcie_aspm_get_link(pdev); > > @@ -1063,18 +1083,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > if (sem) > > down_read(&pci_bus_sem); > > mutex_lock(&aspm_lock); > > - if (state & PCIE_LINK_STATE_L0S) > > - link->aspm_disable |= ASPM_STATE_L0S; > > - if (state & PCIE_LINK_STATE_L1) > > - link->aspm_disable |= ASPM_STATE_L1; > > - if (state & PCIE_LINK_STATE_L1_1) > > - link->aspm_disable |= ASPM_STATE_L1_1; > > - if (state & PCIE_LINK_STATE_L1_2) > > - link->aspm_disable |= ASPM_STATE_L1_2; > > - if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_1_PCIPM; > > - if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_2_PCIPM; > > + link->aspm_disable |= pci_link_state_mask(state); > > pcie_config_aspm_link(link, policy_to_aspm_state(link)); > > > > if (state & PCIE_LINK_STATE_CLKPM) --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- ath11k mailing list ath11k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath11k --8323329-1380828921-1697106845=:1692-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28140CDB46E for ; Thu, 12 Oct 2023 19:09:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C59E8610A7; Thu, 12 Oct 2023 19:08:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C59E8610A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1697137739; bh=00E7rzHex9RbKRBdGVPqiB232Od4WoUVcZG1mZy//7U=; h=Date:From:To:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=JSCw5UJHTCKOl/wp5wTzEe874z1BqXJN9VySl576UAyorz1OH3gF/KtwmuMB9yf7F xw7Cyb7YzEJoCxMiBUz3a8pDj/ixKypowkRRuwdD0GVJq13q6h/HM+ucuZ+rN46V4s is1y2s8EXlOBO5UgL8wmUYuGp1QaU9TJiYvKP236JLRauVmbXa5SI+ggTilvluceS9 243NA5Na0aia+2EWkMI/Qezb7WPptJ2cvIxEdKBfYDKI2dMpSBDmCy2jvVT+BhOFLA CGYsY17xOfgJwbKI2jT1G/5ZwANpX7TVXERuM07Xg3C7I0B0NQnaIMGcQrW5aBu3VW O57Xh80qhq/+w== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3QBfyJPQIDKv; Thu, 12 Oct 2023 19:08:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 25382610A0; Thu, 12 Oct 2023 19:08:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 25382610A0 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 915481BF2B9 for ; Thu, 12 Oct 2023 10:34:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7677782240 for ; Thu, 12 Oct 2023 10:34:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7677782240 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jbHz0X0f9Bvi for ; Thu, 12 Oct 2023 10:34:06 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by smtp1.osuosl.org (Postfix) with ESMTPS id B28D682211 for ; Thu, 12 Oct 2023 10:34:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B28D682211 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="388748396" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="388748396" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="870527710" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="870527710" Received: from asroczyn-mobl.ger.corp.intel.com ([10.249.36.107]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:00 -0700 Date: Thu, 12 Oct 2023 13:29:49 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas In-Reply-To: <20231011193206.GA1039708@bhelgaas> Message-ID: References: <20231011193206.GA1039708@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1380828921-1697106845=:1692" X-Mailman-Approved-At: Thu, 12 Oct 2023 19:06:39 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697106846; x=1728642846; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ji8x2F8u0U0ggxefEbWPL9IJWQlQGGYyAuJIBploLj8=; b=bN3f4Qk6kxsqtiPEdc7hozzc/lHyjyLmT9hB1THfw7cBEeXlPkp2ydv4 A5RWqQuNNWZM4AHxz7lFg/5vYZlLPnq3fbNSRje7q8fucWjt+5h6iHSUq lV2n0tt63s27D4mcreO06tcglJUm++kPYTWNkmUiUTT9Su1BNqB0btepP v2x/eCjoYn4Z/KmXkMXUfrnzCL0uqLlTPy7VYz2lRVcyCOX1YVtOgi8hz PXk3wjIBqd57RZhJI714m3FQ9sIPDHK0wEz4wFbNmHdxX/NDdcpf5ZU/a IrodtZrjUd3H3whvPsp1yjwKL187hu6QXV/0zKS3Pt5cD0Ws99XtR3TbB Q==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bN3f4Qk6 Subject: Re: [Intel-wired-lan] [PATCH v2 04/13] PCI/ASPM: Move L0S/L1/sub states mask calculation into a helper X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , linux-rdma@vger.kernel.org, Lorenzo Pieralisi , "Rafael J . Wysocki" , ath12k@lists.infradead.org, linux-pci@vger.kernel.org, linux-wireless@vger.kernel.org, LKML , ath10k@lists.infradead.org, ath11k@lists.infradead.org, Emmanuel Grumbach , linux-bluetooth@vger.kernel.org, Lukas Wunner , intel-wired-lan@lists.osuosl.org, Netdev , Bjorn Helgaas , linux-mediatek@lists.infradead.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Heiner Kallweit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 11 Oct 2023, Bjorn Helgaas wrote: > On Mon, Sep 18, 2023 at 04:10:54PM +0300, Ilpo Järvinen wrote: > > ASPM service driver does the same L0S / L1S / sub states allowed > > calculation in __pci_disable_link_state() and > > pci_set_default_link_state(). > > Is there a typo or something here? This patch only adds a call to > __pci_disable_link_state(), not to pci_set_default_link_state(). This was because one of the changes that got included in the meantime made the state handling in those two functions to differ so I removed the call from the code but forgot to update the changelog to match the code. I'll fix the changelog. -- i. > > Create a helper to calculate the mask for the allowed states. > > > > Signed-off-by: Ilpo Järvinen > > --- > > drivers/pci/pcie/aspm.c | 33 +++++++++++++++++++++------------ > > 1 file changed, 21 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > > index ec6d7a092ac1..91dc95aca90f 100644 > > --- a/drivers/pci/pcie/aspm.c > > +++ b/drivers/pci/pcie/aspm.c > > @@ -1034,6 +1034,26 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev) > > return bridge->link_state; > > } > > > > +static u8 pci_link_state_mask(int state) > > +{ > > + u8 result = 0; > > + > > + if (state & PCIE_LINK_STATE_L0S) > > + result |= ASPM_STATE_L0S; > > + if (state & PCIE_LINK_STATE_L1) > > + result |= ASPM_STATE_L1; > > + if (state & PCIE_LINK_STATE_L1_1) > > + result |= ASPM_STATE_L1_1; > > + if (state & PCIE_LINK_STATE_L1_2) > > + result |= ASPM_STATE_L1_2; > > + if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > + result |= ASPM_STATE_L1_1_PCIPM; > > + if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > + result |= ASPM_STATE_L1_2_PCIPM; > > + > > + return result; > > +} > > + > > static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > { > > struct pcie_link_state *link = pcie_aspm_get_link(pdev); > > @@ -1063,18 +1083,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > if (sem) > > down_read(&pci_bus_sem); > > mutex_lock(&aspm_lock); > > - if (state & PCIE_LINK_STATE_L0S) > > - link->aspm_disable |= ASPM_STATE_L0S; > > - if (state & PCIE_LINK_STATE_L1) > > - link->aspm_disable |= ASPM_STATE_L1; > > - if (state & PCIE_LINK_STATE_L1_1) > > - link->aspm_disable |= ASPM_STATE_L1_1; > > - if (state & PCIE_LINK_STATE_L1_2) > > - link->aspm_disable |= ASPM_STATE_L1_2; > > - if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_1_PCIPM; > > - if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_2_PCIPM; > > + link->aspm_disable |= pci_link_state_mask(state); > > pcie_config_aspm_link(link, policy_to_aspm_state(link)); > > > > if (state & PCIE_LINK_STATE_CLKPM) --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan --8323329-1380828921-1697106845=:1692-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66129CDB482 for ; Thu, 12 Oct 2023 10:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Message-ID:In-Reply-To:Subject:cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hkncLCFzpF5gz3N0eoI+w/+6kk7cPFzOFwSxAlcWbMU=; b=TJqLVzsObfBWZ995eP3uSeqKsY peN+YrjrdrJCYx2apx+dkLNon9OwdduaiR24Nuczt8v46f6YOHy78DwvhWicIyvYSAe9G9bRAMPDd mTnjK9L0YjZGb2zUJtFlLjWd0PKZOXH1C9IhTyJJS9UGQejk4Vd8CKWK5C8OJgtlE3mJeTKXsksrP MiJOWbX1WlXDPULf0WfY9FNnEh8cBrRL4vPJFWMzd19aDVJHuE9VlF9nao7OwyeMSW6iB91aJIkvP O1tNNwt4W6VsxFljVfuyKrdKSVbHP5epe1kp3TNN1RBYzmpqWFMcLHkrAd0nkmHJ2AtQFSP6Gj2q5 6YV1ErHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqt18-000fsF-22; Thu, 12 Oct 2023 10:34:10 +0000 Received: from mgamail.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqt16-000frW-0B; Thu, 12 Oct 2023 10:34:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697106847; x=1728642847; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ji8x2F8u0U0ggxefEbWPL9IJWQlQGGYyAuJIBploLj8=; b=OE6l4ddimoxfTTVOsME1Ja2Z6eAVv26IaC2lwruRl14aUM5heMpEg3Ak CagCWlpu1rNj5EcUqEnMeR6UfLWfZUYY7YisY7dgi2dq06nUESQeOR9Cg F8Jw1MAY4NJsADNMSi4ulyPEN/QRxbEXf2RgxajbM7b/up7Omw3YXK8Ga 6VP1raw8rj32AYbXTbu418+kyouaQvOIvycmIUllEfOIUxXzbb3hT1t2M oT5EJ8FUl6nWMFRWBX/0GzdjB1Ca1phtz4viwcSdJhpEBIh/4R1C+iW17 llMvqFq3/KMza3RXFjbnA3+8HyAU/QrIQWu3tNKK5vHhd5RczzaxnwdxH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="388748390" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="388748390" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="870527710" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="870527710" Received: from asroczyn-mobl.ger.corp.intel.com ([10.249.36.107]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:00 -0700 Date: Thu, 12 Oct 2023 13:29:49 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, Lorenzo Pieralisi , Rob Herring , =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , Lukas Wunner , "Rafael J . Wysocki" , Heiner Kallweit , Emmanuel Grumbach , LKML , Bjorn Helgaas , ath10k@lists.infradead.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, Netdev Subject: Re: [PATCH v2 04/13] PCI/ASPM: Move L0S/L1/sub states mask calculation into a helper In-Reply-To: <20231011193206.GA1039708@bhelgaas> Message-ID: References: <20231011193206.GA1039708@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1380828921-1697106845=:1692" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231012_033408_156430_889AE8E8 X-CRM114-Status: GOOD ( 23.16 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+ath10k=archiver.kernel.org@lists.infradead.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 11 Oct 2023, Bjorn Helgaas wrote: > On Mon, Sep 18, 2023 at 04:10:54PM +0300, Ilpo Järvinen wrote: > > ASPM service driver does the same L0S / L1S / sub states allowed > > calculation in __pci_disable_link_state() and > > pci_set_default_link_state(). > > Is there a typo or something here? This patch only adds a call to > __pci_disable_link_state(), not to pci_set_default_link_state(). This was because one of the changes that got included in the meantime made the state handling in those two functions to differ so I removed the call from the code but forgot to update the changelog to match the code. I'll fix the changelog. -- i. > > Create a helper to calculate the mask for the allowed states. > > > > Signed-off-by: Ilpo Järvinen > > --- > > drivers/pci/pcie/aspm.c | 33 +++++++++++++++++++++------------ > > 1 file changed, 21 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > > index ec6d7a092ac1..91dc95aca90f 100644 > > --- a/drivers/pci/pcie/aspm.c > > +++ b/drivers/pci/pcie/aspm.c > > @@ -1034,6 +1034,26 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev) > > return bridge->link_state; > > } > > > > +static u8 pci_link_state_mask(int state) > > +{ > > + u8 result = 0; > > + > > + if (state & PCIE_LINK_STATE_L0S) > > + result |= ASPM_STATE_L0S; > > + if (state & PCIE_LINK_STATE_L1) > > + result |= ASPM_STATE_L1; > > + if (state & PCIE_LINK_STATE_L1_1) > > + result |= ASPM_STATE_L1_1; > > + if (state & PCIE_LINK_STATE_L1_2) > > + result |= ASPM_STATE_L1_2; > > + if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > + result |= ASPM_STATE_L1_1_PCIPM; > > + if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > + result |= ASPM_STATE_L1_2_PCIPM; > > + > > + return result; > > +} > > + > > static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > { > > struct pcie_link_state *link = pcie_aspm_get_link(pdev); > > @@ -1063,18 +1083,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > if (sem) > > down_read(&pci_bus_sem); > > mutex_lock(&aspm_lock); > > - if (state & PCIE_LINK_STATE_L0S) > > - link->aspm_disable |= ASPM_STATE_L0S; > > - if (state & PCIE_LINK_STATE_L1) > > - link->aspm_disable |= ASPM_STATE_L1; > > - if (state & PCIE_LINK_STATE_L1_1) > > - link->aspm_disable |= ASPM_STATE_L1_1; > > - if (state & PCIE_LINK_STATE_L1_2) > > - link->aspm_disable |= ASPM_STATE_L1_2; > > - if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_1_PCIPM; > > - if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_2_PCIPM; > > + link->aspm_disable |= pci_link_state_mask(state); > > pcie_config_aspm_link(link, policy_to_aspm_state(link)); > > > > if (state & PCIE_LINK_STATE_CLKPM) --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k --8323329-1380828921-1697106845=:1692-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 197B8CDB46E for ; Thu, 12 Oct 2023 10:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Message-ID:In-Reply-To:Subject:cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s6P426e8vTi37Kl5udrQtjzVvzfcl9/oaPwBxuF63tk=; b=WYEzOvpffncHx3RHwYny2TANgw 3BRV1fcFyvr1bJ7jm4pUEAVxVESnQoHBIVHjdgxC5UJcVS95AakT8YCiyhIlGLSuG+3UqhDTjON/p Pmjo4tXNURY/Pgrm8nFgvqk8K1X7uTByX0ItkWcvw+CvNAkWB5qZVWVkaRWEBLo1tTk+ydgwFv0WH 0uFHOh0UaviIpEvgJULOmaxaLCo7zPDbefqPsVXBe/vaKDUh7dnIPzV9Pq/5ex8o4xhsQLMVXVUcS qu9Ae2TLaw1T52aukfXnZ31U9iJdBVh1mdIsgGZRXmVf5rR7sxyn3Z2wrNBL6FMtI7o8E/GNybr9l uRQymYlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqt19-000fsf-1d; Thu, 12 Oct 2023 10:34:11 +0000 Received: from mgamail.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqt16-000frW-0B; Thu, 12 Oct 2023 10:34:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697106847; x=1728642847; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ji8x2F8u0U0ggxefEbWPL9IJWQlQGGYyAuJIBploLj8=; b=OE6l4ddimoxfTTVOsME1Ja2Z6eAVv26IaC2lwruRl14aUM5heMpEg3Ak CagCWlpu1rNj5EcUqEnMeR6UfLWfZUYY7YisY7dgi2dq06nUESQeOR9Cg F8Jw1MAY4NJsADNMSi4ulyPEN/QRxbEXf2RgxajbM7b/up7Omw3YXK8Ga 6VP1raw8rj32AYbXTbu418+kyouaQvOIvycmIUllEfOIUxXzbb3hT1t2M oT5EJ8FUl6nWMFRWBX/0GzdjB1Ca1phtz4viwcSdJhpEBIh/4R1C+iW17 llMvqFq3/KMza3RXFjbnA3+8HyAU/QrIQWu3tNKK5vHhd5RczzaxnwdxH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="388748390" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="388748390" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="870527710" X-IronPort-AV: E=Sophos;i="6.03,218,1694761200"; d="scan'208";a="870527710" Received: from asroczyn-mobl.ger.corp.intel.com ([10.249.36.107]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2023 03:34:00 -0700 Date: Thu, 12 Oct 2023 13:29:49 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, Lorenzo Pieralisi , Rob Herring , =?ISO-8859-2?Q?Krzysztof_Wilczy=F1ski?= , Lukas Wunner , "Rafael J . Wysocki" , Heiner Kallweit , Emmanuel Grumbach , LKML , Bjorn Helgaas , ath10k@lists.infradead.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, Netdev Subject: Re: [PATCH v2 04/13] PCI/ASPM: Move L0S/L1/sub states mask calculation into a helper In-Reply-To: <20231011193206.GA1039708@bhelgaas> Message-ID: References: <20231011193206.GA1039708@bhelgaas> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1380828921-1697106845=:1692" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231012_033408_156430_889AE8E8 X-CRM114-Status: GOOD ( 23.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 11 Oct 2023, Bjorn Helgaas wrote: > On Mon, Sep 18, 2023 at 04:10:54PM +0300, Ilpo Järvinen wrote: > > ASPM service driver does the same L0S / L1S / sub states allowed > > calculation in __pci_disable_link_state() and > > pci_set_default_link_state(). > > Is there a typo or something here? This patch only adds a call to > __pci_disable_link_state(), not to pci_set_default_link_state(). This was because one of the changes that got included in the meantime made the state handling in those two functions to differ so I removed the call from the code but forgot to update the changelog to match the code. I'll fix the changelog. -- i. > > Create a helper to calculate the mask for the allowed states. > > > > Signed-off-by: Ilpo Järvinen > > --- > > drivers/pci/pcie/aspm.c | 33 +++++++++++++++++++++------------ > > 1 file changed, 21 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > > index ec6d7a092ac1..91dc95aca90f 100644 > > --- a/drivers/pci/pcie/aspm.c > > +++ b/drivers/pci/pcie/aspm.c > > @@ -1034,6 +1034,26 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev) > > return bridge->link_state; > > } > > > > +static u8 pci_link_state_mask(int state) > > +{ > > + u8 result = 0; > > + > > + if (state & PCIE_LINK_STATE_L0S) > > + result |= ASPM_STATE_L0S; > > + if (state & PCIE_LINK_STATE_L1) > > + result |= ASPM_STATE_L1; > > + if (state & PCIE_LINK_STATE_L1_1) > > + result |= ASPM_STATE_L1_1; > > + if (state & PCIE_LINK_STATE_L1_2) > > + result |= ASPM_STATE_L1_2; > > + if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > + result |= ASPM_STATE_L1_1_PCIPM; > > + if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > + result |= ASPM_STATE_L1_2_PCIPM; > > + > > + return result; > > +} > > + > > static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > { > > struct pcie_link_state *link = pcie_aspm_get_link(pdev); > > @@ -1063,18 +1083,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) > > if (sem) > > down_read(&pci_bus_sem); > > mutex_lock(&aspm_lock); > > - if (state & PCIE_LINK_STATE_L0S) > > - link->aspm_disable |= ASPM_STATE_L0S; > > - if (state & PCIE_LINK_STATE_L1) > > - link->aspm_disable |= ASPM_STATE_L1; > > - if (state & PCIE_LINK_STATE_L1_1) > > - link->aspm_disable |= ASPM_STATE_L1_1; > > - if (state & PCIE_LINK_STATE_L1_2) > > - link->aspm_disable |= ASPM_STATE_L1_2; > > - if (state & PCIE_LINK_STATE_L1_1_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_1_PCIPM; > > - if (state & PCIE_LINK_STATE_L1_2_PCIPM) > > - link->aspm_disable |= ASPM_STATE_L1_2_PCIPM; > > + link->aspm_disable |= pci_link_state_mask(state); > > pcie_config_aspm_link(link, policy_to_aspm_state(link)); > > > > if (state & PCIE_LINK_STATE_CLKPM) --8323329-1380828921-1697106845=:1692 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --8323329-1380828921-1697106845=:1692--