qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: qemu-devel@nongnu.org
Subject: Re: Qemu-PPC problems (was [Qemu-devel] Just to add one single point)
Date: Thu, 12 Apr 2007 10:49:50 -0500	[thread overview]
Message-ID: <461E551E.9030803@windriver.com> (raw)
In-Reply-To: <1176364573.6333.25.camel@rapid>

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

J. Mayer wrote:
> On Wed, 2007-04-11 at 17:49 -0400, Rob Landley wrote: 
>   
>> qemu-system-ppc -M prep -nographic -kernel zImage-powerpc -append \
>>   "console=/dev/ttyS0"
>>     
>
> You cannot append anything to the command line this way, with the PPC
> firmware...
> You can append options when using yaboot, not with the -kernel option.
> Then, you should use the CONFIG_CMDLINE kernel option to add the option
> you absolutely need to boot.
>   
If you do not modify the prep loader, then it is impossible to pass 
arguments or load a kernel that expands to > 4meg.  With respect to  
using an unmodified prep loader, you have to build the boot arguments 
you want into the kernel itself with the .config file options.
> [...] 
>   
>>> It also seems that most Linux 2.6 kernels support has been broken. It
>>> used to run too, with some versions having a great problem in
>>> frame-buffer mode (writing black on black is not really usable). Using
>>> the serial console always allowed me to follow the boot until X starts.
>>>       
>> I'm trying to use serial console.
>>     
>
> I tried and the kernel seem to hang before reaching the start_kernel
> routine. That why I said there may now be a CPU emulation bug that broke
> everything.... Must do more checks with a debug kernel (with traces,
> this time. Using early_printk may help a lot !).
>
> [...]
>
>   
> you may try to boot kernels in PREP format as they look like regular boot partitions...
> It may help.
>
>   

While I am sure folks have the objective to be able to boot something 
that is not modified, my objective was to modify the kernel to work with 
qemu until that first objective is met.  If you use a 2.6.21rc candidate 
you can use the attached patches to boot.  I provided a .config file as 
well.  The frame buffer is definitely broken, but I had not really 
looked into why because I was more interested in simply using the ppc 
instruction sets.

Note I startup with the following and it works perfectly fine with my 
modified kernels:
qemu-system-ppc -nographic -kernel zImage.prep -s -M prep -append 
"console=ttyS0 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/export/ppc rw 
netdev=9,0x300,eth0"

