From patchwork Mon Mar 23 07:22:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 6070761 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 26F60BF90F for ; Mon, 23 Mar 2015 07:20:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F7682022D for ; Mon, 23 Mar 2015 07:20:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58540201CD for ; Mon, 23 Mar 2015 07:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752113AbbCWHTx (ORCPT ); Mon, 23 Mar 2015 03:19:53 -0400 Received: from mga14.intel.com ([192.55.52.115]:12007 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752019AbbCWHTu (ORCPT ); Mon, 23 Mar 2015 03:19:50 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 23 Mar 2015 00:19:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,450,1422950400"; d="scan'208";a="702662714" Received: from gerry-dev.bj.intel.com ([10.238.158.72]) by orsmga002.jf.intel.com with ESMTP; 23 Mar 2015 00:19:42 -0700 From: Jiang Liu To: "Rafael J . Wysocki" , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Len Brown Cc: Jiang Liu , Lv Zheng , LKML , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [Bugfix] x86/PCI/ACPI: Fix regression caused by commit 63f1789ec716 Date: Mon, 23 Mar 2015 15:22:14 +0800 Message-Id: <1427095334-7430-1-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Commit 63f1789ec716("Ignore resources consumed by host bridge itself") tries to ignore resources consumed by PCI host bridge itself by checking IORESOURCE_WINDOW flag, which causes regression on some platforms. For example, PC Engines APU.1C platform defines PCI MMIO resources with ACPI Memory32Fixed operator as below: Name (CRES, ResourceTemplate () { ... WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, 0x0000, // Granularity 0x0D00, // Range Minimum 0xFFFF, // Range Maximum 0x0000, // Translation Offset 0xF300, // Length ,, , TypeStatic) Memory32Fixed (ReadOnly, 0x000A0000, // Address Base 0x00020000, // Address Length ) Memory32Fixed (ReadOnly, 0x00000000, // Address Base 0x00000000, // Address Length _Y00) }) Memory32Fixed operator doesn't support concept of "producer/consumer" and it will be treated as "consumer" by the ACPI resource parsing interface, thus cause regression. So the fix is only to check "producer/consumer" flag for resources having "producer/consumer" flag. Another possible fix is to only ignore IO resource consumed by host bridge and keep IOMEM resource consumed by host bridge, please refer to: http://www.spinics.net/lists/linux-pci/msg39706.html Fixes: 63f1789ec716("Ignore resources consumed by host bridge itself") Reported-by: Bernhard Thaler Signed-off-by: Jiang Liu --- Hi Bernhard, Could you please also help to test whether this patch works for you too? Thanks! Gerry --- arch/x86/pci/acpi.c | 5 ++--- drivers/acpi/resource.c | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index e4695985f9de..8c4b1201f340 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -337,7 +337,7 @@ static void probe_pci_root_info(struct pci_root_info *info, info->bridge = device; ret = acpi_dev_get_resources(device, list, acpi_dev_filter_resource_type_cb, - (void *)(IORESOURCE_IO | IORESOURCE_MEM)); + (void *)(IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_WINDOW)); if (ret < 0) dev_warn(&device->dev, "failed to parse _CRS method, error code %d\n", ret); @@ -346,8 +346,7 @@ static void probe_pci_root_info(struct pci_root_info *info, "no IO and memory resources present in _CRS\n"); else resource_list_for_each_entry_safe(entry, tmp, list) { - if ((entry->res->flags & IORESOURCE_WINDOW) == 0 || - (entry->res->flags & IORESOURCE_DISABLED)) + if (entry->res->flags & IORESOURCE_DISABLED) resource_list_destroy_entry(entry); else entry->res->name = info->name; diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 5589a6e2a023..b0d3f2ceef06 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -606,6 +606,9 @@ int acpi_dev_filter_resource_type(struct acpi_resource *ares, case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: + if (((types & IORESOURCE_WINDOW) == 0) ^ + (ares->data.address.producer_consumer == ACPI_CONSUMER)) + break; if (ares->data.address.resource_type == ACPI_MEMORY_RANGE) type = IORESOURCE_MEM; else if (ares->data.address.resource_type == ACPI_IO_RANGE)