Skip to content

Commit dd29b5c

Browse files
Paul Durrantanthonyper-ctx
authored andcommitted
xen: cleanup unrealized flash devices
The generic pc_machine_initfn() calls pc_system_flash_create() which creates 'system.flash0' and 'system.flash1' devices. These devices are then realized by pc_system_flash_map() which is called from pc_system_firmware_init() which itself is called via pc_memory_init(). The latter however is not called when xen_enable() is true and hence the following assertion fails: qemu-system-i386: hw/core/qdev.c:439: qdev_assert_realized_properly: Assertion `dev->realized' failed These flash devices are unneeded when using Xen so this patch avoids the assertion by simply removing them using pc_system_flash_cleanup_unused(). Reported-by: Jason Andryuk <[email protected]> Fixes: ebc29e1 ("pc: Support firmware configuration with -blockdev") Signed-off-by: Paul Durrant <[email protected]> Tested-by: Jason Andryuk <[email protected]> Reviewed-by: Anthony PERARD <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Fixes: dfe8c79 ("qdev: Assert onboard devices all get realized properly") Signed-off-by: Anthony PERARD <[email protected]>
1 parent 104a7f4 commit dd29b5c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

hw/i386/pc_piix.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,12 @@ static void pc_init1(MachineState *machine,
186186
if (!xen_enabled()) {
187187
pc_memory_init(pcms, system_memory,
188188
rom_memory, &ram_memory);
189-
} else if (machine->kernel_filename != NULL) {
190-
/* For xen HVM direct kernel boot, load linux here */
191-
xen_load_linux(pcms);
189+
} else {
190+
pc_system_flash_cleanup_unused(pcms);
191+
if (machine->kernel_filename != NULL) {
192+
/* For xen HVM direct kernel boot, load linux here */
193+
xen_load_linux(pcms);
194+
}
192195
}
193196

194197
gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);

hw/i386/pc_sysfw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void pc_system_flash_create(PCMachineState *pcms)
108108
}
109109
}
110110

111-
static void pc_system_flash_cleanup_unused(PCMachineState *pcms)
111+
void pc_system_flash_cleanup_unused(PCMachineState *pcms)
112112
{
113113
char *prop_name;
114114
int i;

include/hw/i386/pc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ ISADevice *pc_find_fdc0(void);
186186

187187
/* pc_sysfw.c */
188188
void pc_system_flash_create(PCMachineState *pcms);
189+
void pc_system_flash_cleanup_unused(PCMachineState *pcms);
189190
void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory);
190191

191192
/* acpi-build.c */

0 commit comments

Comments
 (0)