From: Jordan Justen <jordan.l.justen@intel.com>
To: qemu-devel@nongnu.org
Cc: Jordan Justen <jordan.l.justen@intel.com>
Subject: [Qemu-devel] [PATCH v7 1/4] isapc: Fix non-KVM qemu boot (read/write memory for isapc BIOS)
Date: Wed, 29 May 2013 01:27:24 -0700 [thread overview]
Message-ID: <1369816047-16384-2-git-send-email-jordan.l.justen@intel.com> (raw)
In-Reply-To: <1369816047-16384-1-git-send-email-jordan.l.justen@intel.com>
The isapc machine with seabios currently requires the BIOS region
to be read/write memory rather than read-only memory.
KVM currently cannot support the BIOS as a ROM region, but qemu
in non-KVM mode can. Based on this, isapc machine currently only
works with KVM.
To work-around this isapc issue, this change avoids marking the
BIOS as readonly for isapc.
This change also will allow KVM to start supporting ROM mode
via KVM_CAP_READONLY_MEM.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/block/pc_sysfw.c | 16 +++++++++++-----
hw/i386/pc_piix.c | 5 +++++
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/hw/block/pc_sysfw.c b/hw/block/pc_sysfw.c
index 4f17668..ea1a355 100644
--- a/hw/block/pc_sysfw.c
+++ b/hw/block/pc_sysfw.c
@@ -39,6 +39,7 @@
typedef struct PcSysFwDevice {
SysBusDevice busdev;
uint8_t rom_only;
+ uint8_t isapc_ram_fw;
} PcSysFwDevice;
static void pc_isa_bios_init(MemoryRegion *rom_memory,
@@ -139,7 +140,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory,
pc_isa_bios_init(rom_memory, flash_mem, size);
}
-static void old_pc_system_rom_init(MemoryRegion *rom_memory)
+static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
{
char *filename;
MemoryRegion *bios, *isa_bios;
@@ -163,7 +164,9 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory)
bios = g_malloc(sizeof(*bios));
memory_region_init_ram(bios, "pc.bios", bios_size);
vmstate_register_ram_global(bios);
- memory_region_set_readonly(bios, true);
+ if (!isapc_ram_fw) {
+ memory_region_set_readonly(bios, true);
+ }
ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
if (ret != 0) {
bios_error:
@@ -186,7 +189,9 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory)
0x100000 - isa_bios_size,
isa_bios,
1);
- memory_region_set_readonly(isa_bios, true);
+ if (!isapc_ram_fw) {
+ memory_region_set_readonly(isa_bios, true);
+ }
/* map all the bios at the top of memory */
memory_region_add_subregion(rom_memory,
@@ -216,7 +221,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory)
qdev_init_nofail(DEVICE(sysfw_dev));
if (sysfw_dev->rom_only) {
- old_pc_system_rom_init(rom_memory);
+ old_pc_system_rom_init(rom_memory, sysfw_dev->isapc_ram_fw);
return;
}
@@ -234,7 +239,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory)
exit(1);
} else {
sysfw_dev->rom_only = 1;
- old_pc_system_rom_init(rom_memory);
+ old_pc_system_rom_init(rom_memory, sysfw_dev->isapc_ram_fw);
return;
}
}
@@ -255,6 +260,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory)
}
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 43ab480..530b6ab 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -713,6 +713,11 @@ static QEMUMachine isapc_machine = {
.property = "rom_only",
.value = stringify(1),
},
+ {
+ .driver = "pc-sysfw",
+ .property = "isapc_ram_fw",
+ .value = stringify(1),
+ },
{ /* end of list */ }
},
DEFAULT_MACHINE_OPTIONS,
--
1.7.10.4
next prev parent reply other threads:[~2013-05-29 8:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 8:27 [Qemu-devel] [PATCH v7 0/4] KVM flash memory support Jordan Justen
2013-05-29 8:27 ` Jordan Justen [this message]
2013-05-31 2:06 ` [Qemu-devel] [PATCH v7 1/4] isapc: Fix non-KVM qemu boot (read/write memory for isapc BIOS) Kevin O'Connor
2013-05-31 4:41 ` Jordan Justen
2013-05-31 12:40 ` Laszlo Ersek
2013-05-31 12:48 ` Paolo Bonzini
2013-05-31 12:48 ` Paolo Bonzini
2013-06-01 3:44 ` Kevin O'Connor
2013-05-29 8:27 ` [Qemu-devel] [PATCH v7 2/4] kvm: add kvm_readonly_mem_enabled Jordan Justen
2013-05-29 8:27 ` [Qemu-devel] [PATCH v7 3/4] kvm: support using KVM_MEM_READONLY flag for regions Jordan Justen
2013-05-29 8:27 ` [Qemu-devel] [PATCH v7 4/4] pc_sysfw: allow flash (-pflash) memory to be used with KVM Jordan Justen
2013-05-31 18:48 ` [Qemu-devel] [PATCH v7 0/4] KVM flash memory support Anthony Liguori
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=1369816047-16384-2-git-send-email-jordan.l.justen@intel.com \
--to=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).