From: Glauber Costa <[EMAIL PROTECTED]>

Remove explicit calls to kvm_cpu_register_physical_memory,
and bundle it together with qemu's memory registration function.

Signed-off-by: Glauber Costa <[EMAIL PROTECTED]>
Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/qemu/exec.c b/qemu/exec.c
index 9e82188..cf9c99c 100644
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -2219,6 +2219,11 @@ void cpu_register_physical_memory(target_phys_addr_t 
start_addr,
         kqemu_set_phys_mem(start_addr, size, phys_offset);
     }
 #endif
+#ifdef USE_KVM
+    if (kvm_enabled())
+        kvm_cpu_register_physical_memory(start_addr, size, phys_offset);
+#endif
+
     size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
     end_addr = start_addr + (target_phys_addr_t)size;
     for(addr = start_addr; addr != end_addr; addr += TARGET_PAGE_SIZE) {
diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c
index d70af90..5227385 100644
--- a/qemu/hw/ipf.c
+++ b/qemu/hw/ipf.c
@@ -420,18 +420,14 @@ static void ipf_init1(ram_addr_t ram_size, int 
vga_ram_size,
     if (kvm_enabled()) {
                ram_addr = qemu_ram_alloc(0xa0000);
                cpu_register_physical_memory(0, 0xa0000, ram_addr);
-               kvm_cpu_register_physical_memory(0, 0xa0000, ram_addr);
 
                ram_addr = qemu_ram_alloc(0x20000); // Workaround 
0xa0000-0xc0000
 
                ram_addr = qemu_ram_alloc(0x40000);
                cpu_register_physical_memory(0xc0000, 0x40000, ram_addr);
-               kvm_cpu_register_physical_memory(0xc0000, 0x40000, ram_addr);
 
                ram_addr = qemu_ram_alloc(ram_size - 0x100000);
                cpu_register_physical_memory(0x100000, ram_size - 0x100000, 
ram_addr);
-               kvm_cpu_register_physical_memory(0x100000, ram_size - 0x100000,
-                               ram_addr);
        } else
     {
         ram_addr = qemu_ram_alloc(ram_size);
@@ -444,9 +440,6 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
        if (above_4g_mem_size > 0) {
                ram_addr = qemu_ram_alloc(above_4g_mem_size);
                cpu_register_physical_memory(0x100000000, above_4g_mem_size, 
ram_addr);
-       if (kvm_enabled())
-               kvm_cpu_register_physical_memory(0x100000000, above_4g_mem_size,
-                                       ram_addr);
        }
 
        /*Load firware to its proper position.*/
@@ -468,7 +461,6 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size,
                fw_image_start = fw_start + GFW_SIZE - image_size;
 
         cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset);
-        kvm_cpu_register_physical_memory(GFW_START,GFW_SIZE, fw_offset);
         memcpy(fw_image_start, image, image_size);
 
                free(image);
diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index cc3bd50..fda4320 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -777,9 +777,7 @@ static int load_option_rom(const char *filename, int 
offset, int type)
     cpu_register_physical_memory(0xd0000 + offset,
                                 size, option_rom_offset | type);
     option_rom_setup_reset(0xd0000 + offset, size);
-    if (kvm_enabled())
-           kvm_cpu_register_physical_memory(0xd0000 + offset,
-                                             size, option_rom_offset | type);
+
     return size;
 }
 
@@ -852,7 +850,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     /* allocate RAM */
     ram_addr = qemu_ram_alloc(0xa0000);
     cpu_register_physical_memory(0, 0xa0000, ram_addr);
-    kvm_cpu_register_physical_memory(0, 0xa0000, ram_addr);
 
     /* Allocate, even though we won't register, so we don't break the
      * phys_ram_base + PA assumption. This range includes vga (0xa0000 - 
0xc0000),
@@ -863,9 +860,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     cpu_register_physical_memory(0x100000,
                  below_4g_mem_size - 0x100000,
                  ram_addr);
-    kvm_cpu_register_physical_memory(0x100000,
-                                     below_4g_mem_size - 0x100000,
-                                     ram_addr);
 
     /* above 4giga memory allocation */
     if (above_4g_mem_size > 0) {
@@ -881,9 +875,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
         cpu_register_physical_memory(0x100000000ULL,
                                      above_4g_mem_size,
                                      ram_addr);
-        kvm_cpu_register_physical_memory(0x100000000ULL,
-                                         above_4g_mem_size,
-                                         ram_addr);
     }
 
     /* allocate VGA RAM */
@@ -927,9 +918,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     /* setup basic memory access */
     cpu_register_physical_memory(0xc0000, 0x10000,
                                  vga_bios_offset | IO_MEM_ROM);
-    if (kvm_enabled())
-        kvm_cpu_register_physical_memory(0xc0000, 0x10000,
-                                         vga_bios_offset | IO_MEM_ROM);
 
     /* map the last 128KB of the BIOS in ISA space */
     isa_bios_size = bios_size;
@@ -941,10 +929,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     cpu_register_physical_memory(0x100000 - isa_bios_size,
                                  isa_bios_size,
                                  (bios_offset + bios_size - isa_bios_size) /* 
| IO_MEM_ROM */);
-    if (kvm_enabled())
-        kvm_cpu_register_physical_memory(0x100000 - isa_bios_size,
-                                         isa_bios_size,
-                                         (bios_offset + bios_size - 
isa_bios_size) | IO_MEM_ROM);
 
     /* XXX: for DDIM support, "ROM space" should be writable during
        initialization, and (optionally) marked readonly by the BIOS
@@ -963,10 +947,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     /* map all the bios at the top of memory */
     cpu_register_physical_memory((uint32_t)(-bios_size),
                                  bios_size, bios_offset | IO_MEM_ROM);
-    if (kvm_enabled()) {
-        kvm_cpu_register_physical_memory((uint32_t)(-bios_size),
-                                           bios_size, bios_offset | 
IO_MEM_ROM);
-    }
 
     bochs_bios_init();
 
diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c
index 9ff6f7d..deafc5f 100644
--- a/qemu/hw/ppc440_bamboo.c
+++ b/qemu/hw/ppc440_bamboo.c
@@ -93,8 +93,6 @@ void bamboo_init(ram_addr_t ram_size, int vga_ram_size,
 
        /* Register mem */
        cpu_register_physical_memory(0, ram_size, 0);
-       if (kvm_enabled())
-         kvm_cpu_register_physical_memory(0, ram_size, 0);
 
        /* load kernel with uboot loader */
        printf("%s: load kernel\n", __func__);
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to