From patchwork Sat Mar 25 21:38:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9644877 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 AB0DB6020B for ; Sat, 25 Mar 2017 21:39:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E69323E64 for ; Sat, 25 Mar 2017 21:39:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92F4F27165; Sat, 25 Mar 2017 21:39:52 +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 1308D23E64 for ; Sat, 25 Mar 2017 21:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751324AbdCYVi7 (ORCPT ); Sat, 25 Mar 2017 17:38:59 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37260 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbdCYVi4 (ORCPT ); Sat, 25 Mar 2017 17:38:56 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BF58F60D5B; Sat, 25 Mar 2017 21:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1490477906; bh=b7QXBdK51VlSKDbyKe3S/CDj+YENN1bq5Ri9szpF5zE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ucb9/t5AA3o41SpvX/GKgyZaHf7KSMr3xegXKUu1b87TuR9vt9qR+v5BRmgPgRRU2 OW5c6pFet5kH0Q4gdEi6xBwCSoLST0O8ezXZ4P2jgBrsUBZoa33hQp1w3GMtbd0rKm yPEYDXhihz/i3z9ypAr5X+N3CgOkzgVHwO0Q9ktc= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CB13660D5B; Sat, 25 Mar 2017 21:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1490477906; bh=b7QXBdK51VlSKDbyKe3S/CDj+YENN1bq5Ri9szpF5zE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ucb9/t5AA3o41SpvX/GKgyZaHf7KSMr3xegXKUu1b87TuR9vt9qR+v5BRmgPgRRU2 OW5c6pFet5kH0Q4gdEi6xBwCSoLST0O8ezXZ4P2jgBrsUBZoa33hQp1w3GMtbd0rKm yPEYDXhihz/i3z9ypAr5X+N3CgOkzgVHwO0Q9ktc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CB13660D5B 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 From: Sinan Kaya To: linux-pci@vger.kernel.org, timur@codeaurora.org Cc: mayurkumar.patel@intel.com, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Bjorn Helgaas , Rajat Jain , David Daney , Shawn Lin , Julia Lawall , linux-kernel@vger.kernel.org Subject: [PATCH V5 1/4] PCI/ASPM: introduce pci_aspm_init() and add to pci_init_capabilities() Date: Sat, 25 Mar 2017 17:38:10 -0400 Message-Id: <1490477893-9517-2-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490477893-9517-1-git-send-email-okaya@codeaurora.org> References: <1490477893-9517-1-git-send-email-okaya@codeaurora.org> 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 We need a callback from pci_init_capabilities function for every single new PCI device that is currently being added. pci_aspm_init() will be used to save the power on state of the HW. Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=194895 Signed-off-by: Sinan Kaya --- drivers/pci/pcie/aspm.c | 10 ++++++++++ drivers/pci/probe.c | 3 +++ include/linux/pci.h | 2 ++ 3 files changed, 15 insertions(+) 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