From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-block@nongnu.org, "Max Reitz" <mreitz@redhat.com>
Subject: Re: [PATCH-for-6.1 2/2] hw/block/pflash_cfi02: Do not create aliases when not necessary
Date: Thu, 25 Mar 2021 06:49:53 -0600 [thread overview]
Message-ID: <c7bac9f7-f9a1-15fb-b863-a4fc6bc1942e@linaro.org> (raw)
In-Reply-To: <20210325120921.858993-3-f4bug@amsat.org>
On 3/25/21 6:09 AM, Philippe Mathieu-Daudé wrote:
> When no mapping is requested, it is pointless to create
> alias regions.
> Only create them when multiple mappings are requested to
> simplify the memory layout. The flatview is not changed.
>
> For example using 'qemu-system-sh4 -M r2d -S -monitor stdio',
>
> * before:
>
> (qemu) info mtree
> address-space: memory
> 0000000000000000-ffffffffffffffff (prio 0, i/o): system
> 0000000000000000-0000000000ffffff (prio 0, i/o): pflash
> 0000000000000000-0000000000ffffff (prio 0, romd): alias pflash-alias @r2d.flash 0000000000000000-0000000000ffffff
> 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga
> 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram
> (qemu) info mtree -f
> FlatView #0
> AS "memory", root: system
> AS "cpu-memory-0", root: system
> Root memory region: system
> 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash
> 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga
> 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram
>
> * after:
>
> (qemu) info mtree
> address-space: memory
> 0000000000000000-ffffffffffffffff (prio 0, i/o): system
> 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash
> 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga
> 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram
> (qemu) info mtree -f
> FlatView #0
> AS "memory", root: system
> AS "cpu-memory-0", root: system
> Root memory region: system
> 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash
> 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga
> 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/block/pflash_cfi02.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
> index 35e30bb812c..02c514fb6e0 100644
> --- a/hw/block/pflash_cfi02.c
> +++ b/hw/block/pflash_cfi02.c
> @@ -917,8 +917,12 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp)
> pfl->sector_erase_map = bitmap_new(pfl->total_sectors);
>
> pfl->rom_mode = true;
> - pflash_setup_mappings(pfl);
> - sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem);
> + if (pfl->mappings > 1) {
> + pflash_setup_mappings(pfl);
> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem);
> + } else {
> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->orig_mem);
> + }
>
> timer_init_ns(&pfl->timer, QEMU_CLOCK_VIRTUAL, pflash_timer, pfl);
> pfl->status = 0;
>
next prev parent reply other threads:[~2021-03-25 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 12:09 [PATCH-for-6.1 0/2] hw/block/pflash_cfi02: Do not create aliases when not necessary Philippe Mathieu-Daudé
2021-03-25 12:09 ` [PATCH-for-6.1 1/2] hw/block/pflash_cfi02: Set romd mode in pflash_cfi02_realize() Philippe Mathieu-Daudé
2021-03-25 12:47 ` Richard Henderson
2021-03-25 12:09 ` [PATCH-for-6.1 2/2] hw/block/pflash_cfi02: Do not create aliases when not necessary Philippe Mathieu-Daudé
2021-03-25 12:49 ` Richard Henderson [this message]
2021-04-19 9:26 ` [PATCH-for-6.1 0/2] " 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=c7bac9f7-f9a1-15fb-b863-a4fc6bc1942e@linaro.org \
--to=richard.henderson@linaro.org \
--cc=f4bug@amsat.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-block@nongnu.org \
--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).