cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 5de16aa3c3b28a7a90426e38b06bda827b3c822f Mon Sep 17 00:00:00 2001
0a122b
From: Laszlo Ersek <lersek@redhat.com>
0a122b
Date: Sat, 11 Jan 2014 18:00:01 +0100
0a122b
Subject: [PATCH 11/22] pc_sysfw: remove the rom_only property
0a122b
0a122b
RH-Author: Laszlo Ersek <lersek@redhat.com>
0a122b
Message-id: <1389463208-6278-12-git-send-email-lersek@redhat.com>
0a122b
Patchwork-id: 56623
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH 11/18] pc_sysfw: remove the rom_only property
0a122b
Bugzilla: 1032346
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Amos Kong <akong@redhat.com>
0a122b
RH-Acked-by: Andrew Jones <drjones@redhat.com>
0a122b
0a122b
From: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
With the new semantics of pc_sysfw (no -pflash implies "old-style" ROM setup,
0a122b
-pflash implies "new-style" ROM setup), there is no need anymore for a compat
0a122b
property.  Old machines simply will never use -pflash, and thus will always
0a122b
use old-style setup.
0a122b
0a122b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Message-id: 1376069702-22330-3-git-send-email-aliguori@us.ibm.com
0a122b
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
(cherry picked from commit a904410af5f1ed6ff031e9e4119ca2f5d99647ce)
0a122b
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
0a122b
---
0a122b
 hw/block/pc_sysfw.c | 64 ++++++-----------------------------------------------
0a122b
 hw/i386/pc_piix.c   |  9 --------
0a122b
 2 files changed, 7 insertions(+), 66 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/block/pc_sysfw.c |   64 +++++---------------------------------------------
0a122b
 hw/i386/pc_piix.c   |    9 -------
0a122b
 2 files changed, 7 insertions(+), 66 deletions(-)
0a122b
0a122b
diff --git a/hw/block/pc_sysfw.c b/hw/block/pc_sysfw.c
0a122b
index 38261b1..f9c0633 100644
0a122b
--- a/hw/block/pc_sysfw.c
0a122b
+++ b/hw/block/pc_sysfw.c
0a122b
@@ -38,7 +38,6 @@
0a122b
 
0a122b
 typedef struct PcSysFwDevice {
0a122b
     SysBusDevice busdev;
0a122b
-    uint8_t rom_only;
0a122b
     uint8_t isapc_ram_fw;
0a122b
 } PcSysFwDevice;
0a122b
 
0a122b
@@ -73,39 +72,6 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
0a122b
     memory_region_set_readonly(isa_bios, true);
0a122b
 }
0a122b
 
0a122b
-static void pc_fw_add_pflash_drv(void)
0a122b
-{
0a122b
-    QemuOpts *opts;
0a122b
-    QEMUMachine *machine;
0a122b
-    char *filename;
0a122b
-
0a122b
-    if (bios_name == NULL) {
0a122b
-        bios_name = BIOS_FILENAME;
0a122b
-    }
0a122b
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
0a122b
-    if (!filename) {
0a122b
-        error_report("Can't open BIOS image %s", bios_name);
0a122b
-        exit(1);
0a122b
-    }
0a122b
-
0a122b
-    opts = drive_add(IF_PFLASH, -1, filename, "readonly=on");
0a122b
-
0a122b
-    g_free(filename);
0a122b
-
0a122b
-    if (opts == NULL) {
0a122b
-      return;
0a122b
-    }
0a122b
-
0a122b
-    machine = find_default_machine();
0a122b
-    if (machine == NULL) {
0a122b
-      return;
0a122b
-    }
0a122b
-
0a122b
-    if (!drive_init(opts, machine->block_default_type)) {
0a122b
-        qemu_opts_del(opts);
0a122b
-    }
0a122b
-}
0a122b
-
0a122b
 static void pc_system_flash_init(MemoryRegion *rom_memory,
0a122b
                                  DriveInfo *pflash_drv)
