All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Gifford <maillist@jg555.com>
To: Jim Gifford <maillist@jg555.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Linux MIPS List <linux-mips@linux-mips.org>
Subject: Re: Building 64 bit kernel on Cobalt
Date: Thu, 08 Mar 2007 00:46:43 -0800	[thread overview]
Message-ID: <45EFCD73.2010404@jg555.com> (raw)
In-Reply-To: <45EFA92C.3070203@jg555.com>

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

Here's what we isolated it to.

The problem looks like this

inflate: decompressing
elf64: 00080000 - 0037701f (ffffffff.80326000) (ffffffff.80000000)
elf64: ffffffff.80080000 (80080000) 2957446t + 151450t
net: interface down

If we apply the patch that's attached we can boot all the way up, but we 
do get some errors. I'm hoping one of these errors might shed the light 
on what the actual issue is.

VFS: Mounted root (nfs filesystem) readonly.
Unhandled kernel unaligned access[#1]:
Cpu 0
$ 0   : 0000000000000000 ffffffff802adc60 0000000000000000 0000000000000000
$ 4   : ffffffff80089eec ffffffffde020000 ffffffff8008c588 0000000000000000
$ 8   : 0000000000561024 996bffffff40b050 0000000000000000 000000000000f6f8
$12   : ffffffff94004ce0 000000001000001e 0000000000000000 ffffffff80300000
$16   : 9800000000387df0 ffffffff80326000 0000000000000000 00067ffffff80326
$20   : 00067ffffff80326 000000000000002d fffffffffffffbff 67ffffff80353000
$24   : 0000000000000010 ffffffff801768d8
$28   : 9800000000384000 9800000000387dc0 67ffffff80326000 ffffffff80081e28
Hi    : 0000000000000000
Lo    : 0000000000000000
epc   : ffffffff80089f04 do_ade+0x3a4/0x4c0     Not tainted
ra    : ffffffff80081e28 ret_from_exception+0x0/0x1c
Status: 94004ce2    KX SX UX KERNEL EXL
Cause : 00808010
BadVA : 996bffffff40b057
PrId  : 000028a0
Process swapper (pid: 1, threadinfo=9800000000384000, task=9800000000381828)
Stack : 996bffffff40b050 ffffffff80326000 016bfffffe40b050 00067ffffff80326
        ffffffff80081e28 0000000000000000 0000000000000000 ffffffff94004ce0
        9800000001000000 019ffffffe00c980 ffffffff94004ce1 00067ffffff80353
        6800000000000000 9800000000381828 98000000013e9a40 98000000003b3000
        ffffffff80309758 000000000000f6f8 0000000000000001 ffffffff801b9388
        0000000000000000 ffffffff80300000 996bffffff40b050 ffffffff80326000
        016bfffffe40b050 00067ffffff80326 00067ffffff80326 000000000000002d
        fffffffffffffbff 67ffffff80353000 0000000000000010 ffffffff801768d8
        ffffffff800fb5ac ffffffff800fb5ac 9800000000384000 9800000000387f20
        67ffffff80326000 ffffffff8008c4d0 ffffffff94004ce2 0000000000000000
        ...
Call Trace:
[<ffffffff80089f04>] do_ade+0x3a4/0x4c0
[<ffffffff80081e28>] ret_from_exception+0x0/0x1c
[<ffffffff8008c588>] free_initmem+0xe8/0x218
[<ffffffff80080688>] init+0x248/0x510
[<ffffffff80084420>] kernel_thread_helper+0x10/0x18


Code: 00431024  5440ff77  de020100 <69230007> 6d230000  24020000  
1440ffba  00051402  08022760
Kernel panic - not syncing: Attempted to kill init!

patch - at http://ftp.jg555.com/revert.working.diff


[-- Attachment #2: revert.working.diff --]
[-- Type: text/x-patch, Size: 4639 bytes --]

--- linux-2.6.19.2/arch/mips/kernel/setup.c	2007-01-10 11:10:37.000000000 -0800
+++ linux-2.6.20.1/arch/mips/kernel/setup.c	2007-03-07 20:59:28.000000000 -0800
@@ -145,13 +145,12 @@
 	unsigned long start = memparse(p, &p);
 
 #ifdef CONFIG_64BIT
-	/* HACK: Guess if the sign extension was forgotten */
-	if (start > 0x0000000080000000 && start < 0x00000000ffffffff)
-		start |= 0xffffffff00000000UL;
+	/* Guess if the sign extension was forgotten by bootloader */
+	if (start < XKPHYS)
+		start = (int)start;
 #endif
 	initrd_start = start;
 	initrd_end += start;
-
 	return 0;
 }
 early_param("rd_start", rd_start_early);
@@ -159,41 +158,64 @@
 static int __init rd_size_early(char *p)
 {
 	initrd_end += memparse(p, &p);
-
 	return 0;
 }
 early_param("rd_size", rd_size_early);
 
+/* it returns the next free pfn after initrd */
 static unsigned long __init init_initrd(void)
 {
-	unsigned long tmp, end, size;
+	unsigned long end;
 	u32 *initrd_header;
 
-	ROOT_DEV = Root_RAM0;
-
 	/*
 	 * Board specific code or command line parser should have
 	 * already set up initrd_start and initrd_end. In these cases
 	 * perfom sanity checks and use them if all looks good.
 	 */
-	size = initrd_end - initrd_start;
-	if (initrd_end == 0 || size == 0) {
-		initrd_start = 0;
-		initrd_end = 0;
-	} else
-		return initrd_end;
-
-	end = (unsigned long)&_end;
-	tmp = PAGE_ALIGN(end) - sizeof(u32) * 2;
-	if (tmp < end)
-		tmp += PAGE_SIZE;
-
-	initrd_header = (u32 *)tmp;
-	if (initrd_header[0] == 0x494E5244) {
-		initrd_start = (unsigned long)&initrd_header[2];
-		initrd_end = initrd_start + initrd_header[1];
+	if (initrd_start && initrd_end > initrd_start)
+		goto sanitize;
+
+	/*
+	 * See if initrd has been added to the kernel image by
+	 * arch/mips/boot/addinitrd.c. In that case a header is
+	 * prepended to initrd and is made up by 8 bytes. The fisrt
+	 * word is a magic number and the second one is the size of
+	 * initrd.  Initrd start must be page aligned in any cases.
+	 */
+	initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
+	if (initrd_header[0] != 0x494E5244)
+		goto disable;
+	initrd_start = (unsigned long)(initrd_header + 2);
+	initrd_end = initrd_start + initrd_header[1];
+
+sanitize:
+	if (initrd_start & ~PAGE_MASK) {
+		printk(KERN_ERR "initrd start must be page aligned\n");
+		goto disable;
 	}
-	return initrd_end;
+	if (initrd_start < PAGE_OFFSET) {
+		printk(KERN_ERR "initrd start < PAGE_OFFSET\n");
+		goto disable;
+	}
+
+	/*
+	 * Sanitize initrd addresses. For example firmware
+	 * can't guess if they need to pass them through
+	 * 64-bits values if the kernel has been built in pure
+	 * 32-bit. We need also to switch from KSEG0 to XKPHYS
+	 * addresses now, so the code can now safely use __pa().
+	 */
+	end = __pa(initrd_end);
+	initrd_end = (unsigned long)__va(end);
+	initrd_start = (unsigned long)__va(__pa(initrd_start));
+
+	ROOT_DEV = Root_RAM0;
+	return PFN_UP(end);
+disable:
+	initrd_start = 0;
+	initrd_end = 0;
+	return 0;
 }
 
 static void __init finalize_initrd(void)
@@ -204,12 +226,12 @@
 		printk(KERN_INFO "Initrd not found or empty");
 		goto disable;
 	}
-	if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) {
+	if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) {
 		printk("Initrd extends beyond end of memory");
 		goto disable;
 	}
 
