aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/block/pc_sysfw.c20
-rw-r--r--hw/i386/pc_piix.c10
-rw-r--r--hw/i386/pc_q35.c8
-rw-r--r--include/hw/i386/pc.h5
4 files changed, 39 insertions, 4 deletions
diff --git a/hw/block/pc_sysfw.c b/hw/block/pc_sysfw.c
index 0d95c8a926..aad8614465 100644
--- a/hw/block/pc_sysfw.c
+++ b/hw/block/pc_sysfw.c
@@ -194,11 +194,23 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory)
bios);
}
+/*
+ * Bug-compatible flash vs. ROM selection enabled?
+ * A few older machines enable this.
+ */
+bool pc_sysfw_flash_vs_rom_bug_compatible;
+
void pc_system_firmware_init(MemoryRegion *rom_memory)
{
DriveInfo *pflash_drv;
PcSysFwDevice *sysfw_dev;
+ /*
+ * TODO This device exists only so that users can switch between
+ * use of flash and ROM for the BIOS. The ability to switch was
+ * created because flash doesn't work with KVM. Once it does, we
+ * should drop this device for new machine types.
+ */
sysfw_dev = (PcSysFwDevice*) qdev_create(NULL, "pc-sysfw");
qdev_init_nofail(DEVICE(sysfw_dev));
@@ -212,7 +224,11 @@ void pc_system_firmware_init(MemoryRegion *rom_memory)
/* Currently KVM cannot execute from device memory.
Use old rom based firmware initialization for KVM. */
- if (kvm_enabled()) {
+ /*
+ * This is a Bad Idea, because it makes enabling/disabling KVM
+ * guest-visible. Do it only in bug-compatibility mode.
+ */
+ if (pc_sysfw_flash_vs_rom_bug_compatible && kvm_enabled()) {
if (pflash_drv != NULL) {
fprintf(stderr, "qemu: pflash cannot be used with kvm enabled\n");
exit(1);
@@ -239,7 +255,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory)
}
static Property pcsysfw_properties[] = {
- DEFINE_PROP_UINT8("rom_only", PcSysFwDevice, rom_only, 0),
+ DEFINE_PROP_UINT8("rom_only", PcSysFwDevice, rom_only, 1),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 13e1d50fc0..89b4cb4635 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -235,9 +235,16 @@ static void pc_init_pci(QEMUMachineInitArgs *args)
initrd_filename, cpu_model, 1, 1);
}
+static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
+{
+ pc_sysfw_flash_vs_rom_bug_compatible = true;
+ pc_init_pci(args);
+}
+
static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
{
enable_compat_apic_id_mode();
+ pc_sysfw_flash_vs_rom_bug_compatible = true;
pc_init_pci(args);
}
@@ -246,6 +253,7 @@ static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
{
disable_kvm_pv_eoi();
enable_compat_apic_id_mode();
+ pc_sysfw_flash_vs_rom_bug_compatible = true;
pc_init_pci(args);
}
@@ -318,7 +326,7 @@ static QEMUMachine pc_i440fx_machine_v1_5 = {
static QEMUMachine pc_i440fx_machine_v1_4 = {
.name = "pc-i440fx-1.4",
.desc = "Standard PC (i440FX + PIIX, 1996)",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_4,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_4,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index e5f417ee08..f16089387c 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -196,6 +196,12 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
}
}
+static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
+{
+ pc_sysfw_flash_vs_rom_bug_compatible = true;
+ pc_q35_init(args);
+}
+
static QEMUMachine pc_q35_machine_v1_5 = {
.name = "pc-q35-1.5",
.alias = "q35",
@@ -208,7 +214,7 @@ static QEMUMachine pc_q35_machine_v1_5 = {
static QEMUMachine pc_q35_machine_v1_4 = {
.name = "pc-q35-1.4",
.desc = "Standard PC (Q35 + ICH9, 2009)",
- .init = pc_q35_init,
+ .init = pc_q35_init_1_4,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_4,
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9bcc8193b7..14b504c74d 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -168,6 +168,7 @@ static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
}
/* pc_sysfw.c */
+extern bool pc_sysfw_flash_vs_rom_bug_compatible;
void pc_system_firmware_init(MemoryRegion *rom_memory);
/* e820 types */
@@ -233,6 +234,10 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
.driver = "virtio-net-pci",\
.property = "romfile",\
.value = "pxe-virtio.rom",\
+ },{\
+ .driver = "pc-sysfw",\
+ .property = "rom_only",\
+ .value = stringify(0),\
}
#endif