qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v1] virtex_ml507: Add support for loading initrd images
@ 2014-02-03 15:20 Edgar E. Iglesias
  2014-02-03 18:36 ` Alexander Graf
  2014-02-03 18:47 ` Andreas Färber
  0 siblings, 2 replies; 4+ messages in thread
From: Edgar E. Iglesias @ 2014-02-03 15:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, agraf

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/ppc/virtex_ml507.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index bdb057e..19083d4 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -166,6 +166,19 @@ static int xilinx_load_device_tree(hwaddr addr,
     if (!fdt) {
         return 0;
     }
+
+    r = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start",
+                              initrd_base);
+    if (r < 0) {
+        error_report("couldn't set /chosen/linux,initrd-start'");
+    }
+
+    r = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
+                              (initrd_base + initrd_size));
+    if (r < 0) {
+        error_report("couldn't set /chosen/linux,initrd-end'");
+    }
+
     r = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline);
     if (r < 0)
         fprintf(stderr, "couldn't set /chosen/bootargs\n");
@@ -179,6 +192,8 @@ static void virtex_init(QEMUMachineInitArgs *args)
     const char *cpu_model = args->cpu_model;
     const char *kernel_filename = args->kernel_filename;
     const char *kernel_cmdline = args->kernel_cmdline;
+    hwaddr initrd_base = 0;
+    int initrd_size = 0;
     MemoryRegion *address_space_mem = get_system_memory();
     DeviceState *dev;
     PowerPCCPU *cpu;
@@ -242,10 +257,27 @@ static void virtex_init(QEMUMachineInitArgs *args)
 
         boot_info.ima_size = kernel_size;
 
+        /* Load initrd. */
+        if (args->initrd_filename) {
+            initrd_base = high = ROUND_UP(high, 4);
+            initrd_size = load_image_targphys(args->initrd_filename,
+                                              high, ram_size - high);
+
+            if (initrd_size < 0) {
+                error_report("couldn't load ram disk '%s'\n",
+                             args->initrd_filename);
+                exit(1);
+            }
+            high = ROUND_UP(high + initrd_size, 4);
+        }
+
         /* Provide a device-tree.  */
         boot_info.fdt = high + (8192 * 2);
         boot_info.fdt &= ~8191;
-        xilinx_load_device_tree(boot_info.fdt, ram_size, 0, 0, kernel_cmdline);
+
+        xilinx_load_device_tree(boot_info.fdt, ram_size,
+                                initrd_base, initrd_size,
+                                kernel_cmdline);
     }
     env->load_info = &boot_info;
 }
-- 
1.8.3.2

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

* Re: [Qemu-devel] [PATCH v1] virtex_ml507: Add support for loading initrd images
  2014-02-03 15:20 [Qemu-devel] [PATCH v1] virtex_ml507: Add support for loading initrd images Edgar E. Iglesias
@ 2014-02-03 18:36 ` Alexander Graf
  2014-02-03 18:47 ` Andreas Färber
  1 sibling, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2014-02-03 18:36 UTC (permalink / raw)
  To: Edgar E. Iglesias; +Cc: list@suse.de:PowerPC, qemu-devel


On 03.02.2014, at 16:20, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:

> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Thanks, applied to ppc-next.


Alex

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

