summaryrefslogtreecommitdiff
path: root/recipes
diff options
context:
space:
mode:
authorKoen Kooi <k-kooi@ti.com>2009-09-15 12:14:07 +0200
committerKoen Kooi <koen@openembedded.org>2009-09-15 13:04:35 +0200
commitff4773355412adf6bb7258bb6c8b45bc43bb5d17 (patch)
tree3d9c51dd63b78eadad6294c2e1c333da14783823 /recipes
parentdd6f2e9c436ee71f728f454ca118453479516a5b (diff)
linux-omap 2.6.31: add memhole patch
Diffstat (limited to 'recipes')
-rwxr-xr-xrecipes/linux/linux-omap-2.6.31/arch-has-holes.diff145
-rw-r--r--recipes/linux/linux-omap_2.6.31.bb1
2 files changed, 146 insertions, 0 deletions
diff --git a/recipes/linux/linux-omap-2.6.31/arch-has-holes.diff b/recipes/linux/linux-omap-2.6.31/arch-has-holes.diff
new file mode 100755
index 0000000000..d6fccc9696
--- /dev/null
+++ b/recipes/linux/linux-omap-2.6.31/arch-has-holes.diff
@@ -0,0 +1,145 @@
+From: Russell King - ARM Linux <linux@arm.linux.org.uk>
+To: Rabin Vincent <rabin@rab.in>
+Cc: "Aguirre Rodriguez, Sergio Alberto" <saaguirre@ti.com>,
+ "Syed Mohammed, Khasim" <khasim@ti.com>,
+ "linux-arm-kernel@lists.arm.linux.org.uk"
+ <linux-arm-kernel@lists.arm.linux.org.uk>,
+ "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
+Subject: Re: Exception while handling MEM Hole on OMAP3 / ARM Cortex A8
+Message-ID: <20090907142210.GB23361@n2100.arm.linux.org.uk>
+List-ID: <linux-omap.vger.kernel.org>
+X-Mailing-List: linux-omap@vger.kernel.org
+
+On Tue, Aug 18, 2009 at 08:31:49AM +0530, Rabin Vincent wrote:
+> Here's a fixed version:
+
+And here's my revised version with these fixes in. I changed the
+while loop to a do..while loop instead (since we will always have
+at least one memory bank, it's pointless doing that test for the
+first iteration.)
+
+Acks and tested-bys would be useful please.
+
+diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
+index 376be1a..cefedf0 100644
+--- a/arch/arm/include/asm/memory.h
++++ b/arch/arm/include/asm/memory.h
+@@ -218,7 +218,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
+ *
+ * page_to_pfn(page) convert a struct page * to a PFN number
+ * pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
+- * pfn_valid(pfn) indicates whether a PFN number is valid
+ *
+ * virt_to_page(k) convert a _valid_ virtual address to struct page *
+ * virt_addr_valid(k) indicates whether a virtual address is valid
+@@ -227,10 +226,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
+
+ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
+
+-#ifndef CONFIG_SPARSEMEM
+-#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
+-#endif
+-
+ #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
+ #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
+
+@@ -247,18 +242,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
+ #define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn)
+ #define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)
+
+-#define pfn_valid(pfn) \
+- ({ \
+- unsigned int nid = PFN_TO_NID(pfn); \
+- int valid = nid < MAX_NUMNODES; \
+- if (valid) { \
+- pg_data_t *node = NODE_DATA(nid); \
+- valid = (pfn - node->node_start_pfn) < \
+- node->node_spanned_pages; \
+- } \
+- valid; \
+- })
+-
+ #define virt_to_page(kaddr) \
+ (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
+
+diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
+index 9c746af..3a32af4 100644
+--- a/arch/arm/include/asm/page.h
++++ b/arch/arm/include/asm/page.h
+@@ -194,6 +194,10 @@ typedef unsigned long pgprot_t;
+
+ typedef struct page *pgtable_t;
+
++#ifndef CONFIG_SPARSEMEM
++extern int pfn_valid(unsigned long);
++#endif
++
+ #include <asm/memory.h>
+
+ #endif /* !__ASSEMBLY__ */
+
+--- /tmp/init.c 2009-09-15 10:17:10.000000000 +0200
++++ git/arch/arm/mm/init.c 2009-09-15 10:17:01.000000000 +0200
+@@ -15,6 +15,7 @@
+ #include <linux/mman.h>
+ #include <linux/nodemask.h>
+ #include <linux/initrd.h>
++#include <linux/sort.h>
+ #include <linux/highmem.h>
+
+ #include <asm/mach-types.h>
+@@ -349,12 +350,43 @@
+ free_area_init_node(node, zone_size, min, zhole_size);
+ }
+
++#ifndef CONFIG_SPARSEMEM
++int pfn_valid(unsigned long pfn)
++{
++ struct meminfo *mi = &meminfo;
++ unsigned int left = 0, right = mi->nr_banks;
++
++ do {
++ unsigned int mid = (right + left) / 2;
++ struct membank *bank = &mi->bank[mid];
++
++ if (pfn < bank_pfn_start(bank))
++ right = mid;
++ else if (pfn >= bank_pfn_end(bank))
++ left = mid + 1;
++ else
++ return 1;
++ } while (left < right);
++ return 0;
++}
++EXPORT_SYMBOL(pfn_valid);
++#endif
++
++static int __init meminfo_cmp(const void *_a, const void *_b)
++{
++ const struct membank *a = _a, *b = _b;
++ long cmp = bank_pfn_start(a) - bank_pfn_start(b);
++ return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
++}
++
+ void __init bootmem_init(void)
+ {
+ struct meminfo *mi = &meminfo;
+ unsigned long min, max_low, max_high;
+ int node, initrd_node;
+
++ sort(&mi->bank, mi->nr_banks, sizeof(mi->bank[0]), meminfo_cmp, NULL);
++
+ /*
+ * Locate which node contains the ramdisk image, if any.
+ */
+diff -purN git2/arch/arm/Kconfig git/arch/arm/Kconfig
+--- git2/arch/arm/Kconfig 2009-07-20 05:07:12.000000000 +0530
++++ git/arch/arm/Kconfig 2009-08-17 12:08:37.000000000 +0530
+@@ -569,6 +570,7 @@ config ARCH_OMAP
+ select ARCH_REQUIRE_GPIOLIB
+ select GENERIC_TIME
+ select GENERIC_CLOCKEVENTS
++ select ARCH_HAS_HOLES_MEMORYMODEL
+ help
+ Support for TI's OMAP platform (OMAP1 and OMAP2).
+
diff --git a/recipes/linux/linux-omap_2.6.31.bb b/recipes/linux/linux-omap_2.6.31.bb
index cf7f69318f..b2387fc6e7 100644
--- a/recipes/linux/linux-omap_2.6.31.bb
+++ b/recipes/linux/linux-omap_2.6.31.bb
@@ -47,6 +47,7 @@ SRC_URI_append = " \
file://expansion-boards/tincantools-zippy.patch;patch=1 \
file://madc/madc-driver.patch;patch=1 \
file://madc/madc.patch;patch=1 \
+ file://arch-has-holes.diff;patch=1 \
"
SRC_URI_append_beagleboard = " file://logo_linux_clut224.ppm \