qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] i386: pc_sysfw: load bios using rom API
@ 2018-10-09  5:55 Li Qiang
  2018-10-11 13:37 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2018-10-09  5:55 UTC (permalink / raw)
  To: pbonzini, rth, ehabkost, mst, marcel.apfelbaum, peter.maydell
  Cc: qemu-devel, Li Qiang

As the bios is a ROM, just using rom API.
AFAICS no functionality changed.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hw/i386/pc_sysfw.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 091e22dd60..7f469fd582 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -209,9 +209,9 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
         goto bios_error;
     }
     bios = g_malloc(sizeof(*bios));
-    memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
-    if (!isapc_ram_fw) {
-        memory_region_set_readonly(bios, true);
+    memory_region_init_rom(bios, NULL, "pc.bios", bios_size, &error_fatal);
+    if (isapc_ram_fw) {
+        memory_region_set_readonly(bios, false);
     }
     ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
     if (ret != 0) {
@@ -230,8 +230,8 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
                                         0x100000 - isa_bios_size,
                                         isa_bios,
                                         1);
-    if (!isapc_ram_fw) {
-        memory_region_set_readonly(isa_bios, true);
+    if (isapc_ram_fw) {
+        memory_region_set_readonly(isa_bios, false);
     }
 
     /* map all the bios at the top of memory */
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] i386: pc_sysfw: load bios using rom API
  2018-10-09  5:55 [Qemu-devel] [PATCH] i386: pc_sysfw: load bios using rom API Li Qiang
@ 2018-10-11 13:37 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2018-10-11 13:37 UTC (permalink / raw)
  To: Li Qiang, rth, ehabkost, mst, marcel.apfelbaum, peter.maydell; +Cc: qemu-devel

On 09/10/2018 07:55, Li Qiang wrote:
> As the bios is a ROM, just using rom API.
> AFAICS no functionality changed.
> 
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---

ROM and RAM are just the same, with the readonly flag defaulting to
either true or false.

Because the alias here:

    memory_region_init_alias(isa_bios, NULL, "isa-bios", bios,
                             bios_size - isa_bios_size, isa_bios_size);
    if (!isapc_ram_fw) {
        memory_region_set_readonly(isa_bios, true);
    }

defaults to read-write (and your patch is wrong in changing the
direction of the if), it makes sense to do the same for the bios memory
region.

Thanks,

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-11 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-09  5:55 [Qemu-devel] [PATCH] i386: pc_sysfw: load bios using rom API Li Qiang
2018-10-11 13:37 ` Paolo Bonzini

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).