From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>
Subject: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory()
Date: Tue, 4 Jul 2017 18:02:40 +0100 [thread overview]
Message-ID: <1499187763-8211-1-git-send-email-peter.maydell@linaro.org> (raw)
Many board models and several devices need to create auxiliary
regions of RAM (in addition to the main lump of 'system' memory),
to model static RAMs, video memory, ROMs, etc. Currently they do
this with a sequence like:
memory_region_init_ram(sram, NULL, "sram", 0x10000, &error_fatal);
vmstate_register_ram_global(sram);
but the need for the second function call is not obvious and if
omitted the bug is subtle (possible migration failure). This series
wraps the two calls up into a single new function
memory_region_allocate_aux_memory(), named to parallel the existing
memory_region_allocate_system_memory().
Patch 1 documents memory_region_allocate_system_memory() which
has a couple of non-obvious wrinkles. Patch 2 implements the new
utility function. Patch 3 changes a lot of callsites to use it
with the aid of the included coccinelle patch. (I think most
of the remaining callsites of vmstate_register_ram_global() are
not changed just because they report the error up to their caller
rather than using error_fatal. I'm not sure what kind of error you
might get back that wasn't "out of memory", which we usually make
fatal anyway, so perhaps we could change those callsites too.)
thanks
-- PMM
Peter Maydell (3):
include/hw/boards.h: Document memory_region_allocate_system_memory()
memory.h: Add new utility function memory_region_allocate_aux_memory()
hw: Use new memory_region_allocate_aux_memory() function
include/exec/memory.h | 23 +++++++++++++++++++++++
include/hw/boards.h | 29 +++++++++++++++++++++++++++++
hw/arm/exynos4210.c | 10 ++++------
hw/arm/exynos4_boards.c | 12 +++++-------
hw/arm/integratorcp.c | 5 ++---
hw/arm/mainstone.c | 5 ++---
hw/arm/musicpal.c | 5 ++---
hw/arm/omap1.c | 5 ++---
hw/arm/omap2.c | 5 ++---
hw/arm/omap_sx1.c | 10 ++++------
hw/arm/palm.c | 4 +---
hw/arm/pxa2xx.c | 20 ++++++++------------
hw/arm/realview.c | 14 +++++---------
hw/arm/spitz.c | 3 +--
hw/arm/stellaris.c | 9 +++------
hw/arm/stm32f205_soc.c | 10 +++-------
hw/arm/tosa.c | 3 +--
hw/arm/vexpress.c | 12 +++---------
hw/arm/virt.c | 3 +--
hw/arm/xilinx_zynq.c | 5 ++---
hw/arm/xlnx-zynqmp.c | 5 ++---
hw/block/onenand.c | 5 ++---
hw/cris/axis_dev88.c | 5 ++---
hw/display/cg3.c | 5 ++---
hw/display/sm501.c | 5 ++---
hw/display/tc6393xb.c | 5 ++---
hw/display/tcx.c | 5 ++---
hw/display/vmware_vga.c | 5 ++---
hw/i386/pc.c | 5 ++---
hw/i386/pc_sysfw.c | 8 +++-----
hw/i386/xen/xen-hvm.c | 4 +---
hw/input/milkymist-softusb.c | 10 ++++------
hw/m68k/an5206.c | 3 +--
hw/m68k/mcf5208.c | 3 +--
hw/microblaze/petalogix_ml605_mmu.c | 11 +++++------
hw/microblaze/petalogix_s3adsp1800_mmu.c | 12 +++++-------
hw/mips/mips_fulong2e.c | 4 +---
hw/mips/mips_jazz.c | 10 ++++------
hw/mips/mips_mipssim.c | 5 ++---
hw/mips/mips_r4k.c | 5 ++---
hw/moxie/moxiesim.c | 6 ++----
hw/net/milkymist-minimac2.c | 6 +++---
hw/openrisc/openrisc_sim.c | 3 +--
hw/pci-host/prep.c | 5 +----
hw/ppc/mac_newworld.c | 5 ++---
hw/ppc/mac_oldworld.c | 5 ++---
hw/ppc/ppc405_boards.c | 14 +++++---------
hw/ppc/ppc405_uc.c | 5 ++---
hw/s390x/sclp.c | 5 ++---
hw/sh4/r2d.c | 3 +--
hw/sh4/shix.c | 13 +++++--------
hw/sparc/leon3.c | 3 +--
hw/sparc/sun4m.c | 13 +++++--------
hw/sparc64/sun4u.c | 10 ++++------
hw/tricore/tricore_testboard.c | 30 ++++++++++++------------------
hw/unicore32/puv3.c | 4 +---
hw/xtensa/sim.c | 6 ++----
hw/xtensa/xtfpga.c | 14 +++++---------
memory.c | 8 ++++++++
scripts/coccinelle/allocate_aux_mem.cocci | 14 ++++++++++++++
60 files changed, 228 insertions(+), 256 deletions(-)
create mode 100644 scripts/coccinelle/allocate_aux_mem.cocci
--
2.7.4
next reply other threads:[~2017-07-04 17:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-04 17:02 Peter Maydell [this message]
2017-07-04 17:02 ` [Qemu-devel] [PATCH 1/3] include/hw/boards.h: Document memory_region_allocate_system_memory() Peter Maydell
2017-07-06 3:18 ` Philippe Mathieu-Daudé
2017-07-06 8:46 ` Paolo Bonzini
2017-07-04 17:02 ` [Qemu-devel] [PATCH 2/3] memory.h: Add new utility function memory_region_allocate_aux_memory() Peter Maydell
2017-07-04 17:02 ` [Qemu-devel] [PATCH 3/3] hw: Use new memory_region_allocate_aux_memory() function Peter Maydell
2017-07-05 12:21 ` [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory() Paolo Bonzini
2017-07-06 14:52 ` Peter Maydell
2017-07-06 14:56 ` Paolo Bonzini
2017-07-06 16:26 ` Peter Maydell
2017-07-06 16:49 ` Paolo Bonzini
2017-07-07 13:18 ` Igor Mammedov
2017-07-07 13:49 ` Peter Maydell
2017-07-17 16:28 ` Peter Maydell
2017-07-07 13:06 ` Igor Mammedov
2017-07-06 17:13 ` Peter Maydell
2017-07-06 17:26 ` Paolo Bonzini
2017-07-06 17:47 ` Peter Maydell
2017-07-07 10:43 ` Peter Maydell
2017-07-07 10:55 ` Paolo Bonzini
2017-07-07 11:58 ` Peter Maydell
2017-07-07 12:03 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499187763-8211-1-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).