From: venkatesh.pallipadi@intel.com
To: ak@muc.de, ebiederm@xmission.com, rdreier@cisco.com,
torvalds@linux-foundation.org, gregkh@suse.de, airlied@skynet.ie,
davej@redhat.com, mingo@elte.hu, tglx@linutronix.de,
hpa@zytor.com, akpm@linux-foundation.org, arjan@infradead.org,
jesse.barnes@intel.com
Cc: linux-kernel@vger.kernel.org,
Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
Suresh Siddha <suresh.b.siddha@intel.com>
Subject: [RFC PATCH 10/12] PAT 64b: Make acpi use early map instead of assuming identity map
Date: Thu, 13 Dec 2007 15:55:53 -0800 [thread overview]
Message-ID: <20071213235713.287720000@intel.com> (raw)
In-Reply-To: 20071213235543.568682000@intel.com
[-- Attachment #1: acpi_use_early_ioremap.patch --]
[-- Type: text/plain, Size: 5378 bytes --]
ACPI boot code has assumptions about entire memory being mapped in identity
mapping at:
* Generic __acpi_map_table
* Looking for RSD PTR at boot time
* Looking for mp table
Fix all these to use early_ioremap and early_iounmap.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
Index: linux-2.6.24-rc/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.24-rc.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6.24-rc/arch/x86/kernel/acpi/boot.c
@@ -105,16 +105,20 @@ enum acpi_irq_model_id acpi_irq_model =
#ifdef CONFIG_X86_64
-/* rely on all ACPI tables being in the direct mapping */
char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
{
if (!phys_addr || !size)
return NULL;
- if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE)
- return __va(phys_addr);
+ return early_ioremap(phys_addr, size);
+}
- return NULL;
+void __acpi_unmap_table(void * addr, unsigned long size)
+{
+ if (!addr || !size)
+ return;
+
+ early_iounmap(addr, size);
}
#else
@@ -158,6 +162,11 @@ char *__acpi_map_table(unsigned long phy
return ((unsigned char *)base + offset);
}
+
+void __acpi_unmap_table(void * addr, unsigned long size)
+{
+}
+
#endif
#ifdef CONFIG_PCI_MMCONFIG
@@ -586,17 +595,23 @@ acpi_scan_rsdp(unsigned long start, unsi
{
unsigned long offset = 0;
unsigned long sig_len = sizeof("RSD PTR ") - 1;
+ char * virt_addr;
+ virt_addr = __acpi_map_table(start, length);
+ if (!virt_addr)
+ return 0;
/*
* Scan all 16-byte boundaries of the physical memory region for the
* RSDP signature.
*/
for (offset = 0; offset < length; offset += 16) {
- if (strncmp((char *)(phys_to_virt(start) + offset), "RSD PTR ", sig_len))
+ if (strncmp(virt_addr + offset, "RSD PTR ", sig_len))
continue;
+ __acpi_unmap_table(virt_addr, length);
return (start + offset);
}
+ __acpi_unmap_table(virt_addr, length);
return 0;
}
Index: linux-2.6.24-rc/drivers/acpi/osl.c
===================================================================
--- linux-2.6.24-rc.orig/drivers/acpi/osl.c
+++ linux-2.6.24-rc/drivers/acpi/osl.c
@@ -231,6 +231,8 @@ void acpi_os_unmap_memory(void __iomem *
{
if (acpi_gbl_permanent_mmap) {
iounmap(virt);
+ } else {
+ __acpi_unmap_table(virt, size);
}
}
EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
Index: linux-2.6.24-rc/include/linux/acpi.h
===================================================================
--- linux-2.6.24-rc.orig/include/linux/acpi.h
+++ linux-2.6.24-rc/include/linux/acpi.h
@@ -79,6 +79,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);
+void __acpi_unmap_table (void * addr, unsigned long size);
unsigned long acpi_find_rsdp (void);
int acpi_boot_init (void);
int acpi_boot_table_init (void);
Index: linux-2.6.24-rc/arch/x86/kernel/mpparse_64.c
===================================================================
--- linux-2.6.24-rc.orig/arch/x86/kernel/mpparse_64.c
+++ linux-2.6.24-rc/arch/x86/kernel/mpparse_64.c
@@ -535,9 +535,12 @@ void __init get_smp_config (void)
static int __init smp_scan_config (unsigned long base, unsigned long length)
{
extern void __bad_mpf_size(void);
- unsigned int *bp = phys_to_virt(base);
+ unsigned int *bp = (unsigned int *)__acpi_map_table(base, length);
struct intel_mp_floating *mpf;
+ if (!bp)
+ return 0;
+
Dprintk("Scan SMP from %p for %ld bytes.\n", bp,length);
if (sizeof(*mpf) != 16)
__bad_mpf_size();
@@ -555,17 +558,20 @@ static int __init smp_scan_config (unsig
if (mpf->mpf_physptr)
reserve_bootmem_generic(mpf->mpf_physptr, PAGE_SIZE);
mpf_found = mpf;
+ __acpi_unmap_table((char *)bp, length);
return 1;
}
bp += 4;
length -= 16;
}
+ __acpi_unmap_table((char *)bp, length);
return 0;
}
void __init find_smp_config(void)
{
unsigned int address;
+ unsigned short *bp;
/*
* FIXME: Linux assumes you have 640K of base ram..
@@ -592,11 +598,17 @@ void __init find_smp_config(void)
* should be fixed.
*/
- address = *(unsigned short *)phys_to_virt(0x40E);
+ bp = (unsigned short *)__acpi_map_table(0x40E, 2);
+ if (!bp)
+ return;
+
+ address = *bp;
address <<= 4;
if (smp_scan_config(address, 0x1000))
return;
+ __acpi_unmap_table((char *)bp, 2);
+
/* If we have come this far, we did not find an MP table */
printk(KERN_INFO "No mptable found.\n");
}
Index: linux-2.6.24-rc/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.24-rc.orig/arch/x86/mm/init_64.c
+++ linux-2.6.24-rc/arch/x86/mm/init_64.c
@@ -206,7 +206,7 @@ static __meminit void unmap_low_page(voi
}
/* Must run before zap_low_mappings */
-__meminit void *early_ioremap(unsigned long addr, unsigned long size)
+void *early_ioremap(unsigned long addr, unsigned long size)
{
unsigned long vaddr;
pmd_t *pmd, *last_pmd;
@@ -235,7 +235,7 @@ __meminit void *early_ioremap(unsigned l
}
/* To avoid virtual aliases later */
-__meminit void early_iounmap(void *addr, unsigned long size)
+void early_iounmap(void *addr, unsigned long size)
{
unsigned long vaddr;
pmd_t *pmd;
--
next prev parent reply other threads:[~2007-12-14 0:05 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 23:55 [RFC PATCH 00/12] PAT 64b: PAT support for X86_64 venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 01/12] PAT 64b: Add cpu_shutdown() support venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 02/12] PAT 64b: Basic PAT implementation venkatesh.pallipadi
2007-12-14 0:42 ` Andi Kleen
2007-12-14 18:31 ` Venki Pallipadi
2007-12-18 4:50 ` Eric W. Biederman
2007-12-14 3:48 ` Eric W. Biederman
2007-12-14 4:23 ` Eric W. Biederman
2007-12-14 21:10 ` Siddha, Suresh B
2007-12-14 23:34 ` Siddha, Suresh B
2007-12-15 7:55 ` Ingo Molnar
2007-12-14 10:25 ` Andi Kleen
2007-12-14 19:45 ` H. Peter Anvin
2007-12-18 4:42 ` Eric W. Biederman
2007-12-14 21:06 ` Siddha, Suresh B
2007-12-13 23:55 ` [RFC PATCH 03/12] PAT 64b: drm driver changes for PAT venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 04/12] PAT 64b: reserve_mattr and free_mattr " venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 05/12] PAT 64b: pci mmap conlfict patch venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 06/12] PAT 64b: Add ioremap_wc support venkatesh.pallipadi
2007-12-14 4:17 ` Roland Dreier
2007-12-14 4:28 ` Eric W. Biederman
2007-12-14 4:32 ` Roland Dreier
2007-12-14 4:48 ` Eric W. Biederman
2007-12-14 21:40 ` Siddha, Suresh B
2007-12-14 23:19 ` Andi Kleen
2007-12-18 8:29 ` Eric W. Biederman
2007-12-13 23:55 ` [RFC PATCH 07/12] PAT 64b: dev mem chanegs for pat venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 08/12] PAT 64b: coherent mmap and sysfs bin ioctl venkatesh.pallipadi
2007-12-14 0:19 ` Greg KH
2007-12-14 0:35 ` David Miller
2007-12-14 6:34 ` Greg KH
2007-12-16 21:57 ` Paul Mackerras
2007-12-17 12:41 ` Andi Kleen
2007-12-18 4:30 ` Eric W. Biederman
2007-12-18 4:51 ` H. Peter Anvin
2007-12-18 9:35 ` Andi Kleen
2007-12-18 13:48 ` Eric W. Biederman
2007-12-14 0:43 ` Andi Kleen
2007-12-14 0:54 ` Jesse Barnes
2007-12-14 3:59 ` Eric W. Biederman
2007-12-14 6:02 ` Greg KH
2007-12-14 6:04 ` Eric W. Biederman
2007-12-14 10:19 ` Andi Kleen
2007-12-13 23:55 ` [RFC PATCH 09/12] PAT 64b: map only usable memory in identity mapping venkatesh.pallipadi
2007-12-13 23:55 ` venkatesh.pallipadi [this message]
2007-12-13 23:55 ` [RFC PATCH 11/12] PAT 64b: devmem do not read pages not mapped in identity map venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 12/12] PAT 64b: skip attr tracking for RAM venkatesh.pallipadi
2007-12-14 0:28 ` [RFC PATCH 00/12] PAT 64b: PAT support for X86_64 Dave Airlie
2007-12-14 22:00 ` Siddha, Suresh B
2007-12-14 22:27 ` Dave Airlie
2007-12-14 22:32 ` H. Peter Anvin
2007-12-14 22:37 ` Dave Airlie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071213235713.287720000@intel.com \
--to=venkatesh.pallipadi@intel.com \
--cc=airlied@skynet.ie \
--cc=ak@muc.de \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=davej@redhat.com \
--cc=ebiederm@xmission.com \
--cc=gregkh@suse.de \
--cc=hpa@zytor.com \
--cc=jesse.barnes@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rdreier@cisco.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).