qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jordan Justen <jordan.l.justen@intel.com>, armbru@redhat.com
Subject: [Qemu-devel] [PATCH 2/3] pc_sysfw: remove the rom_only property
Date: Mon,  3 Jun 2013 17:19:07 +0200	[thread overview]
Message-ID: <1370272748-10629-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1370272748-10629-1-git-send-email-pbonzini@redhat.com>

With the new semantics of pc_sysfw (no -pflash implies "old-style" ROM setup,
-pflash implies "new-style" ROM setup), there is no need anymore for a compat
property.  Old machines simply will never use -pflash, and thus will always
use old-style setup.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/block/pc_sysfw.c | 64 ++++++-----------------------------------------------
 hw/i386/pc_piix.c   |  9 --------
 2 files changed, 7 insertions(+), 66 deletions(-)

diff --git a/hw/block/pc_sysfw.c b/hw/block/pc_sysfw.c
index c6d4be4..651dda8 100644
--- a/hw/block/pc_sysfw.c
+++ b/hw/block/pc_sysfw.c
@@ -38,7 +38,6 @@
 
 typedef struct PcSysFwDevice {
     SysBusDevice busdev;
-    uint8_t rom_only;
     uint8_t isapc_ram_fw;
 } PcSysFwDevice;
 
@@ -76,39 +75,6 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
     memory_region_set_readonly(isa_bios, true);
 }
 
-static void pc_fw_add_pflash_drv(void)
-{
-    QemuOpts *opts;
-    QEMUMachine *machine;
-    char *filename;
-
-    if (bios_name == NULL) {
-        bios_name = BIOS_FILENAME;
-    }
-    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
-    if (!filename) {
-        error_report("Can't open BIOS image %s", bios_name);
-        exit(1);
-    }
-
-    opts = drive_add(IF_PFLASH, -1, filename, "readonly=on");
-
-    g_free(filename);
-
-    if (opts == NULL) {
-      return;
-    }
-
-    machine = find_default_machine();
-    if (machine == NULL) {
-      return;
-    }
-
-    if (!drive_init(opts, machine->block_default_type)) {
-        qemu_opts_del(opts);
-    }
-}
-
 static void pc_system_flash_init(MemoryRegion *rom_memory,
                                  DriveInfo *pflash_drv)
 {
@@ -216,40 +182,24 @@ void pc_system_firmware_init(MemoryRegion *rom_memory)
 
     pflash_drv = drive_get(IF_PFLASH, 0, 0);
 
-    if (pflash_drv == NULL) {
+    if (sysfw_dev->isapc_ram_fw || pflash_drv == NULL) {
         /* When a pflash drive is not found, use rom-mode */
-        sysfw_dev->rom_only = 1;
-    } else if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
-        /* Older KVM cannot execute from device memory. So, flash memory
-         * cannot be used unless the readonly memory kvm capability is present. */
-        fprintf(stderr, "qemu: pflash with kvm requires KVM readonly memory support\n");
-        exit(1);
-    }
-
-    /* If rom-mode is active, use the old pc system rom initialization. */
-    if (sysfw_dev->rom_only) {
         old_pc_system_rom_init(rom_memory, sysfw_dev->isapc_ram_fw);
         return;
     }
 
-    /* If a pflash drive is not found, then create one using
-       the bios filename. */
-    if (pflash_drv == NULL) {
-        pc_fw_add_pflash_drv();
-        pflash_drv = drive_get(IF_PFLASH, 0, 0);
-    }
-
-    if (pflash_drv != NULL) {
-        pc_system_flash_init(rom_memory, pflash_drv);
-    } else {
-        fprintf(stderr, "qemu: PC system firmware (pflash) not available\n");
+    if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
+        /* Older KVM cannot execute from device memory. So, flash memory
+         * cannot be used unless the readonly memory kvm capability is present. */
+        fprintf(stderr, "qemu: pflash with kvm requires KVM readonly memory support\n");
         exit(1);
     }
+
+    pc_system_flash_init(rom_memory, pflash_drv);
 }
 
 static Property pcsysfw_properties[] = {
     DEFINE_PROP_UINT8("isapc_ram_fw", PcSysFwDevice, isapc_ram_fw, 0),
-    DEFINE_PROP_UINT8("rom_only", PcSysFwDevice, rom_only, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 530b6ab..00a729a 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -470,10 +470,6 @@ static QEMUMachine pc_machine_v1_1 = {
 #define PC_COMPAT_1_0 \
         PC_COMPAT_1_1,\
         {\
-            .driver   = "pc-sysfw",\
-            .property = "rom_only",\
-            .value    = stringify(1),\
-        }, {\
             .driver   = TYPE_ISA_FDC,\
             .property = "check_media_rate",\
             .value    = "off",\
@@ -710,11 +706,6 @@ static QEMUMachine isapc_machine = {
     .compat_props = (GlobalProperty[]) {
         {
             .driver   = "pc-sysfw",
-            .property = "rom_only",
-            .value    = stringify(1),
-        },
-        {
-            .driver   = "pc-sysfw",
             .property = "isapc_ram_fw",
             .value    = stringify(1),
         },
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-03 15:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 15:19 [Qemu-devel] [PATCH 0/3] Remove legacy sysfw code Paolo Bonzini
2013-06-03 15:19 ` [Qemu-devel] [PATCH 1/3] sysfw: remove read-only pc_sysfw_flash_vs_rom_bug_compatible Paolo Bonzini
2013-06-03 20:36   ` Jordan Justen
2013-06-03 20:57     ` Paolo Bonzini
2013-06-04  9:17     ` Markus Armbruster
2013-06-04  9:14   ` Markus Armbruster
2013-06-04  9:43     ` Paolo Bonzini
2013-06-03 15:19 ` Paolo Bonzini [this message]
2013-06-03 20:50   ` [Qemu-devel] [PATCH 2/3] pc_sysfw: remove the rom_only property Jordan Justen
2013-06-03 21:00     ` Paolo Bonzini
2013-06-03 15:19 ` [Qemu-devel] [PATCH 3/3] pc_sysfw: do not make it a device anymore Paolo Bonzini
2013-06-03 20:46   ` Jordan Justen
2013-06-03 21:00     ` Paolo Bonzini
2013-06-03 21:56 ` [Qemu-devel] [PATCH 0/3] Remove legacy sysfw code Jordan Justen
2013-06-04  6:46   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370272748-10629-3-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jordan.l.justen@intel.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).