From patchwork Thu Jul 22 15:22:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Steiner X-Patchwork-Id: 113615 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6MFR2RK022283 for ; Thu, 22 Jul 2010 15:30:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755505Ab0GVPW3 (ORCPT ); Thu, 22 Jul 2010 11:22:29 -0400 Received: from relay2.sgi.com ([192.48.179.30]:43259 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751865Ab0GVPW2 (ORCPT ); Thu, 22 Jul 2010 11:22:28 -0400 Received: from estes.americas.sgi.com (estes.americas.sgi.com [128.162.236.10]) by relay2.corp.sgi.com (Postfix) with ESMTP id EAF06304070; Thu, 22 Jul 2010 08:22:24 -0700 (PDT) Received: from shaft.americas.sgi.com (shaft.americas.sgi.com [128.162.232.42]) by estes.americas.sgi.com (Postfix) with ESMTP id CBE8A7001861; Thu, 22 Jul 2010 10:22:24 -0500 (CDT) Received: from shaft.americas.sgi.com (localhost.localdomain [127.0.0.1]) by shaft.americas.sgi.com (8.13.6/8.13.6) with ESMTP id o6MFMOmT018625; Thu, 22 Jul 2010 10:22:24 -0500 Received: (from steiner@localhost) by shaft.americas.sgi.com (8.13.6/8.13.5/Submit) id o6MFMKfF018620; Thu, 22 Jul 2010 10:22:20 -0500 Date: Thu, 22 Jul 2010 10:22:20 -0500 From: Jack Steiner To: mingo@elte.hu, tglx@linutronix.de, lenb@kernel.org Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC] - Mapping ACPI tables as CACHED Message-ID: <20100722152220.GA18290@sgi.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 22 Jul 2010 15:30:35 +0000 (UTC) Index: linux/arch/x86/include/asm/x86_init.h =================================================================== --- linux.orig/arch/x86/include/asm/x86_init.h 2010-07-21 16:53:30.226241589 -0500 +++ linux/arch/x86/include/asm/x86_init.h 2010-07-21 16:57:46.614872338 -0500 @@ -113,6 +113,7 @@ struct x86_cpuinit_ops { /** * struct x86_platform_ops - platform specific runtime functions + * @is_wb_acpi_tables E820 ACPI table are in WB memory * @is_untracked_pat_range exclude from PAT logic * @calibrate_tsc: calibrate TSC * @get_wallclock: get time from HW clock like RTC etc. @@ -120,6 +121,7 @@ struct x86_cpuinit_ops { * @nmi_init enable NMI on cpus */ struct x86_platform_ops { + int (*is_wb_acpi_tables)(void); int (*is_untracked_pat_range)(u64 start, u64 end); unsigned long (*calibrate_tsc)(void); unsigned long (*get_wallclock)(void); Index: linux/arch/x86/kernel/apic/x2apic_uv_x.c =================================================================== --- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c 2010-07-21 16:53:30.226241589 -0500 +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c 2010-07-21 16:54:46.358866486 -0500 @@ -58,6 +58,11 @@ static int uv_is_untracked_pat_range(u64 return is_ISA_range(start, end) || is_GRU_range(start, end); } +static int uv_is_wb_acpi_tables(void) +{ + return 1; +} + static int early_get_nodeid(void) { union uvh_node_id_u node_id; @@ -81,6 +86,7 @@ static int __init uv_acpi_madt_oem_check nodeid = early_get_nodeid(); x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range; x86_platform.nmi_init = uv_nmi_init; + x86_platform.is_wb_acpi_tables = uv_is_wb_acpi_tables; if (!strcmp(oem_table_id, "UVL")) uv_system_type = UV_LEGACY_APIC; else if (!strcmp(oem_table_id, "UVX")) Index: linux/arch/x86/kernel/x86_init.c =================================================================== --- linux.orig/arch/x86/kernel/x86_init.c 2010-07-21 16:53:30.226241589 -0500 +++ linux/arch/x86/kernel/x86_init.c 2010-07-21 16:58:17.106240870 -0500 @@ -71,7 +71,10 @@ struct x86_cpuinit_ops x86_cpuinit __cpu static void default_nmi_init(void) { }; +static int default_wb_acpi_tables(void) {return 0;} + struct x86_platform_ops x86_platform = { + .is_wb_acpi_tables = default_wb_acpi_tables, .is_untracked_pat_range = default_is_untracked_pat_range, .calibrate_tsc = native_calibrate_tsc, .get_wallclock = mach_get_cmos_time, Index: linux/drivers/acpi/osl.c =================================================================== --- linux.orig/drivers/acpi/osl.c 2010-07-21 16:53:30.226241589 -0500 +++ linux/drivers/acpi/osl.c 2010-07-21 17:58:20.370414172 -0500 @@ -293,12 +293,18 @@ acpi_os_map_memory(acpi_physical_address printk(KERN_ERR PREFIX "Cannot map memory that high\n"); return NULL; } - if (acpi_gbl_permanent_mmap) + if (acpi_gbl_permanent_mmap) { /* * ioremap checks to ensure this is in reserved space */ - return ioremap((unsigned long)phys, size); - else + if (x86_platform.is_wb_acpi_tables() && + (e820_all_mapped(phys, phys + size, E820_RAM) || + e820_all_mapped(phys, phys + size, E820_ACPI) || + e820_all_mapped(phys, phys + size, E820_NVS))) + return ioremap_cache((unsigned long)phys, size); + else + return ioremap((unsigned long)phys, size); + } else return __acpi_map_table((unsigned long)phys, size); } EXPORT_SYMBOL_GPL(acpi_os_map_memory);