HIGHMEM now working

Tilmann Bitterberg tibit-ibm at bitterberg.de
Tue Oct 17 08:13:29 EST 2000


Hi Paul, $LIST

I managed to get CONFIG_HIGHMEM to work on CHRP. What I
basically did is to move the HIGHMEM area down from 0xfe to
0xf6. See my patch against the 2.4.0-test9 kernel.org kernel
below. I tested this patch on a 44P-270 with 3GB, a 44P-170
with 1GB and a 43P-150 with 512MB.

On the 150 I faked HIGHEM with MAX_LOW_MEM == 256MB because
I don't have a box with more RAM in it. It worked fine.

I saw that you recently did some fixes for HIGHMEM on CHRP, but
they did not work. Actually, I can't get the kernel to boot on a
270. It dies in 'c01d9ff0 D init_task_union',
but anyway it won't even without HIGHMEM enabled, it didn't pass
'python_pcibios_read_config_byte'.

Why not just lower PKMAP_BASE to 0xf6000000, will this break
someone?

Tilmann
-------------- next part --------------
diff -ur linux-2.4-normal/arch/ppc/kernel/chrp_pci.c linux-2.4-highmem/arch/ppc/kernel/chrp_pci.c
--- linux-2.4-normal/arch/ppc/kernel/chrp_pci.c	Wed Oct 11 10:55:46 2000
+++ linux-2.4-highmem/arch/ppc/kernel/chrp_pci.c	Tue Oct 10 10:06:41 2000
@@ -446,7 +446,8 @@
 				isa_mem_base = 0xa0000000;
 				isa_io_base = 0x88000000;
 			} else if ( !strncmp("IBM,7043-260", name, 12)
-				    || !strncmp("IBM,7044-270", name, 12))
+			         || !strncmp("IBM,7044-170", name, 12)
+			         || !strncmp("IBM,7044-270", name, 12))
 			{
 				pci_dram_offset = 0x0;
 				isa_mem_base = 0xc0000000;
diff -ur linux-2.4-normal/arch/ppc/mm/init.c linux-2.4-highmem/arch/ppc/mm/init.c
--- linux-2.4-normal/arch/ppc/mm/init.c	Wed Oct 11 10:55:46 2000
+++ linux-2.4-highmem/arch/ppc/mm/init.c	Fri Oct 13 11:15:14 2000
@@ -955,6 +962,8 @@
 #ifdef CONFIG_HIGHMEM
 	if (total_lowmem > MAX_LOW_MEM) {
 		total_lowmem = MAX_LOW_MEM;
+		printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
+			pages_to_mb((total_memory - total_lowmem)>>PAGE_SHIFT));
 		mem_pieces_remove(&phys_avail, total_lowmem,
 				  total_memory - total_lowmem, 0);
 	}
@@ -1249,8 +1261,9 @@
 unsigned long __init pmac_find_end_of_memory(void)
 {
 	unsigned long a, total;
+#ifndef CONFIG_HIGHMEM
 	unsigned long ram_limit = 0xe0000000 - KERNELBASE;
-
+#endif /* ndef CONFIG_HIGHMEM */
 	memory_node = find_devices("memory");
 	if (memory_node == NULL) {
 		printk(KERN_ERR "can't find memory node\n");
@@ -1274,12 +1287,14 @@
 	a = phys_mem.regions[0].address;
 	if (a != 0)
 		panic("RAM doesn't start at physical address 0");
+#ifndef CONFIG_HIGHMEM /* tibit */
 	if (__max_memory == 0 || __max_memory > ram_limit)
 		__max_memory = ram_limit;
 	if (phys_mem.regions[0].size >= __max_memory) {
 		phys_mem.regions[0].size = __max_memory;
 		phys_mem.n_regions = 1;
 	}
+#endif /* ndef CONFIG_HIGHMEM */
 	total = phys_mem.regions[0].size;
 	
 	if (phys_mem.n_regions > 1) {
@@ -1440,12 +1455,11 @@
 static void __init hash_init(void)
 {
 	int Hash_bits, mb, mb2;
-	unsigned int hmask, ramsize, h;
+	unsigned int hmask, ramsize = (ulong)end_of_DRAM - KERNELBASE;
 
 	extern unsigned int hash_page_patch_A[], hash_page_patch_B[],
 		hash_page_patch_C[], hash_page[];
 
-	ramsize = (ulong)end_of_DRAM - KERNELBASE;
 #ifdef CONFIG_PPC64BRIDGE
 	/* The hash table has already been allocated and initialized
 	   in prom.c */
@@ -1458,6 +1472,7 @@
 	mb2 = 25 - Hash_bits;
 
 #else /* CONFIG_PPC64BRIDGE */
+	unsigned int h;
 
 	if ( ppc_md.progress ) ppc_md.progress("hash:enter", 0x105);
 	/*
@@ -1498,7 +1513,7 @@
 		Hash = 0;
 #endif /* CONFIG_PPC64BRIDGE */
 
-	printk("Total memory = %dMB; using %ldkB for hash table (at %p)\n",
+	printk("Total low memory = %dMB; using %ldkB for hash table (at %p)\n",
 	       ramsize >> 20, Hash_size >> 10, Hash);
 	if ( Hash_size )
 	{
diff -ur linux-2.4-normal/drivers/input/keybdev.c linux-2.4-highmem/drivers/input/keybdev.c
--- linux-2.4-normal/drivers/input/keybdev.c	Thu Jul 27 20:36:54 2000
+++ linux-2.4-highmem/drivers/input/keybdev.c	Wed Oct  4 07:59:20 2000
@@ -133,8 +133,11 @@
 {
 	if (type != EV_KEY) return;
 
+#if defined(CONFIG_ADB_KEYBOARD)
+
 	if (emulate_raw(code, down))
 		printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", code);
+#endif
 
 	tasklet_schedule(&keyboard_tasklet);
 }
diff -ur linux-2.4-normal/include/asm-ppc/highmem.h linux-2.4-highmem/include/asm-ppc/highmem.h
--- linux-2.4-normal/include/asm-ppc/highmem.h	Wed Oct 11 10:55:51 2000
+++ linux-2.4-highmem/include/asm-ppc/highmem.h	Fri Oct 13 17:02:30 2000
@@ -22,6 +22,7 @@
 
 #ifdef __KERNEL__
 
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <asm/kmap_types.h>
@@ -41,13 +42,26 @@
  * easily, subsequent pte tables have to be allocated in one physical
  * chunk of RAM.
  */
+
+/*
+ * XXX: On CHRP, we cannot use the "normal" highmem area from 0xfe000000 to
+ * 0xffffffff because we have that particular area directly mapped with a BAT.
+ * So we just move it a litte bit down. We need a more flexible way to do that.
+ * -- tibit
+ */
+
+#if 1
+#define PKMAP_BASE (0xf6000000UL)
+#define KMAP_FIX_BEGIN	(0xf6400000UL)
+#else
 #define PKMAP_BASE (0xfe000000UL)
+#define KMAP_FIX_BEGIN  (0xfe400000UL)
+#endif /* CONFIG_POWER3 */
 #define LAST_PKMAP 1024
 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
 
-#define KMAP_FIX_BEGIN	(0xfe400000UL)
 
 extern unsigned long kmap_high(struct page *page);
 extern void kunmap_high(struct page *page);


More information about the Linuxppc-dev mailing list