public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 7] [v3] PowerPC kvm-userspace patches
@ 2008-03-18 20:06 Jerone Young
  2008-03-18 20:06 ` [PATCH 1 of 7] Add libfdt to KVM userspace Jerone Young
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Jerone Young @ 2008-03-18 20:06 UTC (permalink / raw)
  To: kvm-devel; +Cc: kvm-ppc-devel

This set address issues disscussed by Hollis & Anthony on the second go around.
As well as some minor fixes.

This set of patches enables the following:
        -Device tree Support
                - Add libfdt to kvm-userspace
                - Add bamboo device tree to qemu source
                - Detection of host Device Tree attributes
                - Device tree loading
                - Ability to specify initrd on the command line
                - Ability to add kernel arguments on the command line
        - Ability to load compressed uImages
        - Ability to specify memory on the command line

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

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
@ 2008-03-19 14:45 Jerone Young
  2008-03-19 17:55 ` [kvm-ppc-devel] " Hollis Blanchard
  0 siblings, 1 reply; 24+ messages in thread
From: Jerone Young @ 2008-03-19 14:45 UTC (permalink / raw)
  To: kvm-devel; +Cc: kvm-ppc-devel

# HG changeset patch
# User Jerone Young <jyoung5@us.ibm.com>
# Date 1205937727 18000
# Branch merge
# Node ID 17ae5b5f4fbfc2ac365b747ffa864afef67220d7
# Parent  c0a71393d66916148a96e3f2f91d29478fb5d063
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,8 @@
 
 #define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
 