There is a new regression between Apr 9 and Apr 10 in the QEMU CVS HEAD 
where tcp checksums are failing again.  :-(

If it would help, I can certainly provide some of my zImage files which 
run with several different 2.6.x kernels.

Jason.



[-- Attachment #2: dot_config.gz --]
[-- Type: application/x-gzip, Size: 9903 bytes --]

[-- Attachment #3: qemu_prep_loader.patch --]
[-- Type: text/x-patch, Size: 3984 bytes --]

Adjust prep loader to deal with larger kernel images.

signed-off-by: Jason Wessel <jason.wessel@windriver.com>

Index: linux-2.6.21-rc3/arch/ppc/boot/simple/misc.c
===================================================================
--- linux-2.6.21-rc3.orig/arch/ppc/boot/simple/misc.c
+++ linux-2.6.21-rc3/arch/ppc/boot/simple/misc.c
@@ -17,6 +17,7 @@
 #include <linux/types.h>
 #include <linux/string.h>
 
+#include <asm/residual.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
 #include <asm/bootinfo.h>
@@ -27,6 +28,7 @@
 
 #include "nonstdio.h"
 
+#define CONFIG_RUNTIME_CMDLINE 0x17ff000
 /* Default cmdline */
 #ifdef CONFIG_CMDLINE
 #define CMDLINE CONFIG_CMDLINE
@@ -53,7 +55,7 @@
 char *avail_ram;
 char *end_avail;
 char *zimage_start;
-char cmd_preset[] = CMDLINE;
+char cmd_preset[256] = CMDLINE;
 char cmd_buf[256];
 char *cmd_line = cmd_buf;
 int keyb_present = HAS_KEYB;
@@ -91,9 +93,11 @@ get_mem_size(void)
 #endif
 
 struct bi_record *
-decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
+decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum
+,RESIDUAL *residual, void *OFW_interface)
 {
 #ifdef INTERACTIVE_CONSOLE
+    int do_console = 0;
 	int timer = 0;
 	char ch;
 #endif
@@ -120,9 +124,12 @@ decompress_kernel(unsigned long load_add
 	 * and we must have the correct file linked in here.
 	 */
 	TotalMemory = get_mem_size();
+	puts("TotalMemory: "); puthex(TotalMemory); puts("\n");
+	puts("TotalResid: "); puthex(residual->TotalMemory); puts("\n");
+	puts("Resid at: "); puthex((unsigned int)residual); puts("\n");
 
-	/* assume the chunk below 8M is free */
-	end_avail = (char *)0x00800000;
+	/* assume the chunk below 10M is free */
+	end_avail = (char *)0x00A00000;
 
 	/*
 	 * Reveal where we were loaded at and where we
@@ -139,6 +146,13 @@ decompress_kernel(unsigned long load_add
 		puts("\n");
 	}
 
+	if (residual) {
+		puts("board data at: "); puthex((unsigned long)residual);
+		puts(" ");
+		puthex((unsigned long)((unsigned long)residual +
+					sizeof(RESIDUAL)));
+		puts("\n");
+	}
 	/*
 	 * We link ourself to 0x00800000.  When we run, we relocate
 	 * ourselves there.  So we just need __image_begin for the
@@ -167,15 +181,21 @@ decompress_kernel(unsigned long load_add
 	}
 
 #ifndef CONFIG_40x /* don't overwrite the 40x image located at 0x00400000! */
-	avail_ram = (char *)0x00400000;
+	avail_ram = (char *)0x00500000;
 #endif
-	end_avail = (char *)0x00800000;
+	end_avail = (char *)0x00A00000;
 	puts("avail ram:     "); puthex((unsigned long)avail_ram); puts(" ");
 	puthex((unsigned long)end_avail); puts("\n");
 
 	if (keyb_present)
 		CRT_tstc();  /* Forces keyboard to be initialized */
 
+#ifdef CONFIG_RUNTIME_CMDLINE
+    if (*(char *)CONFIG_RUNTIME_CMDLINE != '\0')
+    {
+        memcpy (cmd_preset, (char *)CONFIG_RUNTIME_CMDLINE, sizeof(cmd_preset));
+    }
+#endif
 	/* Display standard Linux/PPC boot prompt for kernel args */
 	puts("\nLinux/PPC load: ");
 	cp = cmd_line;
@@ -187,7 +207,7 @@ decompress_kernel(unsigned long load_add
 	 * If they have a console, allow them to edit the command line.
 	 * Otherwise, don't bother wasting the five seconds.
 	 */
-	while (timer++ < 5*1000) {
+	while (do_console && timer++ < 5*1000) {
 		if (tstc()) {
 			while ((ch = getc()) != '\n' && ch != '\r') {
 				/* Test for backspace/delete */
@@ -215,8 +235,9 @@ decompress_kernel(unsigned long load_add
 #endif
 	puts("\n");
 
-	puts("Uncompressing Linux...");
-	gunzip(NULL, 0x400000, zimage_start, &zimage_size);
+	puts("Compressed size: "); puthex((unsigned long)(zimage_size));
+	puts("\nUncompressing Linux...");
+	gunzip(NULL, 0x500000, zimage_start, &zimage_size);
 	puts("done.\n");
 
 	/* get the bi_rec address */
@@ -274,5 +295,5 @@ load_kernel(unsigned long load_addr, int
 		void *ign1, void *ign2)
 {
 		board_isa_init();
-		return decompress_kernel(load_addr, num_words, cksum);
+		return decompress_kernel(load_addr, num_words, cksum, ign1, ign2);
 }

[-- Attachment #4: qemu_ppc_irq_chip_fix.patch --]
[-- Type: text/x-patch, Size: 719 bytes --]

Workaround for QEMU ppc 32 to force interrupt acknoledgement

signed-off-by: Jason Wessel <jason.wessel@windriver.com>

Index: linux-2.6.21-rc1/kernel/irq/chip.c
===================================================================
--- linux-2.6.21-rc1.orig/kernel/irq/chip.c
+++ linux-2.6.21-rc1/kernel/irq/chip.c
@@ -225,11 +225,17 @@ static void default_enable(unsigned int 
 	desc->status &= ~IRQ_MASKED;
 }
 
+#define IRQ_DELAYED_DISABLE    0x10000000      /* IRQ disable (masking) happens delayed. */
+
 /*
  * default disable function
  */
 static void default_disable(unsigned int irq)
 {
+	struct irq_desc *desc = irq_desc + irq;
+
+	if (!(desc->status & IRQ_DELAYED_DISABLE))
+		desc->chip->mask(irq);
 }
 
 /*

  reply	other threads:[~2007-04-12 15:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-08 10:00 [Qemu-devel] Just to add one single point J. Mayer
2007-04-08 14:11 ` Thiemo Seufer
2007-04-08 16:03   ` J. Mayer
2007-04-08 23:19 ` Paul Brook
2007-04-09  1:22   ` Mike Frysinger
2007-04-09 10:06   ` J. Mayer
2007-04-09 21:26   ` Rob Landley
2007-04-09 22:32     ` J. Mayer
2007-04-11 21:49       ` Rob Landley
2007-04-12  7:56         ` Re:Qemu-PPC problems (was [Qemu-devel] Just to add one single point) J. Mayer
2007-04-12 15:49           ` Jason Wessel [this message]
2007-04-12 16:34             ` Qemu-PPC " Jason Wessel
2007-04-12 20:20             ` J. Mayer
2007-04-12 21:23               ` Jason Wessel
2007-04-14 21:28             ` Rob Landley
2007-04-18 21:34             ` Rob Landley
2007-04-14 19:50           ` Rob Landley

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=461E551E.9030803@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=qemu-devel@nongnu.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).