memory API improvements and bug fixes for memory backends
v6 cover memory API improvements and bug fixes for memory backends
This series includes two parts:
1. part 1 includes patches 1-4, which improves error handling of memory_region_init_ram, memory_region_init_ram_ptr and memory_region_init_rom_device
2. part 2 includes patches 5-7, each fixes a bug of memory backend.
changes to v5:
- split patch 6 in v5 into 2
- use local_err instead of errp
- typo fixes
Hu Tao (7):
exec: add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr
memory: add parameter errp to memory_region_init_ram
memory: add parameter errp to memory_region_init_ram_ptr
memory: add parameter errp to memory_region_init_rom_device
hostmem-ram: don't exit qemu if size of memory-backend-ram is way too
big
exec: report error when memory < hpagesize
exec: add parameter errp to gethugepagesize
backends/hostmem-ram.c | 2 +- exec.c | 60 ++++++++++++++++++++++---------- hw/alpha/typhoon.c | 3 +- hw/arm/armv7m.c | 7 ++-- hw/arm/cubieboard.c | 2 +- hw/arm/digic_boards.c | 2 +- hw/arm/exynos4210.c | 9 ++--- hw/arm/highbank.c | 5 +-- hw/arm/integratorcp.c | 5 +-- hw/arm/kzm.c | 4 +-- hw/arm/mainstone.c | 3 +- hw/arm/musicpal.c | 6 ++-- hw/arm/omap1.c | 6 ++-- hw/arm/omap2.c | 6 ++-- hw/arm/omap_sx1.c | 6 ++-- hw/arm/palm.c | 3 +- hw/arm/pxa2xx.c | 11 +++--- hw/arm/realview.c | 9 +++-- hw/arm/spitz.c | 2 +- hw/arm/strongarm.c | 3 +- hw/arm/tosa.c | 2 +- hw/arm/versatilepb.c | 3 +- hw/arm/vexpress.c | 15 +++++--- hw/arm/virt.c | 3 +- hw/arm/xilinx_zynq.c | 6 ++-- hw/block/onenand.c | 2 +- hw/block/pflash_cfi01.c | 2 +- hw/block/pflash_cfi02.c | 2 +- hw/core/loader.c | 2 +- hw/cris/axis_dev88.c | 6 ++-- hw/display/cg3.c | 6 ++-- hw/display/g364fb.c | 2 +- hw/display/qxl.c | 6 ++-- hw/display/sm501.c | 2 +- hw/display/tc6393xb.c | 3 +- hw/display/tcx.c | 5 +-- hw/display/vga.c | 3 +- hw/display/vmware_vga.c | 3 +- hw/i386/kvm/pci-assign.c | 6 ++-- hw/i386/pc.c | 3 +- hw/i386/pc_sysfw.c | 5 +-- hw/input/milkymist-softusb.c | 4 +-- hw/lm32/lm32_boards.c | 6 ++-- hw/lm32/milkymist.c | 3 +- hw/m68k/an5206.c | 4 +-- hw/m68k/dummy_m68k.c | 2 +- hw/m68k/mcf5208.c | 4 +-- hw/microblaze/petalogix_ml605_mmu.c | 5 +-- hw/microblaze/petalogix_s3adsp1800_mmu.c | 6 ++-- hw/mips/mips_fulong2e.c | 5 +-- hw/mips/mips_jazz.c | 8 +++-- hw/mips/mips_malta.c | 6 ++-- hw/mips/mips_mipssim.c | 6 ++-- hw/mips/mips_r4k.c | 5 +-- hw/misc/ivshmem.c | 5 +-- hw/misc/vfio.c | 3 +- hw/moxie/moxiesim.c | 4 +-- hw/net/milkymist-minimac2.c | 2 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci-host/prep.c | 3 +- hw/pci/pci.c | 2 +- hw/ppc/mac_newworld.c | 3 +- hw/ppc/mac_oldworld.c | 3 +- hw/ppc/ppc405_boards.c | 8 +++-- hw/ppc/ppc405_uc.c | 3 +- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio.c | 2 +- hw/sh4/r2d.c | 2 +- hw/sh4/shix.c | 8 +++-- hw/sparc/leon3.c | 4 +-- hw/sparc/sun4m.c | 10 +++--- hw/sparc64/sun4u.c | 6 ++-- hw/unicore32/puv3.c | 3 +- hw/xtensa/sim.c | 4 +-- hw/xtensa/xtfpga.c | 8 +++-- include/exec/memory.h | 12 +++++-- include/exec/ram_addr.h | 4 +-- memory.c | 15 ++++---- numa.c | 4 +-- xen-hvm.c | 3 +- 81 files changed, 270 insertions(+), 162 deletions(-)
Signature · 1 line
1.9.3
PATCH v6 1/7 exec: add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr
Add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr so that we can handle errors.
--- exec.c | 36 +++++++++++++++++++++++++++--------- include/exec/ram_addr.h | 4 ++-- memory.c | 6 +++--- 3 files changed, 32 insertions(+), 14 deletions(-)
exec.c +27 -9
@@ -1224,7 +1224,7 @@ static int memory_try_enable_merging(void *addr, size_t len)return qemu_madvise (addr, len,QEMU_MADV_MERGEABLE ); } -static ram_addr_t ram_block_add (RAMBlock *new_block) +static ram_addr_t ram_block_add (RAMBlock *new_block,Error **errp) {RAMBlock *block;ram_addr_t old_ram_size, new_ram_size;
@@ -1241,9 +1241,11 @@ static ram_addr_t ram_block_add(RAMBlock *new_block) }else { new_block->host =phys_mem_alloc (new_block->length);if (!new_block->host) { -fprintf (stderr,"Cannot set up guest memory '%s': %s\n" , - new_block->mr->name,strerror (errno)); -exit (1 ); +error_setg_errno (errp, errno, +"cannot set up guest memory '%s'" , + new_block->mr->name); +qemu_mutex_unlock_ramlist (); +return -1 ; }memory_try_enable_merging (new_block->host, new_block->length); }
@@ -1294,6 +1296,8 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, Error **errp) {RAMBlock *new_block; +ram_addr_t addr; +Error *local_err =NULL ;if (xen_enabled ()) {error_setg (errp,"-mem-path not supported with Xen" );
@@ -1323,14 +1327,22 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, return -1; } -return ram_block_add (new_block); + addr =ram_block_add (new_block, &local_err); +if (local_err) { +g_free (new_block); +error_propagate (errp, local_err); +return -1 ; + } +return addr; }#endif ram_addr_t qemu_ram_alloc_from_ptr (ram_addr_t size,void *host, -MemoryRegion *mr) +MemoryRegion *mr,Error **errp) {RAMBlock *new_block; +ram_addr_t addr; +Error *local_err =NULL ; size =TARGET_PAGE_ALIGN (size); new_block =g_malloc0 (sizeof (*new_block));
@@ -1341,12 +1353,18 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,if (host) { new_block->flags |=RAM_PREALLOC ; } -return ram_block_add (new_block); + addr =ram_block_add (new_block, &local_err); +if (local_err) { +g_free (new_block); +error_propagate (errp, local_err); +return -1 ; + } +return addr; } -ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr) +ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr,Error **errp) { -return qemu_ram_alloc_from_ptr (size,NULL , mr); +return qemu_ram_alloc_from_ptr (size,NULL , mr, errp); }void qemu_ram_free_from_ptr (ram_addr_t addr)
include/exec/ram_addr.h +2 -2
@@ -26,8 +26,8 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, bool share, const char *mem_path, Error **errp);ram_addr_t qemu_ram_alloc_from_ptr (ram_addr_t size,void *host, -MemoryRegion *mr); -ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr); +MemoryRegion *mr,Error **errp); +ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr,Error **errp);int qemu_get_ram_fd (ram_addr_t addr);void *qemu_get_ram_block_host_ptr (ram_addr_t addr);void *qemu_get_ram_ptr (ram_addr_t addr);
memory.c +3 -3
@@ -1169,7 +1169,7 @@ void memory_region_init_ram(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram; - mr->ram_addr =qemu_ram_alloc (size, mr); + mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); }#ifdef __linux__
@@ -1199,7 +1199,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; - mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr); + mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr, &error_abort); } void memory_region_init_alias(MemoryRegion *mr,
@@ -1229,7 +1229,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, mr->terminates = true; mr->rom_device = true; mr->destructor = memory_region_destructor_rom_device; - mr->ram_addr =qemu_ram_alloc (size, mr); + mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); } void memory_region_init_iommu(MemoryRegion *mr,
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH v6 1/7] exec: add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr
Quoted 4 lines · Hu Tao
Add parameter errp to
qemu_ram_allocandqemu_ram_alloc_from_ptrso that we can handle errors.Signed-off-by Hu Tao <[email protected]>
Optional nit-picky suggestions below.
Quoted 20 lines
--- exec.c | 36 +++++++++++++++++++++++++++--------- include/exec/ram_addr.h | 4 ++-- memory.c | 6 +++--- 3 files changed, 32 insertions(+), 14 deletions(-)exec.c +1
-1@@ -1224,7 +1224,7 @@ static int memory_try_enable_merging(void *addr, size_t len)return qemu_madvise (addr, len,QEMU_MADV_MERGEABLE ); } -static ram_addr_t ram_block_add (RAMBlock *new_block) +static ram_addr_t ram_block_add (RAMBlock *new_block,Error **errp) {RAMBlock *block;ram_addr_t old_ram_size, new_ram_size;
exec.c static ram_addr_t ram_block_add(RAMBlock *new_block) · line 1246
Quoted 9 lines
exec.c +3
-3@@ -1241,9 +1241,11 @@ static ram_addr_t ram_block_add(RAMBlock *new_block) }else { new_block->host =phys_mem_alloc (new_block->length);if (!new_block->host) { -fprintf (stderr,"Cannot set up guest memory '%s': %s\n" , - new_block->mr->name,strerror (errno)); -exit (1 ); +error_setg_errno (errp, errno, +"cannot set up guest memory '%s'" , + new_block->mr->name);
Out of scope, but if you do need to respin you could change to memory_region_name to avoid the direct struct access of private mr fields.
Quoted 15 lines
exec.c +4
-0+qemu_mutex_unlock_ramlist (); +return -1 ; }memory_try_enable_merging (new_block->host, new_block->length); }@@ -1294,6 +1296,8 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, Error **errp) {RAMBlock *new_block; +ram_addr_t addr; +Error *local_err =NULL ;if (xen_enabled ()) {error_setg (errp,"-mem-path not supported with Xen" );
exec.c ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, · line 1335
Quoted 10 lines
exec.c +5
-1@@ -1323,14 +1327,22 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,return -1 ; } -return ram_block_add (new_block); + addr =ram_block_add (new_block, &local_err); +if (local_err) { +g_free (new_block); +error_propagate (errp, local_err); +return -1 ;
This should be redundant I think. You are unnecessarily defining the error return code in two places when you can just propagate the return code from the botched ram_block_add().
Quoted 16 lines
exec.c +5
-1+ } +return addr; }#endif ram_addr_t qemu_ram_alloc_from_ptr (ram_addr_t size,void *host, -MemoryRegion *mr) +MemoryRegion *mr,Error **errp) {RAMBlock *new_block; +ram_addr_t addr; +Error *local_err =NULL ; size =TARGET_PAGE_ALIGN (size);new_block = g_malloc0(sizeof(*new_block));
exec.c ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, · line 1360
Quoted 9 lines
exec.c +5
-1@@ -1341,12 +1353,18 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,if (host) { new_block->flags |=RAM_PREALLOC ; } -return ram_block_add (new_block); + addr =ram_block_add (new_block, &local_err); +if (local_err) { +g_free (new_block); +error_propagate (errp, local_err); +return -1 ;
Ditto.
Regards,
Peter
Quoted 62 lines
exec.c +4
-2+ } +return addr; } -ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr) +ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr,Error **errp) { -return qemu_ram_alloc_from_ptr (size,NULL , mr); +return qemu_ram_alloc_from_ptr (size,NULL , mr, errp); }void qemu_ram_free_from_ptr (ram_addr_t addr)include/exec/ram_addr.h +2
-2@@ -26,8 +26,8 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, bool share, const char *mem_path, Error **errp);ram_addr_t qemu_ram_alloc_from_ptr (ram_addr_t size,void *host, -MemoryRegion *mr); -ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr); +MemoryRegion *mr,Error **errp); +ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr,Error **errp);int qemu_get_ram_fd (ram_addr_t addr);void *qemu_get_ram_block_host_ptr (ram_addr_t addr);void *qemu_get_ram_ptr (ram_addr_t addr);memory.c +3
-4@@ -1169,7 +1169,7 @@ void memory_region_init_ram(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram; - mr->ram_addr =qemu_ram_alloc (size, mr); + mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); }#ifdef __linux__@@ -1199,7 +1199,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; - mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr); + mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr, &error_abort); } void memory_region_init_alias(MemoryRegion *mr,@@ -1229,7 +1229,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, mr->terminates = true; mr->rom_device = true; mr->destructor = memory_region_destructor_rom_device; - mr->ram_addr =qemu_ram_alloc (size, mr); + mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); } void memory_region_init_iommu(MemoryRegion *mr, --1.9.3
Re: [Qemu-devel] [PATCH v6 1/7] exec: add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr
Quoted 35 lines · Peter Crosthwaite
Quoted 4 lines · Hu Tao
Add parameter errp to
qemu_ram_allocandqemu_ram_alloc_from_ptrso that we can handle errors.Signed-off-by Hu Tao <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>Optional nit-picky suggestions below.
Quoted 25 lines
--- exec.c | 36 +++++++++++++++++++++++++++--------- include/exec/ram_addr.h | 4 ++-- memory.c | 6 +++--- 3 files changed, 32 insertions(+), 14 deletions(-)exec.c +1
-3@@ -1224,7 +1224,7 @@ static int memory_try_enable_merging(void *addr, size_t len)return qemu_madvise (addr, len,QEMU_MADV_MERGEABLE ); } -static ram_addr_t ram_block_add (RAMBlock *new_block) +static ram_addr_t ram_block_add (RAMBlock *new_block,Error **errp) {RAMBlock *block;ram_addr_t old_ram_size, new_ram_size;@@ -1241,9 +1241,11 @@ static ram_addr_t ram_block_add(RAMBlock *new_block) }else { new_block->host =phys_mem_alloc (new_block->length);if (!new_block->host) { -fprintf (stderr,"Cannot set up guest memory '%s': %s\n" , - new_block->mr->name,strerror (errno));
Quoted 8 lines
exec.c static ram_addr_t ram_block_add(RAMBlock *new_block) · line 1246
Quoted 4 lines
exec.c +3
-1-exit (1 ); +error_setg_errno (errp, errno, +"cannot set up guest memory '%s'" , + new_block->mr->name);Out of scope, but if you do need to respin you could change to
memory_region_nameto avoid the direct struct access of private mr fields.
Okay.
Quoted 25 lines
Quoted 24 lines
exec.c +8
-1+qemu_mutex_unlock_ramlist (); +return -1 ; }memory_try_enable_merging (new_block->host, new_block->length); }@@ -1294,6 +1296,8 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, Error **errp) {RAMBlock *new_block; +ram_addr_t addr; +Error *local_err =NULL ;if (xen_enabled ()) {error_setg (errp,"-mem-path not supported with Xen" );@@ -1323,14 +1327,22 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,return -1 ; } -return ram_block_add (new_block); + addr =ram_block_add (new_block, &local_err); +if (local_err) { +g_free (new_block); +error_propagate (errp, local_err);
Quoted 5 lines
exec.c ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, · line 1334
Quoted 1 line
exec.c +1
-0+return -1 ;This should be redundant I think. You are unnecessarily defining the error return code in two places when you can just propagate the return code from the botched
ram_block_add().
It did but mst suggested return -1 instead.
Regards,
Hu
Quoted 94 lines
Quoted 17 lines
exec.c +5
-1+ } +return addr; }#endif ram_addr_t qemu_ram_alloc_from_ptr (ram_addr_t size,void *host, -MemoryRegion *mr) +MemoryRegion *mr,Error **errp) {RAMBlock *new_block; +ram_addr_t addr; +Error *local_err =NULL ; size =TARGET_PAGE_ALIGN (size); new_block =g_malloc0 (sizeof (*new_block));exec.c ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, · line 1360
Quoted 9 lines
exec.c +5
-1@@ -1341,12 +1353,18 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,if (host) { new_block->flags |=RAM_PREALLOC ; } -return ram_block_add (new_block); + addr =ram_block_add (new_block, &local_err); +if (local_err) { +g_free (new_block); +error_propagate (errp, local_err); +return -1 ;Ditto.
Regards,
PeterQuoted 62 lines
exec.c +4
-2+ } +return addr; } -ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr) +ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr,Error **errp) { -return qemu_ram_alloc_from_ptr (size,NULL , mr); +return qemu_ram_alloc_from_ptr (size,NULL , mr, errp); }void qemu_ram_free_from_ptr (ram_addr_t addr)include/exec/ram_addr.h +2
-2@@ -26,8 +26,8 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, bool share, const char *mem_path, Error **errp);ram_addr_t qemu_ram_alloc_from_ptr (ram_addr_t size,void *host, -MemoryRegion *mr); -ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr); +MemoryRegion *mr,Error **errp); +ram_addr_t qemu_ram_alloc (ram_addr_t size,MemoryRegion *mr,Error **errp);int qemu_get_ram_fd (ram_addr_t addr);void *qemu_get_ram_block_host_ptr (ram_addr_t addr);void *qemu_get_ram_ptr (ram_addr_t addr);memory.c +3
-4@@ -1169,7 +1169,7 @@ void memory_region_init_ram(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram; - mr->ram_addr =qemu_ram_alloc (size, mr); + mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); }#ifdef __linux__@@ -1199,7 +1199,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; - mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr); + mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr, &error_abort); } void memory_region_init_alias(MemoryRegion *mr,@@ -1229,7 +1229,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, mr->terminates = true; mr->rom_device = true; mr->destructor = memory_region_destructor_rom_device; - mr->ram_addr =qemu_ram_alloc (size, mr); + mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); } void memory_region_init_iommu(MemoryRegion *mr, --1.9.3
Re: [Qemu-devel] [PATCH v6 1/7] exec: add parameter errp to qemu_ram_alloc and qemu_ram_alloc_from_ptr
Quoted 72 lines · Hu Tao
Quoted 35 lines · Peter Crosthwaite
Quoted 4 lines · Hu Tao
Add parameter errp to
qemu_ram_allocandqemu_ram_alloc_from_ptrso that we can handle errors.Signed-off-by Hu Tao <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>Optional nit-picky suggestions below.
Quoted 25 lines
--- exec.c | 36 +++++++++++++++++++++++++++--------- include/exec/ram_addr.h | 4 ++-- memory.c | 6 +++--- 3 files changed, 32 insertions(+), 14 deletions(-)exec.c +1
-3@@ -1224,7 +1224,7 @@ static int memory_try_enable_merging(void *addr, size_t len)return qemu_madvise (addr, len,QEMU_MADV_MERGEABLE ); } -static ram_addr_t ram_block_add (RAMBlock *new_block) +static ram_addr_t ram_block_add (RAMBlock *new_block,Error **errp) {RAMBlock *block;ram_addr_t old_ram_size, new_ram_size;@@ -1241,9 +1241,11 @@ static ram_addr_t ram_block_add(RAMBlock *new_block) }else { new_block->host =phys_mem_alloc (new_block->length);if (!new_block->host) { -fprintf (stderr,"Cannot set up guest memory '%s': %s\n" , - new_block->mr->name,strerror (errno));Quoted 8 lines
exec.c static ram_addr_t ram_block_add(RAMBlock *new_block) · line 1246
Quoted 4 lines
exec.c +3
-1-exit (1 ); +error_setg_errno (errp, errno, +"cannot set up guest memory '%s'" , + new_block->mr->name);Out of scope, but if you do need to respin you could change to
memory_region_nameto avoid the direct struct access of private mr fields.Okay.
Quoted 25 lines
Quoted 24 lines
exec.c +8
-1+qemu_mutex_unlock_ramlist (); +return -1 ; }memory_try_enable_merging (new_block->host, new_block->length); }@@ -1294,6 +1296,8 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, Error **errp) {RAMBlock *new_block; +ram_addr_t addr; +Error *local_err =NULL ;if (xen_enabled ()) {error_setg (errp,"-mem-path not supported with Xen" );@@ -1323,14 +1327,22 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,return -1 ; } -return ram_block_add (new_block); + addr =ram_block_add (new_block, &local_err); +if (local_err) { +g_free (new_block); +error_propagate (errp, local_err);
Quoted 8 lines
Quoted 5 lines
exec.c ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr, · line 1334
Quoted 1 line
exec.c +1
-0+return -1 ;This should be redundant I think. You are unnecessarily defining the error return code in two places when you can just propagate the return code from the botched
ram_block_add().It did but mst suggested return -1 instead.
Fair enough. Clash of personal prefs I guess.
Regards,
Peter
PATCH v6 2/7 memory: add parameter errp to memory_region_init_ram
In reply to Hu TaoAdd parameter errp to memory_region_init_ram and update all call sites to pass in &error_abort.
--- backends/hostmem-ram.c | 2 +- hw/alpha/typhoon.c | 3 ++- hw/arm/armv7m.c | 7 ++++--- hw/arm/cubieboard.c | 2 +- hw/arm/digic_boards.c | 2 +- hw/arm/exynos4210.c | 9 +++++---- hw/arm/highbank.c | 5 +++-- hw/arm/integratorcp.c | 5 +++-- hw/arm/kzm.c | 4 ++-- hw/arm/mainstone.c | 3 ++- hw/arm/musicpal.c | 6 ++++-- hw/arm/omap1.c | 6 ++++-- hw/arm/omap2.c | 6 ++++-- hw/arm/omap_sx1.c | 6 ++++-- hw/arm/palm.c | 3 ++- hw/arm/pxa2xx.c | 11 +++++++---- hw/arm/realview.c | 9 ++++++--- hw/arm/spitz.c | 2 +- hw/arm/strongarm.c | 3 ++- hw/arm/tosa.c | 2 +- hw/arm/versatilepb.c | 3 ++- hw/arm/vexpress.c | 15 ++++++++++----- hw/arm/virt.c | 3 ++- hw/arm/xilinx_zynq.c | 6 ++++-- hw/block/onenand.c | 2 +- hw/core/loader.c | 2 +- hw/cris/axis_dev88.c | 6 ++++-- hw/display/cg3.c | 6 ++++-- hw/display/qxl.c | 6 +++--- hw/display/sm501.c | 2 +- hw/display/tc6393xb.c | 3 ++- hw/display/tcx.c | 5 +++-- hw/display/vga.c | 3 ++- hw/display/vmware_vga.c | 3 ++- hw/i386/kvm/pci-assign.c | 3 ++- hw/i386/pc.c | 3 ++- hw/i386/pc_sysfw.c | 5 +++-- hw/input/milkymist-softusb.c | 4 ++-- hw/lm32/lm32_boards.c | 6 ++++-- hw/lm32/milkymist.c | 3 ++- hw/m68k/an5206.c | 4 ++-- hw/m68k/dummy_m68k.c | 2 +- hw/m68k/mcf5208.c | 4 ++-- hw/microblaze/petalogix_ml605_mmu.c | 5 +++-- hw/microblaze/petalogix_s3adsp1800_mmu.c | 6 ++++-- hw/mips/mips_fulong2e.c | 5 +++-- hw/mips/mips_jazz.c | 8 +++++--- hw/mips/mips_malta.c | 6 ++++-- hw/mips/mips_mipssim.c | 6 ++++-- hw/mips/mips_r4k.c | 5 +++-- hw/moxie/moxiesim.c | 4 ++-- hw/net/milkymist-minimac2.c | 2 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci-host/prep.c | 3 ++- hw/pci/pci.c | 2 +- hw/ppc/mac_newworld.c | 3 ++- hw/ppc/mac_oldworld.c | 3 ++- hw/ppc/ppc405_boards.c | 8 +++++--- hw/ppc/ppc405_uc.c | 3 ++- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio.c | 2 +- hw/sh4/r2d.c | 2 +- hw/sh4/shix.c | 8 +++++--- hw/sparc/leon3.c | 4 ++-- hw/sparc/sun4m.c | 10 ++++++---- hw/sparc64/sun4u.c | 6 ++++-- hw/unicore32/puv3.c | 3 ++- hw/xtensa/sim.c | 4 ++-- hw/xtensa/xtfpga.c | 8 +++++--- include/exec/memory.h | 4 +++- memory.c | 5 +++-- numa.c | 4 ++-- xen-hvm.c | 3 ++- 73 files changed, 203 insertions(+), 128 deletions(-)
backends/hostmem-ram.c +1 -1
@@ -27,7 +27,7 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) path =object_get_canonical_path_component (OBJECT (backend));memory_region_init_ram (&backend->mr,OBJECT (backend), path, - backend->size); + backend->size, &error_abort);g_free (path); }
hw/alpha/typhoon.c +2 -1
@@ -843,7 +843,8 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ -memory_region_init_ram (&s->ram_region,OBJECT (s),"ram" , ram_size); +memory_region_init_ram (&s->ram_region,OBJECT (s),"ram" , ram_size, + &error_abort);vmstate_register_ram_global (&s->ram_region);memory_region_add_subregion (addr_space,0 , &s->ram_region);
hw/arm/armv7m.c +4 -3
@@ -210,11 +210,12 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,#endif /* Flash programming is done via the SCU, so pretend it is ROM. */ -memory_region_init_ram (flash,NULL ,"armv7m.flash" , flash_size); +memory_region_init_ram (flash,NULL ,"armv7m.flash" , flash_size, + &error_abort);vmstate_register_ram_global (flash);memory_region_set_readonly (flash, true);memory_region_add_subregion (address_space_mem,0 , flash); -memory_region_init_ram (sram,NULL ,"armv7m.sram" , sram_size); +memory_region_init_ram (sram,NULL ,"armv7m.sram" , sram_size, &error_abort);vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,0x20000000 , sram);armv7m_bitband_init ();
@@ -255,7 +256,7 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,/* Hack to map an additional page of ram at the top of the address space. This stops qemu complaining about executing code outside RAM when returning from an exception. */ -memory_region_init_ram (hack,NULL ,"armv7m.hack" ,0x1000 ); +memory_region_init_ram (hack,NULL ,"armv7m.hack" ,0x1000 , &error_abort);vmstate_register_ram_global (hack);memory_region_add_subregion (address_space_mem,0xfffff000 , hack);
hw/arm/cubieboard.c +1 -1
@@ -64,7 +64,7 @@ static void cubieboard_init(MachineState *machine) }memory_region_init_ram (&s->sdram,NULL ,"cubieboard.ram" , - machine->ram_size); + machine->ram_size, &error_abort);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (get_system_memory (),AW_A10_SDRAM_BASE , &s->sdram);
hw/arm/digic_boards.c +1 -1
@@ -51,7 +51,7 @@ typedef struct DigicBoard {static void digic4_board_setup_ram (DigicBoardState *s,hwaddr ram_size) { -memory_region_init_ram (&s->ram,NULL ,"ram" , ram_size); +memory_region_init_ram (&s->ram,NULL ,"ram" , ram_size, &error_abort);memory_region_add_subregion (get_system_memory (),0 , &s->ram);vmstate_register_ram_global (&s->ram); }
hw/arm/exynos4210.c +5 -4
@@ -248,7 +248,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,/* Internal ROM */ memory_region_init_ram (&s->irom_mem,NULL ,"exynos4210.irom" , -EXYNOS4210_IROM_SIZE ); +EXYNOS4210_IROM_SIZE , &error_abort);vmstate_register_ram_global (&s->irom_mem);memory_region_set_readonly (&s->irom_mem, true); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_BASE_ADDR,
@@ -264,7 +264,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,/* Internal RAM */ memory_region_init_ram (&s->iram_mem,NULL ,"exynos4210.iram" , -EXYNOS4210_IRAM_SIZE ); +EXYNOS4210_IRAM_SIZE , &error_abort);vmstate_register_ram_global (&s->iram_mem);memory_region_add_subregion (system_mem,EXYNOS4210_IRAM_BASE_ADDR , &s->iram_mem);
@@ -273,13 +273,14 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, mem_size = ram_size;if (mem_size >EXYNOS4210_DRAM_MAX_SIZE ) {memory_region_init_ram (&s->dram1_mem,NULL ,"exynos4210.dram1" , - mem_size -EXYNOS4210_DRAM_MAX_SIZE ); + mem_size -EXYNOS4210_DRAM_MAX_SIZE , &error_abort);vmstate_register_ram_global (&s->dram1_mem);memory_region_add_subregion (system_mem,EXYNOS4210_DRAM1_BASE_ADDR , &s->dram1_mem); mem_size =EXYNOS4210_DRAM_MAX_SIZE ; } -memory_region_init_ram (&s->dram0_mem,NULL ,"exynos4210.dram0" , mem_size); +memory_region_init_ram (&s->dram0_mem,NULL ,"exynos4210.dram0" , mem_size, + &error_abort);vmstate_register_ram_global (&s->dram0_mem);memory_region_add_subregion (system_mem,EXYNOS4210_DRAM0_BASE_ADDR , &s->dram0_mem);
hw/arm/highbank.c +3 -2
@@ -255,12 +255,13 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) sysmem =get_system_memory (); dram =g_new (MemoryRegion,1 ); -memory_region_init_ram (dram,NULL ,"highbank.dram" , ram_size); +memory_region_init_ram (dram,NULL ,"highbank.dram" , ram_size, &error_abort);/* SDRAM at address zero. */ memory_region_add_subregion (sysmem,0 , dram); sysram =g_new (MemoryRegion,1 ); -memory_region_init_ram (sysram,NULL ,"highbank.sysram" ,0x8000 ); +memory_region_init_ram (sysram,NULL ,"highbank.sysram" ,0x8000 , + &error_abort);memory_region_add_subregion (sysmem,0xfff88000 , sysram);if (bios_name !=NULL ) { sysboot_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name);
hw/arm/integratorcp.c +3 -2
@@ -264,7 +264,8 @@ static int integratorcm_init(SysBusDevice *dev) s->cm_init =0x00000112 ; s->cm_refcnt_offset =muldiv64 (qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ),24 ,1000 ); -memory_region_init_ram (&s->flash,OBJECT (s),"integrator.flash" ,0x100000 ); +memory_region_init_ram (&s->flash,OBJECT (s),"integrator.flash" ,0x100000 , + &error_abort);vmstate_register_ram_global (&s->flash); memory_region_init_io(&s->iomem, OBJECT(s), &integratorcm_ops, s,
@@ -485,7 +486,7 @@ static void integratorcp_init(MachineState *machine)exit (1 ); } -memory_region_init_ram (ram,NULL ,"integrator.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"integrator.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);/* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */ /* ??? RAM should repeat to fill physical memory space. */
hw/arm/kzm.c +2 -2
@@ -97,14 +97,14 @@ static void kzm_init(MachineState *machine)/* On a real system, the first 16k is a `secure boot rom' */ -memory_region_init_ram (ram,NULL ,"kzm.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"kzm.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,KZM_RAMADDRESS , ram);memory_region_init_alias (ram_alias,NULL ,"ram.alias" , ram,0 , ram_size);memory_region_add_subregion (address_space_mem,0x88000000 , ram_alias); -memory_region_init_ram (sram,NULL ,"kzm.sram" ,0x4000 ); +memory_region_init_ram (sram,NULL ,"kzm.sram" ,0x4000 , &error_abort);memory_region_add_subregion (address_space_mem,0x1FFFC000 , sram); dev = sysbus_create_varargs("imx_avic", 0x68000000,
hw/arm/mainstone.c +2 -1
@@ -123,7 +123,8 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,/* Setup CPU & memory */ mpu =pxa270_init (address_space_mem, mainstone_binfo.ram_size, cpu_model); -memory_region_init_ram (rom,NULL ,"mainstone.rom" ,MAINSTONE_ROM ); +memory_region_init_ram (rom,NULL ,"mainstone.rom" ,MAINSTONE_ROM , + &error_abort);vmstate_register_ram_global (rom);memory_region_set_readonly (rom, true);memory_region_add_subregion (address_space_mem,0 , rom);
hw/arm/musicpal.c +4 -2
@@ -1601,11 +1601,13 @@ static void musicpal_init(MachineState *machine) }/* For now we use a fixed - the original - RAM size */ -memory_region_init_ram (ram,NULL ,"musicpal.ram" ,MP_RAM_DEFAULT_SIZE ); +memory_region_init_ram (ram,NULL ,"musicpal.ram" ,MP_RAM_DEFAULT_SIZE , + &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram); -memory_region_init_ram (sram,NULL ,"musicpal.sram" ,MP_SRAM_SIZE ); +memory_region_init_ram (sram,NULL ,"musicpal.sram" ,MP_SRAM_SIZE , + &error_abort);vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,MP_SRAM_BASE , sram);
hw/arm/omap1.c +4 -2
@@ -3854,10 +3854,12 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,omap_clk_init (s);/* Memory-mapped stuff */ -memory_region_init_ram (&s->emiff_ram,NULL ,"omap1.dram" , s->sdram_size); +memory_region_init_ram (&s->emiff_ram,NULL ,"omap1.dram" , s->sdram_size, + &error_abort);vmstate_register_ram_global (&s->emiff_ram);memory_region_add_subregion (system_memory,OMAP_EMIFF_BASE , &s->emiff_ram); -memory_region_init_ram (&s->imif_ram,NULL ,"omap1.sram" , s->sram_size); +memory_region_init_ram (&s->imif_ram,NULL ,"omap1.sram" , s->sram_size, + &error_abort);vmstate_register_ram_global (&s->imif_ram);memory_region_add_subregion (system_memory,OMAP_IMIF_BASE , &s->imif_ram);
hw/arm/omap2.c +4 -2
@@ -2266,10 +2266,12 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,omap_clk_init (s);/* Memory-mapped stuff */ -memory_region_init_ram (&s->sdram,NULL ,"omap2.dram" , s->sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"omap2.dram" , s->sdram_size, + &error_abort);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (sysmem,OMAP2_Q2_BASE , &s->sdram); -memory_region_init_ram (&s->sram,NULL ,"omap2.sram" , s->sram_size); +memory_region_init_ram (&s->sram,NULL ,"omap2.sram" , s->sram_size, + &error_abort);vmstate_register_ram_global (&s->sram);memory_region_add_subregion (sysmem,OMAP2_SRAM_BASE , &s->sram);
hw/arm/omap_sx1.c +4 -2
@@ -122,7 +122,8 @@ static void sx1_init(MachineState *machine, const int version) machine->cpu_model);/* External Flash (EMIFS) */ -memory_region_init_ram (flash,NULL ,"omap_sx1.flash0-0" , flash_size); +memory_region_init_ram (flash,NULL ,"omap_sx1.flash0-0" , flash_size, + &error_abort);vmstate_register_ram_global (flash);memory_region_set_readonly (flash, true);memory_region_add_subregion (address_space,OMAP_CS0_BASE , flash);
@@ -164,7 +165,8 @@ static void sx1_init(MachineState *machine, const int version)if ((version ==1 ) && (dinfo =drive_get (IF_PFLASH ,0 , fl_idx)) !=NULL ) { -memory_region_init_ram (flash_1,NULL ,"omap_sx1.flash1-0" , flash1_size); +memory_region_init_ram (flash_1,NULL ,"omap_sx1.flash1-0" , flash1_size, + &error_abort);vmstate_register_ram_global (flash_1);memory_region_set_readonly (flash_1, true);memory_region_add_subregion (address_space,OMAP_CS1_BASE , flash_1);
hw/arm/palm.c +2 -1
@@ -212,7 +212,8 @@ static void palmte_init(MachineState *machine) mpu =omap310_mpu_init (address_space_mem, sdram_size, cpu_model);/* External Flash (EMIFS) */ -memory_region_init_ram (flash,NULL ,"palmte.flash" , flash_size); +memory_region_init_ram (flash,NULL ,"palmte.flash" , flash_size, + &error_abort);vmstate_register_ram_global (flash);memory_region_set_readonly (flash, true);memory_region_add_subregion (address_space_mem,OMAP_CS0_BASE , flash);
hw/arm/pxa2xx.c +7 -4
@@ -2055,10 +2055,12 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, s->reset =qemu_allocate_irq (pxa2xx_reset, s,0 );/* SDRAM & Internal Memory Storage */ -memory_region_init_ram (&s->sdram,NULL ,"pxa270.sdram" , sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"pxa270.sdram" , sdram_size, + &error_abort);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (address_space,PXA2XX_SDRAM_BASE , &s->sdram); -memory_region_init_ram (&s->internal,NULL ,"pxa270.internal" ,0x40000 ); +memory_region_init_ram (&s->internal,NULL ,"pxa270.internal" ,0x40000 , + &error_abort);vmstate_register_ram_global (&s->internal);memory_region_add_subregion (address_space,PXA2XX_INTERNAL_BASE , &s->internal);
@@ -2186,11 +2188,12 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) s->reset =qemu_allocate_irq (pxa2xx_reset, s,0 );/* SDRAM & Internal Memory Storage */ -memory_region_init_ram (&s->sdram,NULL ,"pxa255.sdram" , sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"pxa255.sdram" , sdram_size, + &error_abort);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (address_space,PXA2XX_SDRAM_BASE , &s->sdram);memory_region_init_ram (&s->internal,NULL ,"pxa255.internal" , -PXA2XX_INTERNAL_SIZE ); +PXA2XX_INTERNAL_SIZE , &error_abort);vmstate_register_ram_global (&s->internal);memory_region_add_subregion (address_space,PXA2XX_INTERNAL_BASE , &s->internal);
hw/arm/realview.c +6 -3
@@ -137,12 +137,14 @@ static void realview_init(MachineState *machine,/* Core tile RAM. */ low_ram_size = ram_size -0x20000000 ; ram_size =0x20000000 ; -memory_region_init_ram (ram_lo,NULL ,"realview.lowmem" , low_ram_size); +memory_region_init_ram (ram_lo,NULL ,"realview.lowmem" , low_ram_size, + &error_abort);vmstate_register_ram_global (ram_lo);memory_region_add_subregion (sysmem,0x20000000 , ram_lo); } -memory_region_init_ram (ram_hi,NULL ,"realview.highmem" , ram_size); +memory_region_init_ram (ram_hi,NULL ,"realview.highmem" , ram_size, + &error_abort);vmstate_register_ram_global (ram_hi); low_ram_size = ram_size;if (low_ram_size >0x10000000 )
@@ -337,7 +339,8 @@ static void realview_init(MachineState *machine,startup code. I guess this works on real hardware because the BootROM happens to be in ROM/flash or in memory that isn't clobbered until after Linux boots the secondary CPUs. */ -memory_region_init_ram (ram_hack,NULL ,"realview.hack" ,0x1000 ); +memory_region_init_ram (ram_hack,NULL ,"realview.hack" ,0x1000 , + &error_abort);vmstate_register_ram_global (ram_hack);memory_region_add_subregion (sysmem,SMP_BOOT_ADDR , ram_hack);
hw/arm/spitz.c +1 -1
@@ -912,7 +912,7 @@ static void spitz_common_init(MachineState *machine,sl_flash_register (mpu, (model == spitz) ?FLASH_128M :FLASH_1024M ); -memory_region_init_ram (rom,NULL ,"spitz.rom" ,SPITZ_ROM ); +memory_region_init_ram (rom,NULL ,"spitz.rom" ,SPITZ_ROM , &error_abort);vmstate_register_ram_global (rom);memory_region_set_readonly (rom, true);memory_region_add_subregion (address_space_mem,0 , rom);
hw/arm/strongarm.c +2 -1
@@ -1604,7 +1604,8 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,exit (1 ); } -memory_region_init_ram (&s->sdram,NULL ,"strongarm.sdram" , sdram_size); +memory_region_init_ram (&s->sdram,NULL ,"strongarm.sdram" , sdram_size, + &error_abort);vmstate_register_ram_global (&s->sdram);memory_region_add_subregion (sysmem,SA_SDCS0 , &s->sdram);
hw/arm/tosa.c +1 -1
@@ -228,7 +228,7 @@ static void tosa_init(MachineState *machine) mpu =pxa255_init (address_space_mem, tosa_binfo.ram_size); -memory_region_init_ram (rom,NULL ,"tosa.rom" ,TOSA_ROM ); +memory_region_init_ram (rom,NULL ,"tosa.rom" ,TOSA_ROM , &error_abort);vmstate_register_ram_global (rom);memory_region_set_readonly (rom, true);memory_region_add_subregion (address_space_mem,0 , rom);
hw/arm/versatilepb.c +2 -1
@@ -198,7 +198,8 @@ static void versatile_init(MachineState *machine, int board_id)fprintf (stderr,"Unable to find CPU definition\n" );exit (1 ); } -memory_region_init_ram (ram,NULL ,"versatile.ram" , machine->ram_size); +memory_region_init_ram (ram,NULL ,"versatile.ram" , machine->ram_size, + &error_abort);vmstate_register_ram_global (ram);/* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero. */
hw/arm/vexpress.c +10 -5
@@ -252,7 +252,8 @@ static void a9_daughterboard_init(const VEDBoardInfo *daughterboard,exit (1 ); } -memory_region_init_ram (ram,NULL ,"vexpress.highmem" , ram_size); +memory_region_init_ram (ram,NULL ,"vexpress.highmem" , ram_size, + &error_abort);vmstate_register_ram_global (ram); low_ram_size = ram_size;if (low_ram_size >0x4000000 ) {
@@ -346,7 +347,8 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard, } } -memory_region_init_ram (ram,NULL ,"vexpress.highmem" , ram_size); +memory_region_init_ram (ram,NULL ,"vexpress.highmem" , ram_size, + &error_abort);vmstate_register_ram_global (ram);/* RAM is from 0x80000000 upwards; there is no low-memory alias for it. */ memory_region_add_subregion (sysmem,0x80000000 , ram);
@@ -364,7 +366,8 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard,/* 0x2b060000: SP805 watchdog: not modelled */ /* 0x2b0a0000: PL341 dynamic memory controller: not modelled */ /* 0x2e000000: system SRAM */ -memory_region_init_ram (sram,NULL ,"vexpress.a15sram" ,0x10000 ); +memory_region_init_ram (sram,NULL ,"vexpress.a15sram" ,0x10000 , + &error_abort);vmstate_register_ram_global (sram);memory_region_add_subregion (sysmem,0x2e000000 , sram);
@@ -634,12 +637,14 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard, } sram_size =0x2000000 ; -memory_region_init_ram (sram,NULL ,"vexpress.sram" , sram_size); +memory_region_init_ram (sram,NULL ,"vexpress.sram" , sram_size, + &error_abort);vmstate_register_ram_global (sram);memory_region_add_subregion (sysmem, map[VE_SRAM ], sram); vram_size =0x800000 ; -memory_region_init_ram (vram,NULL ,"vexpress.vram" , vram_size); +memory_region_init_ram (vram,NULL ,"vexpress.vram" , vram_size, + &error_abort);vmstate_register_ram_global (vram);memory_region_add_subregion (sysmem, map[VE_VIDEORAM ], vram);
hw/arm/virt.c +2 -1
@@ -489,7 +489,8 @@ static void machvirt_init(MachineState *machine)fdt_add_cpu_nodes (vbi);fdt_add_psci_node (vbi); -memory_region_init_ram (ram,NULL ,"mach-virt.ram" , machine->ram_size); +memory_region_init_ram (ram,NULL ,"mach-virt.ram" , machine->ram_size, + &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (sysmem, vbi->memmap[VIRT_MEM ].base, ram);
hw/arm/xilinx_zynq.c +4 -2
@@ -149,12 +149,14 @@ static void zynq_init(MachineState *machine) }/* DDR remapped to address zero. */ -memory_region_init_ram (ext_ram,NULL ,"zynq.ext_ram" , ram_size); +memory_region_init_ram (ext_ram,NULL ,"zynq.ext_ram" , ram_size, + &error_abort);vmstate_register_ram_global (ext_ram);memory_region_add_subregion (address_space_mem,0 , ext_ram);/* 256K of on-chip memory */ -memory_region_init_ram (ocm_ram,NULL ,"zynq.ocm_ram" ,256 <<10 ); +memory_region_init_ram (ocm_ram,NULL ,"zynq.ocm_ram" ,256 <<10 , + &error_abort);vmstate_register_ram_global (ocm_ram);memory_region_add_subregion (address_space_mem,0xFFFC0000 , ocm_ram);
hw/block/onenand.c +1 -1
@@ -789,7 +789,7 @@ static int onenand_initfn(SysBusDevice *sbd) s->otp =memset (g_malloc ((64 +2 ) <<PAGE_SHIFT ),0xff , (64 +2 ) <<PAGE_SHIFT );memory_region_init_ram (&s->ram,OBJECT (s),"onenand.ram" , -0xc000 << s->shift); +0xc000 << s->shift, &error_abort);vmstate_register_ram_global (&s->ram); ram =memory_region_get_ram_ptr (&s->ram); s->boot[0 ] = ram + (0x0000 << s->shift);
hw/core/loader.c +1 -1
@@ -632,7 +632,7 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name)void *data; rom->mr =g_malloc (sizeof (*rom->mr)); -memory_region_init_ram (rom->mr, owner, name, rom->datasize); +memory_region_init_ram (rom->mr, owner, name, rom->datasize, &error_abort);memory_region_set_readonly (rom->mr, true);vmstate_register_ram_global (rom->mr);
hw/cris/axis_dev88.c +4 -2
@@ -270,13 +270,15 @@ void axisdev88_init(MachineState *machine) env = &cpu->env;/* allocate RAM */ -memory_region_init_ram (phys_ram,NULL ,"axisdev88.ram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"axisdev88.ram" , ram_size, + &error_abort);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem,0x40000000 , phys_ram);/* The ETRAX-FS has 128Kb on chip ram, the docs refer to it as the internal memory. */ -memory_region_init_ram (phys_intmem,NULL ,"axisdev88.chipram" ,INTMEM_SIZE ); +memory_region_init_ram (phys_intmem,NULL ,"axisdev88.chipram" ,INTMEM_SIZE , + &error_abort);vmstate_register_ram_global (phys_intmem);memory_region_add_subregion (address_space_mem,0x38000000 , phys_intmem);
hw/display/cg3.c +4 -2
@@ -279,7 +279,8 @@ static void cg3_initfn(Object *obj)SysBusDevice *sbd =SYS_BUS_DEVICE (obj);CG3State *s =CG3 (obj); -memory_region_init_ram (&s->rom,NULL ,"cg3.prom" ,FCODE_MAX_ROM_SIZE ); +memory_region_init_ram (&s->rom,NULL ,"cg3.prom" ,FCODE_MAX_ROM_SIZE , + &error_abort);memory_region_set_readonly (&s->rom, true);sysbus_init_mmio (sbd, &s->rom);
@@ -306,7 +307,8 @@ static void cg3_realizefn(DeviceState *dev, Error **errp) } } -memory_region_init_ram (&s->vram_mem,NULL ,"cg3.vram" , s->vram_size); +memory_region_init_ram (&s->vram_mem,NULL ,"cg3.vram" , s->vram_size, + &error_abort);vmstate_register_ram_global (&s->vram_mem);sysbus_init_mmio (sbd, &s->vram_mem);
hw/display/qxl.c +3 -3
@@ -1979,14 +1979,14 @@ static int qxl_init_common(PCIQXLDevice *qxl) qxl->rom_size =qxl_rom_size ();memory_region_init_ram (&qxl->rom_bar,OBJECT (qxl),"qxl.vrom" , - qxl->rom_size); + qxl->rom_size, &error_abort);vmstate_register_ram (&qxl->rom_bar, &qxl->pci.qdev);init_qxl_rom (qxl);init_qxl_ram (qxl); qxl->guest_surfaces.cmds =g_new0 (QXLPHYSICAL , qxl->ssd.num_surfaces);memory_region_init_ram (&qxl->vram_bar,OBJECT (qxl),"qxl.vram" , - qxl->vram_size); + qxl->vram_size, &error_abort);vmstate_register_ram (&qxl->vram_bar, &qxl->pci.qdev);memory_region_init_alias (&qxl->vram32_bar,OBJECT (qxl),"qxl.vram32" , &qxl->vram_bar,0 , qxl->vram32_size);
@@ -2094,7 +2094,7 @@ static int qxl_init_secondary(PCIDevice *dev) qxl->id = device_id++;qxl_init_ramsize (qxl);memory_region_init_ram (&qxl->vga.vram,OBJECT (dev),"qxl.vgavram" , - qxl->vga.vram_size); + qxl->vga.vram_size, &error_abort);vmstate_register_ram (&qxl->vga.vram, &qxl->pci.qdev); qxl->vga.vram_ptr =memory_region_get_ram_ptr (&qxl->vga.vram); qxl->vga.con =graphic_console_init (DEVICE (dev),0 , &qxl_ops, qxl);
hw/display/sm501.c +1 -1
@@ -1410,7 +1410,7 @@ void sm501_init(MemoryRegion *address_space_mem, uint32_t base,/* allocate local memory */ memory_region_init_ram (&s->local_mem_region,NULL ,"sm501.local" , - local_mem_bytes); + local_mem_bytes, &error_abort);vmstate_register_ram_global (&s->local_mem_region); s->local_mem =memory_region_get_ram_ptr (&s->local_mem_region);memory_region_add_subregion (address_space_mem, base, &s->local_mem_region);
hw/display/tc6393xb.c +2 -1
@@ -581,7 +581,8 @@ TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq)memory_region_init_io (&s->iomem,NULL , &tc6393xb_ops, s,"tc6393xb" ,0x10000 );memory_region_add_subregion (sysmem, base, &s->iomem); -memory_region_init_ram (&s->vram,NULL ,"tc6393xb.vram" ,0x100000 ); +memory_region_init_ram (&s->vram,NULL ,"tc6393xb.vram" ,0x100000 , + &error_abort);vmstate_register_ram_global (&s->vram); s->vram_ptr =memory_region_get_ram_ptr (&s->vram);memory_region_add_subregion (sysmem, base +0x100000 , &s->vram);
hw/display/tcx.c +3 -2
@@ -535,7 +535,8 @@ static void tcx_initfn(Object *obj)SysBusDevice *sbd =SYS_BUS_DEVICE (obj);TCXState *s =TCX (obj); -memory_region_init_ram (&s->rom,NULL ,"tcx.prom" ,FCODE_MAX_ROM_SIZE ); +memory_region_init_ram (&s->rom,NULL ,"tcx.prom" ,FCODE_MAX_ROM_SIZE , + &error_abort);memory_region_set_readonly (&s->rom, true);sysbus_init_mmio (sbd, &s->rom);
@@ -567,7 +568,7 @@ static void tcx_realizefn(DeviceState *dev, Error **errp)char *fcode_filename;memory_region_init_ram (&s->vram_mem,OBJECT (s),"tcx.vram" , - s->vram_size * (1 +4 +4 )); + s->vram_size * (1 +4 +4 ), &error_abort);vmstate_register_ram_global (&s->vram_mem); vram_base =memory_region_get_ram_ptr (&s->vram_mem);
hw/display/vga.c +2 -1
@@ -2291,7 +2291,8 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate) s->vram_size_mb = s->vram_size >>20 ; s->is_vbe_vmstate =1 ; -memory_region_init_ram (&s->vram, obj,"vga.vram" , s->vram_size); +memory_region_init_ram (&s->vram, obj,"vga.vram" , s->vram_size, + &error_abort);vmstate_register_ram (&s->vram, global_vmstate ?NULL :DEVICE (obj));xen_register_framebuffer (&s->vram); s->vram_ptr =memory_region_get_ram_ptr (&s->vram);
hw/display/vmware_vga.c +2 -1
@@ -1201,7 +1201,8 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s, s->vga.con =graphic_console_init (dev,0 , &vmsvga_ops, s); s->fifo_size =SVGA_FIFO_SIZE ; -memory_region_init_ram (&s->fifo_ram,NULL ,"vmsvga.fifo" , s->fifo_size); +memory_region_init_ram (&s->fifo_ram,NULL ,"vmsvga.fifo" , s->fifo_size, + &error_abort);vmstate_register_ram_global (&s->fifo_ram); s->fifo_ptr =memory_region_get_ram_ptr (&s->fifo_ram);
hw/i386/kvm/pci-assign.c +2 -1
@@ -1943,7 +1943,8 @@ static void assigned_dev_load_option_rom(AssignedDevice *dev)snprintf (name,sizeof (name),"%s.rom" ,object_get_typename (OBJECT (dev))); -memory_region_init_ram (&dev->dev.rom,OBJECT (dev), name, st.st_size); +memory_region_init_ram (&dev->dev.rom,OBJECT (dev), name, st.st_size, + &error_abort);vmstate_register_ram (&dev->dev.rom, &dev->dev.qdev); ptr =memory_region_get_ram_ptr (&dev->dev.rom);memset (ptr,0xff , st.st_size);
hw/i386/pc.c +2 -1
@@ -1297,7 +1297,8 @@ FWCfgState *pc_memory_init(MachineState *machine,pc_system_firmware_init (rom_memory, guest_info->isapc_ram_fw); option_rom_mr =g_malloc (sizeof (*option_rom_mr)); -memory_region_init_ram (option_rom_mr,NULL ,"pc.rom" ,PC_ROM_SIZE ); +memory_region_init_ram (option_rom_mr,NULL ,"pc.rom" ,PC_ROM_SIZE , + &error_abort);vmstate_register_ram_global (option_rom_mr); memory_region_add_subregion_overlap(rom_memory, PC_ROM_MIN_VGA,
hw/i386/pc_sysfw.c +3 -2
@@ -55,7 +55,8 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,/* map the last 128KB of the BIOS in ISA space */ isa_bios_size =MIN (flash_size,128 *1024 ); isa_bios =g_malloc (sizeof (*isa_bios)); -memory_region_init_ram (isa_bios,NULL ,"isa-bios" , isa_bios_size); +memory_region_init_ram (isa_bios,NULL ,"isa-bios" , isa_bios_size, + &error_abort);vmstate_register_ram_global (isa_bios); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size,
@@ -192,7 +193,7 @@ 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); +memory_region_init_ram (bios,NULL ,"pc.bios" , bios_size, &error_abort);vmstate_register_ram_global (bios);if (!isapc_ram_fw) {memory_region_set_readonly (bios, true);
hw/input/milkymist-softusb.c +2 -2
@@ -250,12 +250,12 @@ static int milkymist_softusb_init(SysBusDevice *dev)/* register pmem and dmem */ memory_region_init_ram (&s->pmem,OBJECT (s),"milkymist-softusb.pmem" , - s->pmem_size); + s->pmem_size, &error_abort);vmstate_register_ram_global (&s->pmem); s->pmem_ptr =memory_region_get_ram_ptr (&s->pmem);sysbus_init_mmio (dev, &s->pmem);memory_region_init_ram (&s->dmem,OBJECT (s),"milkymist-softusb.dmem" , - s->dmem_size); + s->dmem_size, &error_abort);vmstate_register_ram_global (&s->dmem); s->dmem_ptr =memory_region_get_ram_ptr (&s->dmem);sysbus_init_mmio (dev, &s->dmem);
hw/lm32/lm32_boards.c +4 -2
@@ -111,7 +111,8 @@ static void lm32_evr_init(MachineState *machine) reset_info->flash_base = flash_base; -memory_region_init_ram (phys_ram,NULL ,"lm32_evr.sdram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"lm32_evr.sdram" , ram_size, + &error_abort);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);
@@ -213,7 +214,8 @@ static void lm32_uclinux_init(MachineState *machine) reset_info->flash_base = flash_base; -memory_region_init_ram (phys_ram,NULL ,"lm32_uclinux.sdram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"lm32_uclinux.sdram" , ram_size, + &error_abort);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);
hw/lm32/milkymist.c +2 -1
@@ -118,7 +118,8 @@ milkymist_init(MachineState *machine)cpu_lm32_set_phys_msb_ignore (env,1 ); -memory_region_init_ram (phys_sdram,NULL ,"milkymist.sdram" , sdram_size); +memory_region_init_ram (phys_sdram,NULL ,"milkymist.sdram" , sdram_size, + &error_abort);vmstate_register_ram_global (phys_sdram);memory_region_add_subregion (address_space_mem, sdram_base, phys_sdram);
hw/m68k/an5206.c +2 -2
@@ -50,12 +50,12 @@ static void an5206_init(MachineState *machine) env->rambar0 =AN5206_RAMBAR_ADDR |1 ;/* DRAM at address zero */ -memory_region_init_ram (ram,NULL ,"an5206.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"an5206.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram);/* Internal SRAM. */ -memory_region_init_ram (sram,NULL ,"an5206.sram" ,512 ); +memory_region_init_ram (sram,NULL ,"an5206.sram" ,512 , &error_abort);vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,AN5206_RAMBAR_ADDR , sram);
hw/m68k/dummy_m68k.c +1 -1
@@ -40,7 +40,7 @@ static void dummy_m68k_init(MachineState *machine) env->vbr =0 ;/* RAM at address zero */ -memory_region_init_ram (ram,NULL ,"dummy_m68k.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"dummy_m68k.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram);
hw/m68k/mcf5208.c +2 -2
@@ -218,12 +218,12 @@ static void mcf5208evb_init(MachineState *machine)/* TODO: Configure BARs. */ /* DRAM at 0x40000000 */ -memory_region_init_ram (ram,NULL ,"mcf5208.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mcf5208.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0x40000000 , ram);/* Internal SRAM. */ -memory_region_init_ram (sram,NULL ,"mcf5208.sram" ,16384 ); +memory_region_init_ram (sram,NULL ,"mcf5208.sram" ,16384 , &error_abort);vmstate_register_ram_global (sram);memory_region_add_subregion (address_space_mem,0x80000000 , sram);
hw/microblaze/petalogix_ml605_mmu.c +3 -2
@@ -100,11 +100,12 @@ petalogix_ml605_init(MachineState *machine)/* Attach emulated BRAM through the LMB. */ memory_region_init_ram (phys_lmb_bram,NULL ,"petalogix_ml605.lmb_bram" , -LMB_BRAM_SIZE ); +LMB_BRAM_SIZE , &error_abort);vmstate_register_ram_global (phys_lmb_bram);memory_region_add_subregion (address_space_mem,0x00000000 , phys_lmb_bram); -memory_region_init_ram (phys_ram,NULL ,"petalogix_ml605.ram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"petalogix_ml605.ram" , ram_size, + &error_abort);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (address_space_mem, ddr_base, phys_ram);
hw/microblaze/petalogix_s3adsp1800_mmu.c +4 -2
@@ -81,11 +81,13 @@ petalogix_s3adsp1800_init(MachineState *machine)/* Attach emulated BRAM through the LMB. */ memory_region_init_ram (phys_lmb_bram,NULL , -"petalogix_s3adsp1800.lmb_bram" ,LMB_BRAM_SIZE ); +"petalogix_s3adsp1800.lmb_bram" ,LMB_BRAM_SIZE , + &error_abort);vmstate_register_ram_global (phys_lmb_bram);memory_region_add_subregion (sysmem,0x00000000 , phys_lmb_bram); -memory_region_init_ram (phys_ram,NULL ,"petalogix_s3adsp1800.ram" , ram_size); +memory_region_init_ram (phys_ram,NULL ,"petalogix_s3adsp1800.ram" , + ram_size, &error_abort);vmstate_register_ram_global (phys_ram);memory_region_add_subregion (sysmem, ddr_base, phys_ram);
hw/mips/mips_fulong2e.c +3 -2
@@ -302,9 +302,10 @@ static void mips_fulong2e_init(MachineState *machine) bios_size =1024 *1024 ;/* allocate RAM */ -memory_region_init_ram (ram,NULL ,"fulong2e.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"fulong2e.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram); -memory_region_init_ram (bios,NULL ,"fulong2e.bios" , bios_size); +memory_region_init_ram (bios,NULL ,"fulong2e.bios" , bios_size, + &error_abort);vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true);
hw/mips/mips_jazz.c +5 -3
@@ -179,11 +179,12 @@ static void mips_jazz_init(MemoryRegion *address_space, cc->do_unassigned_access = mips_jazz_do_unassigned_access;/* allocate RAM */ -memory_region_init_ram (ram,NULL ,"mips_jazz.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mips_jazz.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space,0 , ram); -memory_region_init_ram (bios,NULL ,"mips_jazz.bios" ,MAGNUM_BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"mips_jazz.bios" ,MAGNUM_BIOS_SIZE , + &error_abort);vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true); memory_region_init_alias(bios2, NULL, "mips_jazz.bios", bios,
@@ -244,7 +245,8 @@ static void mips_jazz_init(MemoryRegion *address_space, {/* Simple ROM, so user doesn't have to provide one */ MemoryRegion *rom_mr =g_new (MemoryRegion,1 ); -memory_region_init_ram (rom_mr,NULL ,"g364fb.rom" ,0x80000 ); +memory_region_init_ram (rom_mr,NULL ,"g364fb.rom" ,0x80000 , + &error_abort);vmstate_register_ram_global (rom_mr);memory_region_set_readonly (rom_mr, true);uint8_t *rom =memory_region_get_ram_ptr (rom_mr);
hw/mips/mips_malta.c +4 -2
@@ -992,7 +992,8 @@ void mips_malta_init(MachineState *machine) }/* register RAM at high address where it is undisturbed by IO */ -memory_region_init_ram (ram_high,NULL ,"mips_malta.ram" , ram_size); +memory_region_init_ram (ram_high,NULL ,"mips_malta.ram" , ram_size, + &error_abort);vmstate_register_ram_global (ram_high);memory_region_add_subregion (system_memory,0x80000000 , ram_high);
@@ -1116,7 +1117,8 @@ void mips_malta_init(MachineState *machine)* handled by an overlapping region as the resulting ROM code subpage * regions are not executable. */ -memory_region_init_ram (bios_copy,NULL ,"bios.1fc" ,BIOS_SIZE ); +memory_region_init_ram (bios_copy,NULL ,"bios.1fc" ,BIOS_SIZE , + &error_abort);if (!rom_copy (memory_region_get_ram_ptr (bios_copy),FLASH_ADDRESS ,BIOS_SIZE )) { memcpy(memory_region_get_ram_ptr(bios_copy),
hw/mips/mips_mipssim.c +4 -2
@@ -171,9 +171,11 @@ mips_mipssim_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate RAM. */ -memory_region_init_ram (ram,NULL ,"mips_mipssim.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mips_mipssim.ram" , ram_size, + &error_abort);vmstate_register_ram_global (ram); -memory_region_init_ram (bios,NULL ,"mips_mipssim.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"mips_mipssim.bios" ,BIOS_SIZE , + &error_abort);vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true);
hw/mips/mips_r4k.c +3 -2
@@ -204,7 +204,7 @@ void mips_r4k_init(MachineState *machine) ((unsigned int)ram_size / (1 << 20)));exit (1 ); } -memory_region_init_ram (ram,NULL ,"mips_r4k.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"mips_r4k.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0 , ram);
@@ -231,7 +231,8 @@ void mips_r4k_init(MachineState *machine)#endif if ((bios_size >0 ) && (bios_size <=BIOS_SIZE )) { bios =g_new (MemoryRegion,1 ); -memory_region_init_ram (bios,NULL ,"mips_r4k.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"mips_r4k.bios" ,BIOS_SIZE , + &error_abort);vmstate_register_ram_global (bios);memory_region_set_readonly (bios, true);memory_region_add_subregion (get_system_memory (),0x1fc00000 , bios);
hw/moxie/moxiesim.c +2 -2
@@ -123,11 +123,11 @@ static void moxiesim_init(MachineState *machine)qemu_register_reset (main_cpu_reset, cpu);/* Allocate RAM. */ -memory_region_init_ram (ram,NULL ,"moxiesim.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"moxiesim.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem, ram_base, ram); -memory_region_init_ram (rom,NULL ,"moxie.rom" ,128 *0x1000 ); +memory_region_init_ram (rom,NULL ,"moxie.rom" ,128 *0x1000 , &error_abort);vmstate_register_ram_global (rom);memory_region_add_subregion (get_system_memory (),0x1000 , rom);
hw/net/milkymist-minimac2.c +1 -1
@@ -472,7 +472,7 @@ static int milkymist_minimac2_init(SysBusDevice *sbd)/* register buffers memory */ memory_region_init_ram (&s->buffers,OBJECT (dev),"milkymist-minimac2.buffers" , - buffers_size); + buffers_size, &error_abort);vmstate_register_ram_global (&s->buffers); s->rx0_buf =memory_region_get_ram_ptr (&s->buffers); s->rx1_buf = s->rx0_buf +MINIMAC2_BUFFER_SIZE ;
hw/openrisc/openrisc_sim.c +1 -1
@@ -114,7 +114,7 @@ static void openrisc_sim_init(MachineState *machine) } ram =g_malloc (sizeof (*ram)); -memory_region_init_ram (ram,NULL ,"openrisc.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"openrisc.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (get_system_memory (),0 , ram);
hw/pci-host/prep.c +2 -1
@@ -299,7 +299,8 @@ static int raven_init(PCIDevice *d) d->config[0x0D ] =0x10 ;// latency_timer d->config[0x34 ] =0x00 ;// capabilities_pointer -memory_region_init_ram (&s->bios,OBJECT (s),"bios" ,BIOS_SIZE ); +memory_region_init_ram (&s->bios,OBJECT (s),"bios" ,BIOS_SIZE , + &error_abort);memory_region_set_readonly (&s->bios, true);memory_region_add_subregion (get_system_memory (), (uint32_t )(-BIOS_SIZE ), &s->bios);
hw/pci/pci.c +1 -1
@@ -1974,7 +1974,7 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)snprintf (name,sizeof (name),"%s.rom" ,object_get_typename (OBJECT (pdev))); } pdev->has_rom = true; -memory_region_init_ram (&pdev->rom,OBJECT (pdev), name, size); +memory_region_init_ram (&pdev->rom,OBJECT (pdev), name, size, &error_abort);vmstate_register_ram (&pdev->rom, &pdev->qdev); ptr =memory_region_get_ram_ptr (&pdev->rom);load_image (path, ptr);
hw/ppc/mac_newworld.c +2 -1
@@ -204,7 +204,8 @@ static void ppc_core99_init(MachineState *machine)memory_region_add_subregion (get_system_memory (),0 , ram);/* allocate and load BIOS */ -memory_region_init_ram (bios,NULL ,"ppc_core99.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"ppc_core99.bios" ,BIOS_SIZE , + &error_abort);vmstate_register_ram_global (bios);if (bios_name ==NULL )
hw/ppc/mac_oldworld.c +2 -1
@@ -135,7 +135,8 @@ static void ppc_heathrow_init(MachineState *machine)memory_region_add_subregion (sysmem,0 , ram);/* allocate and load BIOS */ -memory_region_init_ram (bios,NULL ,"ppc_heathrow.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"ppc_heathrow.bios" ,BIOS_SIZE , + &error_abort);vmstate_register_ram_global (bios);if (bios_name ==NULL )
hw/ppc/ppc405_boards.c +5 -3
@@ -214,7 +214,7 @@ static void ref405ep_init(MachineState *machine) 33333333, &pic, kernel_filename == NULL ? 0 : 1);/* allocate SRAM */ sram_size =512 *1024 ; -memory_region_init_ram (sram,NULL ,"ef405ep.sram" , sram_size); +memory_region_init_ram (sram,NULL ,"ef405ep.sram" , sram_size, &error_abort);vmstate_register_ram_global (sram);memory_region_add_subregion (sysmem,0xFFF00000 , sram);/* allocate and load BIOS */
@@ -246,7 +246,8 @@ static void ref405ep_init(MachineState *machine)printf ("Load BIOS from file\n" );#endif bios =g_new (MemoryRegion,1 ); -memory_region_init_ram (bios,NULL ,"ef405ep.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"ef405ep.bios" ,BIOS_SIZE , + &error_abort);vmstate_register_ram_global (bios);if (bios_name ==NULL )
@@ -572,7 +573,8 @@ static void taihu_405ep_init(MachineState *machine)if (bios_name ==NULL ) bios_name =BIOS_FILENAME ; bios =g_new (MemoryRegion,1 ); -memory_region_init_ram (bios,NULL ,"taihu_405ep.bios" ,BIOS_SIZE ); +memory_region_init_ram (bios,NULL ,"taihu_405ep.bios" ,BIOS_SIZE , + &error_abort);vmstate_register_ram_global (bios); filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name);if (filename) {
hw/ppc/ppc405_uc.c +2 -1
@@ -974,7 +974,8 @@ static void ppc405_ocm_init(CPUPPCState *env) ocm =g_malloc0 (sizeof (ppc405_ocm_t));/* XXX: Size is 4096 or 0x04000000 */ -memory_region_init_ram (&ocm->isarc_ram,NULL ,"ppc405.ocm" ,4096 ); +memory_region_init_ram (&ocm->isarc_ram,NULL ,"ppc405.ocm" ,4096 , + &error_abort);vmstate_register_ram_global (&ocm->isarc_ram);memory_region_init_alias (&ocm->dsarc_ram,NULL ,"ppc405.dsarc" , &ocm->isarc_ram,0 ,4096 );
hw/s390x/s390-virtio-ccw.c +1 -1
@@ -110,7 +110,7 @@ static void ccw_init(MachineState *machine)virtio_ccw_register_hcalls ();/* allocate RAM */ -memory_region_init_ram (ram,NULL ,"s390.ram" , my_ram_size); +memory_region_init_ram (ram,NULL ,"s390.ram" , my_ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (sysmem,0 , ram);
hw/s390x/s390-virtio.c +1 -1
@@ -256,7 +256,7 @@ static void s390_init(MachineState *machine)s390_virtio_register_hcalls ();/* allocate RAM */ -memory_region_init_ram (ram,NULL ,"s390.ram" , my_ram_size); +memory_region_init_ram (ram,NULL ,"s390.ram" , my_ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (sysmem,0 , ram);
hw/sh4/r2d.c +1 -1
@@ -255,7 +255,7 @@ static void r2d_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate memory space */ -memory_region_init_ram (sdram,NULL ,"r2d.sdram" ,SDRAM_SIZE ); +memory_region_init_ram (sdram,NULL ,"r2d.sdram" ,SDRAM_SIZE , &error_abort);vmstate_register_ram_global (sdram);memory_region_add_subregion (address_space_mem,SDRAM_BASE , sdram);/* Register peripherals */
hw/sh4/shix.c +5 -3
@@ -59,14 +59,16 @@ static void shix_init(MachineState *machine) }/* Allocate memory space */ -memory_region_init_ram (rom,NULL ,"shix.rom" ,0x4000 ); +memory_region_init_ram (rom,NULL ,"shix.rom" ,0x4000 , &error_abort);vmstate_register_ram_global (rom);memory_region_set_readonly (rom, true);memory_region_add_subregion (sysmem,0x00000000 , rom); -memory_region_init_ram (&sdram[0 ],NULL ,"shix.sdram1" ,0x01000000 ); +memory_region_init_ram (&sdram[0 ],NULL ,"shix.sdram1" ,0x01000000 , + &error_abort);vmstate_register_ram_global (&sdram[0 ]);memory_region_add_subregion (sysmem,0x08000000 , &sdram[0 ]); -memory_region_init_ram (&sdram[1 ],NULL ,"shix.sdram2" ,0x01000000 ); +memory_region_init_ram (&sdram[1 ],NULL ,"shix.sdram2" ,0x01000000 , + &error_abort);vmstate_register_ram_global (&sdram[1 ]);memory_region_add_subregion (sysmem,0x0c000000 , &sdram[1 ]);
hw/sparc/leon3.c +2 -2
@@ -151,13 +151,13 @@ static void leon3_generic_hw_init(MachineState *machine)exit (1 ); } -memory_region_init_ram (ram,NULL ,"leon3.ram" , ram_size); +memory_region_init_ram (ram,NULL ,"leon3.ram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space_mem,0x40000000 , ram);/* Allocate BIOS */ prom_size =8 *1024 *1024 ;/* 8Mb */ -memory_region_init_ram (prom,NULL ,"Leon3.bios" , prom_size); +memory_region_init_ram (prom,NULL ,"Leon3.bios" , prom_size, &error_abort);vmstate_register_ram_global (prom);memory_region_set_readonly (prom, true);memory_region_add_subregion (address_space_mem,0x00000000 , prom);
hw/sparc/sun4m.c +6 -4
@@ -621,7 +621,7 @@ static int idreg_init1(SysBusDevice *dev)IDRegState *s =MACIO_ID_REGISTER (dev);memory_region_init_ram (&s->mem,OBJECT (s), -"sun4m.idreg" ,sizeof (idreg_data)); +"sun4m.idreg" ,sizeof (idreg_data), &error_abort);vmstate_register_ram_global (&s->mem);memory_region_set_readonly (&s->mem, true);sysbus_init_mmio (dev, &s->mem);
@@ -668,7 +668,7 @@ static int afx_init1(SysBusDevice *dev) {AFXState *s =TCX_AFX (dev); -memory_region_init_ram (&s->mem,OBJECT (s),"sun4m.afx" ,4 ); +memory_region_init_ram (&s->mem,OBJECT (s),"sun4m.afx" ,4 , &error_abort);vmstate_register_ram_global (&s->mem);sysbus_init_mmio (dev, &s->mem);return 0 ;
@@ -742,7 +742,8 @@ static int prom_init1(SysBusDevice *dev) {PROMState *s =OPENPROM (dev); -memory_region_init_ram (&s->prom,OBJECT (s),"sun4m.prom" ,PROM_SIZE_MAX ); +memory_region_init_ram (&s->prom,OBJECT (s),"sun4m.prom" ,PROM_SIZE_MAX , + &error_abort);vmstate_register_ram_global (&s->prom);memory_region_set_readonly (&s->prom, true);sysbus_init_mmio (dev, &s->prom);
@@ -784,7 +785,8 @@ static int ram_init1(SysBusDevice *dev) {RamDevice *d =SUN4M_RAM (dev); -memory_region_init_ram (&d->ram,OBJECT (d),"sun4m.ram" , d->size); +memory_region_init_ram (&d->ram,OBJECT (d),"sun4m.ram" , d->size, + &error_abort);vmstate_register_ram_global (&d->ram);sysbus_init_mmio (dev, &d->ram);return 0 ;
hw/sparc64/sun4u.c +4 -2
@@ -686,7 +686,8 @@ static int prom_init1(SysBusDevice *dev) {PROMState *s =OPENPROM (dev); -memory_region_init_ram (&s->prom,OBJECT (s),"sun4u.prom" ,PROM_SIZE_MAX ); +memory_region_init_ram (&s->prom,OBJECT (s),"sun4u.prom" ,PROM_SIZE_MAX , + &error_abort);vmstate_register_ram_global (&s->prom);memory_region_set_readonly (&s->prom, true);sysbus_init_mmio (dev, &s->prom);
@@ -729,7 +730,8 @@ static int ram_init1(SysBusDevice *dev) {RamDevice *d =SUN4U_RAM (dev); -memory_region_init_ram (&d->ram,OBJECT (d),"sun4u.ram" , d->size); +memory_region_init_ram (&d->ram,OBJECT (d),"sun4u.ram" , d->size, + &error_abort);vmstate_register_ram_global (&d->ram);sysbus_init_mmio (dev, &d->ram);return 0 ;
hw/unicore32/puv3.c +2 -1
@@ -74,7 +74,8 @@ static void puv3_board_init(CPUUniCore32State *env, ram_addr_t ram_size)MemoryRegion *ram_memory =g_new (MemoryRegion,1 );/* SDRAM at address zero. */ -memory_region_init_ram (ram_memory,NULL ,"puv3.ram" , ram_size); +memory_region_init_ram (ram_memory,NULL ,"puv3.ram" , ram_size, + &error_abort);vmstate_register_ram_global (ram_memory);memory_region_add_subregion (get_system_memory (),0 , ram_memory); }
hw/xtensa/sim.c +2 -2
@@ -79,12 +79,12 @@ static void xtensa_sim_init(MachineState *machine) } ram =g_malloc (sizeof (*ram)); -memory_region_init_ram (ram,NULL ,"xtensa.sram" , ram_size); +memory_region_init_ram (ram,NULL ,"xtensa.sram" , ram_size, &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (get_system_memory (),0 , ram); rom =g_malloc (sizeof (*rom)); -memory_region_init_ram (rom,NULL ,"xtensa.rom" ,0x1000 ); +memory_region_init_ram (rom,NULL ,"xtensa.rom" ,0x1000 , &error_abort);vmstate_register_ram_global (rom);memory_region_add_subregion (get_system_memory (),0xfe000000 , rom);
hw/xtensa/xtfpga.c +5 -3
@@ -143,7 +143,7 @@ static void lx60_net_init(MemoryRegion *address_space, sysbus_mmio_get_region(s, 1)); ram =g_malloc (sizeof (*ram)); -memory_region_init_ram (ram,OBJECT (s),"open_eth.ram" ,16384 ); +memory_region_init_ram (ram,OBJECT (s),"open_eth.ram" ,16384 , &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (address_space, buffers, ram); }
@@ -205,7 +205,8 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine) } ram =g_malloc (sizeof (*ram)); -memory_region_init_ram (ram,NULL ,"lx60.dram" , machine->ram_size); +memory_region_init_ram (ram,NULL ,"lx60.dram" , machine->ram_size, + &error_abort);vmstate_register_ram_global (ram);memory_region_add_subregion (system_memory,0 , ram);
@@ -254,7 +255,8 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)uint32_t cur_lowmem =QEMU_ALIGN_UP (lowmem_end /2 ,4096 ); rom =g_malloc (sizeof (*rom)); -memory_region_init_ram (rom,NULL ,"lx60.sram" , board->sram_size); +memory_region_init_ram (rom,NULL ,"lx60.sram" , board->sram_size, + &error_abort);vmstate_register_ram_global (rom);memory_region_add_subregion (system_memory,0xfe000000 , rom);
include/exec/memory.h +3 -1
@@ -311,11 +311,13 @@ void memory_region_init_io(MemoryRegion *mr,* @owner: the object that tracks the region's reference count * @name: the name of the region. * @size: size of the region. +* @errp: pointer to Error*, to store an error if it happens. */ void memory_region_init_ram (MemoryRegion *mr,struct Object *owner,const char *name, -uint64_t size); +uint64_t size, +Error **errp);#ifdef __linux__/**
memory.c +3 -2
@@ -1163,13 +1163,14 @@ void memory_region_init_io(MemoryRegion *mr,void memory_region_init_ram (MemoryRegion *mr,Object *owner,const char *name, -uint64_t size) +uint64_t size, +Error **errp) {memory_region_init (mr, owner, name, size); mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram; - mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); + mr->ram_addr =qemu_ram_alloc (size, mr, errp); }#ifdef __linux__
numa.c +2 -2
@@ -263,14 +263,14 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,if (err) {qerror_report_err (err);error_free (err); -memory_region_init_ram (mr, owner, name, ram_size); +memory_region_init_ram (mr, owner, name, ram_size, &error_abort); }#else fprintf (stderr,"-mem-path not supported on this host\n" );exit (1 );#endif }else { -memory_region_init_ram (mr, owner, name, ram_size); +memory_region_init_ram (mr, owner, name, ram_size, &error_abort); }vmstate_register_ram_global (mr); }
xen-hvm.c +2 -1
@@ -188,7 +188,8 @@ static void xen_ram_init(ram_addr_t *below_4g_mem_size,*/ block_len = (1ULL <<32 ) + *above_4g_mem_size; } -memory_region_init_ram (&ram_memory,NULL ,"xen.ram" , block_len); +memory_region_init_ram (&ram_memory,NULL ,"xen.ram" , block_len, + &error_abort); *ram_memory_p = &ram_memory;vmstate_register_ram_global (&ram_memory);
Signature · 1 line
1.9.3
PATCH v6 3/7 memory: add parameter errp to memory_region_init_ram_ptr
In reply to Hu TaoAdd parameter errp to memory_region_init_ram_ptr and update all call sites to pass in &error_abort.
--- hw/display/g364fb.c | 2 +- hw/i386/kvm/pci-assign.c | 3 ++- hw/misc/ivshmem.c | 5 +++-- hw/misc/vfio.c | 3 ++- hw/ppc/spapr.c | 2 +- include/exec/memory.h | 4 +++- memory.c | 5 +++-- 7 files changed, 15 insertions(+), 9 deletions(-)
hw/display/g364fb.c +1 -1
@@ -487,7 +487,7 @@ static void g364fb_init(DeviceState *dev, G364State *s)memory_region_init_io (&s->mem_ctrl,NULL , &g364fb_ctrl_ops, s,"ctrl" ,0x180000 );memory_region_init_ram_ptr (&s->mem_vram,NULL ,"vram" , - s->vram_size, s->vram); + s->vram_size, s->vram, &error_abort);vmstate_register_ram (&s->mem_vram, dev);memory_region_set_coalescing (&s->mem_vram); }
hw/i386/kvm/pci-assign.c +2 -1
@@ -456,7 +456,8 @@ static void assigned_dev_register_regions(PCIRegion *io_regions, object_get_typename(OBJECT(pci_dev)), i);memory_region_init_ram_ptr (&pci_dev->v_addrs[i].real_iomem,OBJECT (pci_dev), name, - cur_region->size, virtbase); + cur_region->size, virtbase, + &error_abort);vmstate_register_ram (&pci_dev->v_addrs[i].real_iomem, &pci_dev->dev.qdev); }
hw/misc/ivshmem.c +3 -2
@@ -348,7 +348,7 @@ static void create_shared_memory_BAR(IVShmemState *s, int fd) { ptr =mmap (0 , s->ivshmem_size,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 );memory_region_init_ram_ptr (&s->ivshmem,OBJECT (s),"ivshmem.bar2" , - s->ivshmem_size, ptr); + s->ivshmem_size, ptr, &error_abort);vmstate_register_ram (&s->ivshmem,DEVICE (s));memory_region_add_subregion (&s->bar,0 , &s->ivshmem);
@@ -476,7 +476,8 @@ static void ivshmem_read(void *opaque, const uint8_t * buf, int flags) map_ptr =mmap (0 , s->ivshmem_size,PROT_READ |PROT_WRITE ,MAP_SHARED , incoming_fd,0 );memory_region_init_ram_ptr (&s->ivshmem,OBJECT (s), -"ivshmem.bar2" , s->ivshmem_size, map_ptr); +"ivshmem.bar2" , s->ivshmem_size, map_ptr, + &error_abort);vmstate_register_ram (&s->ivshmem,DEVICE (s)); IVSHMEM_DPRINTF("guest h/w addr = %" PRIu64 ", size = %" PRIu64 "\n",
hw/misc/vfio.c +2 -1
@@ -2894,7 +2894,8 @@ static int vfio_mmap_bar(VFIODevice *vdev, VFIOBAR *bar, goto empty_region; } -memory_region_init_ram_ptr (submem,OBJECT (vdev), name, size, *map); +memory_region_init_ram_ptr (submem,OBJECT (vdev), name, size, *map, + &error_abort); }else { empty_region:/* Create a zero sized sub-region to make cleanup easy. */
hw/ppc/spapr.c +1 -1
@@ -1342,7 +1342,7 @@ static void ppc_spapr_init(MachineState *machine)if (rma_alloc_size && rma) { rma_region =g_new (MemoryRegion,1 );memory_region_init_ram_ptr (rma_region,NULL ,"ppc_spapr.rma" , - rma_alloc_size, rma); + rma_alloc_size, rma, &error_abort);vmstate_register_ram_global (rma_region);memory_region_add_subregion (sysmem,0 , rma_region); }
include/exec/memory.h +3 -1
@@ -351,12 +351,14 @@ void memory_region_init_ram_from_file(MemoryRegion *mr,* @name: the name of the region. * @size: size of the region. * @ptr: memory to be mapped; must contain at least @size bytes. +* @errp: pointer to Error*, to store an error if it happens. */ void memory_region_init_ram_ptr (MemoryRegion *mr,struct Object *owner,const char *name,uint64_t size, -void *ptr); +void *ptr, +Error **errp);/** * memory_region_init_alias: Initialize a memory region that aliases all or a
memory.c +3 -2
@@ -1194,13 +1194,14 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,Object *owner, const char *name, uint64_t size, - void *ptr) + void *ptr, + Error **errp) {memory_region_init (mr ,owner ,name ,size ); mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; - mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr, &error_abort); + mr->ram_addr =qemu_ram_alloc_from_ptr (size, ptr, mr, errp); } void memory_region_init_alias(MemoryRegion *mr,
Signature · 1 line
1.9.3
PATCH v6 4/7 memory: add parameter errp to memory_region_init_rom_device
In reply to Hu TaoAdd parameter errp to memory_region_init_rom_device and update all call sites to pass in &error_abort.
--- hw/block/pflash_cfi01.c | 2 +- hw/block/pflash_cfi02.c | 2 +- include/exec/memory.h | 4 +++- memory.c | 5 +++-- 4 files changed, 8 insertions(+), 5 deletions(-)
hw/block/pflash_cfi01.c +1 -1
@@ -770,7 +770,7 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp)memory_region_init_rom_device ( &pfl->mem,OBJECT (dev), pfl->be ? &pflash_cfi01_ops_be : &pflash_cfi01_ops_le, pfl, - pfl->name, total_len); + pfl->name, total_len, &error_abort);vmstate_register_ram (&pfl->mem,DEVICE (pfl)); pfl->storage =memory_region_get_ram_ptr (&pfl->mem);sysbus_init_mmio (SYS_BUS_DEVICE (dev), &pfl->mem);
hw/block/pflash_cfi02.c +1 -1
@@ -608,7 +608,7 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp)memory_region_init_rom_device (&pfl->orig_mem,OBJECT (pfl), pfl->be ? &pflash_cfi02_ops_be : &pflash_cfi02_ops_le, - pfl, pfl->name, chip_len); + pfl, pfl->name, chip_len, &error_abort);vmstate_register_ram (&pfl->orig_mem,DEVICE (pfl)); pfl->storage =memory_region_get_ram_ptr (&pfl->orig_mem); pfl->chip_len = chip_len;
include/exec/memory.h +3 -1
@@ -388,13 +388,15 @@ void memory_region_init_alias(MemoryRegion *mr,* @ops: callbacks for write access handling. * @name: the name of the region. * @size: size of the region. +* @errp: pointer to Error*, to store an error if it happens. */ void memory_region_init_rom_device (MemoryRegion *mr,struct Object *owner,const MemoryRegionOps *ops,void *opaque,const char *name, -uint64_t size); +uint64_t size, +Error **errp);/** * memory_region_init_reservation: Initialize a memory region that reserves
memory.c +3 -2
@@ -1223,7 +1223,8 @@ void memory_region_init_rom_device(MemoryRegion *mr,const MemoryRegionOps *ops, void *opaque, const char *name, - uint64_t size) + uint64_t size, + Error **errp) {memory_region_init (mr ,owner ,name ,size ); mr->ops = ops;
@@ -1231,7 +1232,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, mr->terminates = true; mr->rom_device = true; mr->destructor = memory_region_destructor_rom_device; - mr->ram_addr =qemu_ram_alloc (size, mr, &error_abort); + mr->ram_addr =qemu_ram_alloc (size, mr, errp); } void memory_region_init_iommu(MemoryRegion *mr,
Signature · 1 line
1.9.3
PATCH v6 5/7 hostmem-ram: don't exit qemu if size of memory-backend-ram is way too big
In reply to Hu TaoWhen using monitor command object_add to add a memory backend whose size is way too big to allocate memory for it, qemu just exits. In the case we'd better give an error message and keep guest running.
The problem can be reproduced as follows:
1. run qemu
2. (monitor)object_add memory-backend-ram,size=100000G,id=ram0
--- backends/hostmem-ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
backends/hostmem-ram.c +1 -1
@@ -27,7 +27,7 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) path =object_get_canonical_path_component (OBJECT (backend));memory_region_init_ram (&backend->mr,OBJECT (backend), path, - backend->size, &error_abort); + backend->size, errp);g_free (path); }
Signature · 1 line
1.9.3
PATCH v6 6/7 exec: report error when memory < hpagesize
In reply to Hu TaoReport error when memory < hpagesize in file_ram_alloc() so callers can handle the error.
This patch fix a problem that if user adds a memory-backend-file object using object_add command, specifying a size that is less than huge page size, qemu will core dump with message:
Bad ram offset fffffffffffff000
Aborted (core dumped)
with this patch, qemu reports error message like:
qemu-system-x86_64: -object memory-backend-file,mem-path=/hugepages,id=mem-file0,size=1M: memory size 0x100000 must be equal to or larger than huge page size 0x200000
--- exec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
exec.c +8 -5
@@ -1024,9 +1024,9 @@ static void *file_ram_alloc(RAMBlock *block,char *filename;char *sanitized_name;char *c; -void *area; +void *area =NULL ;int fd; -unsigned long hpagesize; +uint64_t hpagesize; hpagesize =gethugepagesize (path);if (!hpagesize) {
@@ -1034,7 +1034,10 @@ static void *file_ram_alloc(RAMBlock *block, }if (memory < hpagesize) { -return NULL ; +error_setg (errp,"memory size 0x" RAM_ADDR_FMT " must be equal to " +"or larger than huge page size 0x%" PRIx64, + memory, hpagesize); + goto error; }if (kvm_enabled () && !kvm_has_sync_mmu ()) {
@@ -1094,8 +1097,8 @@ static void *file_ram_alloc(RAMBlock *block,return area; error: -if (mem_prealloc) { -exit (1 ); +if (area && area !=MAP_FAILED ) { +munmap (area, memory); }return NULL ; }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH v6 6/7] exec: report error when memory < hpagesize
Quoted 1 line · Hu Tao
Report error when memory < hpagesize in
file_ram_alloc()so callers can
"an error"
Quoted 3 lines
handle the error.
This patch fix a problem that if user adds a memory-backend-file object
Long sentence. I would drop the "This patch fixes a problem that"
Quoted 6 lines
using
object_addcommand, specifying a size that is less than huge page size, qemu will core dump with message:Bad ram offset
fffffffffffff000
Aborted (core dumped)
Then say here "This patch fixes the problem."
Quoted 39 lines
with this patch, qemu reports error message like:
qemu-system-x86_64: -object memory-backend-file,mem-path=/hugepages,id=mem-file0,size=1M: memory size
0x100000must be equal to or larger than huge page size0x200000Signed-off-by Hu Tao <[email protected]>--- exec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)exec.c +6
-3@@ -1024,9 +1024,9 @@ static void *file_ram_alloc(RAMBlock *block,char *filename;char *sanitized_name;char *c; -void *area; +void *area =NULL ;int fd; -unsigned long hpagesize; +uint64_t hpagesize; hpagesize =gethugepagesize (path);if (!hpagesize) {@@ -1034,7 +1034,10 @@ static void *file_ram_alloc(RAMBlock *block, }if (memory < hpagesize) { -return NULL ; +error_setg (errp,"memory size 0x" RAM_ADDR_FMT " must be equal to " +"or larger than huge page size 0x%" PRIx64, + memory, hpagesize); + goto error; }if (kvm_enabled () && !kvm_has_sync_mmu ()) {
exec.c static void *file_ram_alloc(RAMBlock *block, · line 1098
Quoted 5 lines
exec.c +0
-2@@ -1094,8 +1097,8 @@ static void *file_ram_alloc(RAMBlock *block,return area; error: -if (mem_prealloc) { -exit (1 );
So I get the movitation behind getting rid of the core dump and abort(). But this seems like a different change. You are demoting an explicit fatal error (which looks to me to be unhelpfully silent) to a propagating error. What's the reasoning? Is there any awareness of the must-exit on the mem_prealloc failure case in the higher levels?
Regards,
Peter
Quoted 9 lines
exec.c +2
-1+if (area && area !=MAP_FAILED ) { +munmap (area, memory); }return NULL ; } --1.9.3
Re: [Qemu-devel] [PATCH v6 6/7] exec: report error when memory < hpagesize
Quoted 11 lines · Peter Crosthwaite
Quoted 1 line · Hu Tao
Report error when memory < hpagesize in
file_ram_alloc()so callers can"an error"
Quoted 3 lines
handle the error.
This patch fix a problem that if user adds a memory-backend-file object
Long sentence. I would drop the "This patch fixes a problem that"
Quoted 8 lines
Quoted 6 lines
using
object_addcommand, specifying a size that is less than huge page size, qemu will core dump with message:Bad ram offset
fffffffffffff000
Aborted (core dumped)Then say here "This patch fixes the problem."
I'll reword if respin.
Quoted 42 lines
Quoted 42 lines
with this patch, qemu reports error message like:
qemu-system-x86_64: -object memory-backend-file,mem-path=/hugepages,id=mem-file0,size=1M: memory size
0x100000must be equal to or larger than huge page size0x200000Signed-off-by Hu Tao <[email protected]>--- exec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)exec.c +6
-3@@ -1024,9 +1024,9 @@ static void *file_ram_alloc(RAMBlock *block,char *filename;char *sanitized_name;char *c; -void *area; +void *area =NULL ;int fd; -unsigned long hpagesize; +uint64_t hpagesize; hpagesize =gethugepagesize (path);if (!hpagesize) {@@ -1034,7 +1034,10 @@ static void *file_ram_alloc(RAMBlock *block, }if (memory < hpagesize) { -return NULL ; +error_setg (errp,"memory size 0x" RAM_ADDR_FMT " must be equal to " +"or larger than huge page size 0x%" PRIx64, + memory, hpagesize); + goto error; }if (kvm_enabled () && !kvm_has_sync_mmu ()) {@@ -1094,8 +1097,8 @@ static void *file_ram_alloc(RAMBlock *block,return area;
Quoted 9 lines
exec.c static void *file_ram_alloc(RAMBlock *block, · line 1098
Quoted 3 lines
exec.c +0
-2error: -if (mem_prealloc) { -exit (1 );So I get the movitation behind getting rid of the core dump and
abort(). But this seems like a different change. You are demoting an explicit fatal error (which looks to me to be unhelpfully silent) to a propagating error. What's the reasoning? Is there any awareness of the must-exit on themem_preallocfailure case in the higher levels?
Indeed this change is irrelevant to this patch, but relevant(not quite) to patch 5. The change fixes a similar problem described in patch 5 but at the time preallocating failed.
Steps to reproduce this problem are similar to the ones in patch 5, except that adds -mem-prealloc to qemu command line.
Regards,
Hu
Quoted 13 lines
Regards,
PeterQuoted 9 lines
exec.c +2
-1+if (area && area !=MAP_FAILED ) { +munmap (area, memory); }return NULL ; } --1.9.3
PATCH v6 7/7 exec: add parameter errp to gethugepagesize
In reply to Hu TaoAdd parameter errp to gethugepagesize thus callers can handle errors.
This patch fixes a problem that if user adds a memory-backend-file object using object_add command, specifying a non-existing directory for property mem-path, qemu will core dump with message:
/nonexistingdir: No such file or directory
Bad ram offset fffffffffffff000
Aborted (core dumped)
with this patch, qemu reports error message like:
qemu-system-x86_64: -object memory-backend-file,mem-path=/nonexistingdir,id=mem-file0,size=128M:
failed to stat file /nonexistingdir: No such file or directory
--- exec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
exec.c +7 -4
@@ -996,7 +996,7 @@ void qemu_mutex_unlock_ramlist(void)#define HUGETLBFS_MAGIC 0x958458f6 -static long gethugepagesize (const char *path) +static long gethugepagesize (const char *path,Error **errp) {struct statfs fs;int ret;
@@ -1006,7 +1006,8 @@ static long gethugepagesize(const char *path) }while (ret !=0 && errno ==EINTR );if (ret !=0 ) { -perror (path); +error_setg_errno (errp, errno,"failed to get page size of file %s" , + path);return 0 ; }
@@ -1027,9 +1028,11 @@ static void *file_ram_alloc(RAMBlock *block,void *area =NULL ;int fd;uint64_t hpagesize; +Error *local_err =NULL ; - hpagesize =gethugepagesize (path); -if (!hpagesize) { + hpagesize =gethugepagesize (path, &local_err); +if (local_err) { +error_propagate (errp, local_err); goto error; }
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH v6 7/7] exec: add parameter errp to gethugepagesize
Quoted 5 lines · Hu Tao
Add parameter errp to gethugepagesize thus callers can handle errors.
This patch fixes a problem that if user adds a memory-backend-file object using
object_addcommand, specifying a non-existing directory for property mem-path, qemu will core dump with message:
Same long sentence issue here,
Quoted 11 lines
/nonexistingdir: No such file or directory
Bad ram offsetfffffffffffff000
Aborted (core dumped)with this patch, qemu reports error message like:
qemu-system-x86_64: -object memory-backend-file,mem-path=/nonexistingdir,id=mem-file0,size=128M:
failed to stat file /nonexistingdir: No such file or directorySigned-off-by Hu Tao <[email protected]>
Otherwise:
Quoted 45 lines
--- exec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)exec.c +7
-5@@ -996,7 +996,7 @@ void qemu_mutex_unlock_ramlist(void)#define HUGETLBFS_MAGIC 0x958458f6 -static long gethugepagesize (const char *path) +static long gethugepagesize (const char *path,Error **errp) {struct statfs fs;int ret;@@ -1006,7 +1006,8 @@ static long gethugepagesize(const char *path) }while (ret !=0 && errno ==EINTR );if (ret !=0 ) { -perror (path); +error_setg_errno (errp, errno,"failed to get page size of file %s" , + path);return 0 ; }@@ -1027,9 +1028,11 @@ static void *file_ram_alloc(RAMBlock *block,void *area =NULL ;int fd;uint64_t hpagesize; +Error *local_err =NULL ; - hpagesize =gethugepagesize (path); -if (!hpagesize) { + hpagesize =gethugepagesize (path, &local_err); +if (local_err) { +error_propagate (errp, local_err); goto error; } --1.9.3
Re: [Qemu-devel] [PATCH v6 7/7] exec: add parameter errp to gethugepagesize
Quoted 47 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Peter Crosthwaite
Sent: Thursday, August 07, 2014 7:47 PM
To: Hu Tao
Cc: Yasunori Goto; Paolo Bonzini; Yasuaki Isimatu; [email protected] Developers; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH v6 7/7] exec: add parameter errp to gethugepagesizeQuoted 5 lines · Hu Tao
Add parameter errp to gethugepagesize thus callers can handle errors.
This patch fixes a problem that if user adds a memory-backend-file object using
object_addcommand, specifying a non-existing directory for property mem-path, qemu will core dump with message:Same long sentence issue here,
Quoted 8 lines
/nonexistingdir: No such file or directory
Bad ram offsetfffffffffffff000
Aborted (core dumped)with this patch, qemu reports error message like:
qemu-system-x86_64: -object
memory-backend-file,mem-path=/nonexistingdir,id=mem-file0,size=128M:
Quoted 3 lines
failed to stat file /nonexistingdir: No such file or directory
Signed-off-by Hu Tao <[email protected]>Otherwise:
Reviewed-by Peter Crosthwaite <[email protected]>Quoted 10 lines
--- exec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)exec.c +0
-0@@ -996,7 +996,7 @@ void qemu_mutex_unlock_ramlist(void)
Quoted 4 lines
exec.c void qemu_mutex_unlock_ramlist(void) · line 999
Quoted 4 lines
exec.c +1
-1#define HUGETLBFS_MAGIC 0x958458f6 -static long gethugepagesize (const char *path) +static long gethugepagesize (const char *path,Error **errp)
I'm not following this series, but the function name is not idiomatic QEMU coding style IMHO.
Best regards,
-Gonglei
Re: [Qemu-devel] [PATCH v6 7/7] exec: add parameter errp to gethugepagesize
Quoted 47 lines · Gonglei (Arei)
Quoted 47 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Peter Crosthwaite
Sent: Thursday, August 07, 2014 7:47 PM
To: Hu Tao
Cc: Yasunori Goto; Paolo Bonzini; Yasuaki Isimatu; [email protected] Developers; Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH v6 7/7] exec: add parameter errp to gethugepagesizeQuoted 5 lines · Hu Tao
Add parameter errp to gethugepagesize thus callers can handle errors.
This patch fixes a problem that if user adds a memory-backend-file object using
object_addcommand, specifying a non-existing directory for property mem-path, qemu will core dump with message:Same long sentence issue here,
Quoted 8 lines
/nonexistingdir: No such file or directory
Bad ram offsetfffffffffffff000
Aborted (core dumped)with this patch, qemu reports error message like:
qemu-system-x86_64: -object
memory-backend-file,mem-path=/nonexistingdir,id=mem-file0,size=128M:
Quoted 3 lines
failed to stat file /nonexistingdir: No such file or directory
Signed-off-by Hu Tao <[email protected]>Otherwise:
Reviewed-by Peter Crosthwaite <[email protected]>Quoted 10 lines
--- exec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)exec.c +0
-0@@ -996,7 +996,7 @@ void qemu_mutex_unlock_ramlist(void)
Quoted 7 lines
Quoted 4 lines
exec.c void qemu_mutex_unlock_ramlist(void) · line 999
Quoted 4 lines
exec.c +1
-1#define HUGETLBFS_MAGIC 0x958458f6 -static long gethugepagesize (const char *path) +static long gethugepagesize (const char *path,Error **errp)I'm not following this series, but the function name is not idiomatic QEMU coding style IMHO.
This can be another patch.
Regards,
Hu
Quoted 6 lines · Hu Tao
This series includes two parts:
1. part 1 includes patches 1-4, which improves error handling of
memory_region_init_ram,memory_region_init_ram_ptrandmemory_region_init_rom_device
Quoted 8 lines
2. part 2 includes patches 5-7, each fixes a bug of memory backend.
changes to v5:
- split patch 6 in v5 into 2
- uselocal_errinstead of errp
- typo fixes
A bit of a nit, but when respinning, please keep the changelogs from previous spins. E.g. you should keep the "changes to v4" as you documented in the last cover.
Aids reviewing when reviewers come to a series late or when a reviewer skips a spin etc,
It's not an inhibiting issue on this spin, just for future reference.
Regards,
Peter
Quoted 97 lines
Hu Tao (7):
exec: add parameter errp toqemu_ram_allocandqemu_ram_alloc_from_ptr
memory: add parameter errp tomemory_region_init_ram
memory: add parameter errp tomemory_region_init_ram_ptr
memory: add parameter errp tomemory_region_init_rom_device
hostmem-ram: don't exit qemu if size of memory-backend-ram is way too
big
exec: report error when memory < hpagesize
exec: add parameter errp to gethugepagesizebackends/hostmem-ram.c | 2 +- exec.c | 60 ++++++++++++++++++++++---------- hw/alpha/typhoon.c | 3 +- hw/arm/armv7m.c | 7 ++-- hw/arm/cubieboard.c | 2 +- hw/arm/digic_boards.c | 2 +- hw/arm/exynos4210.c | 9 ++--- hw/arm/highbank.c | 5 +-- hw/arm/integratorcp.c | 5 +-- hw/arm/kzm.c | 4 +-- hw/arm/mainstone.c | 3 +- hw/arm/musicpal.c | 6 ++-- hw/arm/omap1.c | 6 ++-- hw/arm/omap2.c | 6 ++-- hw/arm/omap_sx1.c | 6 ++-- hw/arm/palm.c | 3 +- hw/arm/pxa2xx.c | 11 +++--- hw/arm/realview.c | 9 +++-- hw/arm/spitz.c | 2 +- hw/arm/strongarm.c | 3 +- hw/arm/tosa.c | 2 +- hw/arm/versatilepb.c | 3 +- hw/arm/vexpress.c | 15 +++++--- hw/arm/virt.c | 3 +- hw/arm/xilinx_zynq.c | 6 ++-- hw/block/onenand.c | 2 +- hw/block/pflash_cfi01.c | 2 +- hw/block/pflash_cfi02.c | 2 +- hw/core/loader.c | 2 +- hw/cris/axis_dev88.c | 6 ++-- hw/display/cg3.c | 6 ++-- hw/display/g364fb.c | 2 +- hw/display/qxl.c | 6 ++-- hw/display/sm501.c | 2 +- hw/display/tc6393xb.c | 3 +- hw/display/tcx.c | 5 +-- hw/display/vga.c | 3 +- hw/display/vmware_vga.c | 3 +- hw/i386/kvm/pci-assign.c | 6 ++-- hw/i386/pc.c | 3 +- hw/i386/pc_sysfw.c | 5 +-- hw/input/milkymist-softusb.c | 4 +-- hw/lm32/lm32_boards.c | 6 ++-- hw/lm32/milkymist.c | 3 +- hw/m68k/an5206.c | 4 +-- hw/m68k/dummy_m68k.c | 2 +- hw/m68k/mcf5208.c | 4 +-- hw/microblaze/petalogix_ml605_mmu.c | 5 +-- hw/microblaze/petalogix_s3adsp1800_mmu.c | 6 ++-- hw/mips/mips_fulong2e.c | 5 +-- hw/mips/mips_jazz.c | 8 +++-- hw/mips/mips_malta.c | 6 ++-- hw/mips/mips_mipssim.c | 6 ++-- hw/mips/mips_r4k.c | 5 +-- hw/misc/ivshmem.c | 5 +-- hw/misc/vfio.c | 3 +- hw/moxie/moxiesim.c | 4 +-- hw/net/milkymist-minimac2.c | 2 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci-host/prep.c | 3 +- hw/pci/pci.c | 2 +- hw/ppc/mac_newworld.c | 3 +- hw/ppc/mac_oldworld.c | 3 +- hw/ppc/ppc405_boards.c | 8 +++-- hw/ppc/ppc405_uc.c | 3 +- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio.c | 2 +- hw/sh4/r2d.c | 2 +- hw/sh4/shix.c | 8 +++-- hw/sparc/leon3.c | 4 +-- hw/sparc/sun4m.c | 10 +++--- hw/sparc64/sun4u.c | 6 ++-- hw/unicore32/puv3.c | 3 +- hw/xtensa/sim.c | 4 +-- hw/xtensa/xtfpga.c | 8 +++-- include/exec/memory.h | 12 +++++-- include/exec/ram_addr.h | 4 +-- memory.c | 15 ++++---- numa.c | 4 +-- xen-hvm.c | 3 +- 81 files changed, 270 insertions(+), 162 deletions(-)--
1.9.3
Quoted 16 lines · Peter Crosthwaite
Quoted 6 lines · Hu Tao
This series includes two parts:
1. part 1 includes patches 1-4, which improves error handling of
memory_region_init_ram,memory_region_init_ram_ptrandmemory_region_init_rom_deviceQuoted 8 lines
2. part 2 includes patches 5-7, each fixes a bug of memory backend.
changes to v5:
- split patch 6 in v5 into 2
- uselocal_errinstead of errp
- typo fixes
Quoted 8 lines
A bit of a nit, but when respinning, please keep the changelogs from previous spins. E.g. you should keep the "changes to v4" as you documented in the last cover.
Aids reviewing when reviewers come to a series late or when a reviewer skips a spin etc,
It's not an inhibiting issue on this spin, just for future reference.
Thanks, I'll do it.
Quoted 101 lines
Regards,
PeterQuoted 97 lines
Hu Tao (7):
exec: add parameter errp toqemu_ram_allocandqemu_ram_alloc_from_ptr
memory: add parameter errp tomemory_region_init_ram
memory: add parameter errp tomemory_region_init_ram_ptr
memory: add parameter errp tomemory_region_init_rom_device
hostmem-ram: don't exit qemu if size of memory-backend-ram is way too
big
exec: report error when memory < hpagesize
exec: add parameter errp to gethugepagesizebackends/hostmem-ram.c | 2 +- exec.c | 60 ++++++++++++++++++++++---------- hw/alpha/typhoon.c | 3 +- hw/arm/armv7m.c | 7 ++-- hw/arm/cubieboard.c | 2 +- hw/arm/digic_boards.c | 2 +- hw/arm/exynos4210.c | 9 ++--- hw/arm/highbank.c | 5 +-- hw/arm/integratorcp.c | 5 +-- hw/arm/kzm.c | 4 +-- hw/arm/mainstone.c | 3 +- hw/arm/musicpal.c | 6 ++-- hw/arm/omap1.c | 6 ++-- hw/arm/omap2.c | 6 ++-- hw/arm/omap_sx1.c | 6 ++-- hw/arm/palm.c | 3 +- hw/arm/pxa2xx.c | 11 +++--- hw/arm/realview.c | 9 +++-- hw/arm/spitz.c | 2 +- hw/arm/strongarm.c | 3 +- hw/arm/tosa.c | 2 +- hw/arm/versatilepb.c | 3 +- hw/arm/vexpress.c | 15 +++++--- hw/arm/virt.c | 3 +- hw/arm/xilinx_zynq.c | 6 ++-- hw/block/onenand.c | 2 +- hw/block/pflash_cfi01.c | 2 +- hw/block/pflash_cfi02.c | 2 +- hw/core/loader.c | 2 +- hw/cris/axis_dev88.c | 6 ++-- hw/display/cg3.c | 6 ++-- hw/display/g364fb.c | 2 +- hw/display/qxl.c | 6 ++-- hw/display/sm501.c | 2 +- hw/display/tc6393xb.c | 3 +- hw/display/tcx.c | 5 +-- hw/display/vga.c | 3 +- hw/display/vmware_vga.c | 3 +- hw/i386/kvm/pci-assign.c | 6 ++-- hw/i386/pc.c | 3 +- hw/i386/pc_sysfw.c | 5 +-- hw/input/milkymist-softusb.c | 4 +-- hw/lm32/lm32_boards.c | 6 ++-- hw/lm32/milkymist.c | 3 +- hw/m68k/an5206.c | 4 +-- hw/m68k/dummy_m68k.c | 2 +- hw/m68k/mcf5208.c | 4 +-- hw/microblaze/petalogix_ml605_mmu.c | 5 +-- hw/microblaze/petalogix_s3adsp1800_mmu.c | 6 ++-- hw/mips/mips_fulong2e.c | 5 +-- hw/mips/mips_jazz.c | 8 +++-- hw/mips/mips_malta.c | 6 ++-- hw/mips/mips_mipssim.c | 6 ++-- hw/mips/mips_r4k.c | 5 +-- hw/misc/ivshmem.c | 5 +-- hw/misc/vfio.c | 3 +- hw/moxie/moxiesim.c | 4 +-- hw/net/milkymist-minimac2.c | 2 +- hw/openrisc/openrisc_sim.c | 2 +- hw/pci-host/prep.c | 3 +- hw/pci/pci.c | 2 +- hw/ppc/mac_newworld.c | 3 +- hw/ppc/mac_oldworld.c | 3 +- hw/ppc/ppc405_boards.c | 8 +++-- hw/ppc/ppc405_uc.c | 3 +- hw/ppc/spapr.c | 2 +- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio.c | 2 +- hw/sh4/r2d.c | 2 +- hw/sh4/shix.c | 8 +++-- hw/sparc/leon3.c | 4 +-- hw/sparc/sun4m.c | 10 +++--- hw/sparc64/sun4u.c | 6 ++-- hw/unicore32/puv3.c | 3 +- hw/xtensa/sim.c | 4 +-- hw/xtensa/xtfpga.c | 8 +++-- include/exec/memory.h | 12 +++++-- include/exec/ram_addr.h | 4 +-- memory.c | 15 ++++---- numa.c | 4 +-- xen-hvm.c | 3 +- 81 files changed, 270 insertions(+), 162 deletions(-)--
1.9.3