+#define bytes_to_mb(a) (a>>20)
+
 void bamboo_init(ram_addr_t ram_size, int vga_ram_size,
 			const char *boot_device, DisplayState *ds,
 			const char *kernel_filename,
@@ -23,7 +25,7 @@ void bamboo_init(ram_addr_t ram_size, in
 			const char *cpu_model)
 {
 	char *buf;
-	target_phys_addr_t ram_bases[2], ram_sizes[2];
+	target_phys_addr_t ram_bases[4], ram_sizes[4];
 	qemu_irq *pic;
 	CPUState *env;
 	target_ulong ep=0;
@@ -35,31 +37,36 @@ void bamboo_init(ram_addr_t ram_size, in
 	target_ulong dt_base=0;
 	void *fdt;
 	int ret;
+	int ram_stick_sizes[] = {256<<20, 128<<20, 64<<20,
+				32<<20, 16<<20, 8<<20 }; /* in bytes */
+	ram_addr_t tmp_ram_size;
+	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);
+	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 ((ram_size/ram_stick_sizes[k]) > 0) {
+				ram_sizes[i] = ram_stick_sizes[k];
+				tmp_ram_size -= 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");
@@ -76,7 +83,7 @@ void bamboo_init(ram_addr_t ram_size, in
 	/* Register mem */
 	cpu_register_physical_memory(0, ram_size, 0);
 	if (kvm_enabled())
-	    kvm_cpu_register_physical_memory(0, ram_size, 0);
+	  kvm_cpu_register_physical_memory(0, ram_size, 0);
 
 	/* load kernel with uboot loader */
 	printf("%s: load kernel\n", __func__);

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
@ 2008-03-14 17:09 Jerone Young
  2008-03-14 19:16 ` [kvm-ppc-devel] " Hollis Blanchard
  0 siblings, 1 reply; 24+ messages in thread
From: Jerone Young @ 2008-03-14 17:09 UTC (permalink / raw)
  To: kvm-devel; +Cc: kvm-ppc-devel

# 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 */
+	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++)
+		{
+			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/

^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH 7 of 7] Add ability to specify ram on command line for bamboo board model
@ 2008-03-12  4:50 Jerone Young
  2008-03-13  2:23 ` [kvm-ppc-devel] " Hollis Blanchard
  0 siblings, 1 reply; 24+ messages in thread
From: Jerone Young @ 2008-03-12  4:50 UTC (permalink / raw)
  To: kvm-ppc-devel; +Cc: kvm-devel

# HG changeset patch
# User Jerone Young <jyoung5@us.ibm.com>
# Date 1205296680 18000
# Branch merge
# Node ID 8b1dd3609551efefbd6633ac6fe4caa3a6cbe5e9
# Parent  3a891d8fada96166089b5796f3241087d4aae50f
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,71 @@ void bamboo_init(ram_addr_t ram_size, in
 	target_ulong dt_base=0;
 	void *fdt;
 	int ret;
+	int holdr;
+ 	unsigned long ram_size1; /* Value will be in bytes */
+ 	unsigned long ram_size2; /* Value will be in bytes */
+
 
 	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);
-	}
-
-	/* 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);
+ 	/* Setup Memory */
+ 	printf("Ram size is set to: %i MB\n",
+ 				((int)ram_size/1024)/1024); 		
+ 
+   	/* Check that total ram is at least 8 MB 
+  	 * but less than 512 MB 
+    	 * and is a multiple of 4
+    	 */
+ 
+ 	if (ram_size < (8 * 1024 * 1024)) {
+ 		printf("Ram size specified on cmd line must at least be 8 MB\n");
+ 		exit(1);
+ 	}
+ 
+ 	if (ram_size > (512 * 1024 * 1024)) {
+ 		printf("Ram size specified on cmd line is greater than 512 MB\n");
+ 		exit(1);
+ 	}
+ 
+ 	if ((((int)ram_size/1024)/1024) % 4) {
+ 		printf("Ram size specified on cmd line must be multiple of 4\n");
+ 		exit(1);
+ 	}
+ 
+ 	/* split ram into two slots */
+ 	holdr = (ram_size/(1024*1024))/4;	
+ 
+ 	/* ram_size2 has to at least have 4MB in it*/
+ 	ram_size2 = 4 * 1024 * 1024; /* Add 4MB */
+ 	holdr = holdr - 1;
+ 
+ 	
+ 	if ((4 * holdr) <= 256) {
+ 		/* if what remains is 256MB or less put in first slot */
+ 		ram_size1 = (4 * holdr) * (1024 * 1024);
+ 	}
+ 	else {
+ 		/* place first 256MB or less in first slot */
+ 		ram_size1 = 256 * 1024 * 1024;
+ 		holdr = holdr - (256/4);
+ 		
+ 		/* place remainder in slot 2 */
+ 		ram_size2 += (4 * holdr) * (1024 * 1024);
+ 	}
+ 
+ 	/* 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_size1;
+ 	ram_bases[1] = 0x0;
+ 	ram_sizes[1] = ram_size2;	
 
 	/* 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/

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2008-03-19 17:55 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18 20:06 [PATCH 0 of 7] [v3] PowerPC kvm-userspace patches Jerone Young
2008-03-18 20:06 ` [PATCH 1 of 7] Add libfdt to KVM userspace Jerone Young
2008-03-18 20:06 ` [PATCH 2 of 7] Add libfdt support to qemu Jerone Young
2008-03-18 21:16   ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-18 21:22     ` Jerone Young
2008-03-18 21:28       ` Hollis Blanchard
2008-03-18 21:57         ` 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] " Hollis Blanchard
2008-03-18 21:46     ` Jerone Young
2008-03-18 22:14       ` Hollis Blanchard
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 ` [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] " Hollis Blanchard
2008-03-18 21:35     ` Jerone Young
2008-03-18 22:08       ` Hollis Blanchard
2008-03-18 20:06 ` [PATCH 6 of 7] Modify PPC bamboo & ppc440 board models 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   ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-18 21:17     ` Jerone Young
  -- strict thread matches above, loose matches on Subject: below --
2008-03-19 14:45 Jerone Young
2008-03-19 17:55 ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-14 17:09 Jerone Young
2008-03-14 19:16 ` [kvm-ppc-devel] " Hollis Blanchard
2008-03-14 20:07   ` Jerone Young
2008-03-12  4:50 Jerone Young
2008-03-13  2:23 ` [kvm-ppc-devel] " Hollis Blanchard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox