From patchwork Thu May 4 11:12:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Agarwal X-Patchwork-Id: 13231052 X-Patchwork-Delegate: bhelgaas@google.com 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 3BAFBC7EE21 for ; Thu, 4 May 2023 11:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbjEDLNQ (ORCPT ); Thu, 4 May 2023 07:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbjEDLNO (ORCPT ); Thu, 4 May 2023 07:13:14 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CA932D51 for ; Thu, 4 May 2023 04:13:13 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-55a7d1f6914so4195117b3.1 for ; Thu, 04 May 2023 04:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683198792; x=1685790792; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=BACe8oAsJls97Ud0XHa81Wel0w9BVG2GDsrufMZ/Pl0=; b=1GiuVcNBi9oEBXA0yIhcUizZZi1SJEw+LjmxtHzmka55TfjUwoZgvnyE6PAlH0H3EV TPQTxrn0WmaciVWhT+Z0pzzbf07uU9tkIjHKJUnw3cHbbmta95pu2dIczBPVo+NcyGXv Mx+0EY6q4fIze+mximWB4CN9nd8r2y/Jm1PljnQK4Z3kIYcc1/X2TXQVeSMxhaHcc6Kf dt1e4RszivBoslXjsbw+Xui510Mebbyk91yf4qNGWFKTzGbGYB0ooZU+WnTpU4BK3mBZ H9ZKY3ZE165HL6vxmQ4BJhTBNZLogLCyINrDNjx9gZomzHxiW1skAKEP1cOvaKwANKQr F2sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683198792; x=1685790792; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BACe8oAsJls97Ud0XHa81Wel0w9BVG2GDsrufMZ/Pl0=; b=Vje2/RoB7A/pgTXARggpC3MDH0VC3JavPXgSKrfqf8c84EtHFwwuZeOwjPP9GuV0Hg YEYH5JNUEtOZjn1soFK/z4RcmxmvF3wD+gSnhgH6QDWV6N4eUfd5f9zk6Ni872hdPrVA /oSca4UJh2uVfEWkp1tXHMqeWyJDQVKNX8NAcVUvSFeWcIg4TRnf03POp8xGBkH3pw60 weWQWz0e8KqD/Fl3dormIU93/Cg3YCU9r8LjwQaaOo3cxJj8TYZZKy9nAi3+mJ12L0Wv iOKGh01MgC239JQc/2M+7kNwWGJhRJoaxU9LL1+tPa5gFSfEO+yosFsRXFBxjMLn4hWB MKvg== X-Gm-Message-State: AC+VfDwSXwjgT/2xkro07XpEzieb/S6c2HHyqxOlPFAoiYdz2NJNi10M 1rZbw97QiPojf9CPAy41O7TYvZqmR3qaGTWqcw== X-Google-Smtp-Source: ACHHUZ6A7i7h5CJ3OBZ2bATKkJuBCN2of4XNEVVd2ZpGmguA01XfWkWVAJQAbj5aPYiSRcS0WJdjNogdJ7+EYzjJag== X-Received: from ajaya.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:39b5]) (user=ajayagarwal job=sendgmr) by 2002:a81:4149:0:b0:55d:8472:4597 with SMTP id f9-20020a814149000000b0055d84724597mr324024ywk.10.1683198792626; Thu, 04 May 2023 04:13:12 -0700 (PDT) Date: Thu, 4 May 2023 16:42:57 +0530 In-Reply-To: <20230504111301.229358-1-ajayagarwal@google.com> Mime-Version: 1.0 References: <20230504111301.229358-1-ajayagarwal@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230504111301.229358-2-ajayagarwal@google.com> Subject: [PATCH v3 1/5] PCI/ASPM: Disable ASPM_STATE_L1 only when driver disables L1 ASPM From: Ajay Agarwal To: Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Vidya Sagar , Nikhil Devshatwar , Manu Gautam , "David E. Box" , Kai-Heng Feng , Michael Bottini Cc: linux-pci@vger.kernel.org, Ajay Agarwal Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently the aspm driver sets ASPM_STATE_L1 as well as ASPM_STATE_L1SS bits in aspm_disable when the caller disables L1. pcie_config_aspm_link takes care that L1ss ASPM is not enabled if L1 is disabled. ASPM_STATE_L1SS bits do not need to be explicitly set. The sysfs node store() function, which also modifies the aspm_disable value, does not set these bits either when only L1 ASPM is disabled by the user. Disable ASPM_STATE_L1 only when the caller disables L1 ASPM. No functional changes intended. Signed-off-by: Ajay Agarwal --- Changelog since v2: - Better commit message Changelog since v1: - Better commit message drivers/pci/pcie/aspm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 66d7514ca111..5765b226102a 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1095,8 +1095,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) if (state & PCIE_LINK_STATE_L0S) link->aspm_disable |= ASPM_STATE_L0S; if (state & PCIE_LINK_STATE_L1) - /* L1 PM substates require L1 */ - link->aspm_disable |= ASPM_STATE_L1 | ASPM_STATE_L1SS; + 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) From patchwork Thu May 4 11:12:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Agarwal X-Patchwork-Id: 13231053 X-Patchwork-Delegate: bhelgaas@google.com 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 E7F3DC77B7C for ; Thu, 4 May 2023 11:13:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230208AbjEDLNV (ORCPT ); Thu, 4 May 2023 07:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbjEDLNU (ORCPT ); Thu, 4 May 2023 07:13:20 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 496E649CA for ; Thu, 4 May 2023 04:13:19 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-b9a25f6aa0eso669307276.1 for ; Thu, 04 May 2023 04:13:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683198798; x=1685790798; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=7BHg5gVGq+WKFx3KhBeMhGGTvFwoSEtH3H2Bo8FpB2Q=; b=xAtDTPOoz1Mkj1PFq9m3aneTz3BDtiCEp86cEuDXgb8URnU1LXPoHH0CymgcBUUzZX w4xTvueD6OoKWGvGBwwUlk1Hyy9DqinCLvQptXKMyG69Cy2slAnkT2EYQlX5mleDAQxv JOnMnuBtmwOzDGLM7GTfrWspGlQMvhYe7Ry3QBuOlvx2B/dnvMSfayRSQc8Pk92fKQyz mOl9JN4phns36Gk68I9bAVToMCWD7z0MaPBGQy/2M+iK3RdPuWaYpv99L7DlfT3JYlk9 VMavHNm+Ko9UL7gC6JZYofdMSwcRgRoFd7+knQDphy5JNq5gY+uBbSC/8DCTA2iU/JBH Ghpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683198798; x=1685790798; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7BHg5gVGq+WKFx3KhBeMhGGTvFwoSEtH3H2Bo8FpB2Q=; b=i5rxeH4xXdO/BAozIUMTiIrV2avDwqlpusQQC2+IQ9SsaQOk9gKVhBLvQ4Nmf+kNzs v7pFwpHedkULvbfALd1yhw/nrVTYw65u371XzEXi9NxzGwNGblR4C856Wp8ZdFSE78Au PQi+3OGckzXH9RjwnFbselT0baQtnyxhBGsP4l2b6q71wexPciW4UW5Ss1SAzUj1e/kT /WdMO8C7hH4fK6JbwjP30ltSMUwtHU8QDwBZzNEeQacYE8/YFJEddM9LQAaHQElYp3fM e8KiUNb0HT+o4bam+F1H7FhPjPrIc2iQROIWyKIwfX3tX2kZZy7eTKleGjnUv7Mj3IZx GKQw== X-Gm-Message-State: AC+VfDyazfD0Jrg2N/j9cQMTL4ngVO0J2DO/7/ivrtBp2vLB6QW8+Xi3 MW/ELDaabCnf/53tul48Slj3wGGu2Vfsqnsdvg== X-Google-Smtp-Source: ACHHUZ5BZ+OAxwjJvzwqKv23MuOVWfnM6hOmrcBdhPkt2fw5nQukFzE3ahGzKmR6FPFuZvauV2fZnv8N9ml2fLGiDw== X-Received: from ajaya.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:39b5]) (user=ajayagarwal job=sendgmr) by 2002:a25:5484:0:b0:ba1:919a:8f08 with SMTP id i126-20020a255484000000b00ba1919a8f08mr983708ybb.2.1683198798564; Thu, 04 May 2023 04:13:18 -0700 (PDT) Date: Thu, 4 May 2023 16:42:58 +0530 In-Reply-To: <20230504111301.229358-1-ajayagarwal@google.com> Mime-Version: 1.0 References: <20230504111301.229358-1-ajayagarwal@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230504111301.229358-3-ajayagarwal@google.com> Subject: [PATCH v3 2/5] PCI/ASPM: Set ASPM_STATE_L1 only when driver enables L1 From: Ajay Agarwal To: Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Vidya Sagar , Nikhil Devshatwar , Manu Gautam , "David E. Box" , Kai-Heng Feng , Michael Bottini Cc: linux-pci@vger.kernel.org, Ajay Agarwal Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently the ASPM driver sets ASPM_STATE_L1 as well as ASPM_STATE_L1SS when the caller wants to enable just L1. This is incorrect. Fix this by setting the ASPM_STATE_L1 bit only when the caller wishes to enable L1. Signed-off-by: Ajay Agarwal --- Changelog since v2: - Replace "L1.0" with "L1" in the commit message Changelog since v1: - Break down the L1 and L1ss handling into separate patches drivers/pci/pcie/aspm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 5765b226102a..4ad0bf5d5838 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1170,8 +1170,7 @@ int pci_enable_link_state(struct pci_dev *pdev, int state) if (state & PCIE_LINK_STATE_L0S) link->aspm_default |= ASPM_STATE_L0S; if (state & PCIE_LINK_STATE_L1) - /* L1 PM substates require L1 */ - link->aspm_default |= ASPM_STATE_L1 | ASPM_STATE_L1SS; + link->aspm_default |= ASPM_STATE_L1; if (state & PCIE_LINK_STATE_L1_1) link->aspm_default |= ASPM_STATE_L1_1; if (state & PCIE_LINK_STATE_L1_2) From patchwork Thu May 4 11:12:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Agarwal X-Patchwork-Id: 13231054 X-Patchwork-Delegate: bhelgaas@google.com 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 9A2CBC77B7C for ; Thu, 4 May 2023 11:13:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230214AbjEDLN0 (ORCPT ); Thu, 4 May 2023 07:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbjEDLNZ (ORCPT ); Thu, 4 May 2023 07:13:25 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53DA46A1 for ; Thu, 4 May 2023 04:13:24 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-b9a6eeea78cso10495614276.0 for ; Thu, 04 May 2023 04:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683198804; x=1685790804; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=K8eu1ExWcZGi2HTEZBe77vdZ0MEOOPTzOKbcruguPAc=; b=D+sbYig6Mk04mhuYhK+3MI10DJEiUH2OMA2QN8txeJQAiFrYRxohHh31wutrRJTSQg ywX1+iYyjYedTsKjWQWQhDlQaXJYJbGQBJtY3ysm2UQnHPKfsYufAsuHwnh4qt8isKb2 erwxV5TZs2rFHpD7jtdf31n53kQZA9zf1sSmBlgFD8N4BAxGF5uNNQDNM9srYgOZ/N8L I50r+7AQSYxK8nW9dwYCT+sELe/cZfPdnEpuEPciiPgsv49Sfwqzn8SP7YRK5vVaJ5zX EAX0x6x7dTkk3uzOlheZv2gTcvFD5pn0r//Ue1KKkcOVLb23o7am3qGeSoMg/tIOXQv8 lFdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683198804; x=1685790804; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K8eu1ExWcZGi2HTEZBe77vdZ0MEOOPTzOKbcruguPAc=; b=GVszQPBSNRCX1AXEhGG4NdchyZDF9V1b8ibg8rdW8+4FJUdFMcu9MhpzKBhzamwLHe 437OTI6xhCV/E/FuRKq2ZPVE1i5yBTa0w6jX3qtMGILYblj15wyVGWIiwLhNTeWpBZa/ Me67eLfFWW96E9Lz+5TjjzfX/7MoPdz4KTHxT8ZIygMZmc3eu9ujy1KynQuIkFG7ooPs IKT+rKqJ041bV8ybRtCsvh3+nTnKgXOTWhaJSYQpmRD5oHs94HnRJnrSddYPYvc41tFg B8eo2gB0dhG7Vi9WSTrfvws7+RPcjmCOifcQYbs3wHbG1Fqe++jbXi3eHBF6HbNe3T7r uiuA== X-Gm-Message-State: AC+VfDwYbTV1DdsIHv4z/r5iDmXRwx806nRXgEC48wY58O08QjfXgIlV SQmKzrMyfcAt6bwyrVnH6m3sknUn8DNGt7eLuA== X-Google-Smtp-Source: ACHHUZ699eJaJFCy5BU/26U3oABe5FzU9+FgvTHAtQKoYSbbuEfv56e5wa+zB20urL3PwHlRIG0zrX49a3B64J78FQ== X-Received: from ajaya.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:39b5]) (user=ajayagarwal job=sendgmr) by 2002:a25:9e90:0:b0:b9e:7fbc:15e1 with SMTP id p16-20020a259e90000000b00b9e7fbc15e1mr3401201ybq.0.1683198804225; Thu, 04 May 2023 04:13:24 -0700 (PDT) Date: Thu, 4 May 2023 16:42:59 +0530 In-Reply-To: <20230504111301.229358-1-ajayagarwal@google.com> Mime-Version: 1.0 References: <20230504111301.229358-1-ajayagarwal@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230504111301.229358-4-ajayagarwal@google.com> Subject: [PATCH v3 3/5] PCI/ASPM: Set ASPM_STATE_L1 when driver enables L1ss From: Ajay Agarwal To: Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Vidya Sagar , Nikhil Devshatwar , Manu Gautam , "David E. Box" , Kai-Heng Feng , Michael Bottini Cc: linux-pci@vger.kernel.org, Ajay Agarwal Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently the aspm driver does not set ASPM_STATE_L1 bit in aspm_default when the caller requests L1SS ASPM state. This will lead to pcie_config_aspm_link() not enabling the requested L1SS state. Set ASPM_STATE_L1 when driver enables L1ss. Signed-off-by: Ajay Agarwal --- Changelog since v2: - None Changelog since v1: - Break down the L1 and L1ss handling into separate patches drivers/pci/pcie/aspm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 4ad0bf5d5838..7c9935f331f1 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1171,14 +1171,15 @@ int pci_enable_link_state(struct pci_dev *pdev, int state) link->aspm_default |= ASPM_STATE_L0S; if (state & PCIE_LINK_STATE_L1) link->aspm_default |= ASPM_STATE_L1; + /* L1 PM substates require L1 */ if (state & PCIE_LINK_STATE_L1_1) - link->aspm_default |= ASPM_STATE_L1_1; + link->aspm_default |= ASPM_STATE_L1_1 | ASPM_STATE_L1; if (state & PCIE_LINK_STATE_L1_2) - link->aspm_default |= ASPM_STATE_L1_2; + link->aspm_default |= ASPM_STATE_L1_2 | ASPM_STATE_L1; if (state & PCIE_LINK_STATE_L1_1_PCIPM) - link->aspm_default |= ASPM_STATE_L1_1_PCIPM; + link->aspm_default |= ASPM_STATE_L1_1_PCIPM | ASPM_STATE_L1; if (state & PCIE_LINK_STATE_L1_2_PCIPM) - link->aspm_default |= ASPM_STATE_L1_2_PCIPM; + link->aspm_default |= ASPM_STATE_L1_2_PCIPM | ASPM_STATE_L1; pcie_config_aspm_link(link, policy_to_aspm_state(link)); link->clkpm_default = (state & PCIE_LINK_STATE_CLKPM) ? 1 : 0; From patchwork Thu May 4 11:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Agarwal X-Patchwork-Id: 13231055 X-Patchwork-Delegate: bhelgaas@google.com 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 E4308C77B7C for ; Thu, 4 May 2023 11:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230211AbjEDLNc (ORCPT ); Thu, 4 May 2023 07:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbjEDLNb (ORCPT ); Thu, 4 May 2023 07:13:31 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC1446B3 for ; Thu, 4 May 2023 04:13:30 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-55a42c22300so3578667b3.2 for ; Thu, 04 May 2023 04:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683198809; x=1685790809; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=G9g2B6J+/lgtLQJAP5WaYm5jJ2a9tEyo3V63mEq29uc=; b=2elmKMxGTVN+ms5SSwBMyMgPp3nEJjEe1tNhRYWUa5ElspqbjR2qFcHw/miaZvcOdx GwjOd//yJY5CjS/KyMYS5vml7nGDpkio8EH/SMRzCPhOjk7IrMJ7ounStqLAa3Ms98Xp WZGB4jZt9RLMLQY8iyaA1WIKp1XEpEnYoGlwjD8rjuecFhqc1pikRXjj4fuAkl4KvKSI GAYAGAFwedg0kpWuPT6U62PopXVM/cM4uBMrvdh0ynHYLQuW5Er9wEAJKRpByrKLENHt ijKjRdaKTK6GU+qQLRykrwduLvbRgfdEFrydDPUvid9CWSOiflTk4sG2+FgPk4TNHUwm dUFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683198809; x=1685790809; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G9g2B6J+/lgtLQJAP5WaYm5jJ2a9tEyo3V63mEq29uc=; b=Op2UyY9WHblu4qajtO/RwGT+9NQQyr+Bl9QP+9pRx39HBm3lPdxZoScyJEA/d4rKBI sZL3SrH2dCkAYd4OF4FZTBgw7hRtx5ZybkZTHH9jPpsq0pyvX37K0aEpwA+Mu++yL+35 7aYWS/qaBpc0kEn1KaIwfNZETPYx+e7WkLcwCFbuT/rkrsVtrRFmPjM9SKVSRNCCaUcf a9useJ/Mk81fiZ8iW8ti1fOYwO+DQRsRzUnfrQxaIM99KqQnghV6HPBO3DIqkc3tiKWN lVwFHexBo2v3bN+8xLl2MSExsfw0iiW2jJYJXJH3ix63c6fCIdNs+gGsIl5jUwmU+rnc lXew== X-Gm-Message-State: AC+VfDy9VtSnff05CZD8d211YGH0htUVrBuT8mSrnjALBh7k/a3kXUwQ 9PQObkKagi8viBY6Vahg25774HAW27g62fHBnQ== X-Google-Smtp-Source: ACHHUZ6qDhVW1xrGEu6vTR6XQ5Zkfl4z4tLmG2BKspobTy2QN9n6dqcmlAum5++APnTvyoOO5Z4QNPuwx+hGinquaA== X-Received: from ajaya.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:39b5]) (user=ajayagarwal job=sendgmr) by 2002:a81:ae06:0:b0:54f:68a1:b406 with SMTP id m6-20020a81ae06000000b0054f68a1b406mr1013413ywh.2.1683198809742; Thu, 04 May 2023 04:13:29 -0700 (PDT) Date: Thu, 4 May 2023 16:43:00 +0530 In-Reply-To: <20230504111301.229358-1-ajayagarwal@google.com> Mime-Version: 1.0 References: <20230504111301.229358-1-ajayagarwal@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230504111301.229358-5-ajayagarwal@google.com> Subject: [PATCH v3 4/5] PCI/ASPM: Rename L1.2 specific functions From: Ajay Agarwal To: Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Vidya Sagar , Nikhil Devshatwar , Manu Gautam , "David E. Box" , Kai-Heng Feng , Michael Bottini Cc: linux-pci@vger.kernel.org, Ajay Agarwal Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The functions aspm_calc_l1ss_info() and calc_l1ss_pwron() perform calculations and register programming specific to L1.2 state. Rename them to aspm_calc_l12_info() and calc_l12_pwron() respectively. Signed-off-by: Ajay Agarwal --- Changelog since v2: - None Changelog since v1: - New patch to rename L1.2 specific functions drivers/pci/pcie/aspm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 7c9935f331f1..db7c369a0544 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -337,7 +337,7 @@ static u32 calc_l1_acceptable(u32 encoding) } /* Convert L1SS T_pwr encoding to usec */ -static u32 calc_l1ss_pwron(struct pci_dev *pdev, u32 scale, u32 val) +static u32 calc_l12_pwron(struct pci_dev *pdev, u32 scale, u32 val) { switch (scale) { case 0: @@ -471,7 +471,7 @@ static void pci_clear_and_set_dword(struct pci_dev *pdev, int pos, } /* Calculate L1.2 PM substate timing parameters */ -static void aspm_calc_l1ss_info(struct pcie_link_state *link, +static void aspm_calc_l12_info(struct pcie_link_state *link, u32 parent_l1ss_cap, u32 child_l1ss_cap) { struct pci_dev *child = link->downstream, *parent = link->pdev; @@ -495,13 +495,13 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link, val2 = (child_l1ss_cap & PCI_L1SS_CAP_P_PWR_ON_VALUE) >> 19; scale2 = (child_l1ss_cap & PCI_L1SS_CAP_P_PWR_ON_SCALE) >> 16; - if (calc_l1ss_pwron(parent, scale1, val1) > - calc_l1ss_pwron(child, scale2, val2)) { + if (calc_l12_pwron(parent, scale1, val1) > + calc_l12_pwron(child, scale2, val2)) { ctl2 |= scale1 | (val1 << 3); - t_power_on = calc_l1ss_pwron(parent, scale1, val1); + t_power_on = calc_l12_pwron(parent, scale1, val1); } else { ctl2 |= scale2 | (val2 << 3); - t_power_on = calc_l1ss_pwron(child, scale2, val2); + t_power_on = calc_l12_pwron(child, scale2, val2); } /* @@ -617,7 +617,7 @@ static void aspm_l1ss_init(struct pcie_link_state *link) link->aspm_enabled |= ASPM_STATE_L1_2_PCIPM; if (link->aspm_support & ASPM_STATE_L1SS) - aspm_calc_l1ss_info(link, parent_l1ss_cap, child_l1ss_cap); + aspm_calc_l12_info(link, parent_l1ss_cap, child_l1ss_cap); } static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) From patchwork Thu May 4 11:13:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Agarwal X-Patchwork-Id: 13231056 X-Patchwork-Delegate: bhelgaas@google.com 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 19EA4C7EE21 for ; Thu, 4 May 2023 11:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbjEDLNh (ORCPT ); Thu, 4 May 2023 07:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbjEDLNg (ORCPT ); Thu, 4 May 2023 07:13:36 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8304D1FC4 for ; Thu, 4 May 2023 04:13:35 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-559c416b024so2523367b3.1 for ; Thu, 04 May 2023 04:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683198815; x=1685790815; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VZTg8YSU09x/TXpR8rBIyBBy9InhsQZVM6s+v85AAEk=; b=cj8Luu6jMlKLRDhfSPHC5uICu+23pbqOZ/2sFrp9zUQQge2MjKr4NM8tUwHmAczjbY 5iUWdnrTypI3TsMnThwPd0ykqnPhP9s4AVbokUnarJE6rVMsf2YvpW2J6d2g5YPSMwpV 9tGKgjku2cAX7uyA+n3Kl9uBWIHfv0ps+eBYdwWhZMC+106/Wn+Re3KIpjm695dzKps2 aOvuVe8pj1e2jNqBaAss22g0oFPO4IWDwW2UgjawOw5p6FLCEiA1ylxO9HzP5U0aP/sp QChiIxeZPyIeEJswvJxeRw6ya0e3F7WNjs5qkyfU5zRIWUWCiszMDvw2yGU0exO75I27 7czA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683198815; x=1685790815; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VZTg8YSU09x/TXpR8rBIyBBy9InhsQZVM6s+v85AAEk=; b=dhreEVYjxXliol7kJG27cUt/8Da/7G1R+54+a5ZddRZLKsNNuhPhs0XTj53fRlsaaw x6MR01YzbYwYj/M5VFhXeVgubidBcDPJVY8ov57y5l31nK3rI4ldlKpjadbMTCMnJXdC 1NW/dTK44O7LprjMQhAya+vAOj5qNKE32KWwgZzFR5sMdssI1heqyHA07U0+rgU3cA9o S8QFBH8z8lSWsU/cGQO73d7+zujd7yqf+ECwBoSVK7jaq6pvg5d1dMpMORqAYBjwzJXs xS/zexv38NE/HJ4t7Ct90U3Wj8Xyf7NVE8d+yS5GrjqH4dd9DIaDtw5v1Mo2D6/gl3/i 7Seg== X-Gm-Message-State: AC+VfDxYq4ljDjEZJIzQMPX4WR7sqFz7kyammxEK/+J5xpnlxnvLd6Wb T0CP1UbGUiJYYvdY72JqCEmNGi1gIj+kYjgf1w== X-Google-Smtp-Source: ACHHUZ5C13M4c1gxRubfPt6t4oAUYlpzRWI7JAOF/kAzlt5Afkb5tepOX73rEbGXnUjvJqCrKlGt/FP6EEpBGpp+7g== X-Received: from ajaya.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:39b5]) (user=ajayagarwal job=sendgmr) by 2002:a25:2d27:0:b0:b9a:696a:770f with SMTP id t39-20020a252d27000000b00b9a696a770fmr15223014ybt.13.1683198814795; Thu, 04 May 2023 04:13:34 -0700 (PDT) Date: Thu, 4 May 2023 16:43:01 +0530 In-Reply-To: <20230504111301.229358-1-ajayagarwal@google.com> Mime-Version: 1.0 References: <20230504111301.229358-1-ajayagarwal@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230504111301.229358-6-ajayagarwal@google.com> Subject: [PATCH v3 5/5] PCI/ASPM: Remove unnecessary ASPM_STATE_L1SS check From: Ajay Agarwal To: Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Vidya Sagar , Nikhil Devshatwar , Manu Gautam , "David E. Box" , Kai-Heng Feng , Michael Bottini Cc: linux-pci@vger.kernel.org, Ajay Agarwal Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently the driver checks if ASPM_STATE_L1SS is supported before calling aspm_calc_l12_info(), only for this function to return if ASPM_STATE_L1_2_MASK is not supported. Simplify the logic by directly checking for L1.2 mask. Signed-off-by: Ajay Agarwal --- Changelog since v2: - None Changelog since v1: - Rebase on top of the L1.2 function rename patch drivers/pci/pcie/aspm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index db7c369a0544..e89091cba356 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -481,9 +481,6 @@ static void aspm_calc_l12_info(struct pcie_link_state *link, u32 pctl1, pctl2, cctl1, cctl2; u32 pl1_2_enables, cl1_2_enables; - if (!(link->aspm_support & ASPM_STATE_L1_2_MASK)) - return; - /* Choose the greater of the two Port Common_Mode_Restore_Times */ val1 = (parent_l1ss_cap & PCI_L1SS_CAP_CM_RESTORE_TIME) >> 8; val2 = (child_l1ss_cap & PCI_L1SS_CAP_CM_RESTORE_TIME) >> 8; @@ -616,7 +613,7 @@ static void aspm_l1ss_init(struct pcie_link_state *link) if (parent_l1ss_ctl1 & child_l1ss_ctl1 & PCI_L1SS_CTL1_PCIPM_L1_2) link->aspm_enabled |= ASPM_STATE_L1_2_PCIPM; - if (link->aspm_support & ASPM_STATE_L1SS) + if (link->aspm_support & ASPM_STATE_L1_2_MASK) aspm_calc_l12_info(link, parent_l1ss_cap, child_l1ss_cap); }