From: Anthony Liguori <anthony@codemonkey.ws>
To: Jerone Young <jyoung5@us.ibm.com>
Cc: kvm-devel@lists.sourceforge.net, kvm-ppc-devel@lists.sourceforge.net
Subject: Re: [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
Date: Sun, 16 Mar 2008 00:34:13 -0500 [thread overview]
Message-ID: <47DCB155.3080704@codemonkey.ws> (raw)
In-Reply-To: <3060b75a9597d4ab67c2.1205514554@thinkpad.austin.ibm.com>
Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5@us.ibm.com>
> # Date 1205514174 18000
> # Branch merge
> # Node ID 3060b75a9597d4ab67c23871df41fc5e5476df2b
> # Parent 63237bde74818a5dc3cdb1baee781dab101290ce
> Add ability to specify ram on command line for bamboo board model
>
> This patch adds the ability to now specify ram sizes on the command line.
> Due to the nature of the code there are restictions on exactly how
> much ram and the multiple that the size must match.
>
> 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
> @@ -40,32 +40,50 @@ void bamboo_init(ram_addr_t ram_size, in
> target_ulong dt_base=0;
> void *fdt;
> int ret;
> + unsigned long ram_sticks[] = {0, 0}; /* Value will be in bytes */
>
s/unsigned long/ram_addr_t/ or whatever's appropriate. unsigned long
should almost never appear in QEMU code.
> + ram_addr_t tmp_ram_size;
> + int ram_stick_sizes[] = {256, 128, 64, 32, 16, 8 }; /* in Mega bytes */
> + int i=0, k=0;
>
> uint32_t cpu_freq;
> uint32_t timebase_freq;
>
> printf("%s: START\n", __func__);
>
> - /* Setup Memory */
> - if (ram_size) {
> - printf("Ram size specified on command line is %i bytes\n",
> - (int)ram_size);
> - printf("WARNING: RAM is hard coded to 144MB\n");
> - }
> - else {
> - printf("Using defualt ram size of %iMB\n",
> - ((int)ram_size/1024)/1024);
> + /* Setup Memory */
> + printf("Ram size passed is: %i MB\n",
> + ((int)ram_size/1024)/1024);
> +
> + tmp_ram_size = ram_size;
> +
> + for (i=0; i < (sizeof(ram_sticks)/sizeof(unsigned long)); i++)
> + {
> + for (k=0; k < (sizeof(ram_stick_sizes)/sizeof(int)); k++)
>
This looks like 8 spaces to me? Should be 4 for QEMU code.
Also, if there isn't already an ARRAY_SIZE() macro, now would be a good
way to introduce one. Typically one does sizeof(array) /
sizeof(array[0]) too to be a bit more defensive about types.
> + {
> + if ((((tmp_ram_size/1024)/1024)/ram_stick_sizes[k]) > 0)
> + {
> + ram_sticks[i] = ram_stick_sizes[k]*1024*1024;
> + tmp_ram_size -= ram_stick_sizes[k]*1024*1024;
> + break;
> + }
> + }
> +
> }
>
> - /* Each bank can only have memory in configurations of
> - * 16MB, 32MB, 64MB, 128MB, or 256MB
> - */
> - ram_bases[0] = 0x0;
> - ram_sizes[0] = 0x08000000;
> - ram_bases[1] = 0x0;
> - ram_sizes[1] = 0x01000000;
> + if (tmp_ram_size)
> + printf("WARNING: %i left over memory is ram\n",
> + (tmp_ram_size/1024)/1024);
>
> - printf("Ram size of domain is %d bytes\n", (int)ram_size);
> + /* Each bank can only have memory in configurations of
> + * 4MB, 8MB, 16MB, 32MB, 64MB, 128MB, or 256MB
> + * why? see sdram_bcr()
> + *
> + * Max of 512MB
> + */
> + ram_bases[0] = 0x0;
> + ram_sizes[0] = ram_sticks[0];
> + ram_bases[1] = 0x0;
> + ram_sizes[1] = ram_sticks[1];
>
> /* Setup CPU */
> env = cpu_ppc_init("440");
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-03-16 5:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-14 17:09 [PATCH 0 of 7] [v2] PowerPC kvm-userspace patches Jerone Young
2008-03-14 17:09 ` [PATCH 1 of 7] Add libfdt to KVM userspace Jerone Young
2008-03-14 17:09 ` [PATCH 2 of 7] Add libfdt support to qemu Jerone Young
2008-03-16 5:37 ` Anthony Liguori
2008-03-14 17:09 ` [PATCH 3 of 7] Create new load_uboot() & gunzip support to uboot loader in Qemu Jerone Young
2008-03-14 17:09 ` [PATCH 4 of 7] Add PPC 440EP bamboo board device tree source & binary into qemu Jerone Young
2008-03-14 19:06 ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-14 20:00 ` Jerone Young
2008-03-14 17:09 ` [PATCH 5 of 7] Add dynamic device tree manipulation & change uboot loader for PPC bamboo board model Jerone Young
2008-03-14 17:09 ` [PATCH 6 of 7] Modify PPC bamboo & ppc440 board models Jerone Young
2008-03-14 17:09 ` [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model Jerone Young
2008-03-14 19:16 ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-14 20:07 ` Jerone Young
2008-03-16 5:34 ` Anthony Liguori [this message]
2008-03-14 21:20 ` [kvm-ppc-devel] [PATCH 0 of 7] [v2] PowerPC kvm-userspace patches Hollis Blanchard
-- strict thread matches above, loose matches on Subject: below --
2008-03-19 20:00 [PATCH 0 of 7] [v6] " Jerone Young
2008-03-19 20:00 ` [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model Jerone Young
2008-03-19 19:01 [PATCH 0 of 7] [v5] PowerPC kvm-userspace patches Jerone Young
2008-03-19 19:01 ` [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model Jerone Young
2008-03-19 14:45 [PATCH 0 of 7] PowerPC kvm-userspace patches Jerone Young
2008-03-19 14:45 ` [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model Jerone Young
2008-03-18 20:06 [PATCH 0 of 7] [v3] PowerPC kvm-userspace patches Jerone Young
2008-03-18 20:06 ` [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model Jerone Young
2008-03-12 4:50 [PATCH 0 of 7] PowerPC kvm-userspace patches Jerone Young
2008-03-12 4:50 ` [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model Jerone Young
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=47DCB155.3080704@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=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