qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dinar Valeev <dvaleev@suse.de>
To: Alexander Graf <agraf@suse.de>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, Dinar Valeev <dvaleev@suse.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] hw/ppc/spapr Add qemu_register_boot_set for SPAPR
Date: Mon, 26 Jan 2015 11:49:06 +0100	[thread overview]
Message-ID: <54C61BA2.5000609@suse.de> (raw)
In-Reply-To: <54C2D399.3080307@suse.de>

On 01/24/2015 12:04 AM, Alexander Graf wrote:
>
>
> On 23.01.15 23:51, dvaleev@suse.de wrote:
>> From: Dinar Valeev <dvaleev@suse.com>
>>
>> In order to have -boot once=d functioning, it is required to have
>> qemu_register_boot_set
>>
>> qemu-system-ppc64 -enable-kvm -boot once=d
>>
>> Ready!
>> 0 > dev /chosen   ok
>> 0 > .properties
>> ...
>> qemu,boot-device                 d
>> ...
>> 0 > reset-all
>>
>> Ready!
>> 0 > dev /chosen   ok
>> 0 > .properties
>> ...
>> qemu,boot-device                 cdn
>> ...
>>
>> Signed-off-by: Dinar Valeev <dvaleev@suse.com>
>> ---
>>   hw/ppc/spapr.c | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 3d2cfa3..38b03fc 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -314,6 +314,16 @@ static void add_str(GString *s, const gchar *s1)
>>       g_string_append_len(s, s1, strlen(s1) + 1);
>>   }
>>
>> +static void spapr_boot_set(void *opaque, const char *boot_device,
>> +                           Error **errp)
>> +{
>> +    int offset;
>> +    offset = fdt_path_offset(opaque, "/chosen");
>> +    fdt_setprop_string(opaque, offset, "qemu,boot-device", boot_device);
>> +
>> +}
>> +
>> +
>>   static void *spapr_create_fdt_skel(hwaddr initrd_base,
>>                                      hwaddr initrd_size,
>>                                      hwaddr kernel_size,
>> @@ -414,6 +424,8 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
>>       if (boot_device) {
>>           _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
>>       }
>> +    qemu_register_boot_set(spapr_boot_set, fdt);
>
> If you simply move the code above (the _FDT() one) from create_fdt_skel
> to spapr_finalize_fdt() you should have the same net effect and much
> cleaner code :).
I've tried your proposal, on reset boot-device property stays "d"

qemu,boot-device                 d
0 > reset-all
qemu,boot-device                 d


Here is what I tried:
@@ -411,9 +410,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
              _FDT((fdt_property(fdt, "qemu,boot-kernel-le", NULL, 0)));
          }
      }
-    if (boot_device) {
-        _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
-    }
      if (boot_menu) {
          _FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu)));
      }
@@ -730,6 +726,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
      char *bootlist;
      void *fdt;
      sPAPRPHBState *phb;
+    MachineState *machine = MACHINE(qdev_get_machine());
+    const char *boot_device = machine->boot_order;

      fdt = g_malloc(FDT_MAX_SIZE);

@@ -769,6 +767,14 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr,
          fprintf(stderr, "Couldn't finalize CPU device tree properties\n");
      }

+    if (boot_device) {
+        int offset = fdt_path_offset(fdt, "/chosen");
+        ret = fdt_setprop_string(fdt, offset, "qemu,boot-device", 
boot_device);
+        if (ret < 0) {
+            fprintf(stderr, "Couldn't set up boot-device dt property\n");
+        }
+    }
+
      bootlist = get_boot_devices_list(&cb, true);
      if (cb && bootlist) {
          int offset = fdt_path_offset(fdt, "/chosen");

Dinar,
>
> Alex
>
>> +
>>       if (boot_menu) {
>>           _FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu)));
>>       }
>>

  parent reply	other threads:[~2015-01-26 10:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 22:51 [Qemu-devel] [PATCH 1/2] hw/ppc/spapr.c Set default boot order dvaleev
2015-01-23 22:51 ` [Qemu-devel] [PATCH 2/2] hw/ppc/spapr Add qemu_register_boot_set for SPAPR dvaleev
2015-01-23 23:04   ` Alexander Graf
2015-01-24 16:11     ` Dinar Valeev
2015-01-26 10:49     ` Dinar Valeev [this message]
2015-01-26  9:35       ` Alexander Graf
2015-01-29  0:40         ` Gonglei
2015-01-29  0:42           ` Alexander Graf
2015-01-29  3:46             ` Gonglei
2015-01-29 12:55               ` Alexander Graf
2015-01-29 13:00                 ` Gonglei
2015-04-02  7:41                   ` Alexey Kardashevskiy
2015-04-02 11:23                     ` Gonglei
2015-01-23 23:00 ` [Qemu-devel] [PATCH 1/2] hw/ppc/spapr.c Set default boot order Alexander Graf
2015-01-27  4:36   ` Nikunj A Dadhania
2015-01-26  9:11 ` Markus Armbruster
2015-01-26 10:32   ` Dinar Valeev
2015-01-26 12:37     ` Markus Armbruster
2015-01-26 12:57       ` Dinar Valeev
2015-01-26  9:33         ` Alexander Graf

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=54C61BA2.5000609@suse.de \
    --to=dvaleev@suse.de \
    --cc=agraf@suse.de \
    --cc=dvaleev@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).