From patchwork Mon Mar 13 23:21:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9622275 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 544EB604CC for ; Mon, 13 Mar 2017 23:21:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 450C52850D for ; Mon, 13 Mar 2017 23:21:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39C802851E; Mon, 13 Mar 2017 23:21:53 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 D95A72850D for ; Mon, 13 Mar 2017 23:21:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753577AbdCMXVu (ORCPT ); Mon, 13 Mar 2017 19:21:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58204 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752132AbdCMXVs (ORCPT ); Mon, 13 Mar 2017 19:21:48 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EFDBD607F3; Mon, 13 Mar 2017 23:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1489447306; bh=Inow8+B44oVhQWjmyGd4swW6Pu0rGsGWX8Cmg5BSVMc=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=l+puJcAN3wK8jNkR4ev+rVr52NdwG31La89iY6h0vwWDGbsprVI6TunDt+wisS0j1 l51keaahMLRVDajw2/5jsKOxG6LS9OvjKcZTzXLzSYTLXWpQsc8obVxvmho7Z4+OOr 0NXn7rGSdBMnZyqkS9A89CS2sFG3ZI845cjmVKEs= Received: from [10.228.68.85] (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 518906014D; Mon, 13 Mar 2017 23:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1489447304; bh=Inow8+B44oVhQWjmyGd4swW6Pu0rGsGWX8Cmg5BSVMc=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=ahgrm8KBWNP/Q2pLO7m+woBINeMBUH+K2coNm6bb+B/h7EAP6mZFCWPJ89vR/ofdS X3alUWtwX6PfLltQnelfwI1x4qk5FDVJpla49BGftArXH2M72RfSsVucuKvH2gEmZs pJIx1ghpxiHdpu+PUToPm2GIDa/3qimFlC8Yir80= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 518906014D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH V4 0/3] PCI/ASPM: reconfigure ASPM following hotplug for POLICY_DEFAULT To: Bjorn Helgaas References: <1489438085-2055-1-git-send-email-okaya@codeaurora.org> <20170313214616.GE8232@bhelgaas-glaptop.roam.corp.google.com> <20170313230855.GG8232@bhelgaas-glaptop.roam.corp.google.com> Cc: linux-pci@vger.kernel.org, timur@codeaurora.org, linux-arm-msm@vger.kernel.org, mayurkumar.patel@intel.com, linux-arm-kernel@lists.infradead.org From: Sinan Kaya Message-ID: Date: Mon, 13 Mar 2017 19:21:42 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170313230855.GG8232@bhelgaas-glaptop.roam.corp.google.com> 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 On 3/13/2017 7:08 PM, Bjorn Helgaas wrote: > On Mon, Mar 13, 2017 at 06:05:55PM -0400, Sinan Kaya wrote: >> On 3/13/2017 5:46 PM, Bjorn Helgaas wrote: >>> What is this series based on? Unless they depend on other in-flight >>> patches, I apply patches to branches based on my "master" branch, >>> which is typically -rc1 or -rc2 (it's currently v4.11-rc1). These >>> don't apply to either. >> >> It looks like I am on 4.10. I can rebase and post again. > > Rebasing would be good, but I can give you some comments on your v4, > now that I can apply it and see what it looks like. > Thanks, I'm mostly done with the rebase. I'll have to retest tomorrow morning and then post. I had to drop this - for endpoints, have pcie_aspm_init_link_state() do the actual ASPM setup of the link as it currently does. during rebase. The reason is that the clock configuration needs to switch to common clock mode across all the devices before any ASPM latency is read/configured. Common clock configuration seem to be trying to walk the device list. Here is the untested version. It might not even compile. I'll wait until I receive your comments. diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 973472c..74fd7c5 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -828,6 +828,16 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev) } /* + * pci_aspm_init: Initiate PCI express link state. + * It is called from device_add for every single pci device. + * @pdev: all pci devices + */ +int pci_aspm_init(struct pci_dev *pdev) +{ + return 0; +} + +/* * pcie_aspm_init_link_state: Initiate PCI express link state. * It is called after the pcie and its children devices are scanned. * @pdev: the root port or switch downstream port diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index dfc9a27..1e19364 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1847,6 +1847,9 @@ static void pci_init_capabilities(struct pci_dev *dev) /* Advanced Error Reporting */ pci_aer_init(dev); + + /* Active State Power Management */ + pci_aspm_init(dev); } /* diff --git a/include/linux/pci.h b/include/linux/pci.h index eb3da1a..8828dd7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1396,8 +1396,10 @@ static inline int pci_irq_get_node(struct pci_dev *pdev, int vec) #ifdef CONFIG_PCIEASPM bool pcie_aspm_support_enabled(void); +int pci_aspm_init(struct pci_dev *pdev); #else static inline bool pcie_aspm_support_enabled(void) { return false; } +static inline int pci_aspm_init(struct pci_dev *pdev) { return -ENODEV; } #endif #ifdef CONFIG_PCIEAER