From: David Gibson <david@gibson.dropbear.id.au>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Kevin Wolf" <kwolf@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>,
qemu-block@nongnu.org,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Joel Stanley" <joel@jms.id.au>,
qemu-ppc@nongnu.org,
"Alistair Francis" <Alistair.Francis@wdc.com>,
"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Aleksandar Markovic" <amarkovic@wavecomp.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
"Jason Wang" <jasowang@redhat.com>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
"Laurent Vivier" <laurent@vivier.eu>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Peter Chubb" <peter.chubb@nicta.com.au>,
"Max Reitz" <mreitz@redhat.com>,
"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
"KONRAD Frederic" <frederic.konrad@adacore.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Andrzej Zaborowski" <balrogg@gmail.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
qemu-arm@nongnu.org, "Aurelien Jarno" <aurelien@aurel32.net>,
"Michael Walle" <michael@walle.cc>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
qemu-riscv@nongnu.org, "Fabien Chouteau" <chouteau@adacore.com>
Subject: Re: [PATCH RESEND v2 17/32] hw/ppc/ppc405: Use memory_region_init_rom() with read-only regions
Date: Tue, 25 Feb 2020 11:24:03 +1100 [thread overview]
Message-ID: <20200225002403.GD41629@umbus.fritz.box> (raw)
In-Reply-To: <20200224205533.23798-18-philmd@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2718 bytes --]
On Mon, Feb 24, 2020 at 09:55:18PM +0100, Philippe Mathieu-Daudé wrote:
> The scripts/coccinelle/memory-region-housekeeping.cocci reported:
> * TODO [[view:./hw/ppc/ppc405_boards.c::face=ovl-face1::linb=195::colb=8::cole=30][potential use of memory_region_init_rom*() in ./hw/ppc/ppc405_boards.c::195]]
> * TODO [[view:./hw/ppc/ppc405_boards.c::face=ovl-face1::linb=464::colb=8::cole=30][potential use of memory_region_init_rom*() in ./hw/ppc/ppc405_boards.c::464]]
>
> We can indeed replace the memory_region_init_ram() and
> memory_region_set_readonly() calls by memory_region_init_rom().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> hw/ppc/ppc405_boards.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index 1f721feed6..5afe023253 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -192,7 +192,7 @@ static void ref405ep_init(MachineState *machine)
> #endif
> {
> bios = g_new(MemoryRegion, 1);
> - memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE,
> + memory_region_init_rom(bios, NULL, "ef405ep.bios", BIOS_SIZE,
> &error_fatal);
>
> if (bios_name == NULL)
> @@ -216,7 +216,6 @@ static void ref405ep_init(MachineState *machine)
> /* Avoid an uninitialized variable warning */
> bios_size = -1;
> }
> - memory_region_set_readonly(bios, true);
> }
> /* Register FPGA */
> ref405ep_fpga_init(sysmem, 0xF0300000);
> @@ -461,7 +460,7 @@ static void taihu_405ep_init(MachineState *machine)
> if (bios_name == NULL)
> bios_name = BIOS_FILENAME;
> bios = g_new(MemoryRegion, 1);
> - memory_region_init_ram(bios, NULL, "taihu_405ep.bios", BIOS_SIZE,
> + memory_region_init_rom(bios, NULL, "taihu_405ep.bios", BIOS_SIZE,
> &error_fatal);
> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> if (filename) {
> @@ -479,7 +478,6 @@ static void taihu_405ep_init(MachineState *machine)
> error_report("Could not load PowerPC BIOS '%s'", bios_name);
> exit(1);
> }
> - memory_region_set_readonly(bios, true);
> }
> /* Register Linux flash */
> dinfo = drive_get(IF_PFLASH, 0, fl_idx);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-02-25 0:24 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 20:55 [PATCH RESEND v2 00/32] hw: Sanitize various MemoryRegion calls Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 01/32] memory: Correctly return alias region type Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 02/32] memory: Simplify memory_region_init_rom_nomigrate() to ease review Philippe Mathieu-Daudé
2020-02-24 21:17 ` Alistair Francis
2020-02-24 20:55 ` [PATCH RESEND v2 03/32] scripts/cocci: Rename memory-region-{init-ram -> housekeeping} Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 04/32] scripts/cocci: Patch to replace memory_region_init_{ram, readonly -> rom} Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 05/32] hw/arm: Use memory_region_init_rom() with read-only regions Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 06/32] hw/display: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 07/32] hw/mips: " Philippe Mathieu-Daudé
2020-02-26 11:38 ` Aleksandar Markovic
2020-02-24 20:55 ` [PATCH RESEND v2 08/32] hw/m68k: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 09/32] hw/net: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 10/32] hw/pci-host: " Philippe Mathieu-Daudé
2020-02-25 0:23 ` David Gibson
2020-02-24 20:55 ` [PATCH RESEND v2 11/32] hw/ppc: " Philippe Mathieu-Daudé
2020-02-25 0:23 ` David Gibson
2020-02-24 20:55 ` [PATCH RESEND v2 12/32] hw/riscv: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 13/32] hw/sh4: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 14/32] hw/sparc: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 15/32] scripts/cocci: Patch to detect potential use of memory_region_init_rom Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 16/32] hw/arm/stm32: Use memory_region_init_rom() with read-only regions Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 17/32] hw/ppc/ppc405: " Philippe Mathieu-Daudé
2020-02-25 0:24 ` David Gibson [this message]
2020-02-24 20:55 ` [PATCH RESEND v2 18/32] hw/i386/pc_sysfw: Simplify using memory_region_init_alias() Philippe Mathieu-Daudé
2020-02-25 10:05 ` Philippe Mathieu-Daudé
2020-02-25 12:39 ` Paolo Bonzini
2020-02-24 20:55 ` [PATCH RESEND v2 19/32] hw/i386/pc_sysfw: Remove unused 'ram_size' argument Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 20/32] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly() Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 21/32] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 22/32] scripts/cocci: Patch to let devices own their MemoryRegions Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 23/32] hw/arm: Let devices own the MemoryRegion they create Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 24/32] hw/char: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 25/32] hw/core: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 26/32] hw/display: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 27/32] hw/dma: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 28/32] hw/riscv: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [PATCH RESEND v2 29/32] hw/input/milkymist-softusb: Remove unused 'pmem_ptr' field Philippe Mathieu-Daudé
2020-02-24 20:55 ` [RFC PATCH RESEND v2 30/32] hw/input/milkymist-softusb: Let devices own the MemoryRegion they create Philippe Mathieu-Daudé
2020-02-24 20:55 ` [RFC PATCH RESEND v2 31/32] hw/net/milkymist-minimac2: " Philippe Mathieu-Daudé
2020-02-24 20:55 ` [RFC PATCH RESEND v2 32/32] hw/block/onenand: " Philippe Mathieu-Daudé
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=20200225002403.GD41629@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=Alistair.Francis@wdc.com \
--cc=aleksandar.rikalo@rt-rk.com \
--cc=alistair@alistair23.me \
--cc=amarkovic@wavecomp.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=balrogg@gmail.com \
--cc=chouteau@adacore.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=frederic.konrad@adacore.com \
--cc=hpoussin@reactos.org \
--cc=i.mitsyanko@gmail.com \
--cc=jasowang@redhat.com \
--cc=jcd@tribudubois.net \
--cc=joel@jms.id.au \
--cc=kbastian@mail.uni-paderborn.de \
--cc=kwolf@redhat.com \
--cc=laurent@vivier.eu \
--cc=magnus.damm@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=michael@walle.cc \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.chubb@nicta.com.au \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=rth@twiddle.net \
--cc=sagark@eecs.berkeley.edu \
--cc=sundeep.lkml@gmail.com \
/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).