Blame SOURCES/kvm-pc-make-pc_rom-RO-only-on-new-machine-types.patch

4a2fec
From c091cd7a1b3799d3d2d657bc3dc66dec90eb86f1 Mon Sep 17 00:00:00 2001
4a2fec
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
4a2fec
Date: Wed, 11 Oct 2017 17:55:00 +0200
4a2fec
Subject: [PATCH 15/69] pc: make pc_rom RO only on new machine types
4a2fec
4a2fec
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
4a2fec
Message-id: <20171011175500.12390-3-dgilbert@redhat.com>
4a2fec
Patchwork-id: 77178
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH v3 2/2] pc: make pc_rom RO only on new machine types
4a2fec
Bugzilla: 1489800
4a2fec
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
4a2fec
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
4a2fec
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
4a2fec
4a2fec
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
4a2fec
4a2fec
Upstream lp 1715700 reported that the RO pc_rom settings caused
4a2fec
problems with Windows 7 under OVMF.
4a2fec
This is fixed in a new OVMF, but lets keep things stable on
4a2fec
older machine types.
4a2fec
4a2fec
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/i386/pc.c         | 4 +++-
4a2fec
 hw/i386/pc_piix.c    | 2 ++
4a2fec
 hw/i386/pc_q35.c     | 2 ++
4a2fec
 include/hw/i386/pc.h | 3 +++
4a2fec
 4 files changed, 10 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
4a2fec
index ccaa832..83df57f 100644
4a2fec
--- a/hw/i386/pc.c
4a2fec
+++ b/hw/i386/pc.c
4a2fec
@@ -1444,7 +1444,8 @@ void pc_memory_init(PCMachineState *pcms,
4a2fec
     option_rom_mr = g_malloc(sizeof(*option_rom_mr));
4a2fec
     memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
4a2fec
                            &error_fatal);
4a2fec
-    if (pcmc->pci_enabled) {
4a2fec
+    /* RH difference: See bz 1489800, explicitly make ROM ro */
4a2fec
+    if (pcmc->pc_rom_ro) {
4a2fec
         memory_region_set_readonly(option_rom_mr, true);
4a2fec
     }
4a2fec
     memory_region_add_subregion_overlap(rom_memory,
4a2fec
@@ -2350,6 +2351,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
4a2fec
     pcmc->acpi_data_size = 0x20000 + 0x8000;
4a2fec
     pcmc->save_tsc_khz = true;
4a2fec
     pcmc->linuxboot_dma_enabled = true;
4a2fec
+    pcmc->pc_rom_ro = true;
4a2fec
     mc->get_hotplug_handler = pc_get_hotpug_handler;
4a2fec
     mc->cpu_index_to_instance_props = pc_cpu_index_to_props;
4a2fec
     mc->possible_cpu_arch_ids = pc_possible_cpu_arch_ids;
4a2fec
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
4a2fec
index 935391f..09bfc5a 100644
4a2fec
--- a/hw/i386/pc_piix.c
4a2fec
+++ b/hw/i386/pc_piix.c
4a2fec
@@ -1164,11 +1164,13 @@ static void pc_init_rhel740(MachineState *machine)
4a2fec
 
4a2fec
 static void pc_machine_rhel740_options(MachineClass *m)
4a2fec
 {
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
4a2fec
     pc_machine_rhel750_options(m);
4a2fec
     m->alias = NULL;
4a2fec
     m->is_default = 0;
4a2fec
     m->desc = "RHEL 7.4.0 PC (i440FX + PIIX, 1996)";
4a2fec
     m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
4a2fec
+    pcmc->pc_rom_ro = false;
4a2fec
     SET_MACHINE_COMPAT(m, PC_RHEL7_4_COMPAT);
4a2fec
 }
4a2fec
 
4a2fec
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
4a2fec
index e73097b..27c85c5 100644
4a2fec
--- a/hw/i386/pc_q35.c
4a2fec
+++ b/hw/i386/pc_q35.c
4a2fec
@@ -416,10 +416,12 @@ static void pc_q35_init_rhel740(MachineState *machine)
4a2fec
 
4a2fec
 static void pc_q35_machine_rhel740_options(MachineClass *m)
4a2fec
 {
4a2fec
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
4a2fec
     pc_q35_machine_rhel750_options(m);
4a2fec
     m->alias = NULL;
4a2fec
     m->desc = "RHEL-7.4.0 PC (Q35 + ICH9, 2009)";
4a2fec
     m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
4a2fec
+    pcmc->pc_rom_ro = false;
4a2fec
     SET_MACHINE_COMPAT(m, PC_RHEL7_4_COMPAT);
4a2fec
 }
4a2fec
 
4a2fec
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
4a2fec
index a8d6857..6f65d79 100644
4a2fec
--- a/include/hw/i386/pc.h
4a2fec
+++ b/include/hw/i386/pc.h
4a2fec
@@ -141,6 +141,9 @@ struct PCMachineClass {
4a2fec
 
4a2fec
     /* use DMA capable linuxboot option rom */
4a2fec
     bool linuxboot_dma_enabled;
4a2fec
+
4a2fec
+    /* RH only, see bz 1489800 */
4a2fec
+    bool pc_rom_ro;
4a2fec
 };
4a2fec
 
4a2fec
 #define TYPE_PC_MACHINE "generic-pc-machine"
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec