* [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again)
@ 2015-09-11 14:51 Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 1/4] error: New error_fatal Markus Armbruster
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Markus Armbruster @ 2015-09-11 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, peter.crosthwaite, hutao
Not nice:
$ qemu-system-x86_64 -m 10000000
Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
Aborted (core dumped)
I fixed this in commit 3922825 for v1.7, but commit ef701d7 regressed
it for v2.2, and now I'm fixing it again, only this time the fix is
fifteen times bigger.
Folks involved in the flawed commit cc'ed, so they can do penance by
reviewing my fix ;-P
PATCH 1/4's error_fatal obviously enables further simplifications. I
got some in my local tree, but they're not ready, yet.
Markus Armbruster (4):
error: New error_fatal
Fix bad error handling after memory_region_init_ram()
loader: Fix memory_region_init_resizeable_ram() error handling
memory: Fix bad error handling in memory_region_init_ram_ptr()
hw/arm/armv7m.c | 2 +-
hw/arm/exynos4210.c | 8 ++++----
hw/arm/highbank.c | 2 +-
hw/arm/integratorcp.c | 2 +-
hw/arm/mainstone.c | 2 +-
hw/arm/musicpal.c | 2 +-
hw/arm/omap1.c | 2 +-
hw/arm/omap2.c | 2 +-
hw/arm/omap_sx1.c | 4 ++--
hw/arm/palm.c | 2 +-
hw/arm/pxa2xx.c | 8 ++++----
hw/arm/realview.c | 6 +++---
hw/arm/spitz.c | 2 +-
hw/arm/stellaris.c | 4 ++--
hw/arm/stm32f205_soc.c | 4 ++--
hw/arm/tosa.c | 2 +-
hw/arm/vexpress.c | 6 +++---
hw/arm/xilinx_zynq.c | 2 +-
hw/arm/xlnx-zynqmp.c | 2 +-
hw/block/onenand.c | 2 +-
hw/core/loader.c | 2 +-
hw/cris/axis_dev88.c | 2 +-
hw/display/cg3.c | 4 ++--
hw/display/qxl.c | 6 +++---
hw/display/sm501.c | 2 +-
hw/display/tc6393xb.c | 2 +-
hw/display/tcx.c | 4 ++--
hw/display/vga.c | 2 +-
hw/display/vmware_vga.c | 2 +-
hw/i386/pc.c | 2 +-
hw/i386/pc_sysfw.c | 4 ++--
hw/input/milkymist-softusb.c | 4 ++--
hw/m68k/an5206.c | 2 +-
hw/m68k/mcf5208.c | 2 +-
hw/microblaze/petalogix_ml605_mmu.c | 4 ++--
hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 ++--
hw/mips/mips_fulong2e.c | 2 +-
hw/mips/mips_jazz.c | 4 ++--
hw/mips/mips_malta.c | 2 +-
hw/mips/mips_mipssim.c | 2 +-
hw/mips/mips_r4k.c | 2 +-
hw/moxie/moxiesim.c | 4 ++--
hw/net/milkymist-minimac2.c | 2 +-
hw/openrisc/openrisc_sim.c | 2 +-
hw/pci-host/prep.c | 2 +-
hw/pci/pci.c | 2 +-
hw/ppc/mac_newworld.c | 2 +-
hw/ppc/mac_oldworld.c | 2 +-
hw/ppc/ppc405_boards.c | 7 ++++---
hw/ppc/ppc405_uc.c | 2 +-
hw/s390x/s390-virtio-ccw.c | 2 +-
hw/s390x/sclp.c | 3 ++-
hw/sh4/r2d.c | 2 +-
hw/sh4/shix.c | 6 +++---
hw/sparc/leon3.c | 2 +-
hw/sparc/sun4m.c | 6 +++---
hw/sparc64/sun4u.c | 4 ++--
hw/tricore/tricore_testboard.c | 18 +++++++++++------
hw/unicore32/puv3.c | 2 +-
hw/xtensa/sim.c | 4 ++--
hw/xtensa/xtfpga.c | 7 ++++---
include/qapi/error.h | 11 +++++++++++
memory.c | 2 +-
numa.c | 4 ++--
util/error.c | 34 ++++++++++++++++++++------------
xen-hvm.c | 2 +-
66 files changed, 144 insertions(+), 116 deletions(-)
--
2.4.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 1/4] error: New error_fatal
2015-09-11 14:51 [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
@ 2015-09-11 14:51 ` Markus Armbruster
2015-09-11 15:13 ` Eric Blake
2015-09-11 14:51 ` [Qemu-devel] [PATCH 2/4] Fix bad error handling after memory_region_init_ram() Markus Armbruster
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2015-09-11 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, peter.crosthwaite, hutao
Similar to error_abort, but doesn't report where the error was
created, and terminates the process with exit(1) rather than abort().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/qapi/error.h | 11 +++++++++++
util/error.c | 34 +++++++++++++++++++++-------------
2 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/include/qapi/error.h b/include/qapi/error.h
index d7878c3..c69dddb 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -50,6 +50,9 @@
* Call a function aborting on errors:
* foo(arg, &error_abort);
*
+ * Call a function treating errors as fatal:
+ * foo(arg, &error_fatal);
+ *
* Receive an error and pass it on to the caller:
* Error *err = NULL;
* foo(arg, &err);
@@ -100,6 +103,7 @@ ErrorClass error_get_class(const Error *err);
* If @errp is NULL, the error is ignored. Don't bother creating one
* then.
* If @errp is &error_abort, print a suitable message and abort().
+ * If @errp is &error_fatal, print a suitable message and exit(1).
* If @errp is anything else, *@errp must be NULL.
* The new error's class is ERROR_CLASS_GENERIC_ERROR, and its
* human-readable error message is made from printf-style @fmt, ...
@@ -148,6 +152,8 @@ void error_setg_win32_internal(Error **errp,
* error object.
* Else, if @dst_errp is &error_abort, print a suitable message and
* abort().
+ * Else, if @dst_errp is &error_fatal, print a suitable message and
+ * exit(1).
* Else, if @dst_errp already contains an error, ignore this one: free
* the error object.
* Else, move the error object from @local_err to *@dst_errp.
@@ -206,4 +212,9 @@ void error_set_internal(Error **errp,
*/
extern Error *error_abort;
+/*
+ * Pass to error_setg() & friends to exit(1) on error.
+ */
+extern Error *error_fatal;
+
#endif
diff --git a/util/error.c b/util/error.c
index b1eb8a2..8b86490 100644
--- a/util/error.c
+++ b/util/error.c
@@ -2,9 +2,11 @@
* QEMU Error Objects
*
* Copyright IBM, Corp. 2011
+ * Copyright (C) 2011-2015 Red Hat, Inc.
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
+ * Markus Armbruster <armbru@redhat.com>,
*
* This work is licensed under the terms of the GNU LGPL, version 2. See
* the COPYING.LIB file in the top-level directory.
@@ -24,13 +26,20 @@ struct Error
};
Error *error_abort;
+Error *error_fatal;
-static void error_do_abort(Error *err)
+static void error_handle_fatal(Error **errp, Error *err)
{
- fprintf(stderr, "Unexpected error in %s() at %s:%d:\n",
- err->func, err->src, err->line);
- error_report_err(err);
- abort();
+ if (errp == &error_abort) {
+ fprintf(stderr, "Unexpected error in %s() at %s:%d:\n",
+ err->func, err->src, err->line);
+ error_report_err(err);
+ abort();
+ }
+ if (errp == &error_fatal) {
+ error_report_err(err);
+ exit(1);
+ }
}
static void error_setv(Error **errp,
@@ -52,10 +61,7 @@ static void error_setv(Error **errp,
err->line = line;
err->func = func;
- if (errp == &error_abort) {
- error_do_abort(err);
- }
-
+ error_handle_fatal(errp, err);
*errp = err;
errno = saved_errno;
@@ -216,11 +222,13 @@ void error_free(Error *err)
void error_propagate(Error **dst_errp, Error *local_err)
{
- if (local_err && dst_errp == &error_abort) {
- error_do_abort(local_err);
- } else if (dst_errp && !*dst_errp) {
+ if (!local_err) {
+ return;
+ }
+ error_handle_fatal(dst_errp, local_err);
+ if (dst_errp && !*dst_errp) {
*dst_errp = local_err;
- } else if (local_err) {
+ } else {
error_free(local_err);
}
}
--
2.4.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 2/4] Fix bad error handling after memory_region_init_ram()
2015-09-11 14:51 [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 1/4] error: New error_fatal Markus Armbruster
@ 2015-09-11 14:51 ` Markus Armbruster
2015-09-14 5:13 ` Peter Crosthwaite
2015-09-11 14:51 ` [Qemu-devel] [PATCH 3/4] loader: Fix memory_region_init_resizeable_ram() error handling Markus Armbruster
` (3 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Markus Armbruster @ 2015-09-11 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, peter.crosthwaite, hutao
Symptom:
$ qemu-system-x86_64 -m 10000000
Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
Aborted (core dumped)
Root cause: commit ef701d7 screwed up handling of out-of-memory
conditions. Before the commit, we report the error and exit(1), in
one place, ram_block_add(). The commit lifts the error handling up
the call chain some, to three places. Fine. Except it uses
&error_abort in these places, changing the behavior from exit(1) to
abort(), and thus undoing the work of commit 3922825 "exec: Don't
abort when we can't allocate guest memory".
The three places are:
* memory_region_init_ram()
Commit 4994653 (right after commit ef701d7) lifted the error
handling further, through memory_region_init_ram(), multiplying the
incorrect use of &error_abort. Later on, imitation of existing
(bad) code may have created more.
* memory_region_init_ram_ptr()
The &error_abort is still there.
* memory_region_init_rom_device()
Doesn't need fixing, because commit 33e0eb5 (soon after commit
ef701d7) lifted the error handling further, and in the process
changed it from &error_abort to passing it up the call chain.
Correct, because the callers are realize() methods.
Fix the error handling after memory_region_init_ram() with a
Coccinelle semantic patch:
@r@
expression mr, owner, name, size, err;
position p;
@@
memory_region_init_ram(mr, owner, name, size,
(
- &error_abort
+ &error_fatal
|
err@p
)
);
@script:python@
p << r.p;
@@
print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
When the last argument is &error_abort, it gets replaced by
&error_fatal. This is the fix.
If the last argument is anything else, its position is reported. This
lets us check the fix is complete. Four positions get reported:
* ram_backend_memory_alloc()
Error is passed up the call chain, ultimately through
user_creatable_complete(). As far as I can tell, it's callers all
handle the error sanely.
* fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
DeviceClass.realize() methods, errors handled sanely further up the
call chain.
We're good. Test case again behaves:
$ qemu-system-x86_64 -m 10000000
qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
[Exit 1 ]
The next commits will repair the rest of commit ef701d7's damage.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/arm/armv7m.c | 2 +-
hw/arm/exynos4210.c | 8 ++++----
hw/arm/highbank.c | 2 +-
hw/arm/integratorcp.c | 2 +-
hw/arm/mainstone.c | 2 +-
hw/arm/musicpal.c | 2 +-
hw/arm/omap1.c | 2 +-
hw/arm/omap2.c | 2 +-
hw/arm/omap_sx1.c | 4 ++--
hw/arm/palm.c | 2 +-
hw/arm/pxa2xx.c | 8 ++++----
hw/arm/realview.c | 6 +++---
hw/arm/spitz.c | 2 +-
hw/arm/stellaris.c | 4 ++--
hw/arm/stm32f205_soc.c | 4 ++--
hw/arm/tosa.c | 2 +-
hw/arm/vexpress.c | 6 +++---
hw/arm/xilinx_zynq.c | 2 +-
hw/arm/xlnx-zynqmp.c | 2 +-
hw/block/onenand.c | 2 +-
hw/cris/axis_dev88.c | 2 +-
hw/display/cg3.c | 4 ++--
hw/display/qxl.c | 6 +++---
hw/display/sm501.c | 2 +-
hw/display/tc6393xb.c | 2 +-
hw/display/tcx.c | 4 ++--
hw/display/vga.c | 2 +-
hw/display/vmware_vga.c | 2 +-
hw/i386/pc.c | 2 +-
hw/i386/pc_sysfw.c | 4 ++--
hw/input/milkymist-softusb.c | 4 ++--
hw/m68k/an5206.c | 2 +-
hw/m68k/mcf5208.c | 2 +-
hw/microblaze/petalogix_ml605_mmu.c | 4 ++--
hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 ++--
hw/mips/mips_fulong2e.c | 2 +-
hw/mips/mips_jazz.c | 4 ++--
hw/mips/mips_malta.c | 2 +-
hw/mips/mips_mipssim.c | 2 +-
hw/mips/mips_r4k.c | 2 +-
hw/moxie/moxiesim.c | 4 ++--
hw/net/milkymist-minimac2.c | 2 +-
hw/openrisc/openrisc_sim.c | 2 +-
hw/pci-host/prep.c | 2 +-
hw/pci/pci.c | 2 +-
hw/ppc/mac_newworld.c | 2 +-
hw/ppc/mac_oldworld.c | 2 +-
hw/ppc/ppc405_boards.c | 7 ++++---
hw/ppc/ppc405_uc.c | 2 +-
hw/s390x/s390-virtio-ccw.c | 2 +-
hw/s390x/sclp.c | 3 ++-
hw/sh4/r2d.c | 2 +-
hw/sh4/shix.c | 6 +++---
hw/sparc/leon3.c | 2 +-
hw/sparc/sun4m.c | 6 +++---
hw/sparc64/sun4u.c | 4 ++--
hw/tricore/tricore_testboard.c | 18 ++++++++++++------
hw/unicore32/puv3.c | 2 +-
hw/xtensa/sim.c | 4 ++--
hw/xtensa/xtfpga.c | 7 ++++---
numa.c | 4 ++--
xen-hvm.c | 2 +-
62 files changed, 110 insertions(+), 101 deletions(-)
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index c6eab6d..40334d7 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -229,7 +229,7 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
/* 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, &error_abort);
+ memory_region_init_ram(hack, NULL, "armv7m.hack", 0x1000, &error_fatal);
vmstate_register_ram_global(hack);
memory_region_add_subregion(system_memory, 0xfffff000, hack);
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index c55fab8..d934980 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -259,7 +259,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
/* Internal ROM */
memory_region_init_ram(&s->irom_mem, NULL, "exynos4210.irom",
- EXYNOS4210_IROM_SIZE, &error_abort);
+ EXYNOS4210_IROM_SIZE, &error_fatal);
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,
@@ -275,7 +275,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
/* Internal RAM */
memory_region_init_ram(&s->iram_mem, NULL, "exynos4210.iram",
- EXYNOS4210_IRAM_SIZE, &error_abort);
+ EXYNOS4210_IRAM_SIZE, &error_fatal);
vmstate_register_ram_global(&s->iram_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_IRAM_BASE_ADDR,
&s->iram_mem);
@@ -284,14 +284,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, &error_abort);
+ mem_size - EXYNOS4210_DRAM_MAX_SIZE, &error_fatal);
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->dram0_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
&s->dram0_mem);
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index f8353a7..960bc39 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -281,7 +281,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
sysram = g_new(MemoryRegion, 1);
memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000,
- &error_abort);
+ &error_fatal);
memory_region_add_subregion(sysmem, 0xfff88000, sysram);
if (bios_name != NULL) {
sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index 0fbbf99..d87d36f 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -266,7 +266,7 @@ static int integratorcm_init(SysBusDevice *dev)
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->flash);
memory_region_init_io(&s->iomem, OBJECT(s), &integratorcm_ops, s,
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index 0da02a6..03e9fa5 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -124,7 +124,7 @@ 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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(rom);
memory_region_set_readonly(rom, true);
memory_region_add_subregion(address_space_mem, 0, rom);
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 42f66b3..5cff3d4 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1599,7 +1599,7 @@ static void musicpal_init(MachineState *machine)
memory_region_add_subregion(address_space_mem, 0, ram);
memory_region_init_ram(sram, NULL, "musicpal.sram", MP_SRAM_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(sram);
memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 8873f94..6b1c076 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -3872,7 +3872,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
s->sdram_size);
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->imif_ram);
memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram);
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index 1ee2d61..98ee19f 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -2271,7 +2271,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
s->sdram_size);
memory_region_add_subregion(sysmem, OMAP2_Q2_BASE, &s->sdram);
memory_region_init_ram(&s->sram, NULL, "omap2.sram", s->sram_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->sram);
memory_region_add_subregion(sysmem, OMAP2_SRAM_BASE, &s->sram);
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index 4b0f7f9..4de88f3 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -122,7 +122,7 @@ static void sx1_init(MachineState *machine, const int version)
/* External Flash (EMIFS) */
memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(flash);
memory_region_set_readonly(flash, true);
memory_region_add_subregion(address_space, OMAP_CS0_BASE, flash);
@@ -166,7 +166,7 @@ static void sx1_init(MachineState *machine, const int version)
(dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) {
MemoryRegion *flash_1 = g_new(MemoryRegion, 1);
memory_region_init_ram(flash_1, NULL, "omap_sx1.flash1-0", flash1_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(flash_1);
memory_region_set_readonly(flash_1, true);
memory_region_add_subregion(address_space, OMAP_CS1_BASE, flash_1);
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
index 7f1cfb8..1f84dbf 100644
--- a/hw/arm/palm.c
+++ b/hw/arm/palm.c
@@ -213,7 +213,7 @@ static void palmte_init(MachineState *machine)
/* External Flash (EMIFS) */
memory_region_init_ram(flash, NULL, "palmte.flash", flash_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(flash);
memory_region_set_readonly(flash, true);
memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash);
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index ec56b61..164260a 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -2078,11 +2078,11 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
/* SDRAM & Internal Memory Storage */
memory_region_init_ram(&s->sdram, NULL, "pxa270.sdram", sdram_size,
- &error_abort);
+ &error_fatal);
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->internal);
memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE,
&s->internal);
@@ -2212,11 +2212,11 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
/* SDRAM & Internal Memory Storage */
memory_region_init_ram(&s->sdram, NULL, "pxa255.sdram", sdram_size,
- &error_abort);
+ &error_fatal);
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, &error_abort);
+ PXA2XX_INTERNAL_SIZE, &error_fatal);
vmstate_register_ram_global(&s->internal);
memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE,
&s->internal);
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index ef2788d..23779ec 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -151,13 +151,13 @@ static void realview_init(MachineState *machine,
low_ram_size = ram_size - 0x20000000;
ram_size = 0x20000000;
memory_region_init_ram(ram_lo, NULL, "realview.lowmem", low_ram_size,
- &error_abort);
+ &error_fatal);
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(ram_hi);
low_ram_size = ram_size;
if (low_ram_size > 0x10000000)
@@ -353,7 +353,7 @@ static void realview_init(MachineState *machine,
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(ram_hack);
memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, ram_hack);
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index 5bf032a..1e6c814 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -913,7 +913,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, &error_abort);
+ memory_region_init_ram(rom, NULL, "spitz.rom", SPITZ_ROM, &error_fatal);
vmstate_register_ram_global(rom);
memory_region_set_readonly(rom, true);
memory_region_add_subregion(address_space_mem, 0, rom);
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index ca4628b..a76f051 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -1231,13 +1231,13 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
/* Flash programming is done via the SCU, so pretend it is ROM. */
memory_region_init_ram(flash, NULL, "stellaris.flash", flash_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(flash);
memory_region_set_readonly(flash, true);
memory_region_add_subregion(system_memory, 0, flash);
memory_region_init_ram(sram, NULL, "stellaris.sram", sram_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(sram);
memory_region_add_subregion(system_memory, 0x20000000, sram);
diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
index 0f3bdc7..4d26a7e 100644
--- a/hw/arm/stm32f205_soc.c
+++ b/hw/arm/stm32f205_soc.c
@@ -71,7 +71,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE,
- &error_abort);
+ &error_fatal);
memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias",
flash, 0, FLASH_SIZE);
@@ -84,7 +84,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion(system_memory, 0, flash_alias);
memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(sram);
memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
index 73572eb..2c216e9 100644
--- a/hw/arm/tosa.c
+++ b/hw/arm/tosa.c
@@ -227,7 +227,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, &error_abort);
+ memory_region_init_ram(rom, NULL, "tosa.rom", TOSA_ROM, &error_fatal);
vmstate_register_ram_global(rom);
memory_region_set_readonly(rom, true);
memory_region_add_subregion(address_space_mem, 0, rom);
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index da21788..9ca6e83 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -391,7 +391,7 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,
/* 0x2b0a0000: PL341 dynamic memory controller: not modelled */
/* 0x2e000000: system SRAM */
memory_region_init_ram(sram, NULL, "vexpress.a15sram", 0x10000,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(sram);
memory_region_add_subregion(sysmem, 0x2e000000, sram);
@@ -671,13 +671,13 @@ static void vexpress_common_init(MachineState *machine)
sram_size = 0x2000000;
memory_region_init_ram(sram, NULL, "vexpress.sram", sram_size,
- &error_abort);
+ &error_fatal);
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(vram);
memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram);
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index a4e7b5c..37dc0b0 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -167,7 +167,7 @@ static void zynq_init(MachineState *machine)
/* 256K of on-chip memory */
memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(ocm_ram);
memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram);
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
index 2955f3b..43b3e5a 100644
--- a/hw/arm/xlnx-zynqmp.c
+++ b/hw/arm/xlnx-zynqmp.c
@@ -113,7 +113,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
char *ocm_name = g_strdup_printf("zynqmp.ocm_ram_bank_%d", i);
memory_region_init_ram(&s->ocm_ram[i], NULL, ocm_name,
- XLNX_ZYNQMP_OCM_RAM_SIZE, &error_abort);
+ XLNX_ZYNQMP_OCM_RAM_SIZE, &error_fatal);
vmstate_register_ram_global(&s->ocm_ram[i]);
memory_region_add_subregion(get_system_memory(),
XLNX_ZYNQMP_OCM_RAM_0_ADDRESS +
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index 1b2c893..58eff50 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -786,7 +786,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, &error_abort);
+ 0xc000 << s->shift, &error_fatal);
vmstate_register_ram_global(&s->ram);
ram = memory_region_get_ram_ptr(&s->ram);
s->boot[0] = ram + (0x0000 << s->shift);
diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
index 3cae480..b57051e 100644
--- a/hw/cris/axis_dev88.c
+++ b/hw/cris/axis_dev88.c
@@ -277,7 +277,7 @@ void axisdev88_init(MachineState *machine)
/* 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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(phys_intmem);
memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem);
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index 34dcbc3..d2a0d97 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -281,7 +281,7 @@ static void cg3_initfn(Object *obj)
CG3State *s = CG3(obj);
memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE,
- &error_abort);
+ &error_fatal);
memory_region_set_readonly(&s->rom, true);
sysbus_init_mmio(sbd, &s->rom);
@@ -310,7 +310,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
}
memory_region_init_ram(&s->vram_mem, NULL, "cg3.vram", s->vram_size,
- &error_abort);
+ &error_fatal);
memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
vmstate_register_ram_global(&s->vram_mem);
sysbus_init_mmio(sbd, &s->vram_mem);
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 2288238..9c961da 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1970,14 +1970,14 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
qxl->rom_size = qxl_rom_size();
memory_region_init_ram(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom",
- qxl->rom_size, &error_abort);
+ qxl->rom_size, &error_fatal);
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, &error_abort);
+ qxl->vram_size, &error_fatal);
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);
@@ -2079,7 +2079,7 @@ static void qxl_realize_secondary(PCIDevice *dev, Error **errp)
qxl->id = device_id++;
qxl_init_ramsize(qxl);
memory_region_init_ram(&qxl->vga.vram, OBJECT(dev), "qxl.vgavram",
- qxl->vga.vram_size, &error_abort);
+ qxl->vga.vram_size, &error_fatal);
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);
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 15a5ba8..3c3f978 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1411,7 +1411,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, &error_abort);
+ local_mem_bytes, &error_fatal);
vmstate_register_ram_global(&s->local_mem_region);
memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA);
s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region);
diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
index f5f3f3e..516af1a 100644
--- a/hw/display/tc6393xb.c
+++ b/hw/display/tc6393xb.c
@@ -584,7 +584,7 @@ TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq)
memory_region_add_subregion(sysmem, base, &s->iomem);
memory_region_init_ram(&s->vram, NULL, "tc6393xb.vram", 0x100000,
- &error_abort);
+ &error_fatal);
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);
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 6acdc2d..4635800 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -945,7 +945,7 @@ static void tcx_initfn(Object *obj)
TCXState *s = TCX(obj);
memory_region_init_ram(&s->rom, NULL, "tcx.prom", FCODE_MAX_ROM_SIZE,
- &error_abort);
+ &error_fatal);
memory_region_set_readonly(&s->rom, true);
sysbus_init_mmio(sbd, &s->rom);
@@ -1007,7 +1007,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), &error_abort);
+ s->vram_size * (1 + 4 + 4), &error_fatal);
vmstate_register_ram_global(&s->vram_mem);
memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
vram_base = memory_region_get_ram_ptr(&s->vram_mem);
diff --git a/hw/display/vga.c b/hw/display/vga.c
index b35d523..9f68394 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2139,7 +2139,7 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
s->is_vbe_vmstate = 1;
memory_region_init_ram(&s->vram, obj, "vga.vram", s->vram_size,
- &error_abort);
+ &error_fatal);
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);
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 7f397d3..8e93509 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -1244,7 +1244,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s,
s->fifo_size = SVGA_FIFO_SIZE;
memory_region_init_ram(&s->fifo_ram, NULL, "vmsvga.fifo", s->fifo_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->fifo_ram);
s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b5107f7..6c2a405 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1400,7 +1400,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
option_rom_mr = g_malloc(sizeof(*option_rom_mr));
memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(option_rom_mr);
memory_region_add_subregion_overlap(rom_memory,
PC_ROM_MIN_VGA,
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 662d997..579461f 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -56,7 +56,7 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(isa_bios);
memory_region_add_subregion_overlap(rom_memory,
0x100000 - isa_bios_size,
@@ -193,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, &error_abort);
+ memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
vmstate_register_ram_global(bios);
if (!isapc_ram_fw) {
memory_region_set_readonly(bios, true);
diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c
index 7b0f4db..8a02d35 100644
--- a/hw/input/milkymist-softusb.c
+++ b/hw/input/milkymist-softusb.c
@@ -255,12 +255,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, &error_abort);
+ s->pmem_size, &error_fatal);
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, &error_abort);
+ s->dmem_size, &error_fatal);
vmstate_register_ram_global(&s->dmem);
s->dmem_ptr = memory_region_get_ram_ptr(&s->dmem);
sysbus_init_mmio(dev, &s->dmem);
diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c
index f63ab2b..b18dc7f 100644
--- a/hw/m68k/an5206.c
+++ b/hw/m68k/an5206.c
@@ -54,7 +54,7 @@ static void an5206_init(MachineState *machine)
memory_region_add_subregion(address_space_mem, 0, ram);
/* Internal SRAM. */
- memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_abort);
+ memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal);
vmstate_register_ram_global(sram);
memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index 326a42d..c38ffb8 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -222,7 +222,7 @@ static void mcf5208evb_init(MachineState *machine)
memory_region_add_subregion(address_space_mem, 0x40000000, ram);
/* Internal SRAM. */
- memory_region_init_ram(sram, NULL, "mcf5208.sram", 16384, &error_abort);
+ memory_region_init_ram(sram, NULL, "mcf5208.sram", 16384, &error_fatal);
vmstate_register_ram_global(sram);
memory_region_add_subregion(address_space_mem, 0x80000000, sram);
diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index ed84a37..d75b053 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -92,12 +92,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, &error_abort);
+ LMB_BRAM_SIZE, &error_fatal);
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(phys_ram);
memory_region_add_subregion(address_space_mem, MEMORY_BASEADDR, phys_ram);
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
index 0c2140c..701b435 100644
--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
@@ -71,12 +71,12 @@ 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,
- &error_abort);
+ &error_fatal);
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, &error_abort);
+ ram_size, &error_fatal);
vmstate_register_ram_global(phys_ram);
memory_region_add_subregion(sysmem, ddr_base, phys_ram);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index dea941a..e8fc8fe 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -304,7 +304,7 @@ static void mips_fulong2e_init(MachineState *machine)
/* allocate RAM */
memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size);
memory_region_init_ram(bios, NULL, "fulong2e.bios", bios_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
memory_region_set_readonly(bios, true);
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 9d60633..e163d40 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -184,7 +184,7 @@ static void mips_jazz_init(MachineState *machine,
memory_region_add_subregion(address_space, 0, ram);
memory_region_init_ram(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
memory_region_set_readonly(bios, true);
memory_region_init_alias(bios2, NULL, "mips_jazz.bios", bios,
@@ -252,7 +252,7 @@ static void mips_jazz_init(MachineState *machine,
/* 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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(rom_mr);
memory_region_set_readonly(rom_mr, true);
uint8_t *rom = memory_region_get_ram_ptr(rom_mr);
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 3082e75..e115850 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1130,7 +1130,7 @@ void mips_malta_init(MachineState *machine)
* regions are not executable.
*/
memory_region_init_ram(bios_copy, NULL, "bios.1fc", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
if (!rom_copy(memory_region_get_ram_ptr(bios_copy),
FLASH_ADDRESS, BIOS_SIZE)) {
memcpy(memory_region_get_ram_ptr(bios_copy),
diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
index 61f74a6..063151f 100644
--- a/hw/mips/mips_mipssim.c
+++ b/hw/mips/mips_mipssim.c
@@ -174,7 +174,7 @@ mips_mipssim_init(MachineState *machine)
memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram",
ram_size);
memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
memory_region_set_readonly(bios, true);
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index f4dcacd..7bc8f95 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -233,7 +233,7 @@ void mips_r4k_init(MachineState *machine)
if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
bios = g_new(MemoryRegion, 1);
memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
memory_region_set_readonly(bios, true);
memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios);
diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 80bcc5b..5e69e11 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -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, &error_abort);
+ memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fatal);
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, &error_abort);
+ memory_region_init_ram(rom, NULL, "moxie.rom", 128*0x1000, &error_fatal);
vmstate_register_ram_global(rom);
memory_region_add_subregion(get_system_memory(), 0x1000, rom);
diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
index 5d1cf08..6302b8b 100644
--- a/hw/net/milkymist-minimac2.c
+++ b/hw/net/milkymist-minimac2.c
@@ -463,7 +463,7 @@ static int milkymist_minimac2_init(SysBusDevice *sbd)
/* register buffers memory */
memory_region_init_ram(&s->buffers, OBJECT(dev), "milkymist-minimac2.buffers",
- buffers_size, &error_abort);
+ buffers_size, &error_fatal);
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;
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index 1da0657..09285bd 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -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, &error_abort);
+ memory_region_init_ram(ram, NULL, "openrisc.ram", ram_size, &error_fatal);
vmstate_register_ram_global(ram);
memory_region_add_subregion(get_system_memory(), 0, ram);
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index c63f45d..c93426b 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -302,7 +302,7 @@ static void raven_realize(PCIDevice *d, Error **errp)
d->config[0x34] = 0x00; // capabilities_pointer
memory_region_init_ram(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
memory_region_set_readonly(&s->bios, true);
memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE),
&s->bios);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index ccea628..b0bf540 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2081,7 +2081,7 @@ static void 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, &error_abort);
+ memory_region_init_ram(&pdev->rom, OBJECT(pdev), name, size, &error_fatal);
vmstate_register_ram(&pdev->rom, &pdev->qdev);
ptr = memory_region_get_ram_ptr(&pdev->rom);
load_image(path, ptr);
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 77d5c81..3c82be2 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -207,7 +207,7 @@ static void ppc_core99_init(MachineState *machine)
/* allocate and load BIOS */
memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
if (bios_name == NULL)
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 06fdbaf..1e4b55a 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -135,7 +135,7 @@ static void ppc_heathrow_init(MachineState *machine)
/* allocate and load BIOS */
memory_region_init_ram(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
if (bios_name == NULL)
diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index ec6c4cb..5389725 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -215,7 +215,8 @@ 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, &error_abort);
+ memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size,
+ &error_fatal);
vmstate_register_ram_global(sram);
memory_region_add_subregion(sysmem, 0xFFF00000, sram);
/* allocate and load BIOS */
@@ -250,7 +251,7 @@ static void ref405ep_init(MachineState *machine)
#endif
bios = g_new(MemoryRegion, 1);
memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
if (bios_name == NULL)
@@ -579,7 +580,7 @@ static void taihu_405ep_init(MachineState *machine)
bios_name = BIOS_FILENAME;
bios = g_new(MemoryRegion, 1);
memory_region_init_ram(bios, NULL, "taihu_405ep.bios", BIOS_SIZE,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(bios);
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index c77434a..10f5dda 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -975,7 +975,7 @@ 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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&ocm->isarc_ram);
memory_region_init_alias(&ocm->dsarc_ram, NULL, "ppc405.dsarc", &ocm->isarc_ram,
0, 4096);
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 27a8360..0e30c0f 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -106,7 +106,7 @@ void s390_memory_init(ram_addr_t mem_size)
MemoryRegion *ram = g_new(MemoryRegion, 1);
/* allocate RAM for core */
- memory_region_init_ram(ram, NULL, "s390.ram", mem_size, &error_abort);
+ memory_region_init_ram(ram, NULL, "s390.ram", mem_size, &error_fatal);
vmstate_register_ram_global(ram);
memory_region_add_subregion(sysmem, 0, ram);
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index fd277e1..a061b49 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -231,7 +231,8 @@ static void assign_storage(SCLPDevice *sclp, SCCB *sccb)
this_subregion_size = mhd->standby_subregion_size;
}
- memory_region_init_ram(standby_ram, NULL, id, this_subregion_size, &error_abort);
+ memory_region_init_ram(standby_ram, NULL, id, this_subregion_size,
+ &error_fatal);
/* This is a hack to make memory hotunplug work again. Once we have
* subdevices, we have to unparent them when unassigning memory,
* instead of doing it via the ref count of the MemoryRegion. */
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index 5e22ed7..fead347 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -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, &error_abort);
+ memory_region_init_ram(sdram, NULL, "r2d.sdram", SDRAM_SIZE, &error_fatal);
vmstate_register_ram_global(sdram);
memory_region_add_subregion(address_space_mem, SDRAM_BASE, sdram);
/* Register peripherals */
diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c
index f93f98e..59bcc23 100644
--- a/hw/sh4/shix.c
+++ b/hw/sh4/shix.c
@@ -59,16 +59,16 @@ static void shix_init(MachineState *machine)
}
/* Allocate memory space */
- memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_abort);
+ memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal);
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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&sdram[0]);
memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]);
memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&sdram[1]);
memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]);
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 7f5dcd6..dd01842 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -156,7 +156,7 @@ static void leon3_generic_hw_init(MachineState *machine)
/* Allocate BIOS */
prom_size = 8 * 1024 * 1024; /* 8Mb */
- memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size, &error_abort);
+ memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size, &error_fatal);
vmstate_register_ram_global(prom);
memory_region_set_readonly(prom, true);
memory_region_add_subregion(address_space_mem, 0x00000000, prom);
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 68ac4d8..7888b00 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -641,7 +641,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), &error_abort);
+ "sun4m.idreg", sizeof(idreg_data), &error_fatal);
vmstate_register_ram_global(&s->mem);
memory_region_set_readonly(&s->mem, true);
sysbus_init_mmio(dev, &s->mem);
@@ -688,7 +688,7 @@ static int afx_init1(SysBusDevice *dev)
{
AFXState *s = TCX_AFX(dev);
- memory_region_init_ram(&s->mem, OBJECT(s), "sun4m.afx", 4, &error_abort);
+ memory_region_init_ram(&s->mem, OBJECT(s), "sun4m.afx", 4, &error_fatal);
vmstate_register_ram_global(&s->mem);
sysbus_init_mmio(dev, &s->mem);
return 0;
@@ -763,7 +763,7 @@ static int prom_init1(SysBusDevice *dev)
PROMState *s = OPENPROM(dev);
memory_region_init_ram(&s->prom, OBJECT(s), "sun4m.prom", PROM_SIZE_MAX,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->prom);
memory_region_set_readonly(&s->prom, true);
sysbus_init_mmio(dev, &s->prom);
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 30cfa0e..47ecc23 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -690,7 +690,7 @@ static int prom_init1(SysBusDevice *dev)
PROMState *s = OPENPROM(dev);
memory_region_init_ram(&s->prom, OBJECT(s), "sun4u.prom", PROM_SIZE_MAX,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&s->prom);
memory_region_set_readonly(&s->prom, true);
sysbus_init_mmio(dev, &s->prom);
@@ -734,7 +734,7 @@ static int ram_init1(SysBusDevice *dev)
RamDevice *d = SUN4U_RAM(dev);
memory_region_init_ram(&d->ram, OBJECT(d), "sun4u.ram", d->size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(&d->ram);
sysbus_init_mmio(dev, &d->ram);
return 0;
diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c
index a059a20..ff4d2bd 100644
--- a/hw/tricore/tricore_testboard.c
+++ b/hw/tricore/tricore_testboard.c
@@ -76,17 +76,23 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
exit(1);
}
env = &cpu->env;
- memory_region_init_ram(ext_cram, NULL, "powerlink_ext_c.ram", 2*1024*1024, &error_abort);
+ memory_region_init_ram(ext_cram, NULL, "powerlink_ext_c.ram", 2*1024*1024,
+ &error_fatal);
vmstate_register_ram_global(ext_cram);
- memory_region_init_ram(ext_dram, NULL, "powerlink_ext_d.ram", 4*1024*1024, &error_abort);
+ memory_region_init_ram(ext_dram, NULL, "powerlink_ext_d.ram", 4*1024*1024,
+ &error_fatal);
vmstate_register_ram_global(ext_dram);
- memory_region_init_ram(int_cram, NULL, "powerlink_int_c.ram", 48*1024, &error_abort);
+ memory_region_init_ram(int_cram, NULL, "powerlink_int_c.ram", 48*1024,
+ &error_fatal);
vmstate_register_ram_global(int_cram);
- memory_region_init_ram(int_dram, NULL, "powerlink_int_d.ram", 48*1024, &error_abort);
+ memory_region_init_ram(int_dram, NULL, "powerlink_int_d.ram", 48*1024,
+ &error_fatal);
vmstate_register_ram_global(int_dram);
- memory_region_init_ram(pcp_data, NULL, "powerlink_pcp_data.ram", 16*1024, &error_abort);
+ memory_region_init_ram(pcp_data, NULL, "powerlink_pcp_data.ram", 16*1024,
+ &error_fatal);
vmstate_register_ram_global(pcp_data);
- memory_region_init_ram(pcp_text, NULL, "powerlink_pcp_text.ram", 32*1024, &error_abort);
+ memory_region_init_ram(pcp_text, NULL, "powerlink_pcp_text.ram", 32*1024,
+ &error_fatal);
vmstate_register_ram_global(pcp_text);
memory_region_add_subregion(sysmem, 0x80000000, ext_cram);
diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
index 703e29d..3026d94 100644
--- a/hw/unicore32/puv3.c
+++ b/hw/unicore32/puv3.c
@@ -75,7 +75,7 @@ static void puv3_board_init(CPUUniCore32State *env, ram_addr_t ram_size)
/* SDRAM at address zero. */
memory_region_init_ram(ram_memory, NULL, "puv3.ram", ram_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(ram_memory);
memory_region_add_subregion(get_system_memory(), 0, ram_memory);
}
diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c
index 328d209..3a8140a 100644
--- a/hw/xtensa/sim.c
+++ b/hw/xtensa/sim.c
@@ -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, &error_abort);
+ memory_region_init_ram(ram, NULL, "xtensa.sram", ram_size, &error_fatal);
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, &error_abort);
+ memory_region_init_ram(rom, NULL, "xtensa.rom", 0x1000, &error_fatal);
vmstate_register_ram_global(rom);
memory_region_add_subregion(get_system_memory(), 0xfe000000, rom);
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index ab4d0e4..5030ec9 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -143,7 +143,8 @@ 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, &error_abort);
+ memory_region_init_ram(ram, OBJECT(s), "open_eth.ram", 16384,
+ &error_fatal);
vmstate_register_ram_global(ram);
memory_region_add_subregion(address_space, buffers, ram);
}
@@ -223,7 +224,7 @@ 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,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(ram);
memory_region_add_subregion(system_memory, 0, ram);
@@ -275,7 +276,7 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
rom = g_malloc(sizeof(*rom));
memory_region_init_ram(rom, NULL, "lx60.sram", board->sram_size,
- &error_abort);
+ &error_fatal);
vmstate_register_ram_global(rom);
memory_region_add_subregion(system_memory, 0xfe000000, rom);
diff --git a/numa.c b/numa.c
index 402804b..f5aef36 100644
--- a/numa.c
+++ b/numa.c
@@ -424,14 +424,14 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,
*/
if (err) {
error_report_err(err);
- memory_region_init_ram(mr, owner, name, ram_size, &error_abort);
+ memory_region_init_ram(mr, owner, name, ram_size, &error_fatal);
}
#else
fprintf(stderr, "-mem-path not supported on this host\n");
exit(1);
#endif
} else {
- memory_region_init_ram(mr, owner, name, ram_size, &error_abort);
+ memory_region_init_ram(mr, owner, name, ram_size, &error_fatal);
}
vmstate_register_ram_global(mr);
}
diff --git a/xen-hvm.c b/xen-hvm.c
index 5ea621e..3d78a0c 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -213,7 +213,7 @@ static void xen_ram_init(PCMachineState *pcms,
block_len = (1ULL << 32) + pcms->above_4g_mem_size;
}
memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len,
- &error_abort);
+ &error_fatal);
*ram_memory_p = &ram_memory;
vmstate_register_ram_global(&ram_memory);
--
2.4.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 3/4] loader: Fix memory_region_init_resizeable_ram() error handling
2015-09-11 14:51 [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 1/4] error: New error_fatal Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 2/4] Fix bad error handling after memory_region_init_ram() Markus Armbruster
@ 2015-09-11 14:51 ` Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 4/4] memory: Fix bad error handling in memory_region_init_ram_ptr() Markus Armbruster
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Markus Armbruster @ 2015-09-11 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, peter.crosthwaite, hutao
Commit ef701d7 screwed up handling of out-of-memory conditions.
Before the commit, we report the error and exit(1), in one place. The
commit lifts the error handling up the call chain some, to three
places. Fine. Except it uses &error_abort in these places, changing
the behavior from exit(1) to abort(), and thus undoing the work of
commit 3922825 "exec: Don't abort when we can't allocate guest
memory".
The previous commit fixed up uses of memory_region_init_ram(). One of
them was replaced by memory_region_init_resizeable_ram() [sic!] in
commit a166614, so Coccinelle missed it. Fix it up.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/core/loader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 216eeeb..3b29881 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -741,7 +741,7 @@ static void *rom_set_mr(Rom *rom, Object *owner, const char *name)
memory_region_init_resizeable_ram(rom->mr, owner, name,
rom->datasize, rom->romsize,
fw_cfg_resized,
- &error_abort);
+ &error_fatal);
memory_region_set_readonly(rom->mr, true);
vmstate_register_ram_global(rom->mr);
--
2.4.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH 4/4] memory: Fix bad error handling in memory_region_init_ram_ptr()
2015-09-11 14:51 [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
` (2 preceding siblings ...)
2015-09-11 14:51 ` [Qemu-devel] [PATCH 3/4] loader: Fix memory_region_init_resizeable_ram() error handling Markus Armbruster
@ 2015-09-11 14:51 ` Markus Armbruster
2015-09-11 15:10 ` [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
2015-09-14 5:14 ` Peter Crosthwaite
5 siblings, 0 replies; 10+ messages in thread
From: Markus Armbruster @ 2015-09-11 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, peter.crosthwaite, hutao
Commit ef701d7 screwed up handling of out-of-memory conditions.
Before the commit, we report the error and exit(1), in one place. The
commit lifts the error handling up the call chain some, to three
places. Fine. Except it uses &error_abort in these places, changing
the behavior from exit(1) to abort(), and thus undoing the work of
commit 3922825 "exec: Don't abort when we can't allocate guest
memory".
The previous two commits fixed one of the three places, another one
was fixed in commit 33e0eb5. This commit fixes the third one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/memory.c b/memory.c
index 0d8b2d9..ef87363 100644
--- a/memory.c
+++ b/memory.c
@@ -1251,7 +1251,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
/* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */
assert(ptr != NULL);
- mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr, &error_abort);
+ mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr, &error_fatal);
}
void memory_region_set_skip_dump(MemoryRegion *mr)
--
2.4.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again)
2015-09-11 14:51 [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
` (3 preceding siblings ...)
2015-09-11 14:51 ` [Qemu-devel] [PATCH 4/4] memory: Fix bad error handling in memory_region_init_ram_ptr() Markus Armbruster
@ 2015-09-11 15:10 ` Markus Armbruster
2015-09-14 5:14 ` Peter Crosthwaite
5 siblings, 0 replies; 10+ messages in thread
From: Markus Armbruster @ 2015-09-11 15:10 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, Peter Crosthwaite
hutao@cn.fujitsu.com bounces, dropping.
peter.crosthwaite@xilinx.com, replacing with current address.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 1/4] error: New error_fatal
2015-09-11 14:51 ` [Qemu-devel] [PATCH 1/4] error: New error_fatal Markus Armbruster
@ 2015-09-11 15:13 ` Eric Blake
0 siblings, 0 replies; 10+ messages in thread
From: Eric Blake @ 2015-09-11 15:13 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: pbonzini, peter.crosthwaite, hutao
[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]
On 09/11/2015 08:51 AM, Markus Armbruster wrote:
> Similar to error_abort, but doesn't report where the error was
> created, and terminates the process with exit(1) rather than abort().
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> include/qapi/error.h | 11 +++++++++++
> util/error.c | 34 +++++++++++++++++++++-------------
> 2 files changed, 32 insertions(+), 13 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index d7878c3..c69dddb 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -50,6 +50,9 @@
> * Call a function aborting on errors:
> * foo(arg, &error_abort);
> *
> + * Call a function treating errors as fatal:
> + * foo(arg, &error_fatal);
> + *
Might be worth a bit more explanatory text: error_abort is for
diagnosing programmer errors (the situation cannot occur unless someone
introduced a bug), while error_fatal is for gracefully diagnosing user
errors at startup (the VM can't be booted because the user asked for the
impossible).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 2/4] Fix bad error handling after memory_region_init_ram()
2015-09-11 14:51 ` [Qemu-devel] [PATCH 2/4] Fix bad error handling after memory_region_init_ram() Markus Armbruster
@ 2015-09-14 5:13 ` Peter Crosthwaite
2015-09-14 7:57 ` Markus Armbruster
0 siblings, 1 reply; 10+ messages in thread
From: Peter Crosthwaite @ 2015-09-14 5:13 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Paolo Bonzini, qemu-devel@nongnu.org Developers, hutao
On Fri, Sep 11, 2015 at 7:51 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Symptom:
>
> $ qemu-system-x86_64 -m 10000000
> Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
> upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
> Aborted (core dumped)
>
> Root cause: commit ef701d7 screwed up handling of out-of-memory
> conditions. Before the commit, we report the error and exit(1), in
> one place, ram_block_add(). The commit lifts the error handling up
> the call chain some, to three places. Fine. Except it uses
> &error_abort in these places, changing the behavior from exit(1) to
> abort(), and thus undoing the work of commit 3922825 "exec: Don't
> abort when we can't allocate guest memory".
>
> The three places are:
>
> * memory_region_init_ram()
>
> Commit 4994653 (right after commit ef701d7) lifted the error
> handling further, through memory_region_init_ram(), multiplying the
> incorrect use of &error_abort. Later on, imitation of existing
> (bad) code may have created more.
>
> * memory_region_init_ram_ptr()
>
> The &error_abort is still there.
>
> * memory_region_init_rom_device()
>
> Doesn't need fixing, because commit 33e0eb5 (soon after commit
> ef701d7) lifted the error handling further, and in the process
> changed it from &error_abort to passing it up the call chain.
> Correct, because the callers are realize() methods.
>
> Fix the error handling after memory_region_init_ram() with a
> Coccinelle semantic patch:
>
> @r@
> expression mr, owner, name, size, err;
> position p;
> @@
> memory_region_init_ram(mr, owner, name, size,
> (
> - &error_abort
> + &error_fatal
> |
> err@p
> )
> );
> @script:python@
> p << r.p;
> @@
> print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
>
> When the last argument is &error_abort, it gets replaced by
> &error_fatal. This is the fix.
>
> If the last argument is anything else, its position is reported. This
> lets us check the fix is complete. Four positions get reported:
>
> * ram_backend_memory_alloc()
>
> Error is passed up the call chain, ultimately through
> user_creatable_complete(). As far as I can tell, it's callers all
> handle the error sanely.
>
> * fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
>
This is super modern code that is the exception to the rule doing it right.
> DeviceClass.realize() methods, errors handled sanely further up the
> call chain.
>
> We're good. Test case again behaves:
>
> $ qemu-system-x86_64 -m 10000000
> qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
> [Exit 1 ]
>
> The next commits will repair the rest of commit ef701d7's damage.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/arm/armv7m.c | 2 +-
> hw/arm/exynos4210.c | 8 ++++----
> hw/arm/highbank.c | 2 +-
> hw/arm/integratorcp.c | 2 +-
> hw/arm/mainstone.c | 2 +-
> hw/arm/musicpal.c | 2 +-
> hw/arm/omap1.c | 2 +-
> hw/arm/omap2.c | 2 +-
> hw/arm/omap_sx1.c | 4 ++--
> hw/arm/palm.c | 2 +-
> hw/arm/pxa2xx.c | 8 ++++----
> hw/arm/realview.c | 6 +++---
> hw/arm/spitz.c | 2 +-
> hw/arm/stellaris.c | 4 ++--
> hw/arm/stm32f205_soc.c | 4 ++--
> hw/arm/tosa.c | 2 +-
> hw/arm/vexpress.c | 6 +++---
> hw/arm/xilinx_zynq.c | 2 +-
> hw/arm/xlnx-zynqmp.c | 2 +-
> hw/block/onenand.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/display/cg3.c | 4 ++--
> hw/display/qxl.c | 6 +++---
> hw/display/sm501.c | 2 +-
> hw/display/tc6393xb.c | 2 +-
> hw/display/tcx.c | 4 ++--
> hw/display/vga.c | 2 +-
> hw/display/vmware_vga.c | 2 +-
> hw/i386/pc.c | 2 +-
> hw/i386/pc_sysfw.c | 4 ++--
> hw/input/milkymist-softusb.c | 4 ++--
> hw/m68k/an5206.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_ml605_mmu.c | 4 ++--
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 ++--
> hw/mips/mips_fulong2e.c | 2 +-
> hw/mips/mips_jazz.c | 4 ++--
> hw/mips/mips_malta.c | 2 +-
> hw/mips/mips_mipssim.c | 2 +-
> hw/mips/mips_r4k.c | 2 +-
> hw/moxie/moxiesim.c | 4 ++--
> hw/net/milkymist-minimac2.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/pci-host/prep.c | 2 +-
> hw/pci/pci.c | 2 +-
> hw/ppc/mac_newworld.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/ppc405_boards.c | 7 ++++---
> hw/ppc/ppc405_uc.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/s390x/sclp.c | 3 ++-
> hw/sh4/r2d.c | 2 +-
> hw/sh4/shix.c | 6 +++---
> hw/sparc/leon3.c | 2 +-
> hw/sparc/sun4m.c | 6 +++---
> hw/sparc64/sun4u.c | 4 ++--
> hw/tricore/tricore_testboard.c | 18 ++++++++++++------
> hw/unicore32/puv3.c | 2 +-
> hw/xtensa/sim.c | 4 ++--
> hw/xtensa/xtfpga.c | 7 ++++---
> numa.c | 4 ++--
> xen-hvm.c | 2 +-
So the changes here fall into a few different categories.
* Machine init code - error_fatal() is definately right (for the
moment, unless we want to support complete machine hotplug or
something crazy like that).
* SysBusDevice::init functions - These should be propagatable, but we
are really getting what we deserve with error_fatal(). They should be
desysbusified then can be converted to realize. Out of scope of this
series though.
* Device Realize functions (incl a few SoCs). In these cases we should
propagate for the sake of hotplug failure (or other reasons). I have
flagged the easy ones below.
* Common helper functions that are missing Error ** even though their
callers have them. We should added them (particular in VGA).
I think we should try and get the realize and helper ones right and do
the machine init and SBD::init ones later.
> 62 files changed, 110 insertions(+), 101 deletions(-)
>
> diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
> index c6eab6d..40334d7 100644
> --- a/hw/arm/armv7m.c
> +++ b/hw/arm/armv7m.c
> @@ -229,7 +229,7 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
> /* 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, &error_abort);
> + memory_region_init_ram(hack, NULL, "armv7m.hack", 0x1000, &error_fatal);
> vmstate_register_ram_global(hack);
> memory_region_add_subregion(system_memory, 0xfffff000, hack);
>
> diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
> index c55fab8..d934980 100644
> --- a/hw/arm/exynos4210.c
> +++ b/hw/arm/exynos4210.c
> @@ -259,7 +259,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
>
> /* Internal ROM */
> memory_region_init_ram(&s->irom_mem, NULL, "exynos4210.irom",
> - EXYNOS4210_IROM_SIZE, &error_abort);
> + EXYNOS4210_IROM_SIZE, &error_fatal);
> 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,
> @@ -275,7 +275,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
>
> /* Internal RAM */
> memory_region_init_ram(&s->iram_mem, NULL, "exynos4210.iram",
> - EXYNOS4210_IRAM_SIZE, &error_abort);
> + EXYNOS4210_IRAM_SIZE, &error_fatal);
> vmstate_register_ram_global(&s->iram_mem);
> memory_region_add_subregion(system_mem, EXYNOS4210_IRAM_BASE_ADDR,
> &s->iram_mem);
> @@ -284,14 +284,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, &error_abort);
> + mem_size - EXYNOS4210_DRAM_MAX_SIZE, &error_fatal);
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(&s->dram0_mem);
> memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
> &s->dram0_mem);
> diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
> index f8353a7..960bc39 100644
> --- a/hw/arm/highbank.c
> +++ b/hw/arm/highbank.c
> @@ -281,7 +281,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
>
> sysram = g_new(MemoryRegion, 1);
> memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000,
> - &error_abort);
> + &error_fatal);
> memory_region_add_subregion(sysmem, 0xfff88000, sysram);
> if (bios_name != NULL) {
> sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
> index 0fbbf99..d87d36f 100644
> --- a/hw/arm/integratorcp.c
> +++ b/hw/arm/integratorcp.c
> @@ -266,7 +266,7 @@ static int integratorcm_init(SysBusDevice *dev)
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(&s->flash);
>
> memory_region_init_io(&s->iomem, OBJECT(s), &integratorcm_ops, s,
> diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
> index 0da02a6..03e9fa5 100644
> --- a/hw/arm/mainstone.c
> +++ b/hw/arm/mainstone.c
> @@ -124,7 +124,7 @@ 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(rom);
> memory_region_set_readonly(rom, true);
> memory_region_add_subregion(address_space_mem, 0, rom);
> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
> index 42f66b3..5cff3d4 100644
> --- a/hw/arm/musicpal.c
> +++ b/hw/arm/musicpal.c
> @@ -1599,7 +1599,7 @@ static void musicpal_init(MachineState *machine)
> memory_region_add_subregion(address_space_mem, 0, ram);
>
> memory_region_init_ram(sram, NULL, "musicpal.sram", MP_SRAM_SIZE,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(sram);
> memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
>
> diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
> index 8873f94..6b1c076 100644
> --- a/hw/arm/omap1.c
> +++ b/hw/arm/omap1.c
> @@ -3872,7 +3872,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
> s->sdram_size);
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(&s->imif_ram);
> memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram);
>
> diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
> index 1ee2d61..98ee19f 100644
> --- a/hw/arm/omap2.c
> +++ b/hw/arm/omap2.c
> @@ -2271,7 +2271,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
> s->sdram_size);
> memory_region_add_subregion(sysmem, OMAP2_Q2_BASE, &s->sdram);
> memory_region_init_ram(&s->sram, NULL, "omap2.sram", s->sram_size,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(&s->sram);
> memory_region_add_subregion(sysmem, OMAP2_SRAM_BASE, &s->sram);
>
> diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
> index 4b0f7f9..4de88f3 100644
> --- a/hw/arm/omap_sx1.c
> +++ b/hw/arm/omap_sx1.c
> @@ -122,7 +122,7 @@ static void sx1_init(MachineState *machine, const int version)
>
> /* External Flash (EMIFS) */
> memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(flash);
> memory_region_set_readonly(flash, true);
> memory_region_add_subregion(address_space, OMAP_CS0_BASE, flash);
> @@ -166,7 +166,7 @@ static void sx1_init(MachineState *machine, const int version)
> (dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) {
> MemoryRegion *flash_1 = g_new(MemoryRegion, 1);
> memory_region_init_ram(flash_1, NULL, "omap_sx1.flash1-0", flash1_size,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(flash_1);
> memory_region_set_readonly(flash_1, true);
> memory_region_add_subregion(address_space, OMAP_CS1_BASE, flash_1);
> diff --git a/hw/arm/palm.c b/hw/arm/palm.c
> index 7f1cfb8..1f84dbf 100644
> --- a/hw/arm/palm.c
> +++ b/hw/arm/palm.c
> @@ -213,7 +213,7 @@ static void palmte_init(MachineState *machine)
>
> /* External Flash (EMIFS) */
> memory_region_init_ram(flash, NULL, "palmte.flash", flash_size,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(flash);
> memory_region_set_readonly(flash, true);
> memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash);
> diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
> index ec56b61..164260a 100644
> --- a/hw/arm/pxa2xx.c
> +++ b/hw/arm/pxa2xx.c
> @@ -2078,11 +2078,11 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
>
> /* SDRAM & Internal Memory Storage */
> memory_region_init_ram(&s->sdram, NULL, "pxa270.sdram", sdram_size,
> - &error_abort);
> + &error_fatal);
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(&s->internal);
> memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE,
> &s->internal);
> @@ -2212,11 +2212,11 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
>
> /* SDRAM & Internal Memory Storage */
> memory_region_init_ram(&s->sdram, NULL, "pxa255.sdram", sdram_size,
> - &error_abort);
> + &error_fatal);
> 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, &error_abort);
> + PXA2XX_INTERNAL_SIZE, &error_fatal);
> vmstate_register_ram_global(&s->internal);
> memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE,
> &s->internal);
> diff --git a/hw/arm/realview.c b/hw/arm/realview.c
> index ef2788d..23779ec 100644
> --- a/hw/arm/realview.c
> +++ b/hw/arm/realview.c
> @@ -151,13 +151,13 @@ static void realview_init(MachineState *machine,
> low_ram_size = ram_size - 0x20000000;
> ram_size = 0x20000000;
> memory_region_init_ram(ram_lo, NULL, "realview.lowmem", low_ram_size,
> - &error_abort);
> + &error_fatal);
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(ram_hi);
> low_ram_size = ram_size;
> if (low_ram_size > 0x10000000)
> @@ -353,7 +353,7 @@ static void realview_init(MachineState *machine,
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(ram_hack);
> memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, ram_hack);
>
> diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
> index 5bf032a..1e6c814 100644
> --- a/hw/arm/spitz.c
> +++ b/hw/arm/spitz.c
> @@ -913,7 +913,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, &error_abort);
> + memory_region_init_ram(rom, NULL, "spitz.rom", SPITZ_ROM, &error_fatal);
> vmstate_register_ram_global(rom);
> memory_region_set_readonly(rom, true);
> memory_region_add_subregion(address_space_mem, 0, rom);
> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
> index ca4628b..a76f051 100644
> --- a/hw/arm/stellaris.c
> +++ b/hw/arm/stellaris.c
> @@ -1231,13 +1231,13 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
>
> /* Flash programming is done via the SCU, so pretend it is ROM. */
> memory_region_init_ram(flash, NULL, "stellaris.flash", flash_size,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(flash);
> memory_region_set_readonly(flash, true);
> memory_region_add_subregion(system_memory, 0, flash);
>
> memory_region_init_ram(sram, NULL, "stellaris.sram", sram_size,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(sram);
> memory_region_add_subregion(system_memory, 0x20000000, sram);
>
> diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
> index 0f3bdc7..4d26a7e 100644
> --- a/hw/arm/stm32f205_soc.c
> +++ b/hw/arm/stm32f205_soc.c
> @@ -71,7 +71,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
> MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
>
> memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE,
> - &error_abort);
> + &error_fatal);
This should propagate
> memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias",
> flash, 0, FLASH_SIZE);
>
> @@ -84,7 +84,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
> memory_region_add_subregion(system_memory, 0, flash_alias);
>
> memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(sram);
> memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);
>
> diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
> index 73572eb..2c216e9 100644
> --- a/hw/arm/tosa.c
> +++ b/hw/arm/tosa.c
> @@ -227,7 +227,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, &error_abort);
> + memory_region_init_ram(rom, NULL, "tosa.rom", TOSA_ROM, &error_fatal);
> vmstate_register_ram_global(rom);
> memory_region_set_readonly(rom, true);
> memory_region_add_subregion(address_space_mem, 0, rom);
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index da21788..9ca6e83 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -391,7 +391,7 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,
> /* 0x2b0a0000: PL341 dynamic memory controller: not modelled */
> /* 0x2e000000: system SRAM */
> memory_region_init_ram(sram, NULL, "vexpress.a15sram", 0x10000,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(sram);
> memory_region_add_subregion(sysmem, 0x2e000000, sram);
>
> @@ -671,13 +671,13 @@ static void vexpress_common_init(MachineState *machine)
>
> sram_size = 0x2000000;
> memory_region_init_ram(sram, NULL, "vexpress.sram", sram_size,
> - &error_abort);
> + &error_fatal);
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(vram);
> memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram);
>
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index a4e7b5c..37dc0b0 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -167,7 +167,7 @@ static void zynq_init(MachineState *machine)
>
> /* 256K of on-chip memory */
> memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(ocm_ram);
> memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram);
>
> diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
> index 2955f3b..43b3e5a 100644
> --- a/hw/arm/xlnx-zynqmp.c
> +++ b/hw/arm/xlnx-zynqmp.c
> @@ -113,7 +113,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
> char *ocm_name = g_strdup_printf("zynqmp.ocm_ram_bank_%d", i);
>
> memory_region_init_ram(&s->ocm_ram[i], NULL, ocm_name,
> - XLNX_ZYNQMP_OCM_RAM_SIZE, &error_abort);
> + XLNX_ZYNQMP_OCM_RAM_SIZE, &error_fatal);
This should propagate.
> vmstate_register_ram_global(&s->ocm_ram[i]);
> memory_region_add_subregion(get_system_memory(),
> XLNX_ZYNQMP_OCM_RAM_0_ADDRESS +
> diff --git a/hw/block/onenand.c b/hw/block/onenand.c
> index 1b2c893..58eff50 100644
> --- a/hw/block/onenand.c
> +++ b/hw/block/onenand.c
> @@ -786,7 +786,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, &error_abort);
> + 0xc000 << s->shift, &error_fatal);
> vmstate_register_ram_global(&s->ram);
> ram = memory_region_get_ram_ptr(&s->ram);
> s->boot[0] = ram + (0x0000 << s->shift);
> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
> index 3cae480..b57051e 100644
> --- a/hw/cris/axis_dev88.c
> +++ b/hw/cris/axis_dev88.c
> @@ -277,7 +277,7 @@ void axisdev88_init(MachineState *machine)
> /* 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(phys_intmem);
> memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem);
>
> diff --git a/hw/display/cg3.c b/hw/display/cg3.c
> index 34dcbc3..d2a0d97 100644
> --- a/hw/display/cg3.c
> +++ b/hw/display/cg3.c
> @@ -281,7 +281,7 @@ static void cg3_initfn(Object *obj)
> CG3State *s = CG3(obj);
>
> memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE,
> - &error_abort);
> + &error_fatal);
> memory_region_set_readonly(&s->rom, true);
> sysbus_init_mmio(sbd, &s->rom);
>
> @@ -310,7 +310,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
> }
>
> memory_region_init_ram(&s->vram_mem, NULL, "cg3.vram", s->vram_size,
> - &error_abort);
> + &error_fatal);
> memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
> vmstate_register_ram_global(&s->vram_mem);
> sysbus_init_mmio(sbd, &s->vram_mem);
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index 2288238..9c961da 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -1970,14 +1970,14 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
>
> qxl->rom_size = qxl_rom_size();
> memory_region_init_ram(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom",
> - qxl->rom_size, &error_abort);
> + qxl->rom_size, &error_fatal);
Propagate.
> 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, &error_abort);
> + qxl->vram_size, &error_fatal);
> 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);
> @@ -2079,7 +2079,7 @@ static void qxl_realize_secondary(PCIDevice *dev, Error **errp)
> qxl->id = device_id++;
> qxl_init_ramsize(qxl);
> memory_region_init_ram(&qxl->vga.vram, OBJECT(dev), "qxl.vgavram",
> - qxl->vga.vram_size, &error_abort);
> + qxl->vga.vram_size, &error_fatal);
Propagate.
> 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);
> diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> index 15a5ba8..3c3f978 100644
> --- a/hw/display/sm501.c
> +++ b/hw/display/sm501.c
> @@ -1411,7 +1411,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, &error_abort);
> + local_mem_bytes, &error_fatal);
> vmstate_register_ram_global(&s->local_mem_region);
> memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA);
> s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region);
> diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c
> index f5f3f3e..516af1a 100644
> --- a/hw/display/tc6393xb.c
> +++ b/hw/display/tc6393xb.c
> @@ -584,7 +584,7 @@ TC6393xbState *tc6393xb_init(MemoryRegion *sysmem, uint32_t base, qemu_irq irq)
> memory_region_add_subregion(sysmem, base, &s->iomem);
>
> memory_region_init_ram(&s->vram, NULL, "tc6393xb.vram", 0x100000,
> - &error_abort);
> + &error_fatal);
> 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);
> diff --git a/hw/display/tcx.c b/hw/display/tcx.c
> index 6acdc2d..4635800 100644
> --- a/hw/display/tcx.c
> +++ b/hw/display/tcx.c
> @@ -945,7 +945,7 @@ static void tcx_initfn(Object *obj)
> TCXState *s = TCX(obj);
>
> memory_region_init_ram(&s->rom, NULL, "tcx.prom", FCODE_MAX_ROM_SIZE,
> - &error_abort);
> + &error_fatal);
I guess this one is particularly difficult, and indicates the RAM init
needs to move to realize.
> memory_region_set_readonly(&s->rom, true);
> sysbus_init_mmio(sbd, &s->rom);
>
> @@ -1007,7 +1007,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), &error_abort);
> + s->vram_size * (1 + 4 + 4), &error_fatal);
Propagate.
> vmstate_register_ram_global(&s->vram_mem);
> memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
> vram_base = memory_region_get_ram_ptr(&s->vram_mem);
> diff --git a/hw/display/vga.c b/hw/display/vga.c
> index b35d523..9f68394 100644
> --- a/hw/display/vga.c
> +++ b/hw/display/vga.c
> @@ -2139,7 +2139,7 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
>
Can this function accept error ** ? Most of the callers are realize fns.
> s->is_vbe_vmstate = 1;
> memory_region_init_ram(&s->vram, obj, "vga.vram", s->vram_size,
> - &error_abort);
> + &error_fatal);
Then this becomes a propagation.
> 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);
> diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
> index 7f397d3..8e93509 100644
> --- a/hw/display/vmware_vga.c
> +++ b/hw/display/vmware_vga.c
> @@ -1244,7 +1244,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s,
>
> s->fifo_size = SVGA_FIFO_SIZE;
> memory_region_init_ram(&s->fifo_ram, NULL, "vmsvga.fifo", s->fifo_size,
> - &error_abort);
> + &error_fatal);
Can add errp to this function from caller and propagate.
> vmstate_register_ram_global(&s->fifo_ram);
> s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram);
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index b5107f7..6c2a405 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1400,7 +1400,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
>
> option_rom_mr = g_malloc(sizeof(*option_rom_mr));
> memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(option_rom_mr);
> memory_region_add_subregion_overlap(rom_memory,
> PC_ROM_MIN_VGA,
> diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
> index 662d997..579461f 100644
> --- a/hw/i386/pc_sysfw.c
> +++ b/hw/i386/pc_sysfw.c
> @@ -56,7 +56,7 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(isa_bios);
> memory_region_add_subregion_overlap(rom_memory,
> 0x100000 - isa_bios_size,
> @@ -193,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, &error_abort);
> + memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal);
> vmstate_register_ram_global(bios);
> if (!isapc_ram_fw) {
> memory_region_set_readonly(bios, true);
> diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c
> index 7b0f4db..8a02d35 100644
> --- a/hw/input/milkymist-softusb.c
> +++ b/hw/input/milkymist-softusb.c
> @@ -255,12 +255,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, &error_abort);
> + s->pmem_size, &error_fatal);
> 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, &error_abort);
> + s->dmem_size, &error_fatal);
> vmstate_register_ram_global(&s->dmem);
> s->dmem_ptr = memory_region_get_ram_ptr(&s->dmem);
> sysbus_init_mmio(dev, &s->dmem);
> diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c
> index f63ab2b..b18dc7f 100644
> --- a/hw/m68k/an5206.c
> +++ b/hw/m68k/an5206.c
> @@ -54,7 +54,7 @@ static void an5206_init(MachineState *machine)
> memory_region_add_subregion(address_space_mem, 0, ram);
>
> /* Internal SRAM. */
> - memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_abort);
> + memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal);
> vmstate_register_ram_global(sram);
> memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);
>
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index 326a42d..c38ffb8 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -222,7 +222,7 @@ static void mcf5208evb_init(MachineState *machine)
> memory_region_add_subregion(address_space_mem, 0x40000000, ram);
>
> /* Internal SRAM. */
> - memory_region_init_ram(sram, NULL, "mcf5208.sram", 16384, &error_abort);
> + memory_region_init_ram(sram, NULL, "mcf5208.sram", 16384, &error_fatal);
> vmstate_register_ram_global(sram);
> memory_region_add_subregion(address_space_mem, 0x80000000, sram);
>
> diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
> index ed84a37..d75b053 100644
> --- a/hw/microblaze/petalogix_ml605_mmu.c
> +++ b/hw/microblaze/petalogix_ml605_mmu.c
> @@ -92,12 +92,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, &error_abort);
> + LMB_BRAM_SIZE, &error_fatal);
> 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(phys_ram);
> memory_region_add_subregion(address_space_mem, MEMORY_BASEADDR, phys_ram);
>
> diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> index 0c2140c..701b435 100644
> --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
> +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
> @@ -71,12 +71,12 @@ 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,
> - &error_abort);
> + &error_fatal);
> 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, &error_abort);
> + ram_size, &error_fatal);
> vmstate_register_ram_global(phys_ram);
> memory_region_add_subregion(sysmem, ddr_base, phys_ram);
>
> diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
> index dea941a..e8fc8fe 100644
> --- a/hw/mips/mips_fulong2e.c
> +++ b/hw/mips/mips_fulong2e.c
> @@ -304,7 +304,7 @@ static void mips_fulong2e_init(MachineState *machine)
> /* allocate RAM */
> memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size);
> memory_region_init_ram(bios, NULL, "fulong2e.bios", bios_size,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(bios);
> memory_region_set_readonly(bios, true);
>
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index 9d60633..e163d40 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -184,7 +184,7 @@ static void mips_jazz_init(MachineState *machine,
> memory_region_add_subregion(address_space, 0, ram);
>
> memory_region_init_ram(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(bios);
> memory_region_set_readonly(bios, true);
> memory_region_init_alias(bios2, NULL, "mips_jazz.bios", bios,
> @@ -252,7 +252,7 @@ static void mips_jazz_init(MachineState *machine,
> /* 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,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(rom_mr);
> memory_region_set_readonly(rom_mr, true);
> uint8_t *rom = memory_region_get_ram_ptr(rom_mr);
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 3082e75..e115850 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1130,7 +1130,7 @@ void mips_malta_init(MachineState *machine)
> * regions are not executable.
> */
> memory_region_init_ram(bios_copy, NULL, "bios.1fc", BIOS_SIZE,
> - &error_abort);
> + &error_fatal);
> if (!rom_copy(memory_region_get_ram_ptr(bios_copy),
> FLASH_ADDRESS, BIOS_SIZE)) {
> memcpy(memory_region_get_ram_ptr(bios_copy),
> diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
> index 61f74a6..063151f 100644
> --- a/hw/mips/mips_mipssim.c
> +++ b/hw/mips/mips_mipssim.c
> @@ -174,7 +174,7 @@ mips_mipssim_init(MachineState *machine)
> memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram",
> ram_size);
> memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(bios);
> memory_region_set_readonly(bios, true);
>
> diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
> index f4dcacd..7bc8f95 100644
> --- a/hw/mips/mips_r4k.c
> +++ b/hw/mips/mips_r4k.c
> @@ -233,7 +233,7 @@ void mips_r4k_init(MachineState *machine)
> if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
> bios = g_new(MemoryRegion, 1);
> memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
> - &error_abort);
> + &error_fatal);
> vmstate_register_ram_global(bios);
> memory_region_set_readonly(bios, true);
> memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios);
> diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
> index 80bcc5b..5e69e11 100644
> --- a/hw/moxie/moxiesim.c
> +++ b/hw/moxie/moxiesim.c
> @@ -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, &error_abort);
> + memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fatal);
> 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, &error_abort);
> + memory_region_init_ram(rom, NULL, "moxie.rom", 128*0x1000, &error_fatal);
> vmstate_register_ram_global(rom);
> memory_region_add_subregion(get_system_memory(), 0x1000, rom);
>
> diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c
> index 5d1cf08..6302b8b 100644
> --- a/hw/net/milkymist-minimac2.c
> +++ b/hw/net/milkymist-minimac2.c
> @@ -463,7 +463,7 @@ static int milkymist_minimac2_init(SysBusDevice *sbd)
>
> /* register buffers memory */
> memory_region_init_ram(&s->buffers, OBJECT(dev), "milkymist-minimac2.buffers",
> - buffers_size, &error_abort);
> + buffers_size, &error_fatal);
> 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;
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index 1da0657..09285bd 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -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, &error_abort);
> + memory_region_init_ram(ram, NULL, "openrisc.ram", ram_size, &error_fatal);
> vmstate_register_ram_global(ram);
> memory_region_add_subregion(get_system_memory(), 0, ram);
>
> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
> index c63f45d..c93426b 100644
> --- a/hw/pci-host/prep.c
> +++ b/hw/pci-host/prep.c
> @@ -302,7 +302,7 @@ static void raven_realize(PCIDevice *d, Error **errp)
> d->config[0x34] = 0x00; // capabilities_pointer
>
> memory_region_init_ram(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
> - &error_abort);
> + &error_fatal);
> memory_region_set_readonly(&s->bios, true);
> memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE),
> &s->bios);
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index ccea628..b0bf540 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2081,7 +2081,7 @@ static void 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, &error_abort);
> + memory_region_init_ram(&pdev->rom, OBJECT(pdev), name, size, &error_fatal);
Propagate.
Regards,
Peter
> vmstate_register_ram(&pdev->rom, &pdev->qdev);
> ptr = memory_region_get_ram_ptr(&pdev->rom);
> load_image(path, ptr);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again)
2015-09-11 14:51 [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
` (4 preceding siblings ...)
2015-09-11 15:10 ` [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
@ 2015-09-14 5:14 ` Peter Crosthwaite
5 siblings, 0 replies; 10+ messages in thread
From: Peter Crosthwaite @ 2015-09-14 5:14 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Paolo Bonzini, qemu-devel@nongnu.org Developers, hutao
On Fri, Sep 11, 2015 at 7:51 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Not nice:
>
> $ qemu-system-x86_64 -m 10000000
> Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
> upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
> Aborted (core dumped)
>
> I fixed this in commit 3922825 for v1.7, but commit ef701d7 regressed
> it for v2.2, and now I'm fixing it again, only this time the fix is
> fifteen times bigger.
>
> Folks involved in the flawed commit cc'ed, so they can do penance by
> reviewing my fix ;-P
>
> PATCH 1/4's error_fatal obviously enables further simplifications. I
> got some in my local tree, but they're not ready, yet.
>
This is better behaviour than before so
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
But many of these call sites are from modular code that shouldn't have
the authority to fatal QEMU. The SoCs and devices with their own RAMs
in particular, as it would be nice to one-day hotplug all this stuff.
Many of them should be converted to propagations. I have made more
notes on P2.
Regards,
Peter
> Markus Armbruster (4):
> error: New error_fatal
> Fix bad error handling after memory_region_init_ram()
> loader: Fix memory_region_init_resizeable_ram() error handling
> memory: Fix bad error handling in memory_region_init_ram_ptr()
>
> hw/arm/armv7m.c | 2 +-
> hw/arm/exynos4210.c | 8 ++++----
> hw/arm/highbank.c | 2 +-
> hw/arm/integratorcp.c | 2 +-
> hw/arm/mainstone.c | 2 +-
> hw/arm/musicpal.c | 2 +-
> hw/arm/omap1.c | 2 +-
> hw/arm/omap2.c | 2 +-
> hw/arm/omap_sx1.c | 4 ++--
> hw/arm/palm.c | 2 +-
> hw/arm/pxa2xx.c | 8 ++++----
> hw/arm/realview.c | 6 +++---
> hw/arm/spitz.c | 2 +-
> hw/arm/stellaris.c | 4 ++--
> hw/arm/stm32f205_soc.c | 4 ++--
> hw/arm/tosa.c | 2 +-
> hw/arm/vexpress.c | 6 +++---
> hw/arm/xilinx_zynq.c | 2 +-
> hw/arm/xlnx-zynqmp.c | 2 +-
> hw/block/onenand.c | 2 +-
> hw/core/loader.c | 2 +-
> hw/cris/axis_dev88.c | 2 +-
> hw/display/cg3.c | 4 ++--
> hw/display/qxl.c | 6 +++---
> hw/display/sm501.c | 2 +-
> hw/display/tc6393xb.c | 2 +-
> hw/display/tcx.c | 4 ++--
> hw/display/vga.c | 2 +-
> hw/display/vmware_vga.c | 2 +-
> hw/i386/pc.c | 2 +-
> hw/i386/pc_sysfw.c | 4 ++--
> hw/input/milkymist-softusb.c | 4 ++--
> hw/m68k/an5206.c | 2 +-
> hw/m68k/mcf5208.c | 2 +-
> hw/microblaze/petalogix_ml605_mmu.c | 4 ++--
> hw/microblaze/petalogix_s3adsp1800_mmu.c | 4 ++--
> hw/mips/mips_fulong2e.c | 2 +-
> hw/mips/mips_jazz.c | 4 ++--
> hw/mips/mips_malta.c | 2 +-
> hw/mips/mips_mipssim.c | 2 +-
> hw/mips/mips_r4k.c | 2 +-
> hw/moxie/moxiesim.c | 4 ++--
> hw/net/milkymist-minimac2.c | 2 +-
> hw/openrisc/openrisc_sim.c | 2 +-
> hw/pci-host/prep.c | 2 +-
> hw/pci/pci.c | 2 +-
> hw/ppc/mac_newworld.c | 2 +-
> hw/ppc/mac_oldworld.c | 2 +-
> hw/ppc/ppc405_boards.c | 7 ++++---
> hw/ppc/ppc405_uc.c | 2 +-
> hw/s390x/s390-virtio-ccw.c | 2 +-
> hw/s390x/sclp.c | 3 ++-
> hw/sh4/r2d.c | 2 +-
> hw/sh4/shix.c | 6 +++---
> hw/sparc/leon3.c | 2 +-
> hw/sparc/sun4m.c | 6 +++---
> hw/sparc64/sun4u.c | 4 ++--
> hw/tricore/tricore_testboard.c | 18 +++++++++++------
> hw/unicore32/puv3.c | 2 +-
> hw/xtensa/sim.c | 4 ++--
> hw/xtensa/xtfpga.c | 7 ++++---
> include/qapi/error.h | 11 +++++++++++
> memory.c | 2 +-
> numa.c | 4 ++--
> util/error.c | 34 ++++++++++++++++++++------------
> xen-hvm.c | 2 +-
> 66 files changed, 144 insertions(+), 116 deletions(-)
>
> --
> 2.4.3
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH 2/4] Fix bad error handling after memory_region_init_ram()
2015-09-14 5:13 ` Peter Crosthwaite
@ 2015-09-14 7:57 ` Markus Armbruster
0 siblings, 0 replies; 10+ messages in thread
From: Markus Armbruster @ 2015-09-14 7:57 UTC (permalink / raw)
To: Peter Crosthwaite; +Cc: Paolo Bonzini, qemu-devel@nongnu.org Developers, hutao
Peter Crosthwaite <crosthwaitepeter@gmail.com> writes:
> On Fri, Sep 11, 2015 at 7:51 AM, Markus Armbruster <armbru@redhat.com> wrote:
>> Symptom:
>>
>> $ qemu-system-x86_64 -m 10000000
>> Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
>> upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
>> Aborted (core dumped)
>>
>> Root cause: commit ef701d7 screwed up handling of out-of-memory
>> conditions. Before the commit, we report the error and exit(1), in
>> one place, ram_block_add(). The commit lifts the error handling up
>> the call chain some, to three places. Fine. Except it uses
>> &error_abort in these places, changing the behavior from exit(1) to
>> abort(), and thus undoing the work of commit 3922825 "exec: Don't
>> abort when we can't allocate guest memory".
>>
>> The three places are:
>>
>> * memory_region_init_ram()
>>
>> Commit 4994653 (right after commit ef701d7) lifted the error
>> handling further, through memory_region_init_ram(), multiplying the
>> incorrect use of &error_abort. Later on, imitation of existing
>> (bad) code may have created more.
>>
>> * memory_region_init_ram_ptr()
>>
>> The &error_abort is still there.
>>
>> * memory_region_init_rom_device()
>>
>> Doesn't need fixing, because commit 33e0eb5 (soon after commit
>> ef701d7) lifted the error handling further, and in the process
>> changed it from &error_abort to passing it up the call chain.
>> Correct, because the callers are realize() methods.
>>
>> Fix the error handling after memory_region_init_ram() with a
>> Coccinelle semantic patch:
>>
>> @r@
>> expression mr, owner, name, size, err;
>> position p;
>> @@
>> memory_region_init_ram(mr, owner, name, size,
>> (
>> - &error_abort
>> + &error_fatal
>> |
>> err@p
>> )
>> );
>> @script:python@
>> p << r.p;
>> @@
>> print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
>>
>> When the last argument is &error_abort, it gets replaced by
>> &error_fatal. This is the fix.
>>
>> If the last argument is anything else, its position is reported. This
>> lets us check the fix is complete. Four positions get reported:
>>
>> * ram_backend_memory_alloc()
>>
>> Error is passed up the call chain, ultimately through
>> user_creatable_complete(). As far as I can tell, it's callers all
>> handle the error sanely.
>>
>> * fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
>>
>
> This is super modern code that is the exception to the rule doing it right.
Progress :)
>> DeviceClass.realize() methods, errors handled sanely further up the
>> call chain.
>>
>> We're good. Test case again behaves:
>>
>> $ qemu-system-x86_64 -m 10000000
>> qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
>> [Exit 1 ]
>>
>> The next commits will repair the rest of commit ef701d7's damage.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
[...]
> So the changes here fall into a few different categories.
>
> * Machine init code - error_fatal() is definately right (for the
> moment, unless we want to support complete machine hotplug or
> something crazy like that).
> * SysBusDevice::init functions - These should be propagatable, but we
> are really getting what we deserve with error_fatal(). They should be
> desysbusified then can be converted to realize. Out of scope of this
> series though.
> * Device Realize functions (incl a few SoCs). In these cases we should
> propagate for the sake of hotplug failure (or other reasons). I have
> flagged the easy ones below.
> * Common helper functions that are missing Error ** even though their
> callers have them. We should added them (particular in VGA).
>
> I think we should try and get the realize and helper ones right and do
> the machine init and SBD::init ones later.
Makes sense. In fact, I got the obvious realize ones sketched in my
tree, but then forgot to mention it in my cover letter. Let me compare
your notes to my sketch.
[...]
>> --- a/hw/arm/stm32f205_soc.c
>> +++ b/hw/arm/stm32f205_soc.c
>> @@ -71,7 +71,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
>> MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
>>
>> memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE,
>> - &error_abort);
>> + &error_fatal);
>
>
> This should propagate
Yes.
>> memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias",
>> flash, 0, FLASH_SIZE);
>>
>> @@ -84,7 +84,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
>> memory_region_add_subregion(system_memory, 0, flash_alias);
>>
>> memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE,
>> - &error_abort);
>> + &error_fatal);
>> vmstate_register_ram_global(sram);
>> memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);
>>
This, too.
[...]
>> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
>> index a4e7b5c..37dc0b0 100644
>> --- a/hw/arm/xilinx_zynq.c
>> +++ b/hw/arm/xilinx_zynq.c
>> @@ -167,7 +167,7 @@ static void zynq_init(MachineState *machine)
>>
>> /* 256K of on-chip memory */
>> memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10,
>> - &error_abort);
>> + &error_fatal);
>> vmstate_register_ram_global(ocm_ram);
>> memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram);
>>
>> diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
>> index 2955f3b..43b3e5a 100644
>> --- a/hw/arm/xlnx-zynqmp.c
>> +++ b/hw/arm/xlnx-zynqmp.c
>> @@ -113,7 +113,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
>> char *ocm_name = g_strdup_printf("zynqmp.ocm_ram_bank_%d", i);
>>
>> memory_region_init_ram(&s->ocm_ram[i], NULL, ocm_name,
>> - XLNX_ZYNQMP_OCM_RAM_SIZE, &error_abort);
>> + XLNX_ZYNQMP_OCM_RAM_SIZE, &error_fatal);
>
> This should propagate.
Yes.
>> vmstate_register_ram_global(&s->ocm_ram[i]);
>> memory_region_add_subregion(get_system_memory(),
>> XLNX_ZYNQMP_OCM_RAM_0_ADDRESS +
>> diff --git a/hw/block/onenand.c b/hw/block/onenand.c
>> index 1b2c893..58eff50 100644
>> --- a/hw/block/onenand.c
>> +++ b/hw/block/onenand.c
>> @@ -786,7 +786,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, &error_abort);
>> + 0xc000 << s->shift, &error_fatal);
>> vmstate_register_ram_global(&s->ram);
>> ram = memory_region_get_ram_ptr(&s->ram);
>> s->boot[0] = ram + (0x0000 << s->shift);
>> diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c
>> index 3cae480..b57051e 100644
>> --- a/hw/cris/axis_dev88.c
>> +++ b/hw/cris/axis_dev88.c
>> @@ -277,7 +277,7 @@ void axisdev88_init(MachineState *machine)
>> /* 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,
>> - &error_abort);
>> + &error_fatal);
>> vmstate_register_ram_global(phys_intmem);
>> memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem);
>>
>> diff --git a/hw/display/cg3.c b/hw/display/cg3.c
>> index 34dcbc3..d2a0d97 100644
>> --- a/hw/display/cg3.c
>> +++ b/hw/display/cg3.c
>> @@ -281,7 +281,7 @@ static void cg3_initfn(Object *obj)
>> CG3State *s = CG3(obj);
>>
>> memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE,
>> - &error_abort);
>> + &error_fatal);
>> memory_region_set_readonly(&s->rom, true);
>> sysbus_init_mmio(sbd, &s->rom);
>>
Do this in cg3_realizefn() instead, so we can propagate?
>> @@ -310,7 +310,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
>> }
>>
>> memory_region_init_ram(&s->vram_mem, NULL, "cg3.vram", s->vram_size,
>> - &error_abort);
>> + &error_fatal);
>> memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
>> vmstate_register_ram_global(&s->vram_mem);
>> sysbus_init_mmio(sbd, &s->vram_mem);
This should propagate.
>> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
>> index 2288238..9c961da 100644
>> --- a/hw/display/qxl.c
>> +++ b/hw/display/qxl.c
>> @@ -1970,14 +1970,14 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
>>
>> qxl->rom_size = qxl_rom_size();
>> memory_region_init_ram(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom",
>> - qxl->rom_size, &error_abort);
>> + qxl->rom_size, &error_fatal);
>
> Propagate.
Yes.
>> 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, &error_abort);
>> + qxl->vram_size, &error_fatal);
>> 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);
This, too.
>> @@ -2079,7 +2079,7 @@ static void qxl_realize_secondary(PCIDevice *dev, Error **errp)
>> qxl->id = device_id++;
>> qxl_init_ramsize(qxl);
>> memory_region_init_ram(&qxl->vga.vram, OBJECT(dev), "qxl.vgavram",
>> - qxl->vga.vram_size, &error_abort);
>> + qxl->vga.vram_size, &error_fatal);
>
> Propagate.
Yes.
>> 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);
[...]
>> --- a/hw/display/tcx.c
>> +++ b/hw/display/tcx.c
>> @@ -945,7 +945,7 @@ static void tcx_initfn(Object *obj)
>> TCXState *s = TCX(obj);
>>
>> memory_region_init_ram(&s->rom, NULL, "tcx.prom", FCODE_MAX_ROM_SIZE,
>> - &error_abort);
>> + &error_fatal);
>
> I guess this one is particularly difficult, and indicates the RAM init
> needs to move to realize.
Similar to cg3_initfn().
>> memory_region_set_readonly(&s->rom, true);
>> sysbus_init_mmio(sbd, &s->rom);
>>
>> @@ -1007,7 +1007,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), &error_abort);
>> + s->vram_size * (1 + 4 + 4), &error_fatal);
>
> Propagate.
Yes.
>> vmstate_register_ram_global(&s->vram_mem);
>> memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
>> vram_base = memory_region_get_ram_ptr(&s->vram_mem);
>> diff --git a/hw/display/vga.c b/hw/display/vga.c
>> index b35d523..9f68394 100644
>> --- a/hw/display/vga.c
>> +++ b/hw/display/vga.c
>> @@ -2139,7 +2139,7 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
>>
>
> Can this function accept error ** ? Most of the callers are realize fns.
Then it should take Error **errp.
>> s->is_vbe_vmstate = 1;
>> memory_region_init_ram(&s->vram, obj, "vga.vram", s->vram_size,
>> - &error_abort);
>> + &error_fatal);
>
> Then this becomes a propagation.
Yes.
>> 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);
>> diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
>> index 7f397d3..8e93509 100644
>> --- a/hw/display/vmware_vga.c
>> +++ b/hw/display/vmware_vga.c
>> @@ -1244,7 +1244,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s,
>>
>> s->fifo_size = SVGA_FIFO_SIZE;
>> memory_region_init_ram(&s->fifo_ram, NULL, "vmsvga.fifo", s->fifo_size,
>> - &error_abort);
>> + &error_fatal);
>
> Can add errp to this function from caller and propagate.
Yes.
[...]
>> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
>> index c63f45d..c93426b 100644
>> --- a/hw/pci-host/prep.c
>> +++ b/hw/pci-host/prep.c
>> @@ -302,7 +302,7 @@ static void raven_realize(PCIDevice *d, Error **errp)
>> d->config[0x34] = 0x00; // capabilities_pointer
>>
>> memory_region_init_ram(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
>> - &error_abort);
>> + &error_fatal);
>> memory_region_set_readonly(&s->bios, true);
>> memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE),
>> &s->bios);
Propagate.
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index ccea628..b0bf540 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -2081,7 +2081,7 @@ static void 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, &error_abort);
>> + memory_region_init_ram(&pdev->rom, OBJECT(pdev), name, size, &error_fatal);
>
> Propagate.
Yes.
> Regards,
> Peter
>
>> vmstate_register_ram(&pdev->rom, &pdev->qdev);
>> ptr = memory_region_get_ram_ptr(&pdev->rom);
>> load_image(path, ptr);
You got a few more than me, I got a few more than you; lovely :)
Three kinds of changes to be done, I think:
A. Fix use of &error_fatal in functions that already have an Error **
parameter
Propagate the error. Trivial. Could probably go through my tree as
a single patch. Should start with my sketch (appended) to save some
typing.
B. Add Error ** parameter to functions called from functions that have an
Error ** parameter
Should be straightforward. May want to route it through the
relevant maintainer, though.
C. Move calls that can fail from .instance_init() to .realize()
Route through the relevant maintainer.
If you'd like to pitch in, let me know, so we don't duplicate work.
Here's my (incomplete!) sketch:
diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
index 4d26a7e..e3bec1d 100644
--- a/hw/arm/stm32f205_soc.c
+++ b/hw/arm/stm32f205_soc.c
@@ -71,7 +71,11 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE,
- &error_fatal);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias",
flash, 0, FLASH_SIZE);
@@ -83,8 +87,11 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash);
memory_region_add_subregion(system_memory, 0, flash_alias);
- memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE,
- &error_fatal);
+ memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
vmstate_register_ram_global(sram);
memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
index 43b3e5a..2d57f27 100644
--- a/hw/arm/xlnx-zynqmp.c
+++ b/hw/arm/xlnx-zynqmp.c
@@ -113,7 +113,11 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
char *ocm_name = g_strdup_printf("zynqmp.ocm_ram_bank_%d", i);
memory_region_init_ram(&s->ocm_ram[i], NULL, ocm_name,
- XLNX_ZYNQMP_OCM_RAM_SIZE, &error_fatal);
+ XLNX_ZYNQMP_OCM_RAM_SIZE, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
vmstate_register_ram_global(&s->ocm_ram[i]);
memory_region_add_subregion(get_system_memory(),
XLNX_ZYNQMP_OCM_RAM_0_ADDRESS +
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index d2a0d97..adf847f 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -294,6 +294,7 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
{
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
CG3State *s = CG3(dev);
+ Error *err = NULL;
int ret;
char *fcode_filename;
@@ -310,7 +311,11 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
}
memory_region_init_ram(&s->vram_mem, NULL, "cg3.vram", s->vram_size,
- &error_fatal);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
vmstate_register_ram_global(&s->vram_mem);
sysbus_init_mmio(sbd, &s->vram_mem);
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 9c961da..d8a381f 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1931,6 +1931,7 @@ static void qxl_init_ramsize(PCIQXLDevice *qxl)
static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
{
uint8_t* config = qxl->pci.config;
+ Error *err = NULL;
uint32_t pci_device_rev;
uint32_t io_size;
@@ -1970,14 +1971,22 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
qxl->rom_size = qxl_rom_size();
memory_region_init_ram(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom",
- qxl->rom_size, &error_fatal);
+ qxl->rom_size, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
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, &error_fatal);
+ qxl->vram_size, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
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);
@@ -2075,11 +2084,16 @@ static void qxl_realize_secondary(PCIDevice *dev, Error **errp)
{
static int device_id = 1;
PCIQXLDevice *qxl = PCI_QXL(dev);
+ Error *err = NULL;
qxl->id = device_id++;
qxl_init_ramsize(qxl);
memory_region_init_ram(&qxl->vga.vram, OBJECT(dev), "qxl.vgavram",
- qxl->vga.vram_size, &error_fatal);
+ qxl->vga.vram_size, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
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);
diff --git a/hw/display/tcx.c b/hw/display/tcx.c
index 4635800..623683f 100644
--- a/hw/display/tcx.c
+++ b/hw/display/tcx.c
@@ -1002,12 +1002,17 @@ static void tcx_realizefn(DeviceState *dev, Error **errp)
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
TCXState *s = TCX(dev);
ram_addr_t vram_offset = 0;
+ Error *err = NULL;
int size, ret;
uint8_t *vram_base;
char *fcode_filename;
memory_region_init_ram(&s->vram_mem, OBJECT(s), "tcx.vram",
- s->vram_size * (1 + 4 + 4), &error_fatal);
+ s->vram_size * (1 + 4 + 4), &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
vmstate_register_ram_global(&s->vram_mem);
memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
vram_base = memory_region_get_ram_ptr(&s->vram_mem);
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index c93426b..9af1323 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -294,6 +294,7 @@ static void raven_pcihost_initfn(Object *obj)
static void raven_realize(PCIDevice *d, Error **errp)
{
RavenPCIState *s = RAVEN_PCI_DEVICE(d);
+ Error *err = NULL;
char *filename;
int bios_size = -1;
@@ -301,8 +302,11 @@ static void raven_realize(PCIDevice *d, Error **errp)
d->config[0x0D] = 0x10; // latency_timer
d->config[0x34] = 0x00; // capabilities_pointer
- memory_region_init_ram(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
- &error_fatal);
+ memory_region_init_ram(&s->bios, OBJECT(s), "bios", BIOS_SIZE, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
memory_region_set_readonly(&s->bios, true);
memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE),
&s->bios);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index b0bf540..88acbeb 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2020,6 +2020,7 @@ static void pci_patch_ids(PCIDevice *pdev, uint8_t *ptr, int size)
static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,
Error **errp)
{
+ Error *err = NULL;
int size;
char *path;
void *ptr;
@@ -2081,7 +2082,11 @@ static void 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, &error_fatal);
+ memory_region_init_ram(&pdev->rom, OBJECT(pdev), name, size, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
vmstate_register_ram(&pdev->rom, &pdev->qdev);
ptr = memory_region_get_ram_ptr(&pdev->rom);
load_image(path, ptr);
--
2.4.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-09-14 7:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11 14:51 [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 1/4] error: New error_fatal Markus Armbruster
2015-09-11 15:13 ` Eric Blake
2015-09-11 14:51 ` [Qemu-devel] [PATCH 2/4] Fix bad error handling after memory_region_init_ram() Markus Armbruster
2015-09-14 5:13 ` Peter Crosthwaite
2015-09-14 7:57 ` Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 3/4] loader: Fix memory_region_init_resizeable_ram() error handling Markus Armbruster
2015-09-11 14:51 ` [Qemu-devel] [PATCH 4/4] memory: Fix bad error handling in memory_region_init_ram_ptr() Markus Armbruster
2015-09-11 15:10 ` [Qemu-devel] [PATCH 0/4] Don't abort when we can't allocate guest memory (again) Markus Armbruster
2015-09-14 5:14 ` Peter Crosthwaite
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).