* Re: [Qemu-devel] [PATCH v1] virtex_ml507: Add support for loading initrd images
  2014-02-03 15:20 [Qemu-devel] [PATCH v1] virtex_ml507: Add support for loading initrd images Edgar E. Iglesias
  2014-02-03 18:36 ` Alexander Graf
@ 2014-02-03 18:47 ` Andreas Färber
  2014-02-03 19:02   ` Alexander Graf
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Färber @ 2014-02-03 18:47 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel, agraf; +Cc: qemu-ppc

Am 03.02.2014 16:20, schrieb Edgar E. Iglesias:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/ppc/virtex_ml507.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
> index bdb057e..19083d4 100644
> --- a/hw/ppc/virtex_ml507.c
> +++ b/hw/ppc/virtex_ml507.c
> @@ -166,6 +166,19 @@ static int xilinx_load_device_tree(hwaddr addr,
>      if (!fdt) {
>          return 0;
>      }
> +
> +    r = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start",
> +                              initrd_base);
> +    if (r < 0) {
> +        error_report("couldn't set /chosen/linux,initrd-start'");

Both this ...

> +    }
> +
> +    r = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
> +                              (initrd_base + initrd_size));
> +    if (r < 0) {
> +        error_report("couldn't set /chosen/linux,initrd-end'");

... and the other error_report() have either a stray trailing
single-quote or one missing before the path.

> +    }
> +
>      r = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline);
>      if (r < 0)
>          fprintf(stderr, "couldn't set /chosen/bootargs\n");
> @@ -179,6 +192,8 @@ static void virtex_init(QEMUMachineInitArgs *args)
>      const char *cpu_model = args->cpu_model;
>      const char *kernel_filename = args->kernel_filename;
>      const char *kernel_cmdline = args->kernel_cmdline;
> +    hwaddr initrd_base = 0;
> +    int initrd_size = 0;
>      MemoryRegion *address_space_mem = get_system_memory();
>      DeviceState *dev;
>      PowerPCCPU *cpu;
> @@ -242,10 +257,27 @@ static void virtex_init(QEMUMachineInitArgs *args)
>  
>          boot_info.ima_size = kernel_size;
>  
> +        /* Load initrd. */
> +        if (args->initrd_filename) {
> +            initrd_base = high = ROUND_UP(high, 4);
> +            initrd_size = load_image_targphys(args->initrd_filename,
> +                                              high, ram_size - high);
> +
> +            if (initrd_size < 0) {
> +                error_report("couldn't load ram disk '%s'\n",

And here's a stray \n.

Andreas

> +                             args->initrd_filename);
> +                exit(1);
> +            }
> +            high = ROUND_UP(high + initrd_size, 4);
> +        }
> +
>          /* Provide a device-tree.  */
>          boot_info.fdt = high + (8192 * 2);
>          boot_info.fdt &= ~8191;
> -        xilinx_load_device_tree(boot_info.fdt, ram_size, 0, 0, kernel_cmdline);
> +
> +        xilinx_load_device_tree(boot_info.fdt, ram_size,
> +                                initrd_base, initrd_size,
> +                                kernel_cmdline);
>      }
>      env->load_info = &boot_info;
>  }

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH v1] virtex_ml507: Add support for loading initrd images
  2014-02-03 18:47 ` Andreas Färber
@ 2014-02-03 19:02   ` Alexander Graf
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2014-02-03 19:02 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Edgar E. Iglesias, list@suse.de:PowerPC, qemu-devel


On 03.02.2014, at 19:47, Andreas Färber <afaerber@suse.de> wrote:

> Am 03.02.2014 16:20, schrieb Edgar E. Iglesias:
>> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>> 
>> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>> ---
>> hw/ppc/virtex_ml507.c | 34 +++++++++++++++++++++++++++++++++-
>> 1 file changed, 33 insertions(+), 1 deletion(-)
>> 
>> diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
>> index bdb057e..19083d4 100644
>> --- a/hw/ppc/virtex_ml507.c
>> +++ b/hw/ppc/virtex_ml507.c
>> @@ -166,6 +166,19 @@ static int xilinx_load_device_tree(hwaddr addr,
>>     if (!fdt) {
>>         return 0;
>>     }
>> +
>> +    r = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start",
>> +                              initrd_base);
>> +    if (r < 0) {
>> +        error_report("couldn't set /chosen/linux,initrd-start'");
> 
> Both this ...
> 
>> +    }
>> +
>> +    r = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
>> +                              (initrd_base + initrd_size));
>> +    if (r < 0) {
>> +        error_report("couldn't set /chosen/linux,initrd-end'");
> 
> ... and the other error_report() have either a stray trailing
> single-quote or one missing before the path.
> 
>> +    }
>> +
>>     r = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline);
>>     if (r < 0)
>>         fprintf(stderr, "couldn't set /chosen/bootargs\n");
>> @@ -179,6 +192,8 @@ static void virtex_init(QEMUMachineInitArgs *args)
>>     const char *cpu_model = args->cpu_model;
>>     const char *kernel_filename = args->kernel_filename;
>>     const char *kernel_cmdline = args->kernel_cmdline;
>> +    hwaddr initrd_base = 0;
>> +    int initrd_size = 0;
>>     MemoryRegion *address_space_mem = get_system_memory();
>>     DeviceState *dev;
>>     PowerPCCPU *cpu;
>> @@ -242,10 +257,27 @@ static void virtex_init(QEMUMachineInitArgs *args)
>> 
>>         boot_info.ima_size = kernel_size;
>> 
>> +        /* Load initrd. */
>> +        if (args->initrd_filename) {
>> +            initrd_base = high = ROUND_UP(high, 4);
>> +            initrd_size = load_image_targphys(args->initrd_filename,
>> +                                              high, ram_size - high);
>> +
>> +            if (initrd_size < 0) {
>> +                error_report("couldn't load ram disk '%s'\n",
> 
> And here's a stray \n.

Do you think we could add this to checkpatch.pl? A \n at the end of error_report() is certainly something I've seen a lot already :).

I'll fix these 3 bits up in my branch.


Alex

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

end of thread, other threads:[~2014-02-03 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-03 15:20 [Qemu-devel] [PATCH v1] virtex_ml507: Add support for loading initrd images Edgar E. Iglesias
2014-02-03 18:36 ` Alexander Graf
2014-02-03 18:47 ` Andreas Färber
2014-02-03 19:02   ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).