qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>,
	"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH v3 20/25] hw/riscv: Let devices own the MemoryRegion they create
Date: Mon, 16 Mar 2020 19:50:01 +0100	[thread overview]
Message-ID: <20200316185006.576-21-philmd@redhat.com> (raw)
In-Reply-To: <20200316185006.576-1-philmd@redhat.com>

Avoid orphan memory regions being added in the /unattached QOM
container.

This commit was produced with the Coccinelle script
scripts/coccinelle/memory-region-housekeeping.cocci.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/riscv/sifive_e.c | 6 +++---
 hw/riscv/sifive_u.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index a1974ef7be..646553a7c3 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -145,8 +145,8 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
                             &error_abort);
 
     /* Mask ROM */
-    memory_region_init_rom(&s->mask_rom, NULL, "riscv.sifive.e.mrom",
-        memmap[SIFIVE_E_MROM].size, &error_fatal);
+    memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom",
+                           memmap[SIFIVE_E_MROM].size, &error_fatal);
     memory_region_add_subregion(sys_mem,
         memmap[SIFIVE_E_MROM].base, &s->mask_rom);
 
@@ -208,7 +208,7 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
         memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size);
 
     /* Flash memory */
-    memory_region_init_rom(&s->xip_mem, NULL, "riscv.sifive.e.xip",
+    memory_region_init_rom(&s->xip_mem, OBJECT(dev), "riscv.sifive.e.xip",
                            memmap[SIFIVE_E_XIP].size, &error_fatal);
     memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base,
         &s->xip_mem);
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 156a003642..662d42a5a7 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -497,7 +497,7 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
                              &error_abort);
 
     /* boot rom */
-    memory_region_init_rom(mask_rom, NULL, "riscv.sifive.u.mrom",
+    memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom",
                            memmap[SIFIVE_U_MROM].size, &error_fatal);
     memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base,
                                 mask_rom);
-- 
2.21.1



  parent reply	other threads:[~2020-03-16 18:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 18:49 [PATCH v3 00/25] hw: Sanitize various MemoryRegion calls Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 01/25] memory: Correctly return alias region type Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 02/25] memory: Simplify memory_region_init_rom_nomigrate() to ease review Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 03/25] scripts/cocci: Rename memory-region-{init-ram -> housekeeping} Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 04/25] scripts/cocci: Patch to replace memory_region_init_{ram, readonly -> rom} Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 05/25] hw/arm: Use memory_region_init_rom() with read-only regions Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 06/25] hw/display: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 07/25] hw/m68k: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 08/25] hw/net: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 09/25] hw/pci-host: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 10/25] hw/ppc: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 11/25] hw/riscv: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 12/25] hw/sh4: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 13/25] hw/sparc: " Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 14/25] scripts/cocci: Patch to detect potential use of memory_region_init_rom Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 15/25] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly() Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 16/25] scripts/cocci: Patch to let devices own their MemoryRegions Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 17/25] hw/core: Let devices own the MemoryRegion they create Philippe Mathieu-Daudé
2020-03-16 18:49 ` [PATCH v3 18/25] hw/display: " Philippe Mathieu-Daudé
2020-03-16 18:50 ` [PATCH v3 19/25] hw/dma: " Philippe Mathieu-Daudé
2020-03-16 18:50 ` Philippe Mathieu-Daudé [this message]
2020-03-16 18:50   ` [PATCH v3 20/25] hw/riscv: " Alistair Francis
2020-03-16 18:50 ` [PATCH v3 21/25] hw/char: " Philippe Mathieu-Daudé
2020-03-16 18:50 ` [PATCH v3 22/25] hw/arm/stm32: Use memory_region_init_rom() with read-only regions Philippe Mathieu-Daudé
2020-03-16 18:50 ` [PATCH v3 23/25] hw/ppc/ppc405: " Philippe Mathieu-Daudé
2020-03-16 18:50 ` [PATCH v3 24/25] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias Philippe Mathieu-Daudé
2020-03-16 18:50 ` [PATCH v3 25/25] hw/arm: Let devices own the MemoryRegion they create Philippe Mathieu-Daudé
2020-03-16 19:50 ` [PATCH v3 00/25] hw: Sanitize various MemoryRegion calls Aleksandar Markovic

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=20200316185006.576-21-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=sagark@eecs.berkeley.edu \
    /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).