0a122b
 {
0a122b
@@ -213,40 +179,24 @@ void pc_system_firmware_init(MemoryRegion *rom_memory)
0a122b
 
0a122b
     pflash_drv = drive_get(IF_PFLASH, 0, 0);
0a122b
 
0a122b
-    if (pflash_drv == NULL) {
0a122b
+    if (sysfw_dev->isapc_ram_fw || pflash_drv == NULL) {
0a122b
         /* When a pflash drive is not found, use rom-mode */
0a122b
-        sysfw_dev->rom_only = 1;
0a122b
-    } else if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
0a122b
-        /* Older KVM cannot execute from device memory. So, flash memory
0a122b
-         * cannot be used unless the readonly memory kvm capability is present. */
0a122b
-        fprintf(stderr, "qemu: pflash with kvm requires KVM readonly memory support\n");
0a122b
-        exit(1);
0a122b
-    }
0a122b
-
0a122b
-    /* If rom-mode is active, use the old pc system rom initialization. */
0a122b
-    if (sysfw_dev->rom_only) {
0a122b
         old_pc_system_rom_init(rom_memory, sysfw_dev->isapc_ram_fw);
0a122b
         return;
0a122b
     }
0a122b
 
0a122b
-    /* If a pflash drive is not found, then create one using
0a122b
-       the bios filename. */
0a122b
-    if (pflash_drv == NULL) {
0a122b
-        pc_fw_add_pflash_drv();
0a122b
-        pflash_drv = drive_get(IF_PFLASH, 0, 0);
0a122b
-    }
0a122b
-
0a122b
-    if (pflash_drv != NULL) {
0a122b
-        pc_system_flash_init(rom_memory, pflash_drv);
0a122b
-    } else {
0a122b
-        fprintf(stderr, "qemu: PC system firmware (pflash) not available\n");
0a122b
+    if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
0a122b
+        /* Older KVM cannot execute from device memory. So, flash memory
0a122b
+         * cannot be used unless the readonly memory kvm capability is present. */
0a122b
+        fprintf(stderr, "qemu: pflash with kvm requires KVM readonly memory support\n");
0a122b
         exit(1);
0a122b
     }
0a122b
+
0a122b
+    pc_system_flash_init(rom_memory, pflash_drv);
0a122b
 }
0a122b
 
0a122b
 static Property pcsysfw_properties[] = {
0a122b
     DEFINE_PROP_UINT8("isapc_ram_fw", PcSysFwDevice, isapc_ram_fw, 0),
0a122b
-    DEFINE_PROP_UINT8("rom_only", PcSysFwDevice, rom_only, 0),
0a122b
     DEFINE_PROP_END_OF_LIST(),
0a122b
 };
0a122b
 
0a122b
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
0a122b
index 0a8a4e5..6f273db 100644
0a122b
--- a/hw/i386/pc_piix.c
0a122b
+++ b/hw/i386/pc_piix.c
0a122b
@@ -471,10 +471,6 @@ static QEMUMachine pc_machine_v1_1 = {
0a122b
 #define PC_COMPAT_1_0 \
0a122b
         PC_COMPAT_1_1,\
0a122b
         {\
0a122b
-            .driver   = "pc-sysfw",\
0a122b
-            .property = "rom_only",\
0a122b
-            .value    = stringify(1),\
0a122b
-        }, {\
0a122b
             .driver   = TYPE_ISA_FDC,\
0a122b
             .property = "check_media_rate",\
0a122b
             .value    = "off",\
0a122b
@@ -711,11 +707,6 @@ static QEMUMachine isapc_machine = {
0a122b
     .compat_props = (GlobalProperty[]) {
0a122b
         {
0a122b
             .driver   = "pc-sysfw",
0a122b
-            .property = "rom_only",
0a122b
-            .value    = stringify(1),
0a122b
-        },
0a122b
-        {
0a122b
-            .driver   = "pc-sysfw",
0a122b
             .property = "isapc_ram_fw",
0a122b
             .value    = stringify(1),
0a122b
         },
0a122b
-- 
0a122b
1.7.1
0a122b