From patchwork Mon Oct 30 11:03:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 10032321 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1CD15603B4 for ; Mon, 30 Oct 2017 11:06:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E54328853 for ; Mon, 30 Oct 2017 11:06:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02E1C28856; Mon, 30 Oct 2017 11:06:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A210328853 for ; Mon, 30 Oct 2017 11:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932450AbdJ3LGa (ORCPT ); Mon, 30 Oct 2017 07:06:30 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:4884 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932400AbdJ3LG2 (ORCPT ); Mon, 30 Oct 2017 07:06:28 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Mon, 30 Oct 2017 04:06:07 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 30 Oct 2017 04:06:08 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 30 Oct 2017 04:06:08 -0700 Received: from HQMAIL110.nvidia.com (172.18.146.15) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Mon, 30 Oct 2017 11:03:28 +0000 Received: from HQMAIL108.nvidia.com (172.18.146.13) by hqmail110.nvidia.com (172.18.146.15) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Mon, 30 Oct 2017 11:03:27 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server id 15.0.1293.2 via Frontend Transport; Mon, 30 Oct 2017 11:03:28 +0000 Received: from vidyas-desktop.nvidia.com (Not Verified[10.24.36.185]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 30 Oct 2017 04:03:27 -0700 From: Vidya Sagar To: , , , , , CC: , , , , Subject: [PATCH 1/4] PCI/ASPM: Add API to supply LTR L1.2 threshold Date: Mon, 30 Oct 2017 16:33:02 +0530 Message-ID: <1509361385-21224-2-git-send-email-vidyas@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509361385-21224-1-git-send-email-vidyas@nvidia.com> References: <1509361385-21224-1-git-send-email-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP adds API for host controller drivers to specify LTR L1.2 threshold value if it is different from the default value. weak implementation of the API is added to supply default value Signed-off-by: Vidya Sagar --- drivers/pci/pcie/aspm.c | 11 ++++++++--- include/linux/pci-aspm.h | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 1dfa10cc566b..c6e8604796e5 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -436,6 +436,11 @@ static struct pci_dev *pci_function_0(struct pci_bus *linkbus) return NULL; } +u32 __weak pcie_aspm_get_ltr_l_1_2_threshold(void) +{ + return LTR_L1_2_THRESHOLD_BITS; +} + /* Calculate L1.2 PM substate timing parameters */ static void aspm_calc_l1ss_info(struct pcie_link_state *link, struct aspm_register_info *upreg, @@ -458,10 +463,10 @@ static void aspm_calc_l1ss_info(struct pcie_link_state *link, else link->l1ss.ctl1 |= val2 << 8; /* - * We currently use LTR L1.2 threshold to be fixed constant picked from - * Intel's coreboot. + * Get LTR L1.2 threshold value specific to a platform if present + * Otherwise, get a constant value picked from Intel's coreboot. */ - link->l1ss.ctl1 |= LTR_L1_2_THRESHOLD_BITS; + link->l1ss.ctl1 |= pcie_aspm_get_ltr_l_1_2_threshold(); /* Choose the greater of the two T_pwr_on */ val1 = (upreg->l1ss_cap >> 19) & 0x1F; diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index 207c561fb40e..7ffde0f57688 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h @@ -30,6 +30,7 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev); void pci_disable_link_state(struct pci_dev *pdev, int state); void pci_disable_link_state_locked(struct pci_dev *pdev, int state); void pcie_no_aspm(void); +u32 pcie_aspm_get_ltr_l_1_2_threshold(void); #else static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { @@ -49,6 +50,11 @@ static inline void pci_disable_link_state(struct pci_dev *pdev, int state) static inline void pcie_no_aspm(void) { } + +static inline u32 pcie_aspm_get_ltr_l_1_2_threshold(void) +{ + return 0; +} #endif #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */