Browse Source

fw_cfg: ignore suffixes in the bootdevice list dependent on machine class

For the older machines (such as Mac and SPARC) the DT nodes representing
bootdevices for disk nodes are irregular for mainly historical reasons.

Since the majority of bootdevice nodes for these machines either do not have a
separate disk node or require different (custom) names then it is much easier
for processing to just disable all suffixes for a particular machine.

Introduce a new ignore_boot_device_suffixes MachineClass property to control
bootdevice suffix generation, defaulting to false in order to preserve
compatibility.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <2018081012.10698-1-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
tags/v3.1.0-rc0
Mark Cave-Ayland 10 months ago
parent
commit
907aac2f6a
5 changed files with 9 additions and 4 deletions
  1. 4
    1
      bootdevice.c
  2. 1
    1
      hw/nvram/fw_cfg.c
  3. 2
    1
      hw/ppc/spapr.c
  4. 1
    0
      include/hw/boards.h
  5. 1
    1
      include/sysemu/sysemu.h

+ 4
- 1
bootdevice.c View File

@@ -29,6 +29,7 @@
29 29
 #include "qemu/error-report.h"
30 30
 #include "sysemu/reset.h"
31 31
 #include "hw/qdev-core.h"
32
+#include "hw/boards.h"
32 33
 
33 34
 typedef struct FWBootEntry FWBootEntry;
34 35
 
@@ -208,11 +209,13 @@ DeviceState *get_boot_device(uint32_t position)
208 209
  * memory pointed by "size" is assigned total length of the array in bytes
209 210
  *
210 211
  */
211
-char *get_boot_devices_list(size_t *size, bool ignore_suffixes)
212
+char *get_boot_devices_list(size_t *size)
212 213
 {
213 214
     FWBootEntry *i;
214 215
     size_t total = 0;
215 216
     char *list = NULL;
217
+    MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
218
+    bool ignore_suffixes = mc->ignore_boot_device_suffixes;
216 219
 
217 220
     QTAILQ_FOREACH(i, &fw_boot_order, link) {
218 221
         char *devpath = NULL,  *suffix = NULL;

+ 1
- 1
hw/nvram/fw_cfg.c View File

@@ -861,7 +861,7 @@ static void fw_cfg_machine_reset(void *opaque)
861 861
     void *ptr;
862 862
     size_t len;
863 863
     FWCfgState *s = opaque;
864
-    char *bootindex = get_boot_devices_list(&len, false);
864
+    char *bootindex = get_boot_devices_list(&len);
865 865
 
866 866
     ptr = fw_cfg_modify_file(s, "bootorder", (uint8_t *)bootindex, len);
867 867
     g_free(ptr);

+ 2
- 1
hw/ppc/spapr.c View File

@@ -1160,7 +1160,7 @@ static void spapr_dt_chosen(sPAPRMachineState *spapr, void *fdt)
1160 1160
     const char *boot_device = machine->boot_order;
1161 1161
     char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus);
1162 1162
     size_t cb = 0;
1163
-    char *bootlist = get_boot_devices_list(&cb, true);
1163
+    char *bootlist = get_boot_devices_list(&cb);
1164 1164
 
1165 1165
     _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
1166 1166
 
@@ -3949,6 +3949,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
3949 3949
     InterruptStatsProviderClass *ispc = INTERRUPT_STATS_PROVIDER_CLASS(oc);
3950 3950
 
3951 3951
     mc->desc = "pSeries Logical Partition (PAPR compliant)";
3952
+    mc->ignore_boot_device_suffixes = true;
3952 3953
 
3953 3954
     /*
3954 3955
      * We set up the default / latest behaviour here.  The class_init

+ 1
- 0
include/hw/boards.h View File

@@ -206,6 +206,7 @@ struct MachineClass {
206 206
     bool auto_enable_numa_with_memhp;
207 207
     void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
208 208
                                  int nb_nodes, ram_addr_t size);
209
+    bool ignore_boot_device_suffixes;
209 210
 
210 211
     HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
211 212
                                            DeviceState *dev);

+ 1
- 1
include/sysemu/sysemu.h View File

@@ -182,7 +182,7 @@ void hmp_info_usb(Monitor *mon, const QDict *qdict);
182 182
 
183 183
 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
184 184
                           const char *suffix);
185
-char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
185
+char *get_boot_devices_list(size_t *size);
186 186
 
187 187
 DeviceState *get_boot_device(uint32_t position);
188 188
 void check_boot_index(int32_t bootindex, Error **errp);

Loading…
Cancel
Save