From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Song Gao" <gaosong@loongson.cn>,
"Antony Pavlov" <antonynpavlov@gmail.com>,
"Jan Kiszka" <jan.kiszka@web.de>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Bernhard Beschow" <shentey@gmail.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
qemu-ppc@nongnu.org, "Mark Burton" <mburton@qti.qualcomm.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Radoslaw Biernacki" <rad@semihalf.com>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Xiaojuan Yang" <yangxiaojuan@loongson.cn>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-block@nongnu.org, qemu-riscv@nongnu.org,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Alistair Francis" <alistair@alistair23.me>,
qemu-arm@nongnu.org, "Leif Lindholm" <quic_llindhol@quicinc.com>,
"Kevin Wolf" <kwolf@redhat.com>
Subject: [PATCH 17/20] hw/arm: Open-code pflash_cfi02_register()
Date: Wed, 4 Jan 2023 23:04:46 +0100 [thread overview]
Message-ID: <20230104220449.41337-18-philmd@linaro.org> (raw)
In-Reply-To: <20230104220449.41337-1-philmd@linaro.org>
pflash_cfi02_register() hides an implicit sysbus mapping of
MMIO region #0. This is not practical in a heterogeneous world
where multiple cores use different address spaces. In order to
remove to remove pflash_cfi02_register() from the pflash API,
open-code it as a qdev creation call followed by an explicit
sysbus mapping.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/digic_boards.c | 14 ++++++++------
hw/arm/musicpal.c | 13 +++++++------
hw/arm/xilinx_zynq.c | 10 +++++-----
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 4093af09cb..98b0002d16 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -115,13 +115,15 @@ static void digic4_add_k8p3215uqb_rom(DigicState *s, hwaddr addr,
{
#define FLASH_K8P3215UQB_SIZE (4 * 1024 * 1024)
#define FLASH_K8P3215UQB_SECTOR_SIZE (64 * 1024)
+ DeviceState *dev;
- pflash_cfi02_register(addr, "pflash", FLASH_K8P3215UQB_SIZE,
- NULL, FLASH_K8P3215UQB_SECTOR_SIZE,
- DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE,
- 4,
- 0x00EC, 0x007E, 0x0003, 0x0001,
- 0x0555, 0x2aa, 0);
+ dev = pflash_cfi02_create("pflash", FLASH_K8P3215UQB_SIZE,
+ NULL, FLASH_K8P3215UQB_SECTOR_SIZE,
+ DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE,
+ 4,
+ 0x00EC, 0x007E, 0x0003, 0x0001,
+ 0x0555, 0x2aa, 0);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
digic_load_rom(s, addr, FLASH_K8P3215UQB_SIZE, filename);
}
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index b65c020115..9f75d69b7f 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1275,12 +1275,13 @@ static void musicpal_init(MachineState *machine)
* 0xFF800000 (if there is 8 MB flash). So remap flash access if the
* image is smaller than 32 MB.
*/
- pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX,
- "musicpal.flash", flash_size,
- blk, 0x10000,
- MP_FLASH_SIZE_MAX / flash_size,
- 2, 0x00BF, 0x236D, 0x0000, 0x0000,
- 0x5555, 0x2AAA, 0);
+ dev = pflash_cfi02_create("musicpal.flash", flash_size,
+ blk, 0x10000,
+ MP_FLASH_SIZE_MAX / flash_size,
+ 2, 0x00BF, 0x236D, 0x0000, 0x0000,
+ 0x5555, 0x2AAA, 0);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0,
+ 0x100000000ULL - MP_FLASH_SIZE_MAX);
}
sysbus_create_simple(TYPE_MV88W8618_FLASHCFG, MP_FLASHCFG_BASE, NULL);
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 3190cc0b8d..e55aff5532 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -218,11 +218,11 @@ static void zynq_init(MachineState *machine)
DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
/* AMD */
- pflash_cfi02_register(0xe2000000, "zynq.pflash", FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE, 1,
- 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa,
- 0);
+ dev = pflash_cfi02_create("zynq.pflash", FLASH_SIZE,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
+ FLASH_SECTOR_SIZE, 1, 1,
+ 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, 0);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xe2000000);
/* Create the main clock source, and feed slcr with it */
zynq_machine->ps_clk = CLOCK(object_new(TYPE_CLOCK));
--
2.38.1
next prev parent reply other threads:[~2023-01-04 22:42 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 22:04 [PATCH 00/20] hw: Remove implicit sysbus_mmio_map() from pflash APIs Philippe Mathieu-Daudé
2023-01-04 22:04 ` [PATCH 01/20] hw/block: Pass DeviceState to pflash_cfi01_get_blk() Philippe Mathieu-Daudé
2023-01-08 4:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 02/20] hw/block: Use pflash_cfi01_get_blk() in pflash_cfi01_legacy_drive() Philippe Mathieu-Daudé
2023-01-08 4:29 ` Bin Meng
2023-01-04 22:04 ` [PATCH 03/20] hw/block: Pass DeviceState to pflash_cfi01_get_memory() Philippe Mathieu-Daudé
2023-01-08 4:30 ` Bin Meng
2023-01-04 22:04 ` [PATCH 04/20] hw/arm: Use generic DeviceState instead of PFlashCFI01 Philippe Mathieu-Daudé
2023-01-08 5:25 ` Bin Meng
2023-01-04 22:04 ` [PATCH 05/20] hw/loongarch: " Philippe Mathieu-Daudé
2023-01-08 5:25 ` Bin Meng
2023-01-04 22:04 ` [PATCH 06/20] hw/riscv: " Philippe Mathieu-Daudé
2023-01-06 20:33 ` Daniel Henrique Barboza
2023-01-08 5:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 07/20] hw/i386: " Philippe Mathieu-Daudé
2023-01-08 5:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 08/20] hw/xtensa: " Philippe Mathieu-Daudé
2023-01-08 5:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 09/20] hw/block: Factor pflash_cfi01_create() out of pflash_cfi01_register() Philippe Mathieu-Daudé
2023-01-08 5:32 ` Bin Meng
2023-01-04 22:04 ` [PATCH 10/20] hw/arm: Open-code pflash_cfi01_register() Philippe Mathieu-Daudé
2023-01-08 5:35 ` Bin Meng
2023-01-04 22:04 ` [PATCH 11/20] hw/microblaze: " Philippe Mathieu-Daudé
2023-01-08 12:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 12/20] hw/mips: " Philippe Mathieu-Daudé
2023-01-08 12:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 13/20] hw/ppc: " Philippe Mathieu-Daudé
2023-01-08 12:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 14/20] hw/block: Remove unused pflash_cfi01_register() Philippe Mathieu-Daudé
2023-01-08 12:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 15/20] hw/block: Make PFlashCFI01 QOM declaration internal Philippe Mathieu-Daudé
2023-01-08 12:28 ` Bin Meng
2023-01-04 22:04 ` [PATCH 16/20] hw/block: Factor pflash_cfi02_create() out of pflash_cfi02_register() Philippe Mathieu-Daudé
2023-01-08 12:34 ` Bin Meng
2023-01-04 22:04 ` Philippe Mathieu-Daudé [this message]
2023-01-08 12:34 ` [PATCH 17/20] hw/arm: Open-code pflash_cfi02_register() Bin Meng
2023-01-04 22:04 ` [PATCH 18/20] hw/sh4: " Philippe Mathieu-Daudé
2023-01-08 12:34 ` Bin Meng
2023-01-04 22:04 ` [PATCH 19/20] hw/block: Remove unused pflash_cfi02_register() Philippe Mathieu-Daudé
2023-01-08 12:34 ` Bin Meng
2023-01-04 22:04 ` [PATCH 20/20] hw/block: Make PFlashCFI02 QOM declaration internal Philippe Mathieu-Daudé
2023-01-08 12:34 ` Bin Meng
2023-01-06 17:51 ` [PATCH 00/20] hw: Remove implicit sysbus_mmio_map() from pflash APIs Peter Maydell
2023-01-09 10:39 ` 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=20230104220449.41337-18-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=alistair@alistair23.me \
--cc=antonynpavlov@gmail.com \
--cc=aurelien@aurel32.net \
--cc=balaton@eik.bme.hu \
--cc=bin.meng@windriver.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=gaosong@loongson.cn \
--cc=hreitz@redhat.com \
--cc=jan.kiszka@web.de \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=kwolf@redhat.com \
--cc=magnus.damm@gmail.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mburton@qti.qualcomm.com \
--cc=mst@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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=quic_llindhol@quicinc.com \
--cc=rad@semihalf.com \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
--cc=yangxiaojuan@loongson.cn \
--cc=ysato@users.sourceforge.jp \
/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).