All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>,
	Andreas Faerber <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH v5 1/6] boot: extend get_boot_devices_list() to ignore suffixes
Date: Fri, 21 Feb 2014 00:50:41 +1100	[thread overview]
Message-ID: <1392904246-15575-2-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1392904246-15575-1-git-send-email-aik@ozlabs.ru>

As suffixes do not make sense for sPAPR's device tree and
there is no way to filter them out on the BusState::get_fw_dev_path
level, let's add an ability for the external caller to specify
whether to apply suffixes or not.

We could handle suffixes in SLOF (ignore for now) but this would require
serious rework in the node opening code in SLOF which has no obvious
benefit for the currently emulated sPAPR machine.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v4:
* changed commit message about not having plans in SLOF rework as it is scary :)
---
 hw/nvram/fw_cfg.c       | 2 +-
 include/sysemu/sysemu.h | 2 +-
 vl.c                    | 8 +++++---
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index ee96c16..42fa448 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -504,7 +504,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
 {
     size_t len;
     FWCfgState *s = container_of(n, FWCfgState, machine_ready);
-    char *bootindex = get_boot_devices_list(&len);
+    char *bootindex = get_boot_devices_list(&len, false);
 
     fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len);
 }
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 495dae8..2b71a4a 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -185,7 +185,7 @@ void rtc_change_mon_event(struct tm *tm);
 
 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                           const char *suffix);
-char *get_boot_devices_list(size_t *size);
+char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
 
 DeviceState *get_boot_device(uint32_t position);
 
diff --git a/vl.c b/vl.c
index 57e98fa..01ab7e4 100644
--- a/vl.c
+++ b/vl.c
@@ -1166,7 +1166,7 @@ DeviceState *get_boot_device(uint32_t position)
  * memory pointed by "size" is assigned total length of the array in bytes
  *
  */
-char *get_boot_devices_list(size_t *size)
+char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
 {
     FWBootEntry *i;
     size_t total = 0;
@@ -1181,7 +1181,7 @@ char *get_boot_devices_list(size_t *size)
             assert(devpath);
         }
 
-        if (i->suffix && devpath) {
+        if (i->suffix && !ignore_suffixes && devpath) {
             size_t bootpathlen = strlen(devpath) + strlen(i->suffix) + 1;
 
             bootpath = g_malloc(bootpathlen);
@@ -1189,9 +1189,11 @@ char *get_boot_devices_list(size_t *size)
             g_free(devpath);
         } else if (devpath) {
             bootpath = devpath;
-        } else {
+        } else if (!ignore_suffixes) {
             assert(i->suffix);
             bootpath = g_strdup(i->suffix);
+        } else {
+            bootpath = g_strdup("");
         }
 
         if (total) {
-- 
1.8.4.rc4

  reply	other threads:[~2014-02-20 13:51 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 13:50 [Qemu-devel] [PATCH v5 0/6] spapr: bootindex support Alexey Kardashevskiy
2014-02-20 13:50 ` Alexey Kardashevskiy [this message]
2014-02-20 13:55   ` [Qemu-devel] [PATCH v5 1/6] boot: extend get_boot_devices_list() to ignore suffixes Paolo Bonzini
2014-02-20 14:03     ` Alexey Kardashevskiy
2014-02-20 14:05       ` Paolo Bonzini
2014-03-13  3:32         ` Alexey Kardashevskiy
2014-03-13  8:00           ` Paolo Bonzini
2014-02-20 13:50 ` [Qemu-devel] [PATCH v5 2/6] qdev: introduce FWPathProvider interface Alexey Kardashevskiy
2014-03-12 18:07   ` Andreas Färber
2014-03-12 18:15     ` Paolo Bonzini
2014-03-12 23:02     ` Alexey Kardashevskiy
2014-03-12 23:38       ` Andreas Färber
2014-03-13  1:03         ` Alexey Kardashevskiy
2014-03-13  3:40     ` Alexey Kardashevskiy
2014-02-20 13:50 ` [Qemu-devel] [PATCH v5 3/6] vl: allow customizing the class of /machine Alexey Kardashevskiy
2014-02-20 13:58   ` Paolo Bonzini
2014-02-27 10:34     ` Andreas Färber
2014-02-27 10:41       ` Paolo Bonzini
2014-02-27 14:39         ` Marcel Apfelbaum
2014-02-27 14:59           ` Paolo Bonzini
2014-02-27 15:04             ` Marcel Apfelbaum
2014-02-28 15:03               ` Alexey Kardashevskiy
2014-02-28 15:05                 ` Paolo Bonzini
2014-02-28 15:08                   ` Alexey Kardashevskiy
2014-02-28 15:57                     ` Andreas Färber
2014-02-28 16:35                       ` Paolo Bonzini
2014-03-03 10:04                       ` Alexey Kardashevskiy
2014-02-21  3:04   ` Alexey Kardashevskiy
2014-02-21 10:30     ` Paolo Bonzini
2014-02-27  2:35       ` Alexey Kardashevskiy
2014-02-27  7:44         ` Markus Armbruster
2014-02-27 11:47           ` Alexey Kardashevskiy
2014-02-27 13:38             ` Markus Armbruster
2014-02-20 13:50 ` [Qemu-devel] [PATCH v5 4/6] spapr-llan: add to boot device list Alexey Kardashevskiy
2014-02-20 13:50 ` [Qemu-devel] [PATCH v5 5/6] spapr-vio: fix firmware names Alexey Kardashevskiy
2014-02-20 13:50 ` [Qemu-devel] [PATCH v5 6/6] spapr: define interface to fix device pathname Alexey Kardashevskiy
2014-02-20 13:58 ` [Qemu-devel] [PATCH v5 0/6] spapr: bootindex support Paolo Bonzini
2014-02-20 14:05   ` Alexey Kardashevskiy
2014-02-20 14:06     ` Paolo Bonzini

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=1392904246-15575-2-git-send-email-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=pbonzini@redhat.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 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.