-	reserve_bootmem(CPHYSADDR(initrd_start), size);
+	reserve_bootmem(__pa(initrd_start), size);
 	initrd_below_start_ok = 1;
 
 	printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n",
@@ -259,8 +281,7 @@
 	 * not selected. Once that done we can determine the low bound
 	 * of usable memory.
 	 */
-	reserved_end = init_initrd();
-	reserved_end = PFN_UP(CPHYSADDR(max(reserved_end, (unsigned long)&_end)));
+	reserved_end = max(init_initrd(), PFN_UP(__pa_symbol(&_end)));
 
 	/*
 	 * Find the highest page frame number we have available.
@@ -432,10 +453,10 @@
 	if (UNCAC_BASE != IO_BASE)
 		return;
 
-	code_resource.start = virt_to_phys(&_text);
-	code_resource.end = virt_to_phys(&_etext) - 1;
-	data_resource.start = virt_to_phys(&_etext);
-	data_resource.end = virt_to_phys(&_edata) - 1;
+	code_resource.start = __pa_symbol(&_text);
+	code_resource.end = __pa_symbol(&_etext) - 1;
+	data_resource.start = __pa_symbol(&_etext);
+	data_resource.end = __pa_symbol(&_edata) - 1;
 
 	/*
 	 * Request address space for all standard RAM.
@@ -500,7 +521,7 @@
 #endif
 }
 
-int __init fpu_disable(char *s)
+static int __init fpu_disable(char *s)
 {
 	int i;
 
@@ -512,7 +533,7 @@
 
 __setup("nofpu", fpu_disable);
 
-int __init dsp_disable(char *s)
+static int __init dsp_disable(char *s)
 {
 	cpu_data[0].ases &= ~MIPS_ASE_DSP;
 

  reply	other threads:[~2007-03-08  8:48 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-04 23:18 Building 64 bit kernel on Cobalt Jim Gifford
2007-03-04 23:27 ` Ralf Baechle
2007-03-08  6:11   ` Jim Gifford
2007-03-08  8:46     ` Jim Gifford [this message]
2007-03-08 12:48     ` Franck Bui-Huu
2007-03-08 16:11       ` Jim Gifford
2007-03-13  0:57         ` Jim Gifford
2007-03-13 10:38           ` Franck Bui-Huu
2007-03-13 11:53             ` Ralf Baechle
2007-03-18 21:52             ` Jim Gifford
2007-03-19  1:12               ` Atsushi Nemoto
2007-03-19  5:20                 ` Jim Gifford
2007-03-19  6:07                   ` Atsushi Nemoto
2007-03-19 10:08                     ` Franck Bui-Huu
2007-03-19 10:17                       ` Franck Bui-Huu
2007-03-21 17:07                         ` Atsushi Nemoto
2007-03-21 19:31                           ` Franck Bui-Huu
2007-03-23 13:47                             ` Kumba
2007-03-23 15:24                               ` Atsushi Nemoto
2007-03-24  3:31                                 ` Kumba
2007-03-24 14:47                                   ` Atsushi Nemoto
2007-03-24 23:16                                     ` Thiemo Seufer
2007-03-25  7:25                                       ` [PATCH]: Remove CONFIG_BUILD_ELF64 entirely Kumba
2007-03-25 14:45                                         ` Thiemo Seufer
2007-03-26 11:35                                           ` Maciej W. Rozycki
2007-03-26 11:56                                             ` Ralf Baechle
2007-03-26 12:09                                               ` Maciej W. Rozycki
2007-03-26 12:34                                                 ` Ralf Baechle
2007-03-25 16:10                                         ` Atsushi Nemoto
2007-03-25 16:40                                           ` Ralf Baechle
2007-03-26  9:14                                             ` Franck Bui-Huu
2007-03-26  9:42                                               ` Thiemo Seufer
2007-03-25 16:59                                           ` Kumba
2007-03-25 17:07                                             ` Atsushi Nemoto
2007-03-25 18:33                                               ` Kumba
2007-03-26 10:36                                                 ` Atsushi Nemoto
2007-03-26 13:48                                                   ` Kumba
2007-03-26 14:43                                                     ` Atsushi Nemoto
2007-03-27  0:51                                                       ` Kumba
2007-03-27 14:53                                                         ` Atsushi Nemoto
2007-03-27 17:54                                                           ` Ilya A. Volynets-Evenbakh
2007-03-28 15:14                                                             ` Atsushi Nemoto
2007-03-27 19:01                                                           ` Thiemo Seufer
2007-03-28 13:26                                                           ` Kumba
2007-03-28 15:24                                                             ` Atsushi Nemoto
2007-03-29  1:50                                                               ` Kumba
2007-03-29 14:53                                                                 ` Atsushi Nemoto
2007-03-30  6:18                                                                   ` Kumba
2007-03-30  2:20                                                               ` Kumba
2007-02-18 20:00                                                                 ` IP32 prom crashes due to __pa() funkiness Kumba
2007-03-01  4:33                                                                   ` Kumba
2007-03-01  9:39                                                                   ` Franck Bui-Huu
2007-03-10  9:41                                                                     ` [PATCH], " peter fuerst
2007-03-17 19:52                                                                     ` Kumba
2007-03-17 21:48                                                                       ` Arnaud Giersch
2007-03-18  2:04                                                                         ` Kumba
2007-03-19 13:53                                                                           ` Franck Bui-Huu
2007-03-19 14:07                                                                             ` Thiemo Seufer
2007-03-19 14:19                                                                               ` Franck Bui-Huu
2007-03-19 14:17                                                                             ` Franck Bui-Huu
2007-03-19 14:24                                                                             ` Kumba
2007-03-19 14:45                                                                               ` Thiemo Seufer
2007-03-19 14:46                                                                               ` Atsushi Nemoto
2007-03-19 21:35                                                                               ` Franck Bui-Huu
2007-03-20 14:10                                                                                 ` Kumba
2007-03-23 15:12                                                                                   ` Franck Bui-Huu
     [not found]                                                                     ` <45FC3923.2080207@gentoo.org>
2007-03-18  9:42                                                                       ` peter fuerst
2007-03-18 21:26                                                                         ` Kumba
2007-03-18 21:37                                                                           ` Kumba
2007-03-18 22:44                                                                         ` Kumba
2007-03-19 13:57                                                                           ` Franck Bui-Huu
2007-03-30  3:01                                                                   ` [PATCH]: Remove CONFIG_BUILD_ELF64 entirely Atsushi Nemoto
2007-03-30  5:35                                                                     ` Kumba
2007-03-30  6:09                                                                       ` Atsushi Nemoto
2007-09-26  2:08                                                                         ` CONFIG_BUILD_ELF64 broken on IP32 since 2.6.20 Atsushi Nemoto
2007-09-26  5:59                                                                           ` Martin Michlmayr
2007-09-26  6:19                                                                             ` Giuseppe Sacco
2007-09-27  0:24                                                                             ` Thiemo Seufer
2007-09-26  9:14                                                                           ` Franck Bui-Huu
2007-09-26 14:42                                                                             ` Atsushi Nemoto
2007-03-25 22:19                                             ` [PATCH]: Remove CONFIG_BUILD_ELF64 entirely Ralf Baechle
2007-03-26 13:25                                               ` Atsushi Nemoto
2007-03-26 13:54                                               ` Franck Bui-Huu
2007-03-26 14:48                                                 ` Atsushi Nemoto
2007-03-26 15:31                                                   ` Franck Bui-Huu
2007-03-26 15:45                                                     ` Atsushi Nemoto
2007-03-26 16:07                                                       ` Franck Bui-Huu
2007-03-27  3:12                                                         ` Atsushi Nemoto
2007-03-27  8:01                                                           ` Franck Bui-Huu
2007-03-26 15:56                                                     ` Thiemo Seufer
2007-03-26  9:02                                             ` Franck Bui-Huu
2007-03-25 15:40                                       ` Building 64 bit kernel on Cobalt Atsushi Nemoto
  -- strict thread matches above, loose matches on Subject: below --
2007-09-25 18:13 CONFIG_BUILD_ELF64 broken on IP32 since 2.6.20 Martin Michlmayr
2007-09-25 18:32 ` sknauert
2007-09-25 18:43   ` Martin Michlmayr
2007-09-25 18:56     ` sknauert
2007-09-26  8:03 ` Franck Bui-Huu
2007-09-26  9:14   ` Martin Michlmayr
2007-09-26  9:54     ` Franck Bui-Huu
2007-09-26 10:24       ` Martin Michlmayr
2007-09-26 11:32         ` Maciej W. Rozycki
2007-09-26 13:34           ` Franck Bui-Huu
2007-09-26 13:46             ` Martin Michlmayr
2007-09-26 14:49             ` Maciej W. Rozycki
2007-09-26 15:34               ` Atsushi Nemoto
2007-09-26 15:47                 ` Maciej W. Rozycki
2007-09-27  8:11                   ` Franck Bui-Huu
2007-09-27 11:10                     ` Maciej W. Rozycki
2007-09-27 13:36                     ` Ralf Baechle
2007-09-27 13:47                       ` Franck Bui-Huu

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=45EFCD73.2010404@jg555.com \
    --to=maillist@jg555.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.