Patchwork ppc: fixed RAM initialization bug in hw/ppc4xx_devs.c, can now use memory larger than 256MB in bamboo PPC machines

login
register
mail settings
Submitter Alin Tomescu
Date Feb. 21, 2013, 2:36 a.m.
Message ID <1361414169-2887-1-git-send-email-tomescu.alin@gmail.com>
Download mbox | patch
Permalink /patch/222170/
State New
Headers show

Comments

Alin Tomescu - Feb. 21, 2013, 2:36 a.m.
I hope this is the right way of submitting QEMU patches.

I was trying to launch a PowerPC "bamboo" machine with more than 256MB of RAM
with qemu-system-ppc -M bamboo -kernel $kernel -initrd $ramdisk -m 512, but QEMU
would just hang. However, when I used -m 256, the machine would boot.

I looked through the code in hw/ and it seems there is an error when the
RAM memory is setup (if my understanding is correct).

After patching it, the machine launched and booted successfully with 512MB of
RAM.

Signed-off-by: Alin Tomescu <tomescu.alin@gmail.com>
---
 hw/ppc4xx_devs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Stefan Hajnoczi - Feb. 21, 2013, 9:36 a.m.
On Wed, Feb 20, 2013 at 09:36:09PM -0500, Alin Tomescu wrote:
> I hope this is the right way of submitting QEMU patches.
> 
> I was trying to launch a PowerPC "bamboo" machine with more than 256MB of RAM
> with qemu-system-ppc -M bamboo -kernel $kernel -initrd $ramdisk -m 512, but QEMU
> would just hang. However, when I used -m 256, the machine would boot.
> 
> I looked through the code in hw/ and it seems there is an error when the
> RAM memory is setup (if my understanding is correct).
> 
> After patching it, the machine launched and booted successfully with 512MB of
> RAM.
> 
> Signed-off-by: Alin Tomescu <tomescu.alin@gmail.com>
> ---
>  hw/ppc4xx_devs.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I shortened the commit message and dropped the first line of commit
description ("I hope this is the right way of submitting QEMU
patches.").

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

Patch

diff --git a/hw/ppc4xx_devs.c b/hw/ppc4xx_devs.c
index 5e491bc..b6bb0e1 100644
--- a/hw/ppc4xx_devs.c
+++ b/hw/ppc4xx_devs.c
@@ -700,7 +700,7 @@  ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
                 vmstate_register_ram_global(&ram_memories[i]);
                 ram_bases[i] = base;
                 ram_sizes[i] = bank_size;
-                base += ram_size;
+                base += bank_size;
                 size_left -= bank_size;
                 break;
             }