From patchwork Wed Jul 16 10:03:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vidya sagar X-Patchwork-Id: 4566111 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7EEAA9F295 for ; Wed, 16 Jul 2014 10:04:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0697201C8 for ; Wed, 16 Jul 2014 10:04:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B8AD201B4 for ; Wed, 16 Jul 2014 10:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756961AbaGPKEk (ORCPT ); Wed, 16 Jul 2014 06:04:40 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:43786 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756613AbaGPKEh (ORCPT ); Wed, 16 Jul 2014 06:04:37 -0400 Received: by mail-pd0-f173.google.com with SMTP id w10so979321pde.4 for ; Wed, 16 Jul 2014 03:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ICroy0bab0gpChNGmC/OEQqbnJRgJJ2uOEFpWAmRn8s=; b=FNPPx6kG4/bR4cbTmyN1e1MclMAJ3eR/GMKxMdEILxo4wtyi+goR1/YT0YjSvbYJ15 s05+DuowJzw+Yv1FaJxaQ2FXojIs7sEVwPOhuvyOeZQrhlS0hMMDgo/DzbpKHANiusmi 1wel1XInPHZFd5lIaaEYLeGn53rAsemXcPbY6jOJrGFEMxf+6Z0UuBJH47lEySs7ip0k xhm9AP4kQtmPBLmDFTCpN+sXvTtJZUS6DM8zeWO2j/HygHQZCIeAZjs+6Xi5iBAjQ1Ai GL6H0NadC2V02UHP7NSYTiEmH5hG2sf9XSATbeS9vJgEwiPdORSjulKzBh5HBO9iVLoP eRqw== X-Received: by 10.70.42.38 with SMTP id k6mr14697112pdl.120.1405505076127; Wed, 16 Jul 2014 03:04:36 -0700 (PDT) Received: from localhost.localdomain ([106.216.155.158]) by mx.google.com with ESMTPSA id qk8sm16529513pbb.24.2014.07.16.03.04.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jul 2014 03:04:35 -0700 (PDT) From: Vidya Sagar X-Google-Original-From: Vidya Sagar To: bhelgaas@google.com, matthew.garrett@nebula.com, rjw@rjwysocki.net, nchumbalkar@lenovo.com, thierry.reding@gmail.com, swarren@nvidia.com, linux-pci@vger.kernel.org Cc: kthota@nvidia.com, linux-kernel@vger.kernel.org, vidyas@nvidia.com, Vidya Sagar Subject: [PATCH v3] PCI: enable ASPM configuration in PCIE POWERSAVE mode Date: Wed, 16 Jul 2014 15:33:42 +0530 Message-Id: <1405505022-7593-1-git-send-email-vidyas@nvidia.com> X-Mailer: git-send-email 1.8.1.5 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vidya Sagar Commit 1a680b7c3258 ("PCI: PCIe links may not get configured for ASPM under POWERSAVE mode") moved pcie_aspm_powersave_config_link() out of pci_raw_set_power_state() to pci_set_power_state() which would enable ASPM. But, with Commit db288c9c5f9d ("PCI / PM: restore the original behavior of pci_set_power_state()"), which re-introduced the following check ./drivers/pci/pci.c: pci_set_power_state() + /* Check if we're already there */ + if (dev->current_state == state) + return 0; in pci_set_power_state(), call to pcie_aspm_powersave_config_link() is never made leaving ASPM broken. Fix it by configuring links for ASPM in do_pci_enable_device() instead of pci_set_power_state() Suggested-by: Bjorn Helgaas Signed-off-by: Vidya Sagar --- v3: * Modified commit message removed single quotes around commit messages added Suggested-by line v2: * Calling ASPM config code is moved from pci_set_power_state() to * do_pci_enable_device() drivers/pci/pci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1c8592b..81d49d3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -839,12 +839,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) if (!__pci_complete_power_transition(dev, state)) error = 0; - /* - * When aspm_policy is "powersave" this call ensures - * that ASPM is configured. - */ - if (!error && dev->bus->self) - pcie_aspm_powersave_config_link(dev->bus->self); return error; } @@ -1195,12 +1189,18 @@ int __weak pcibios_enable_device(struct pci_dev *dev, int bars) static int do_pci_enable_device(struct pci_dev *dev, int bars) { int err; + struct pci_dev *bridge; u16 cmd; u8 pin; err = pci_set_power_state(dev, PCI_D0); if (err < 0 && err != -EIO) return err; + + bridge = pci_upstream_bridge(dev); + if (bridge) + pcie_aspm_powersave_config_link(bridge); + err = pcibios_enable_device(dev, bars); if (err < 0) return err;