Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753383AbdCBQK1 convert rfc822-to-8bit (ORCPT ); Thu, 2 Mar 2017 11:10:27 -0500 Received: from mga07.intel.com ([134.134.136.100]:27957 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752542AbdCBQIm (ORCPT ); Thu, 2 Mar 2017 11:08:42 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,232,1484035200"; d="scan'208";a="71452945" From: "Patel, Mayurkumar" To: "'Sinan Kaya'" , "linux-pci@vger.kernel.org" , "timur@codeaurora.org" , "cov@codeaurora.org" , Bjorn Helgaas CC: "linux-arm-msm@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , open list Subject: RE: [PATCH V2] PCI/ASPM: reconfigure ASPM following hotplug for POLICY_DEFAULT Thread-Topic: [PATCH V2] PCI/ASPM: reconfigure ASPM following hotplug for POLICY_DEFAULT Thread-Index: AQHSe/qttcHwVK+D9UySxiqVwThowaF+YrwwgABNHgCAADQfcIABjtUAgAD/8XA= Date: Thu, 2 Mar 2017 16:05:17 +0000 Message-ID: <92EBB4272BF81E4089A7126EC1E7B28466669BFF@IRSMSX101.ger.corp.intel.com> References: <1485891928-14573-1-git-send-email-okaya@codeaurora.org> <92EBB4272BF81E4089A7126EC1E7B2846666830C@IRSMSX101.ger.corp.intel.com> <92EBB4272BF81E4089A7126EC1E7B28466668774@IRSMSX101.ger.corp.intel.com> In-Reply-To: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2162 Lines: 43 > >Hi Bjorn, > >On 2/28/2017 1:57 PM, Patel, Mayurkumar wrote: >>> I was trying to figure out when to use saved values vs. the values in >>> registers by looking at the enable_cnt. >>> enable_cnt is 0 during boot on my system. >> enable_cnt for the root port on my system is set to 1 for "root port" already without saving >> any ASPM related settings. >> >> > >What would be the best way to figure out when to save power-on values from >the registers? > So in my case, pci_enable_device() for root port is called from pcie_port_device_register() at the boot time which Is called from pcie_portdrv_probe() function which does not call pcie_aspm_init_link_state() but Increment's enable_cnt field. When the Endpoint get plugged in, pcie_aspm_init_link_state() is called from hotplug routine on "Root port" but due to enable_cnt is already incremented we do not set right policy and aspm gets disabled by aspm driver. Shall we introduce new atomic variable along with aspm_default in struct pci_dev and increment it in when called first time pcie_aspm_init_link_state() to save power-on values ( I have tested it locally, if you think could be good approach I can upload the diffs) because enable_cnt in pci_enable_device() can be triggered from multiple places at boot time so it might not be safe to use it? or adding pcie_aspm_init_link_state() in pcie_port_device_register() for ports before calling pci_enable_device() although I am not sure whether it's the right approach and that would work for all the devices! @Kaya/Bjorn: Do you have any other suggestions or Could you also please help by comment what would make sense? >-- >Sinan Kaya >Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. >Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928