* [PATCH v2 0/6] hw/arm: Create the RAM in the board
@ 2019-10-21 19:06 Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 1/6] hw/arm/xilinx_zynq: Use the IEC binary prefix definitions Philippe Mathieu-Daudé
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-21 19:06 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Philippe Mathieu-Daudé, Alistair Francis, Richard Henderson,
qemu-arm, Antony Pavlov, Edgar E. Iglesias
Hi Peter,
This series contains the ARM patches extracted from the
"Let the machine be the owner of the system memory" series [1]
reviewed by Richard.
These are cleanups moving the creation of the system ram at
the board level. The other series will enforce
memory_region_allocate_system_memory() get called with a
MachineState argument, this preliminary cleanup is required.
Regard,
Phil.
[1] https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg05085.html
Philippe Mathieu-Daudé (6):
hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
hw/arm/mps2: Use the IEC binary prefix definitions
hw/arm/collie: Create the RAM in the board
hw/arm/omap2: Create the RAM in the board
hw/arm/omap1: Create the RAM in the board
hw/arm/digic4: Inline digic4_board_setup_ram() function
hw/arm/collie.c | 8 ++++++--
hw/arm/digic_boards.c | 9 ++-------
hw/arm/mps2-tz.c | 3 ++-
hw/arm/mps2.c | 3 ++-
hw/arm/nseries.c | 10 +++++++---
hw/arm/omap1.c | 12 +++++-------
hw/arm/omap2.c | 13 +++++--------
hw/arm/omap_sx1.c | 8 ++++++--
hw/arm/palm.c | 8 ++++++--
hw/arm/strongarm.c | 7 +------
hw/arm/strongarm.h | 4 +---
hw/arm/xilinx_zynq.c | 3 ++-
include/hw/arm/omap.h | 10 +++-------
13 files changed, 48 insertions(+), 50 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/6] hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
@ 2019-10-21 19:06 ` Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 2/6] hw/arm/mps2: " Philippe Mathieu-Daudé
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-21 19:06 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Philippe Mathieu-Daudé, Alistair Francis, Richard Henderson,
qemu-arm, Antony Pavlov, Edgar E. Iglesias
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/arm/xilinx_zynq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index c14774e542..3a0fa5b23f 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -16,6 +16,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "qapi/error.h"
#include "cpu.h"
#include "hw/sysbus.h"
@@ -194,7 +195,7 @@ static void zynq_init(MachineState *machine)
memory_region_add_subregion(address_space_mem, 0, ext_ram);
/* 256K of on-chip memory */
- memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10,
+ memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 * KiB,
&error_fatal);
memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram);
--
2.21.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/6] hw/arm/mps2: Use the IEC binary prefix definitions
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 1/6] hw/arm/xilinx_zynq: Use the IEC binary prefix definitions Philippe Mathieu-Daudé
@ 2019-10-21 19:06 ` Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 3/6] hw/arm/collie: Create the RAM in the board Philippe Mathieu-Daudé
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-21 19:06 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Philippe Mathieu-Daudé, Alistair Francis, Richard Henderson,
qemu-arm, Antony Pavlov, Edgar E. Iglesias
IEC binary prefixes ease code review: the unit is explicit.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/arm/mps2-tz.c | 3 ++-
hw/arm/mps2.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index 6b24aaacde..f8b620bcc6 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -38,6 +38,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "hw/arm/boot.h"
@@ -458,7 +459,7 @@ static void mps2tz_common_init(MachineState *machine)
* call the 16MB our "system memory", as it's the largest lump.
*/
memory_region_allocate_system_memory(&mms->psram,
- NULL, "mps.ram", 0x01000000);
+ NULL, "mps.ram", 16 * MiB);
memory_region_add_subregion(system_memory, 0x80000000, &mms->psram);
/* The overflow IRQs for all UARTs are ORed together.
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
index 10efff36b2..d002b126d3 100644
--- a/hw/arm/mps2.c
+++ b/hw/arm/mps2.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "hw/arm/boot.h"
@@ -146,7 +147,7 @@ static void mps2_common_init(MachineState *machine)
* zbt_boot_ctrl is always zero).
*/
memory_region_allocate_system_memory(&mms->psram,
- NULL, "mps.ram", 0x1000000);
+ NULL, "mps.ram", 16 * MiB);
memory_region_add_subregion(system_memory, 0x21000000, &mms->psram);
switch (mmc->fpga_type) {
--
2.21.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/6] hw/arm/collie: Create the RAM in the board
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 1/6] hw/arm/xilinx_zynq: Use the IEC binary prefix definitions Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 2/6] hw/arm/mps2: " Philippe Mathieu-Daudé
@ 2019-10-21 19:06 ` Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 4/6] hw/arm/omap2: " Philippe Mathieu-Daudé
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-21 19:06 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Philippe Mathieu-Daudé, Alistair Francis, Richard Henderson,
qemu-arm, Antony Pavlov, Edgar E. Iglesias
The SDRAM is incorrectly created in the SA1110 SoC.
Move its creation in the board code, this will later allow the
board to have the QOM ownership of the RAM.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/arm/collie.c | 8 ++++++--
hw/arm/strongarm.c | 7 +------
hw/arm/strongarm.h | 4 +---
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
index b1288ccea8..970a4405cc 100644
--- a/hw/arm/collie.c
+++ b/hw/arm/collie.c
@@ -27,9 +27,13 @@ static void collie_init(MachineState *machine)
{
StrongARMState *s;
DriveInfo *dinfo;
- MemoryRegion *sysmem = get_system_memory();
+ MemoryRegion *sdram = g_new(MemoryRegion, 1);
- s = sa1110_init(sysmem, collie_binfo.ram_size, machine->cpu_type);
+ s = sa1110_init(machine->cpu_type);
+
+ memory_region_allocate_system_memory(sdram, NULL, "strongarm.sdram",
+ collie_binfo.ram_size);
+ memory_region_add_subregion(get_system_memory(), SA_SDCS0, sdram);
dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000,
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index dc65d88a65..6bee034914 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -1586,8 +1586,7 @@ static const TypeInfo strongarm_ssp_info = {
};
/* Main CPU functions */
-StrongARMState *sa1110_init(MemoryRegion *sysmem,
- unsigned int sdram_size, const char *cpu_type)
+StrongARMState *sa1110_init(const char *cpu_type)
{
StrongARMState *s;
int i;
@@ -1601,10 +1600,6 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,
s->cpu = ARM_CPU(cpu_create(cpu_type));
- memory_region_allocate_system_memory(&s->sdram, NULL, "strongarm.sdram",
- sdram_size);
- memory_region_add_subregion(sysmem, SA_SDCS0, &s->sdram);
-
s->pic = sysbus_create_varargs("strongarm_pic", 0x90050000,
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ),
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ),
diff --git a/hw/arm/strongarm.h b/hw/arm/strongarm.h
index e98840b461..192821f6aa 100644
--- a/hw/arm/strongarm.h
+++ b/hw/arm/strongarm.h
@@ -55,7 +55,6 @@ enum {
typedef struct {
ARMCPU *cpu;
- MemoryRegion sdram;
DeviceState *pic;
DeviceState *gpio;
DeviceState *ppc;
@@ -63,7 +62,6 @@ typedef struct {
SSIBus *ssp_bus;
} StrongARMState;
-StrongARMState *sa1110_init(MemoryRegion *sysmem,
- unsigned int sdram_size, const char *rev);
+StrongARMState *sa1110_init(const char *cpu_type);
#endif
--
2.21.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/6] hw/arm/omap2: Create the RAM in the board
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2019-10-21 19:06 ` [PATCH v2 3/6] hw/arm/collie: Create the RAM in the board Philippe Mathieu-Daudé
@ 2019-10-21 19:06 ` Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 5/6] hw/arm/omap1: " Philippe Mathieu-Daudé
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-21 19:06 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Philippe Mathieu-Daudé, Alistair Francis, Richard Henderson,
qemu-arm, Antony Pavlov, Edgar E. Iglesias
The SDRAM is incorrectly created in the OMAP2420 SoC.
Move its creation in the board code, this will later allow the
board to have the QOM ownership of the RAM.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v2: Move MemoryRegion sdram to struct n800_s (Richard)
---
hw/arm/nseries.c | 10 +++++++---
hw/arm/omap2.c | 13 +++++--------
include/hw/arm/omap.h | 4 +---
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index a36971d39a..7e361936a9 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -47,6 +47,7 @@
/* Nokia N8x0 support */
struct n800_s {
+ MemoryRegion sdram;
struct omap_mpu_state_s *mpu;
struct rfbi_chip_s blizzard;
@@ -1311,11 +1312,14 @@ static int n810_atag_setup(const struct arm_boot_info *info, void *p)
static void n8x0_init(MachineState *machine,
struct arm_boot_info *binfo, int model)
{
- MemoryRegion *sysmem = get_system_memory();
struct n800_s *s = (struct n800_s *) g_malloc0(sizeof(*s));
- int sdram_size = binfo->ram_size;
+ uint64_t sdram_size = binfo->ram_size;
- s->mpu = omap2420_mpu_init(sysmem, sdram_size, machine->cpu_type);
+ memory_region_allocate_system_memory(&s->sdram, NULL, "omap2.dram",
+ sdram_size);
+ memory_region_add_subregion(get_system_memory(), OMAP2_Q2_BASE, &s->sdram);
+
+ s->mpu = omap2420_mpu_init(&s->sdram, machine->cpu_type);
/* Setup peripherals
*
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index bd7ddff983..457f152bac 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -22,6 +22,7 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "cpu.h"
+#include "exec/address-spaces.h"
#include "sysemu/blockdev.h"
#include "sysemu/qtest.h"
#include "sysemu/reset.h"
@@ -2276,8 +2277,7 @@ static const struct dma_irq_map omap2_dma_irq_map[] = {
{ 0, OMAP_INT_24XX_SDMA_IRQ3 },
};
-struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
- unsigned long sdram_size,
+struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
const char *cpu_type)
{
struct omap_mpu_state_s *s = g_new0(struct omap_mpu_state_s, 1);
@@ -2286,11 +2286,11 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
int i;
SysBusDevice *busdev;
struct omap_target_agent_s *ta;
+ MemoryRegion *sysmem = get_system_memory();
/* Core */
s->mpu_model = omap2420;
s->cpu = ARM_CPU(cpu_create(cpu_type));
- s->sdram_size = sdram_size;
s->sram_size = OMAP242X_SRAM_SIZE;
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
@@ -2299,9 +2299,6 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
omap_clk_init(s);
/* Memory-mapped stuff */
- memory_region_allocate_system_memory(&s->sdram, NULL, "omap2.dram",
- s->sdram_size);
- memory_region_add_subregion(sysmem, OMAP2_Q2_BASE, &s->sdram);
memory_region_init_ram(&s->sram, NULL, "omap2.sram", s->sram_size,
&error_fatal);
memory_region_add_subregion(sysmem, OMAP2_SRAM_BASE, &s->sram);
@@ -2338,8 +2335,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
s->port->addr_valid = omap2_validate_addr;
/* Register SDRAM and SRAM ports for fast DMA transfers. */
- soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sdram),
- OMAP2_Q2_BASE, s->sdram_size);
+ soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(sdram),
+ OMAP2_Q2_BASE, memory_region_size(sdram));
soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sram),
OMAP2_SRAM_BASE, s->sram_size);
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index 2fda996648..763d8eab4f 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -824,7 +824,6 @@ struct omap_mpu_state_s {
MemoryRegion tap_iomem;
MemoryRegion imif_ram;
MemoryRegion emiff_ram;
- MemoryRegion sdram;
MemoryRegion sram;
struct omap_dma_port_if_s {
@@ -938,8 +937,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
const char *core);
/* omap2.c */
-struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
- unsigned long sdram_size,
+struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
const char *core);
uint32_t omap_badwidth_read8(void *opaque, hwaddr addr);
--
2.21.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/6] hw/arm/omap1: Create the RAM in the board
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2019-10-21 19:06 ` [PATCH v2 4/6] hw/arm/omap2: " Philippe Mathieu-Daudé
@ 2019-10-21 19:06 ` Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 6/6] hw/arm/digic4: Inline digic4_board_setup_ram() function Philippe Mathieu-Daudé
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-21 19:06 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Philippe Mathieu-Daudé, Alistair Francis, Richard Henderson,
qemu-arm, Antony Pavlov, Edgar E. Iglesias
The SDRAM is incorrectly created in the OMAP310 SoC.
Move its creation in the board code, this will later allow the
board to have the QOM ownership of the RAM.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/arm/omap1.c | 12 +++++-------
hw/arm/omap_sx1.c | 8 ++++++--
hw/arm/palm.c | 8 ++++++--
include/hw/arm/omap.h | 6 ++----
4 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 0400593805..6ce038a453 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -23,6 +23,7 @@
#include "qapi/error.h"
#include "qemu-common.h"
#include "cpu.h"
+#include "exec/address-spaces.h"
#include "hw/boards.h"
#include "hw/hw.h"
#include "hw/irq.h"
@@ -3858,8 +3859,7 @@ static int omap_validate_tipb_mpui_addr(struct omap_mpu_state_s *s,
return range_covers_byte(0xe1010000, 0xe1020004 - 0xe1010000, addr);
}
-struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
- unsigned long sdram_size,
+struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
const char *cpu_type)
{
int i;
@@ -3867,11 +3867,12 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
qemu_irq dma_irqs[6];
DriveInfo *dinfo;
SysBusDevice *busdev;
+ MemoryRegion *system_memory = get_system_memory();
/* Core */
s->mpu_model = omap310;
s->cpu = ARM_CPU(cpu_create(cpu_type));
- s->sdram_size = sdram_size;
+ s->sdram_size = memory_region_size(dram);
s->sram_size = OMAP15XX_SRAM_SIZE;
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
@@ -3880,9 +3881,6 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
omap_clk_init(s);
/* Memory-mapped stuff */
- memory_region_allocate_system_memory(&s->emiff_ram, NULL, "omap1.dram",
- s->sdram_size);
- memory_region_add_subregion(system_memory, OMAP_EMIFF_BASE, &s->emiff_ram);
memory_region_init_ram(&s->imif_ram, NULL, "omap1.sram", s->sram_size,
&error_fatal);
memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram);
@@ -3925,7 +3923,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
s->port[tipb_mpui].addr_valid = omap_validate_tipb_mpui_addr;
/* Register SDRAM and SRAM DMA ports for fast transfers. */
- soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->emiff_ram),
+ soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(dram),
OMAP_EMIFF_BASE, s->sdram_size);
soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->imif_ram),
OMAP_IMIF_BASE, s->sram_size);
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index c071197be7..be245714db 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -103,6 +103,7 @@ static void sx1_init(MachineState *machine, const int version)
{
struct omap_mpu_state_s *mpu;
MemoryRegion *address_space = get_system_memory();
+ MemoryRegion *dram = g_new(MemoryRegion, 1);
MemoryRegion *flash = g_new(MemoryRegion, 1);
MemoryRegion *cs = g_new(MemoryRegion, 4);
static uint32_t cs0val = 0x00213090;
@@ -118,8 +119,11 @@ static void sx1_init(MachineState *machine, const int version)
flash_size = flash2_size;
}
- mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size,
- machine->cpu_type);
+ memory_region_allocate_system_memory(dram, NULL, "omap1.dram",
+ sx1_binfo.ram_size);
+ memory_region_add_subregion(address_space, OMAP_EMIFF_BASE, dram);
+
+ mpu = omap310_mpu_init(dram, machine->cpu_type);
/* External Flash (EMIFS) */
memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size,
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
index 02a3a82b9b..72eca8cc55 100644
--- a/hw/arm/palm.c
+++ b/hw/arm/palm.c
@@ -190,16 +190,20 @@ static void palmte_init(MachineState *machine)
MemoryRegion *address_space_mem = get_system_memory();
struct omap_mpu_state_s *mpu;
int flash_size = 0x00800000;
- int sdram_size = palmte_binfo.ram_size;
static uint32_t cs0val = 0xffffffff;
static uint32_t cs1val = 0x0000e1a0;
static uint32_t cs2val = 0x0000e1a0;
static uint32_t cs3val = 0xe1a0e1a0;
int rom_size, rom_loaded = 0;
+ MemoryRegion *dram = g_new(MemoryRegion, 1);
MemoryRegion *flash = g_new(MemoryRegion, 1);
MemoryRegion *cs = g_new(MemoryRegion, 4);
- mpu = omap310_mpu_init(address_space_mem, sdram_size, machine->cpu_type);
+ memory_region_allocate_system_memory(dram, NULL, "omap1.dram",
+ palmte_binfo.ram_size);
+ memory_region_add_subregion(address_space_mem, OMAP_EMIFF_BASE, dram);
+
+ mpu = omap310_mpu_init(dram, machine->cpu_type);
/* External Flash (EMIFS) */
memory_region_init_ram(flash, NULL, "palmte.flash", flash_size,
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index 763d8eab4f..f3aa670036 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -823,7 +823,6 @@ struct omap_mpu_state_s {
MemoryRegion mpui_io_iomem;
MemoryRegion tap_iomem;
MemoryRegion imif_ram;
- MemoryRegion emiff_ram;
MemoryRegion sram;
struct omap_dma_port_if_s {
@@ -835,7 +834,7 @@ struct omap_mpu_state_s {
hwaddr addr);
} port[__omap_dma_port_last];
- unsigned long sdram_size;
+ uint64_t sdram_size;
unsigned long sram_size;
/* MPUI-TIPB peripherals */
@@ -932,8 +931,7 @@ struct omap_mpu_state_s {
};
/* omap1.c */
-struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
- unsigned long sdram_size,
+struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *sdram,
const char *core);
/* omap2.c */
--
2.21.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 6/6] hw/arm/digic4: Inline digic4_board_setup_ram() function
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2019-10-21 19:06 ` [PATCH v2 5/6] hw/arm/omap1: " Philippe Mathieu-Daudé
@ 2019-10-21 19:06 ` Philippe Mathieu-Daudé
2019-10-21 20:54 ` [PATCH v2 0/6] hw/arm: Create the RAM in the board Alistair Francis
2019-10-22 13:06 ` Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-21 19:06 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
Cc: Philippe Mathieu-Daudé, Alistair Francis, Richard Henderson,
qemu-arm, Antony Pavlov, Edgar E. Iglesias
Having the RAM creation code in a separate function is not
very helpful. Move this code directly inside the board_init()
function, this will later allow the board to have the QOM
ownership of the RAM.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/arm/digic_boards.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 304e4d1a29..ef3fc2b6a5 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -53,12 +53,6 @@ typedef struct DigicBoard {
const char *rom1_def_filename;
} DigicBoard;
-static void digic4_board_setup_ram(DigicBoardState *s, hwaddr ram_size)
-{
- memory_region_allocate_system_memory(&s->ram, NULL, "ram", ram_size);
- memory_region_add_subregion(get_system_memory(), 0, &s->ram);
-}
-
static void digic4_board_init(DigicBoard *board)
{
Error *err = NULL;
@@ -72,7 +66,8 @@ static void digic4_board_init(DigicBoard *board)
exit(1);
}
- digic4_board_setup_ram(s, board->ram_size);
+ memory_region_allocate_system_memory(&s->ram, NULL, "ram", board->ram_size);
+ memory_region_add_subregion(get_system_memory(), 0, &s->ram);
if (board->add_rom0) {
board->add_rom0(s, DIGIC4_ROM0_BASE, board->rom0_def_filename);
--
2.21.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/6] hw/arm: Create the RAM in the board
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2019-10-21 19:06 ` [PATCH v2 6/6] hw/arm/digic4: Inline digic4_board_setup_ram() function Philippe Mathieu-Daudé
@ 2019-10-21 20:54 ` Alistair Francis
2019-10-22 13:06 ` Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2019-10-21 20:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Peter Maydell, Alistair Francis, Richard Henderson,
qemu-devel@nongnu.org Developers, qemu-arm, Antony Pavlov,
Edgar E. Iglesias
On Mon, Oct 21, 2019 at 12:07 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> Hi Peter,
>
> This series contains the ARM patches extracted from the
> "Let the machine be the owner of the system memory" series [1]
> reviewed by Richard.
>
> These are cleanups moving the creation of the system ram at
> the board level. The other series will enforce
> memory_region_allocate_system_memory() get called with a
> MachineState argument, this preliminary cleanup is required.
For the whole series:
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
>
> Regard,
>
> Phil.
>
> [1] https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg05085.html
>
> Philippe Mathieu-Daudé (6):
> hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
> hw/arm/mps2: Use the IEC binary prefix definitions
> hw/arm/collie: Create the RAM in the board
> hw/arm/omap2: Create the RAM in the board
> hw/arm/omap1: Create the RAM in the board
> hw/arm/digic4: Inline digic4_board_setup_ram() function
>
> hw/arm/collie.c | 8 ++++++--
> hw/arm/digic_boards.c | 9 ++-------
> hw/arm/mps2-tz.c | 3 ++-
> hw/arm/mps2.c | 3 ++-
> hw/arm/nseries.c | 10 +++++++---
> hw/arm/omap1.c | 12 +++++-------
> hw/arm/omap2.c | 13 +++++--------
> hw/arm/omap_sx1.c | 8 ++++++--
> hw/arm/palm.c | 8 ++++++--
> hw/arm/strongarm.c | 7 +------
> hw/arm/strongarm.h | 4 +---
> hw/arm/xilinx_zynq.c | 3 ++-
> include/hw/arm/omap.h | 10 +++-------
> 13 files changed, 48 insertions(+), 50 deletions(-)
>
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/6] hw/arm: Create the RAM in the board
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2019-10-21 20:54 ` [PATCH v2 0/6] hw/arm: Create the RAM in the board Alistair Francis
@ 2019-10-22 13:06 ` Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2019-10-22 13:06 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Alistair Francis, Richard Henderson, QEMU Developers, qemu-arm,
Antony Pavlov, Edgar E. Iglesias
On Mon, 21 Oct 2019 at 20:07, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> Hi Peter,
>
> This series contains the ARM patches extracted from the
> "Let the machine be the owner of the system memory" series [1]
> reviewed by Richard.
>
> These are cleanups moving the creation of the system ram at
> the board level. The other series will enforce
> memory_region_allocate_system_memory() get called with a
> MachineState argument, this preliminary cleanup is required.
>
> Regard,
>
> Phil.
>
> [1] https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg05085.html
>
> Philippe Mathieu-Daudé (6):
> hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
> hw/arm/mps2: Use the IEC binary prefix definitions
> hw/arm/collie: Create the RAM in the board
> hw/arm/omap2: Create the RAM in the board
> hw/arm/omap1: Create the RAM in the board
> hw/arm/digic4: Inline digic4_board_setup_ram() function
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-10-22 13:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-21 19:06 [PATCH v2 0/6] hw/arm: Create the RAM in the board Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 1/6] hw/arm/xilinx_zynq: Use the IEC binary prefix definitions Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 2/6] hw/arm/mps2: " Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 3/6] hw/arm/collie: Create the RAM in the board Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 4/6] hw/arm/omap2: " Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 5/6] hw/arm/omap1: " Philippe Mathieu-Daudé
2019-10-21 19:06 ` [PATCH v2 6/6] hw/arm/digic4: Inline digic4_board_setup_ram() function Philippe Mathieu-Daudé
2019-10-21 20:54 ` [PATCH v2 0/6] hw/arm: Create the RAM in the board Alistair Francis
2019-10-22 13:06 ` Peter Maydell
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).