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

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