public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerone Young <jyoung5@us.ibm.com>
To: kvm-devel@lists.sourceforge.net
Cc: kvm-ppc-devel@lists.sourceforge.net
Subject: [PATCH 2 of 2] Fix memory defined in device tree by declaring it	dynamically for bamboo board model
Date: Mon, 05 May 2008 11:04:54 -0500	[thread overview]
Message-ID: <c455452c9b217abed8a2.1210003494@thinkpadL> (raw)
In-Reply-To: <patchbomb.1210003492@thinkpadL>

# HG changeset patch
# User Jerone Young <jyoung5@us.ibm.com>
# Date 1210003411 18000
# Branch merge
# Node ID c455452c9b217abed8a2e6147bbeb91f33ff1799
# Parent  cf3ccc3add69052aade695c746151b1cb8812252
Fix memory defined in device tree by declaring it dynamically for bamboo board model

This fixes a issue where the amount of memory is not properly being defined in the device tree. It currently is hardcoded for 144MB. The result is that if you specify a memory size below the hardcoded size, the guest crashes. This patch now dynamically changes the device tree to the memory value specified.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>

diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c
--- a/qemu/hw/ppc440_bamboo.c
+++ b/qemu/hw/ppc440_bamboo.c
@@ -50,6 +50,7 @@ void bamboo_init(ram_addr_t ram_size, in
 	int i=0, k=0;
 	uint32_t cpu_freq;
 	uint32_t timebase_freq;
+	uint32_t mem_reg_property[]={0, 0, ram_size};
 
 	printf("%s: START\n", __func__);
 
@@ -73,6 +74,7 @@ void bamboo_init(ram_addr_t ram_size, in
 		printf("WARNING: %i MB left over memory is ram\n",
 			bytes_to_mb((int)tmp_ram_size));
 		ram_size -= tmp_ram_size;
+		mem_reg_property[2] = ram_size;
 	}
 
 	/* Setup CPU */
@@ -159,6 +161,8 @@ void bamboo_init(ram_addr_t ram_size, in
 	/* manipulate device tree in memory */
 	dt_cell(fdt, "/cpus/cpu@0", "clock-frequency", cpu_freq);
 	dt_cell(fdt, "/cpus/cpu@0", "timebase-frequency", timebase_freq);
+	dt_cell_multi(fdt, "/memory", "reg", mem_reg_property,
+			sizeof(mem_reg_property));
 	dt_cell(fdt, "/chosen", "linux,initrd-start", initrd_base);
 	dt_cell(fdt, "/chosen", "linux,initrd-end",
 				(initrd_base + initrd_size));

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

  parent reply	other threads:[~2008-05-05 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05 16:04 [PATCH 0 of 2] [RESEND] [PowerPC] Fix setting memory for bamboo board model Jerone Young
2008-05-05 16:04 ` [PATCH 1 of 2] Add function dt_cell_multi to hw/device_tree.c Jerone Young
2008-05-05 16:04 ` Jerone Young [this message]
2008-05-05 18:00 ` [kvm-ppc-devel] [PATCH 0 of 2] [RESEND] [PowerPC] Fix setting memory for bamboo board model Hollis Blanchard
2008-05-06 14:58 ` Avi Kivity

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=c455452c9b217abed8a2.1210003494@thinkpadL \
    --to=jyoung5@us.ibm.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=kvm-ppc-devel@lists.sourceforge.net \
    /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