From: Anthony Xu <anthony.xu@intel.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, eblake@redhat.com,
Anthony Xu <anthony.xu@intel.com>
Subject: [Qemu-devel] [PATCH 4/4] pam: setup pc.bios
Date: Fri, 7 Apr 2017 17:45:36 -0700 [thread overview]
Message-ID: <1491612336-31066-5-git-send-email-anthony.xu@intel.com> (raw)
In-Reply-To: <1491612336-31066-1-git-send-email-anthony.xu@intel.com>
when pam is disabled, set pc.bios and isa.bios region as writeable,
and add isa.bios to system memory region.
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
---
hw/i386/pc.c | 2 +-
hw/i386/pc_sysfw.c | 30 +++++++++++++++++++++---------
include/hw/i386/pc.h | 4 +++-
3 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 455f7fe..3e23f58 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1443,7 +1443,7 @@ void pc_memory_init(PCMachineState *pcms,
}
/* Initialize PC system firmware */
- pc_system_firmware_init(rom_memory, !pcmc->pci_enabled);
+ pc_system_firmware_init(system_memory, rom_memory, !pcmc->pci_enabled);
if (pcms->pam) {
MemoryRegion *option_rom_mr = g_malloc(sizeof(*option_rom_mr));
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index f915ad0..e5ac615 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -173,7 +173,8 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
}
}
-static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
+static void old_pc_system_rom_init(MemoryRegion *system_memory,
+ MemoryRegion *rom_memory, bool isapc_ram_fw)
{
char *filename;
MemoryRegion *bios, *isa_bios;
@@ -197,8 +198,11 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
bios = g_malloc(sizeof(*bios));
memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
vmstate_register_ram_global(bios);
- if (!isapc_ram_fw) {
- memory_region_set_readonly(bios, true);
+ if (PC_MACHINE(current_machine)->pam) {
+ /* if PAM is disabled, set it as readwrite */
+ 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) {
@@ -216,21 +220,29 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
isa_bios = g_malloc(sizeof(*isa_bios));
memory_region_init_alias(isa_bios, NULL, "isa-bios", bios,
bios_size - isa_bios_size, isa_bios_size);
- memory_region_add_subregion_overlap(rom_memory,
+ if (PC_MACHINE(current_machine)->pam) {
+ memory_region_add_subregion_overlap(rom_memory,
+ 0x100000 - isa_bios_size,
+ isa_bios,
+ 1);
+ if (!isapc_ram_fw) {
+ memory_region_set_readonly(isa_bios, true);
+ }
+ } else {
+ /* if PAM is disabed, add isa-bios to system memory region */
+ memory_region_add_subregion_overlap(system_memory,
0x100000 - isa_bios_size,
isa_bios,
1);
- 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,
(uint32_t)(-bios_size),
bios);
}
-void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
+void pc_system_firmware_init(MemoryRegion *system_memory,
+ MemoryRegion *rom_memory, bool isapc_ram_fw)
{
DriveInfo *pflash_drv;
@@ -238,7 +250,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
if (isapc_ram_fw || pflash_drv == NULL) {
/* When a pflash drive is not found, use rom-mode */
- old_pc_system_rom_init(rom_memory, isapc_ram_fw);
+ old_pc_system_rom_init(system_memory, rom_memory, isapc_ram_fw);
return;
}
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 05f4df5..eb5b853 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -354,7 +354,9 @@ static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
}
/* pc_sysfw.c */
-void pc_system_firmware_init(MemoryRegion *rom_memory,
+
+void pc_system_firmware_init(MemoryRegion *system_memory,
+ MemoryRegion *rom_memory,
bool isapc_ram_fw);
/* pvpanic.c */
--
1.8.3.1
next prev parent reply other threads:[~2017-04-08 0:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-08 0:45 [Qemu-devel] [PATCH 0/4] pam: make pam configurable Anthony Xu
2017-04-08 0:45 ` [Qemu-devel] [PATCH 1/4] pam:refactor PAM related code Anthony Xu
2017-04-08 9:49 ` Paolo Bonzini
2017-04-11 1:25 ` Xu, Anthony
2017-04-08 0:45 ` [Qemu-devel] [PATCH 2/4] pam: Make PAM configurable Anthony Xu
2017-04-08 0:45 ` [Qemu-devel] [PATCH 3/4] pam: disable pc.rom when pam is disabled Anthony Xu
2017-04-08 0:45 ` Anthony Xu [this message]
2017-04-08 9:49 ` [Qemu-devel] [PATCH 4/4] pam: setup pc.bios Paolo Bonzini
2017-04-11 1:42 ` Xu, Anthony
2017-04-11 9:18 ` 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=1491612336-31066-5-git-send-email-anthony.xu@intel.com \
--to=anthony.xu@intel.com \
--cc=eblake@redhat.com \
--cc=pbonzini@redhat.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).