From: Hollis Blanchard <hollisb@us.ibm.com>
To: Jerone Young <jyoung5@us.ibm.com>
Cc: kvm-devel@lists.sourceforge.net, kvm-ppc-devel@lists.sourceforge.net
Subject: Re: [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram
Date: Tue, 18 Mar 2008 21:03:23 +0000 [thread overview]
Message-ID: <1205874203.11784.24.camel@basalt> (raw)
In-Reply-To: <4f90f7d25186f55bfb15.1205870800@thinkpad.austin.ibm.com>
On Tue, 2008-03-18 at 15:06 -0500, Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5@us.ibm.com>
> # Date 1205870472 18000
> # Branch merge
> # Node ID 4f90f7d25186f55bfb1503764af5264201df067f
> # Parent ac0fc9dfd78d2eddd083326e9b635a9286fc3b19
> 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
> @@ -15,6 +15,9 @@
>
> #define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
>
> +#define bytes_to_mb(a) (a>>20)
> +#define mb_to_bytes(a) (a<<20)
> +
> /* PPC 440 refrence demo board
> *
> * 440 PowerPC CPU
> @@ -28,7 +31,7 @@ void bamboo_init(ram_addr_t ram_size, in
> const char *cpu_model)
> {
> char buf[1024];
> - target_phys_addr_t ram_bases[2], ram_sizes[2];
> + target_phys_addr_t ram_bases[2], ram_sizes[2];
> qemu_irq *pic;
> CPUState *env;
> target_ulong ep=0;
Here you have added a trailing space.
> @@ -40,32 +43,39 @@ void bamboo_init(ram_addr_t ram_size, in
> target_ulong dt_base=0;
> void *fdt;
> int ret;
> + int ram_stick_sizes[] = {256, 128, 64, 32, 16, 8 }; /* in Mega bytes */
> + ram_addr_t tmp_ram_size;
> + int i=0, k=0;
Define ram_stick_sizes[] in MB and then remove all the shifting inside
the loops.
> 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",
> + bytes_to_mb((int)ram_size));
> +
> + tmp_ram_size = ram_size;
> +
> + for (i=0; i < (sizeof(ram_sizes)/sizeof(ram_sizes[0])); i++)
> + {
> + for (k=0; k < (sizeof(ram_stick_sizes)/sizeof(ram_stick_sizes[0])); k++)
> + {
> + if ((bytes_to_mb(ram_size)/ram_stick_sizes[k]) > 0)
> + {
Don't divide, just use a logical comparison.
Also, put all the open-braces on the previous lines.
> + ram_sizes[i] = mb_to_bytes(ram_stick_sizes[k]);
> + tmp_ram_size -= mb_to_bytes(ram_stick_sizes[k]);
> + 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;
> -
> - printf("Ram size of domain is %d bytes\n", (int)ram_size);
> + if (tmp_ram_size) {
> + printf("WARNING: %i MB left over memory is ram\n",
> + bytes_to_mb((int)tmp_ram_size));
> + ram_size -= tmp_ram_size;
> + }
>
> /* Setup CPU */
> env = cpu_ppc_init("440");
Remove tmp_ram_size completely. Just decrement ram_size in the loop and
check if it's non-zero at the end.
--
Hollis Blanchard
IBM Linux Technology Center
-------------------------------------------------------------------------
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-ppc-devel mailing list
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
WARNING: multiple messages have this Message-ID (diff)
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Jerone Young <jyoung5@us.ibm.com>
Cc: kvm-devel@lists.sourceforge.net, kvm-ppc-devel@lists.sourceforge.net
Subject: Re: [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
Date: Tue, 18 Mar 2008 16:03:23 -0500 [thread overview]
Message-ID: <1205874203.11784.24.camel@basalt> (raw)
In-Reply-To: <4f90f7d25186f55bfb15.1205870800@thinkpad.austin.ibm.com>
On Tue, 2008-03-18 at 15:06 -0500, Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5@us.ibm.com>
> # Date 1205870472 18000
> # Branch merge
> # Node ID 4f90f7d25186f55bfb1503764af5264201df067f
> # Parent ac0fc9dfd78d2eddd083326e9b635a9286fc3b19
> 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
> @@ -15,6 +15,9 @@
>
> #define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
>
> +#define bytes_to_mb(a) (a>>20)
> +#define mb_to_bytes(a) (a<<20)
> +
> /* PPC 440 refrence demo board
> *
> * 440 PowerPC CPU
> @@ -28,7 +31,7 @@ void bamboo_init(ram_addr_t ram_size, in
> const char *cpu_model)
> {
> char buf[1024];
> - target_phys_addr_t ram_bases[2], ram_sizes[2];
> + target_phys_addr_t ram_bases[2], ram_sizes[2];
> qemu_irq *pic;
> CPUState *env;
> target_ulong ep=0;
Here you have added a trailing space.
> @@ -40,32 +43,39 @@ void bamboo_init(ram_addr_t ram_size, in
> target_ulong dt_base=0;
> void *fdt;
> int ret;
> + int ram_stick_sizes[] = {256, 128, 64, 32, 16, 8 }; /* in Mega bytes */
> + ram_addr_t tmp_ram_size;
> + int i=0, k=0;
Define ram_stick_sizes[] in MB and then remove all the shifting inside
the loops.
> 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",
> + bytes_to_mb((int)ram_size));
> +
> + tmp_ram_size = ram_size;
> +
> + for (i=0; i < (sizeof(ram_sizes)/sizeof(ram_sizes[0])); i++)
> + {
> + for (k=0; k < (sizeof(ram_stick_sizes)/sizeof(ram_stick_sizes[0])); k++)
> + {
> + if ((bytes_to_mb(ram_size)/ram_stick_sizes[k]) > 0)
> + {
Don't divide, just use a logical comparison.
Also, put all the open-braces on the previous lines.
> + ram_sizes[i] = mb_to_bytes(ram_stick_sizes[k]);
> + tmp_ram_size -= mb_to_bytes(ram_stick_sizes[k]);
> + 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;
> -
> - printf("Ram size of domain is %d bytes\n", (int)ram_size);
> + if (tmp_ram_size) {
> + printf("WARNING: %i MB left over memory is ram\n",
> + bytes_to_mb((int)tmp_ram_size));
> + ram_size -= tmp_ram_size;
> + }
>
> /* Setup CPU */
> env = cpu_ppc_init("440");
Remove tmp_ram_size completely. Just decrement ram_size in the loop and
check if it's non-zero at the end.
--
Hollis Blanchard
IBM Linux Technology Center
-------------------------------------------------------------------------
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-18 21:03 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-18 20:06 [kvm-ppc-devel] [PATCH 0 of 7] [v3] PowerPC kvm-userspace patches Jerone Young
2008-03-18 20:06 ` Jerone Young
2008-03-18 20:06 ` [kvm-ppc-devel] [PATCH 1 of 7] Add libfdt to KVM userspace Jerone Young
2008-03-18 20:06 ` Jerone Young
2008-03-18 20:06 ` [kvm-ppc-devel] [PATCH 2 of 7] Add libfdt support to qemu Jerone Young
2008-03-18 20:06 ` Jerone Young
2008-03-18 21:16 ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-18 21:16 ` Hollis Blanchard
2008-03-18 21:22 ` Jerone Young
2008-03-18 21:22 ` Jerone Young
2008-03-18 21:28 ` Hollis Blanchard
2008-03-18 21:28 ` Hollis Blanchard
2008-03-18 21:57 ` [kvm-ppc-devel] [kvm-devel] [PATCH 2 of 7] Add libfdt Jerone Young
2008-03-18 21:57 ` [kvm-ppc-devel] [PATCH 2 of 7] Add libfdt support to qemu Jerone Young
2008-03-18 20:06 ` [kvm-ppc-devel] [PATCH 3 of 7] Create new load_uimage() & gunzip Jerone Young
2008-03-18 20:06 ` [PATCH 3 of 7] Create new load_uimage() & gunzip support to uboot loader in Qemu Jerone Young
2008-03-18 21:14 ` [kvm-ppc-devel] [PATCH 3 of 7] Create new load_uimage() Hollis Blanchard
2008-03-18 21:14 ` [kvm-ppc-devel] [PATCH 3 of 7] Create new load_uimage() & gunzip support to uboot loader in Qemu Hollis Blanchard
2008-03-18 21:46 ` [kvm-ppc-devel] [PATCH 3 of 7] Create new load_uimage() Jerone Young
2008-03-18 21:46 ` [kvm-ppc-devel] [PATCH 3 of 7] Create new load_uimage() & gunzip support to uboot loader in Qemu Jerone Young
2008-03-18 22:14 ` [kvm-ppc-devel] [PATCH 3 of 7] Create new Hollis Blanchard
2008-03-18 22:14 ` [kvm-ppc-devel] [PATCH 3 of 7] Create new load_uimage() & gunzip support to uboot loader in Qemu Hollis Blanchard
2008-03-18 20:06 ` [kvm-ppc-devel] [PATCH 4 of 7] Add PPC 440EP bamboo board device Jerone Young
2008-03-18 20:06 ` [PATCH 4 of 7] Add PPC 440EP bamboo board device tree source & binary into qemu Jerone Young
2008-03-18 20:06 ` [kvm-ppc-devel] [PATCH 5 of 7] Add dynamic device tree manipulation Jerone Young
2008-03-18 20:06 ` [PATCH 5 of 7] Add dynamic device tree manipulation & change uboot loader for PPC bamboo board model Jerone Young
2008-03-18 21:25 ` [kvm-ppc-devel] [PATCH 5 of 7] Add dynamic device Hollis Blanchard
2008-03-18 21:25 ` [kvm-ppc-devel] [PATCH 5 of 7] Add dynamic device tree manipulation & change uboot loader for PPC bamboo board model Hollis Blanchard
2008-03-18 21:35 ` [kvm-ppc-devel] [PATCH 5 of 7] Add dynamic device Jerone Young
2008-03-18 21:35 ` [kvm-ppc-devel] [PATCH 5 of 7] Add dynamic device tree manipulation & change uboot loader for PPC bamboo board model Jerone Young
2008-03-18 22:08 ` [kvm-ppc-devel] [PATCH 5 of 7] Add dynamic Hollis Blanchard
2008-03-18 22:08 ` [kvm-ppc-devel] [PATCH 5 of 7] Add dynamic device tree manipulation & change uboot loader for PPC bamboo board model Hollis Blanchard
2008-03-18 20:06 ` [kvm-ppc-devel] [PATCH 6 of 7] Modify PPC bamboo & ppc440 board Jerone Young
2008-03-18 20:06 ` [PATCH 6 of 7] Modify PPC bamboo & ppc440 board models Jerone Young
2008-03-18 20:06 ` [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on 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-18 21:03 ` Hollis Blanchard [this message]
2008-03-18 21:03 ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-18 21:17 ` [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram Jerone Young
2008-03-18 21:17 ` [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model Jerone Young
-- strict thread matches above, loose matches on Subject: below --
2008-03-19 14:45 [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on Jerone Young
2008-03-19 17:55 ` [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram Hollis Blanchard
2008-03-14 17:09 [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on Jerone Young
2008-03-14 19:16 ` [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram Hollis Blanchard
2008-03-14 20:07 ` Jerone Young
2008-03-12 4:50 [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram on Jerone Young
2008-03-13 2:23 ` [kvm-ppc-devel] [PATCH 7 of 7] Add ability to specify ram Hollis Blanchard
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=1205874203.11784.24.camel@basalt \
--to=hollisb@us.ibm.com \
--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 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.