android_kernel_xiaomi_sm8350/arch/x86/mm
Andres Salomon cb8ab687c3 x86: ioremap ram check fix
bdd3cee2e4 (x86: ioremap(), extend check
to all RAM pages) breaks OLPC's ioremap call.  The ioremap that OLPC uses is:

        romsig = ioremap(0xffffffc0, 16);

The commit that breaks it is basically:

-       for (pfn = phys_addr >> PAGE_SHIFT; pfn < max_pfn_mapped &&
-            (pfn << PAGE_SHIFT) < last_addr; pfn++) {
+       for (pfn = phys_addr >> PAGE_SHIFT;
+                               (pfn << PAGE_SHIFT) < last_addr; pfn++) {
+

Previously, the 'pfn < max_pfn_mapped' check would've caused us to not
enter the loop.  Removing that check means we loop infinitely.  The
reason for that is because pfn is 0xfffff, and last_addr is 0xffffffcf.
The remaining check that is used to exit the loop is not sufficient;
when pfn<<PAGE_SHIFT is 0xfffff000, that is less than 0xffffffcf; when
we increment pfn and it overflows (pfn == 0x100000), pfn<<PAGE_SHIFT
ends up being 0.  That, of course, is less than last_addr.  In effect,
pfn<<PAGE_SHIFT is never lower than last_addr.

The simple fix for this is to limit the last_addr check to the PAGE_MASK;
a patch is below.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-04-30 23:15:35 +02:00
..
discontig_32.c x86: rename find_max_pfn() to propagate_e820_map() 2008-04-19 19:19:55 +02:00
dump_pagetables.c "make namespacecheck" fixes 2008-04-24 23:15:44 +02:00
extable.c x86: unify extable_{32|64}.c 2008-01-30 13:31:41 +01:00
fault.c x86: cleanup - rename VM_MASK to X86_VM_MASK 2008-04-17 17:41:33 +02:00
highmem_32.c x86: unexport kmap_atomic_to_page 2008-04-30 23:15:34 +02:00
hugetlbpage.c x86: stricter check in follow_huge_addr() 2008-03-27 16:08:45 +01:00
init_32.c hotplug-memory: make online_page() common 2008-04-28 08:58:17 -07:00
init_64.c hotplug-memory: make online_page() common 2008-04-28 08:58:17 -07:00
ioremap.c x86: ioremap ram check fix 2008-04-30 23:15:35 +02:00
k8topology_64.c acpi: get boot_cpu_id as early for k8_scan_nodes 2008-04-26 23:41:04 +02:00
Makefile x86: add common mm/pgtable.c 2008-04-24 23:57:30 +02:00
mmap.c x86: unify mmap_{32|64}.c 2008-01-30 13:31:10 +01:00
numa_64.c x86_64: fix setup_node_bootmem to support big mem excluding with memmap 2008-04-26 22:51:08 +02:00
pageattr-test.c x86: remove over noisy debug printk 2008-02-11 11:24:24 -08:00
pageattr.c x86 PAT: fix performance drop for glx, use UC minus for ioremap(), ioremap_nocache() and pci_mmap_page_range() 2008-04-30 23:15:35 +02:00
pat.c x86: PAT fix 2008-04-28 08:15:16 -07:00
pgtable_32.c x86: move pmd functions into common asm/pgalloc.h 2008-04-24 23:57:30 +02:00
pgtable.c x86: unify pgd ctor/dtor 2008-04-24 23:57:31 +02:00
srat_64.c "make namespacecheck" fixes 2008-04-24 23:15:44 +02:00