From patchwork Thu Aug 26 17:17:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Steiner X-Patchwork-Id: 135221 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7QHHAH4025224 for ; Thu, 26 Aug 2010 17:17:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751983Ab0HZRRJ (ORCPT ); Thu, 26 Aug 2010 13:17:09 -0400 Received: from relay2.sgi.com ([192.48.179.30]:46510 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751714Ab0HZRRI (ORCPT ); Thu, 26 Aug 2010 13:17:08 -0400 Received: from estes.americas.sgi.com (estes.americas.sgi.com [128.162.236.10]) by relay2.corp.sgi.com (Postfix) with ESMTP id 77104304097; Thu, 26 Aug 2010 10:17:06 -0700 (PDT) Received: from trebol1.americas.sgi.com (gulag1.americas.sgi.com [128.162.236.41]) by estes.americas.sgi.com (Postfix) with ESMTP id 3CF647001A69; Thu, 26 Aug 2010 12:17:05 -0500 (CDT) Received: by trebol1.americas.sgi.com (Postfix, from userid 14185) id 24FD3107ABCE0; Thu, 26 Aug 2010 12:17:05 -0500 (CDT) Date: Thu, 26 Aug 2010 12:17:04 -0500 From: Jack Steiner To: "H. Peter Anvin" , hmh@hmh.eng.br, mingo@elte.hu, tglx@linutronix.de, lenb@kernel.org, tony.luck@gmail.com Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC - V2] - Mapping ACPI tables as CACHED Message-ID: <20100826171704.GA21584@sgi.com> References: <20100722152220.GA18290@sgi.com> <20100724001449.GA9618@khazad-dum.debian.net> <4C743C0F.2010101@zytor.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4C743C0F.2010101@zytor.com> 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 (demeter1.kernel.org [140.211.167.41]); Thu, 26 Aug 2010 17:17:10 +0000 (UTC) Index: linux/arch/ia64/kernel/acpi.c =================================================================== --- linux.orig/arch/ia64/kernel/acpi.c 2010-08-26 09:32:46.000000000 -0500 +++ linux/arch/ia64/kernel/acpi.c 2010-08-26 11:51:05.544732478 -0500 @@ -172,6 +172,11 @@ char *__init __acpi_map_table(unsigned l return __va(phys_addr); } +char *__init __acpi_map_table_permanent(unsigned long phys_addr, unsigned long size) +{ + return ioremap(phys_addr, size); +} + void __init __acpi_unmap_table(char *map, unsigned long size) { } Index: linux/arch/x86/kernel/acpi/boot.c =================================================================== --- linux.orig/arch/x86/kernel/acpi/boot.c 2010-08-26 09:32:48.000000000 -0500 +++ linux/arch/x86/kernel/acpi/boot.c 2010-08-26 11:57:27.408724846 -0500 @@ -167,6 +167,20 @@ void __init __acpi_unmap_table(char *map early_iounmap(map, size); } +/* + * Permanently map memory for ACPI. Map ACPI tables and RAM as WB, + * other regions as UC. + */ +char *__init __acpi_map_table_permanent(unsigned long phys, unsigned long size) +{ + if (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(phys, size); +} + #ifdef CONFIG_X86_LOCAL_APIC static int __init acpi_parse_madt(struct acpi_table_header *table) { Index: linux/drivers/acpi/osl.c =================================================================== --- linux.orig/drivers/acpi/osl.c 2010-08-26 09:32:48.276653117 -0500 +++ linux/drivers/acpi/osl.c 2010-08-26 11:45:33.488606489 -0500 @@ -271,7 +271,7 @@ acpi_os_map_memory(acpi_physical_address /* * ioremap checks to ensure this is in reserved space */ - return ioremap((unsigned long)phys, size); + return __acpi_map_table_permanent((unsigned long)phys, size); else return __acpi_map_table((unsigned long)phys, size); } Index: linux/include/linux/acpi.h =================================================================== --- linux.orig/include/linux/acpi.h 2010-08-26 09:32:51.000000000 -0500 +++ linux/include/linux/acpi.h 2010-08-26 11:41:14.484709188 -0500 @@ -77,6 +77,7 @@ typedef int (*acpi_table_handler) (struc typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); char * __acpi_map_table (unsigned long phys_addr, unsigned long size); +char * __acpi_map_table_permanent (unsigned long phys_addr, unsigned long size); void __acpi_unmap_table(char *map, unsigned long size); int early_acpi_boot_init(void); int acpi_boot_init (void);