Blame SOURCES/pc-Disable-the-use-flash-device-for-BIOS-unless-KVM-misfeature.patch

218e99
From 62868855d0fdd34dee119a59c7e56c1706fc27ab Mon Sep 17 00:00:00 2001
218e99
From: Miroslav Rezanina <mrezanin@redhat.com>
218e99
Date: Wed, 31 Jul 2013 08:00:55 +0200
218e99
Subject: pc: Disable the "use flash device for BIOS unless KVM" misfeature
218e99
218e99
Message-id: <1373453682-19227-2-git-send-email-armbru@redhat.com>
218e99
Patchwork-id: 52417
218e99
O-Subject: [RHEL-7 PATCH qemu-kvm 1/1] pc: Disable the "use flash device for BIOS unless KVM" misfeature
218e99
Bugzilla: 963280
218e99
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
218e99
Use of a flash memory device for the BIOS was added in series "[PATCH
218e99
v10 0/8] PC system flash support", commit 4732dca..1b89faf, v1.1.
218e99
218e99
Flash vs. ROM is a guest-visible difference.  Thus, flash use had to
218e99
be suppressed for machine types pc-1.0 and older.  This was
218e99
accomplished by adding a dummy device "pc-sysfw" with property
218e99
"rom_only":
218e99
218e99
* Non-zero rom_only means "use ROM".  Default for pc-1.0 and older.
218e99
* Zero rom_only means "maybe use flash".  Default for newer machines.
218e99
218e99
Not only is the dummy device ugly, it was also retroactively added to
218e99
the older machine types!  Fortunately, it's not guest-visible (thus no
218e99
immediate guest ABI breakage), and has no vmstate (thus no immediate
218e99
migration breakage).  Breakage occurs only if the user unwisely
218e99
enables flash by setting rom_only to zero.  Patch review FAIL #1.
218e99
218e99
Why "maybe use flash"?  Flash didn't work with KVM.  Therefore,
218e99
rom_only=0 really means "use flash, except when KVM is enabled, use
218e99
ROM".  This is a Bad Idea, because it makes enabling/ disabling KVM
218e99
guest-visible.  Patch review FAIL #2.
218e99
218e99
Aside: it also precludes migrating between KVM on and off, but that's
218e99
not possible for other reasons anyway.
218e99
218e99
Upstream commit 9953f88 killed the misfeature for new machine types.
218e99
Upstream commit 9e1c2ec reverted the kill, but left a dead variable
218e99
behind.  This is what's in RHEL-7 is before this patch.
218e99
218e99
KVM has recently been made to support flash (KVM_CAP_READONLY_MEM),
218e99
which permitted upstream QEMU to redo the flash vs. ROM switch
218e99
properly (commit 338ea90..dafb82e).  The required follow-up cleanup
218e99
hasn't been committed, yet: Paolo's [PATCH v2 0/3] Remove legacy sysfw
218e99
code.
218e99
218e99
Instead of backporting all that, I'm simply ripping out the flash
218e99
feature.  ROM has been working just fine for us, and I don't think we
218e99
should complicate RHEL-7 maintenance and support by having two ways to
218e99
map BIOS, at least not without sufficient business reason.
218e99
218e99
The result behaves just like upstream with the follow-up cleanup
218e99
applied, except -pflash doesn't affect the BIOS mapping, but remains
218e99
as it always was: it creates an unused drive.
218e99
218e99
Signed-off-by: Markus Armbruster <armbru@redhat.com>
218e99
218e99
diff --git a/hw/block/pc_sysfw.c b/hw/block/pc_sysfw.c
218e99
index 4f17668..2bbedc9 100644
218e99
--- a/hw/block/pc_sysfw.c
218e99
+++ b/hw/block/pc_sysfw.c
218e99
@@ -36,6 +36,7 @@
218e99
 
218e99
 #define BIOS_FILENAME "bios.bin"
218e99
 
218e99
+#if 0   /* Disabled for Red Hat Enterprise Linux */
218e99
 typedef struct PcSysFwDevice {
218e99
     SysBusDevice busdev;
218e99
     uint8_t rom_only;
218e99
@@ -138,6 +139,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory,
218e99
 
218e99
     pc_isa_bios_init(rom_memory, flash_mem, size);
218e99
 }
218e99
+#endif  /* Disabled for Red Hat Enterprise Linux */
218e99
 
218e99
 static void old_pc_system_rom_init(MemoryRegion *rom_memory)
218e99
 {
218e99
@@ -194,6 +196,7 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory)
218e99
                                 bios);
218e99
 }
218e99
 
218e99
+#if 0   /* Disabled for Red Hat Enterprise Linux */
218e99
 /*
218e99
  * Bug-compatible flash vs. ROM selection enabled?
218e99
  * A few older machines enable this.
218e99
@@ -287,3 +290,9 @@ static void pcsysfw_register (void)
218e99
 
218e99
 type_init (pcsysfw_register);
218e99
 
218e99
+#else   /* Disabled for Red Hat Enterprise Linux */
218e99
+void pc_system_firmware_init(MemoryRegion *rom_memory)
218e99
+{
218e99
+    old_pc_system_rom_init(rom_memory);
218e99
+}
218e99
+#endif