From patchwork Fri Oct 30 15:47:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 7527831 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7D497BEEA4 for ; Fri, 30 Oct 2015 15:48:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB853207A2 for ; Fri, 30 Oct 2015 15:48:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EB5C20791 for ; Fri, 30 Oct 2015 15:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759702AbbJ3Prv (ORCPT ); Fri, 30 Oct 2015 11:47:51 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:61146 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752472AbbJ3Prt (ORCPT ); Fri, 30 Oct 2015 11:47:49 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.15.0.59/8.15.0.59) with SMTP id t9UFl7dJ028202; Fri, 30 Oct 2015 08:47:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=mjmsalMjCWdycdl7vRnd4X0BoyY8JXp5vIKOmK71YYo=; b=niPW8AjEhvRUtL1hEURCgJ2O6fU+6qTkt1tLPCxK9qkPZu/ryZPP2ZiXoH1faTyu2CGK fbDX35PHxhZhrAStO+UGWBON2wz4dMCk1BXUl9ejqjdTocFuOyCwnjuS5XT1O9yTyGnC YAYYwTf+KoLSgo/tS81MFTyV9F2AK5XjDow= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 1xuq50va4n-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 30 Oct 2015 08:47:46 -0700 Received: from localhost (192.168.52.123) by mail.thefacebook.com (192.168.16.20) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 30 Oct 2015 08:47:42 -0700 From: Josef Bacik To: , , , , , Subject: [RFC][PATCH] pci: completely disable aspm if it's unsupported Date: Fri, 30 Oct 2015 11:47:41 -0400 Message-ID: <1446220061-28570-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-10-30_10:, , signatures=0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 We have some hardware that takes about 30 seconds to setup common clocks for ASPM, but our bios'es don't actually allow ASPM. It seems we had this thing in place where we would disable ASPM after the pci bus probe so that we would make sure that pre pcie 1.1 devices would be properly skipped during initialization. This is because the mechanism to disable ASPM doesn't actually disable the setting up of the link state stuff, it just keeps us from changing the link state after the fact. So instead make it so that when we call pcie_no_aspm() that we disable ASPM completley, that is we skip setting up the link state and everything. This way we avoid the costly setup for a feature we cannot support in the first place and we also make sure we are safe from future tampering with the ASPM link state. Thanks, Signed-off-by: Josef Bacik --- drivers/acpi/pci_root.c | 22 +++++----------------- drivers/pci/pcie/aspm.c | 1 + 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 393706a..00e164a 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -419,7 +419,7 @@ out: } EXPORT_SYMBOL(acpi_pci_osc_control_set); -static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) +static void negotiate_os_control(struct acpi_pci_root *root) { u32 support, control, requested; acpi_status status; @@ -456,7 +456,7 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) if (ACPI_FAILURE(status)) { dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", acpi_format_exception(status)); - *no_aspm = 1; + pcie_no_aspm(); return; } @@ -495,22 +495,14 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) * intact and prevent the OS from touching it. */ dev_info(&device->dev, "FADT indicates ASPM is unsupported, using BIOS configuration\n"); - *no_aspm = 1; + pcie_no_aspm(); } } else { decode_osc_control(root, "OS requested", requested); decode_osc_control(root, "platform willing to grant", control); dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", acpi_format_exception(status)); - - /* - * We want to disable ASPM here, but aspm_disabled - * needs to remain in its state from boot so that we - * properly handle PCIe 1.1 devices. So we set this - * flag here, to defer the action until after the ACPI - * root scan. - */ - *no_aspm = 1; + pcie_no_aspm(); } } @@ -522,7 +514,6 @@ static int acpi_pci_root_add(struct acpi_device *device, int result; struct acpi_pci_root *root; acpi_handle handle = device->handle; - int no_aspm = 0; bool hotadd = system_state != SYSTEM_BOOTING; root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); @@ -581,7 +572,7 @@ static int acpi_pci_root_add(struct acpi_device *device, root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle); - negotiate_os_control(root, &no_aspm); + negotiate_os_control(root); /* * TBD: Need PCI interface for enumeration/configuration of roots. @@ -604,9 +595,6 @@ static int acpi_pci_root_add(struct acpi_device *device, goto remove_dmar; } - if (no_aspm) - pcie_no_aspm(); - pci_acpi_add_bus_pm_notifier(device); if (device->wakeup.flags.run_wake) device_set_run_wake(root->bus->bridge, true); diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 317e355..5f84af2 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -954,6 +954,7 @@ void pcie_no_aspm(void) if (!aspm_force) { aspm_policy = POLICY_DEFAULT; aspm_disabled = 1; + aspm_support_enabled = false; } }