hw: Let the machine be the owner of the system memory
Subsystems (4)
cover hw: Let the machine be the owner of the system memory
Hi,
This series is based on Igor's "eliminate remaining places that abuse memory_region_allocate_system_memory()":
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg01601.html
It is quite simple, we enforce all machines to be the QOM owner of the system memory.
This changes the memory tree from:
(qemu) info mtree -o
memory-region: pc.ram
0000000000000000-0000000007ffffff (prio 0, ram): pc.ram parent:{obj path=/machine/unattached}to:
(qemu) info mtree -o
memory-region: pc.ram
0000000000000000-0000000007ffffff (prio 0, ram): pc.ram owner:{obj path=/machine}Few patches are required to clean the codebase first, to unify the creation of the system memory in the board/machine code. Mostly some old ARM machines (pre-QOM) were affected.
Please review (as a generic codebase cleanup).
Regards,
Phil.
Based-on: <[email protected]>
Philippe Mathieu-Daudé (21):
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: Drop QOM ownership on memory_region_allocate_system_memory() calls hw/alpha/dp264: Create the RAM in the board
hw: Let memory_region_allocate_system_memory take MachineState
argument
hw/core: Let the machine be the owner of the system memory hw/alpha: Let the machine be the owner of the system memory hw/arm: Let the machine be the owner of the system memory hw/cris: Let the machine be the owner of the system memory hw/hppa: Let the machine be the owner of the system memory hw/i386: Let the machine be the owner of the system memory hw/lm32: Let the machine be the owner of the system memory hw/m68k: Let the machine be the owner of the system memory hw/mips: Let the machine be the owner of the system memory hw/ppc: Let the machine be the owner of the system memory hw/sparc: Let the machine be the owner of the system memory hw/core: Assert memory_region_allocate_system_memory has machine owner
hw/alpha/alpha_sys.h | 2 +- hw/alpha/dp264.c | 11 ++++++++++- hw/alpha/typhoon.c | 9 +-------- hw/arm/aspeed.c | 2 +- hw/arm/collie.c | 8 ++++++-- hw/arm/cubieboard.c | 2 +- hw/arm/digic_boards.c | 14 +++++--------- hw/arm/highbank.c | 3 ++- hw/arm/imx25_pdk.c | 2 +- hw/arm/integratorcp.c | 2 +- hw/arm/kzm.c | 2 +- hw/arm/mcimx6ul-evk.c | 2 +- hw/arm/mcimx7d-sabre.c | 2 +- hw/arm/mps2-tz.c | 5 +++-- hw/arm/mps2.c | 5 +++-- hw/arm/musicpal.c | 2 +- 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/raspi.c | 2 +- hw/arm/sabrelite.c | 2 +- hw/arm/sbsa-ref.c | 2 +- hw/arm/strongarm.c | 7 +------ hw/arm/strongarm.h | 4 +--- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 4 ++-- hw/arm/virt.c | 2 +- hw/arm/xilinx_zynq.c | 5 +++-- hw/arm/xlnx-versal-virt.c | 2 +- hw/arm/xlnx-zcu102.c | 2 +- hw/core/null-machine.c | 2 +- hw/core/numa.c | 9 +++++---- hw/cris/axis_dev88.c | 2 +- hw/hppa/machine.c | 2 +- hw/i386/pc.c | 2 +- hw/lm32/lm32_boards.c | 4 ++-- hw/lm32/milkymist.c | 2 +- hw/m68k/an5206.c | 2 +- hw/m68k/mcf5208.c | 2 +- hw/m68k/next-cube.c | 2 +- hw/mips/boston.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++- hw/ppc/e500.c | 3 ++- hw/ppc/mac_newworld.c | 3 ++- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pnv.c | 2 +- hw/ppc/ppc405_boards.c | 6 +++--- hw/ppc/prep.c | 3 ++- hw/ppc/spapr.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- hw/sparc/leon3.c | 2 +- hw/sparc/sun4m.c | 2 +- include/hw/arm/omap.h | 10 +++------- include/hw/boards.h | 6 ++++-- 60 files changed, 127 insertions(+), 117 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/21 hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
IEC binary prefixes ease code review: the unit is explicit.
--- hw/arm/xilinx_zynq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/xilinx_zynq.c +2 -1
@@ -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);
Signature · 1 line
2.21.0
Re: [PATCH 01/21] hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
Quoted 6 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/xilinx_zynq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
r~
Re: [PATCH 01/21] hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 29 lines
--- hw/arm/xilinx_zynq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/arm/xilinx_zynq.c +2
-2@@ -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
PATCH 2/21 hw/arm/mps2: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéIEC binary prefixes ease code review: the unit is explicit.
--- hw/arm/mps2-tz.c | 3 ++- hw/arm/mps2.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
hw/arm/mps2-tz.c +2 -1
@@ -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.
hw/arm/mps2.c +2 -1
@@ -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) {
Signature · 1 line
2.21.0
Re: [PATCH 02/21] hw/arm/mps2: Use the IEC binary prefix definitions
Quoted 7 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/mps2-tz.c | 3 ++- hw/arm/mps2.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
r~
Re: [PATCH 02/21] hw/arm/mps2: Use the IEC binary prefix definitions
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
IEC binary prefixes ease code review: the unit is explicit.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 51 lines
--- hw/arm/mps2-tz.c | 3 ++- hw/arm/mps2.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)hw/arm/mps2-tz.c +2
-1@@ -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. hw/arm/mps2.c +2
-2@@ -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
PATCH 3/21 hw/arm/collie: Create the RAM in the board
In reply to Philippe Mathieu-Daudé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.
--- hw/arm/collie.c | 8 ++++++-- hw/arm/strongarm.c | 7 +------ hw/arm/strongarm.h | 4 +--- 3 files changed, 8 insertions(+), 11 deletions(-)
hw/arm/collie.c +6 -2
@@ -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,
hw/arm/strongarm.c +1 -6
@@ -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),
hw/arm/strongarm.h +1 -3
@@ -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
Signature · 1 line
2.21.0
Re: [PATCH 03/21] hw/arm/collie: Create the RAM in the board
Quoted 10 lines · Philippe Mathieu-Daudé
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.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/collie.c | 8 ++++++-- hw/arm/strongarm.c | 7 +------ hw/arm/strongarm.h | 4 +--- 3 files changed, 8 insertions(+), 11 deletions(-)
r~
Re: [PATCH 03/21] hw/arm/collie: Create the RAM in the board
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
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.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 76 lines
--- hw/arm/collie.c | 8 ++++++-- hw/arm/strongarm.c | 7 +------ hw/arm/strongarm.h | 4 +--- 3 files changed, 8 insertions(+), 11 deletions(-)hw/arm/collie.c +6
-2@@ -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,hw/arm/strongarm.c +1
-6@@ -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),hw/arm/strongarm.h +1
-4@@ -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
PATCH 4/21 hw/arm/omap2: Create the RAM in the board
In reply to Philippe Mathieu-Daudé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.
--- hw/arm/nseries.c | 10 +++++++--- hw/arm/omap2.c | 13 +++++-------- include/hw/arm/omap.h | 4 +--- 3 files changed, 13 insertions(+), 14 deletions(-)
hw/arm/nseries.c +7 -3
@@ -1311,11 +1311,15 @@ 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 (); +MemoryRegion *sdram =g_new (MemoryRegion,1 );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 (sdram,NULL ,"omap2.dram" , + sdram_size); +memory_region_add_subregion (get_system_memory (),OMAP2_Q2_BASE , sdram); + + s->mpu =omap2420_mpu_init (sdram, machine->cpu_type);/* Setup peripherals *
hw/arm/omap2.c +5 -8
@@ -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);
include/hw/arm/omap.h +1 -3
@@ -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);
Signature · 1 line
2.21.0
Re: [PATCH 04/21] hw/arm/omap2: Create the RAM in the board
Quoted 5 lines · Philippe Mathieu-Daudé
static void n8x0_init(MachineState *machine,
structarm_boot_info*binfo, int model)
{hw/arm/nseries.c +1
-1-MemoryRegion *sysmem =get_system_memory (); +MemoryRegion *sdram =g_new (MemoryRegion,1 );
hw/arm/nseries.c static int n810_atag_setup(const struct arm_boot_info *info, void *p) · line 1322
Quoted 10 lines
hw/arm/nseries.c +6
-2struct 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 (sdram,NULL ,"omap2.dram" , + sdram_size); +memory_region_add_subregion (get_system_memory (),OMAP2_Q2_BASE , sdram); + + s->mpu =omap2420_mpu_init (sdram, machine->cpu_type);
Any reason not to put the MemoryRegion in to the n800_s structure?
Otherwise,
r~
Re: [PATCH 04/21] hw/arm/omap2: Create the RAM in the board
Quoted 10 lines · Richard Henderson
Quoted 9 lines · Philippe Mathieu-Daudé
static void n8x0_init(MachineState *machine,
structarm_boot_info*binfo, int model)
{hw/arm/nseries.c +2
-2-MemoryRegion *sysmem =get_system_memory (); +MemoryRegion *sdram =g_new (MemoryRegion,1 );struct n800_s *s = (struct n800_s *)g_malloc0 (sizeof (*s)); -int sdram_size = binfo->ram_size; +uint64_t sdram_size = binfo->ram_size;
Quoted 8 lines
hw/arm/nseries.c static int n810_atag_setup(const struct arm_boot_info *info, void *p) · line 1322
Quoted 6 lines
hw/arm/nseries.c +5
-1- s->mpu =omap2420_mpu_init (sysmem, sdram_size, machine->cpu_type); +memory_region_allocate_system_memory (sdram,NULL ,"omap2.dram" , + sdram_size); +memory_region_add_subregion (get_system_memory (),OMAP2_Q2_BASE , sdram); + + s->mpu =omap2420_mpu_init (sdram, machine->cpu_type);Any reason not to put the MemoryRegion in to the
n800_sstructure?
Ah yes, better to keep it in n800_s in case we ever QOM'ify this SoC. I'll do.
Quoted 2 lines
Otherwise,
Reviewed-by Richard Henderson <[email protected]>
Thanks :)
PATCH 5/21 hw/arm/omap1: Create the RAM in the board
In reply to Philippe Mathieu-Daudé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.
--- 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(-)
hw/arm/omap1.c +5 -7
@@ -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);
hw/arm/omap_sx1.c +6 -2
@@ -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,
hw/arm/palm.c +6 -2
@@ -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,
include/hw/arm/omap.h +2 -4
@@ -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 */
Signature · 1 line
2.21.0
Re: [PATCH 05/21] hw/arm/omap1: Create the RAM in the board
Quoted 11 lines · Philippe Mathieu-Daudé
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.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)
r~
PATCH 6/21 hw/arm/digic4: Inline digic4_board_setup_ram() function
In reply to Philippe Mathieu-Daudé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.
--- hw/arm/digic_boards.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
hw/arm/digic_boards.c +2 -7
@@ -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);
Signature · 1 line
2.21.0
Re: [PATCH 06/21] hw/arm/digic4: Inline digic4_board_setup_ram() function
Quoted 9 lines · Philippe Mathieu-Daudé
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.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/digic_boards.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
r~
Re: [PATCH 06/21] hw/arm/digic4: Inline digic4_board_setup_ram() function
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
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.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 35 lines
--- hw/arm/digic_boards.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)hw/arm/digic_boards.c +2
-8@@ -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
PATCH 7/21 hw: Drop QOM ownership on memory_region_allocate_system_memory() calls
In reply to Philippe Mathieu-DaudéAll the memory_region_allocate_system_memory() calls are in the board_init() code. From the 58 calls in the repository, only 4 set the 'owner' parameter. It is obvious we want the Machine to be the owner of the RAM, so we want to use OBJECT(machine) as owner. We can simplify a bit by passing MachineState to memory_region_allocate_system_memory(). In preparation of this refactor, first drop the 'owner' argument from these 4 uses.
$ git grep memory_region_allocate_system_memory hw/ | wc -l 58
--- hw/alpha/typhoon.c | 2 +- hw/arm/raspi.c | 2 +- hw/hppa/machine.c | 2 +- hw/sparc/sun4m.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
hw/alpha/typhoon.c +1 -1
@@ -851,7 +851,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,OBJECT (s),"ram" , +memory_region_allocate_system_memory (&s->ram_region,NULL ,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , &s->ram_region);
hw/arm/raspi.c +1 -1
@@ -182,7 +182,7 @@ static void raspi_init(MachineState *machine, int version) &error_abort, NULL);/* Allocate and map RAM */ -memory_region_allocate_system_memory (&s->ram,OBJECT (machine),"ram" , +memory_region_allocate_system_memory (&s->ram,NULL ,"ram" , machine->ram_size);/* FIXME: Remove when we have custom CPU address space support */ memory_region_add_subregion_overlap (get_system_memory (),0 , &s->ram,0 );
hw/hppa/machine.c +1 -1
@@ -96,7 +96,7 @@ static void machine_hppa_init(MachineState *machine)/* Main memory region. */ ram_region =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram_region,OBJECT (machine), +memory_region_allocate_system_memory (ram_region,NULL ,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , ram_region);
hw/sparc/sun4m.c +1 -1
@@ -788,7 +788,7 @@ static void ram_realize(DeviceState *dev, Error **errp)RamDevice *d =SUN4M_RAM (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); -memory_region_allocate_system_memory (&d->ram,OBJECT (d),"sun4m.ram" , +memory_region_allocate_system_memory (&d->ram,NULL ,"sun4m.ram" , d->size);sysbus_init_mmio (sbd, &d->ram); }
Signature · 1 line
2.21.0
Re: [PATCH 07/21] hw: Drop QOM ownership on memory_region_allocate_system_memory() calls
Quoted 9 lines · Philippe Mathieu-Daudé
All the
memory_region_allocate_system_memory()calls are in theboard_init()code. From the 58 calls in the repository, only 4 set the 'owner' parameter. It is obvious we want the Machine to be the owner of the RAM, so we want to use OBJECT(machine) as owner. We can simplify a bit by passing MachineState tomemory_region_allocate_system_memory(). In preparation of this refactor, first drop the 'owner' argument from these 4 uses.
Quoted 4 lines
$ git grep memory_region_allocate_system_memory hw/ | wc -l 58Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 63 lines
--- hw/alpha/typhoon.c | 2 +- hw/arm/raspi.c | 2 +- hw/hppa/machine.c | 2 +- hw/sparc/sun4m.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)hw/alpha/typhoon.c +1
-1@@ -851,7 +851,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,OBJECT (s),"ram" , +memory_region_allocate_system_memory (&s->ram_region,NULL ,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , &s->ram_region);hw/arm/raspi.c +1
-1@@ -182,7 +182,7 @@ static void raspi_init(MachineState *machine, int version) &error_abort, NULL);/* Allocate and map RAM */ -memory_region_allocate_system_memory (&s->ram,OBJECT (machine),"ram" , +memory_region_allocate_system_memory (&s->ram,NULL ,"ram" , machine->ram_size);/* FIXME: Remove when we have custom CPU address space support */ memory_region_add_subregion_overlap (get_system_memory (),0 , &s->ram,0 );hw/hppa/machine.c +1
-1@@ -96,7 +96,7 @@ static void machine_hppa_init(MachineState *machine)/* Main memory region. */ ram_region =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram_region,OBJECT (machine), +memory_region_allocate_system_memory (ram_region,NULL ,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , ram_region);hw/sparc/sun4m.c +1
-2@@ -788,7 +788,7 @@ static void ram_realize(DeviceState *dev, Error **errp)RamDevice *d =SUN4M_RAM (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); -memory_region_allocate_system_memory (&d->ram,OBJECT (d),"sun4m.ram" , +memory_region_allocate_system_memory (&d->ram,NULL ,"sun4m.ram" , d->size);sysbus_init_mmio (sbd, &d->ram); } --2.21.0
Artyom Tarasenko
Reviewed-byRe: [PATCH 07/21] hw: Drop QOM ownership on memory_region_allocate_system_memory() calls
Quoted 12 lines · Alistair Francis
Quoted 9 lines · Philippe Mathieu-Daudé
All the
memory_region_allocate_system_memory()calls are in theboard_init()code. From the 58 calls in the repository, only 4 set the 'owner' parameter. It is obvious we want the Machine to be the owner of the RAM, so we want to use OBJECT(machine) as owner. We can simplify a bit by passing MachineState tomemory_region_allocate_system_memory(). In preparation of this refactor, first drop the 'owner' argument from these 4 uses.
Quoted 6 lines
Quoted 4 lines
$ git grep memory_region_allocate_system_memory hw/ | wc -l 58Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Alistair Francis <[email protected]>
Quoted 66 lines
Alistair
Quoted 63 lines
--- hw/alpha/typhoon.c | 2 +- hw/arm/raspi.c | 2 +- hw/hppa/machine.c | 2 +- hw/sparc/sun4m.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)hw/alpha/typhoon.c +1
-1@@ -851,7 +851,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,OBJECT (s),"ram" , +memory_region_allocate_system_memory (&s->ram_region,NULL ,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , &s->ram_region);hw/arm/raspi.c +1
-1@@ -182,7 +182,7 @@ static void raspi_init(MachineState *machine, int version) &error_abort, NULL);/* Allocate and map RAM */ -memory_region_allocate_system_memory (&s->ram,OBJECT (machine),"ram" , +memory_region_allocate_system_memory (&s->ram,NULL ,"ram" , machine->ram_size);/* FIXME: Remove when we have custom CPU address space support */ memory_region_add_subregion_overlap (get_system_memory (),0 , &s->ram,0 );hw/hppa/machine.c +1
-1@@ -96,7 +96,7 @@ static void machine_hppa_init(MachineState *machine)/* Main memory region. */ ram_region =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram_region,OBJECT (machine), +memory_region_allocate_system_memory (ram_region,NULL ,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , ram_region);hw/sparc/sun4m.c +1
-2@@ -788,7 +788,7 @@ static void ram_realize(DeviceState *dev, Error **errp)RamDevice *d =SUN4M_RAM (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev); -memory_region_allocate_system_memory (&d->ram,OBJECT (d),"sun4m.ram" , +memory_region_allocate_system_memory (&d->ram,NULL ,"sun4m.ram" , d->size);sysbus_init_mmio (sbd, &d->ram); } --2.21.0
Signature · 4 lines
Regards, Artyom Tarasenko SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
PATCH 8/21 hw/alpha/dp264: Create the RAM in the board
In reply to Philippe Mathieu-DaudéThe SDRAM is incorrectly created in the Tyohoon northbridge ASIC. Move its creation in the board code, this will later allow the board to have the QOM ownership of the RAM.
---
checkpatch complains:
ERROR: spaces required around that '*' (ctx:WxV) #10: FILE: hw/alpha/alpha_sys.h:13:
+PCIBus *typhoon_init(ISABus **, qemu_irq *, AlphaCPU *[4],
^ --- hw/alpha/alpha_sys.h | 2 +- hw/alpha/dp264.c | 11 ++++++++++- hw/alpha/typhoon.c | 9 +-------- 3 files changed, 12 insertions(+), 10 deletions(-)
hw/alpha/alpha_sys.h +1 -1
@@ -10,7 +10,7 @@#include "hw/i386/pc.h" -PCIBus *typhoon_init (ram_addr_t ,ISABus **,qemu_irq *,AlphaCPU *[4 ], +PCIBus *typhoon_init (ISABus **,qemu_irq *,AlphaCPU *[4 ],pci_map_irq_fn );/* alpha_pci.c. */
hw/alpha/dp264.c +10 -1
@@ -62,6 +62,7 @@ static void clipper_init(MachineState *machine)uint64_t palcode_entry, palcode_low, palcode_high;uint64_t kernel_entry, kernel_low, kernel_high;unsigned int smp_cpus = machine->smp.cpus; +MemoryRegion ram_region;/* Create up to 4 cpus. */ memset (cpus,0 ,sizeof (cpus));
@@ -73,8 +74,16 @@ static void clipper_init(MachineState *machine) cpus[0 ]->env.trap_arg1 =0 ; cpus[0 ]->env.trap_arg2 = smp_cpus; +/* +* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, +* but the address space hole reserved at this point is 8TB. +*/ +memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , + ram_size); +memory_region_add_subregion (get_system_memory (),0 , &ram_region); +/* Init the chipset. */ - pci_bus =typhoon_init (ram_size, &isa_bus, &rtc_irq, cpus, + pci_bus =typhoon_init (&isa_bus, &rtc_irq, cpus, clipper_pci_map_irq);/* Since we have an SRM-compatible PALcode, use the SRM epoch. */
hw/alpha/typhoon.c +1 -8
@@ -58,7 +58,6 @@ typedef struct TyphoonState {TyphoonCchip cchip;TyphoonPchip pchip;MemoryRegion dchip_region; -MemoryRegion ram_region; } TyphoonState;/* Called when one of DRIR or DIM changes. */
@@ -817,7 +816,7 @@ static void typhoon_alarm_timer(void *opaque)cpu_interrupt (CPU (s->cchip.cpu[cpu]),CPU_INTERRUPT_TIMER ); } -PCIBus *typhoon_init (ram_addr_t ram_size,ISABus **isa_bus, +PCIBus *typhoon_init (ISABus **isa_bus,qemu_irq *p_rtc_irq,AlphaCPU *cpus[4 ],pci_map_irq_fn sys_map_irq) {
@@ -849,12 +848,6 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, *p_rtc_irq =qemu_allocate_irq (typhoon_set_timer_irq, s,0 ); -/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, -but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,NULL ,"ram" , - ram_size); -memory_region_add_subregion (addr_space,0 , &s->ram_region); -/* TIGbus, 0x801.0000.0000, 1GB. */ /* ??? The TIGbus is used for delivering interrupts, and access to the flash ROM. I'm not sure that we need to implement it at all. */
Signature · 1 line
2.21.0
Re: [PATCH 08/21] hw/alpha/dp264: Create the RAM in the board
Quoted 36 lines · Philippe Mathieu-Daudé
The SDRAM is incorrectly created in the Tyohoon northbridge ASIC. Move its creation in the board code, this will later allow the board to have the QOM ownership of the RAM.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
checkpatch complains:ERROR: spaces required around that '*' (ctx:WxV) #10: FILE:
hw/alpha/alpha_sys.h:13:
+PCIBus *typhoon_init(ISABus **,qemu_irq*, AlphaCPU *[4],^ --- hw/alpha/alpha_sys.h | 2 +- hw/alpha/dp264.c | 11 ++++++++++- hw/alpha/typhoon.c | 9 +-------- 3 files changed, 12 insertions(+), 10 deletions(-)hw/alpha/alpha_sys.h +1
-1@@ -10,7 +10,7 @@#include "hw/i386/pc.h" -PCIBus *typhoon_init (ram_addr_t ,ISABus **,qemu_irq *,AlphaCPU *[4 ], +PCIBus *typhoon_init (ISABus **,qemu_irq *,AlphaCPU *[4 ],pci_map_irq_fn );/* alpha_pci.c. */ hw/alpha/dp264.c +0
-0
hw/alpha/dp264.c static void clipper_init(MachineState *machine) · line 65
Quoted 4 lines
hw/alpha/dp264.c +1
-0@@ -62,6 +62,7 @@ static void clipper_init(MachineState *machine)uint64_t palcode_entry, palcode_low, palcode_high;uint64_t kernel_entry, kernel_low, kernel_high;unsigned int smp_cpus = machine->smp.cpus; +MemoryRegion ram_region;
This is incorrect, this variable should be in .heap, not stack.
Quoted 56 lines
hw/alpha/dp264.c +9
-1/* Create up to 4 cpus. */ memset (cpus,0 ,sizeof (cpus));@@ -73,8 +74,16 @@ static void clipper_init(MachineState *machine) cpus[0 ]->env.trap_arg1 =0 ; cpus[0 ]->env.trap_arg2 = smp_cpus; +/* +* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, +* but the address space hole reserved at this point is 8TB. +*/ +memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , + ram_size); +memory_region_add_subregion (get_system_memory (),0 , &ram_region); +/* Init the chipset. */ - pci_bus =typhoon_init (ram_size, &isa_bus, &rtc_irq, cpus, + pci_bus =typhoon_init (&isa_bus, &rtc_irq, cpus, clipper_pci_map_irq);/* Since we have an SRM-compatible PALcode, use the SRM epoch. */ hw/alpha/typhoon.c +1
-8@@ -58,7 +58,6 @@ typedef struct TyphoonState {TyphoonCchip cchip;TyphoonPchip pchip;MemoryRegion dchip_region; -MemoryRegion ram_region; } TyphoonState;/* Called when one of DRIR or DIM changes. */ @@ -817,7 +816,7 @@ static void typhoon_alarm_timer(void *opaque)cpu_interrupt (CPU (s->cchip.cpu[cpu]),CPU_INTERRUPT_TIMER ); } -PCIBus *typhoon_init (ram_addr_t ram_size,ISABus **isa_bus, +PCIBus *typhoon_init (ISABus **isa_bus,qemu_irq *p_rtc_irq,AlphaCPU *cpus[4 ],pci_map_irq_fn sys_map_irq) {@@ -849,12 +848,6 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, *p_rtc_irq =qemu_allocate_irq (typhoon_set_timer_irq, s,0 ); -/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, -but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,NULL ,"ram" , - ram_size); -memory_region_add_subregion (addr_space,0 , &s->ram_region); -/* TIGbus, 0x801.0000.0000, 1GB. */ /* ??? The TIGbus is used for delivering interrupts, and access to the flash ROM. I'm not sure that we need to implement it at all. */
Re: [PATCH 08/21] hw/alpha/dp264: Create the RAM in the board
In reply to Philippe Mathieu-Daudéhw/alpha/dp264.c static void clipper_init(MachineState *machine) · line 83
Quoted 11 lines · Philippe Mathieu-Daudé
hw/alpha/dp264.c +7
-0@@ -73,8 +74,16 @@ static void clipper_init(MachineState *machine) cpus[0 ]->env.trap_arg1 =0 ; cpus[0 ]->env.trap_arg2 = smp_cpus; +/* +* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, +* but the address space hole reserved at this point is 8TB. +*/ +memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , + ram_size); +memory_region_add_subregion (get_system_memory (),0 , &ram_region);
The thing that I don't like about this is that ...
hw/alpha/typhoon.c PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, · line 853
Quoted 13 lines
hw/alpha/typhoon.c +0
-6@@ -849,12 +848,6 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, *p_rtc_irq =qemu_allocate_irq (typhoon_set_timer_irq, s,0 ); -/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, -but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,NULL ,"ram" , - ram_size); -memory_region_add_subregion (addr_space,0 , &s->ram_region); -/* TIGbus, 0x801.0000.0000, 1GB. */ /* ??? The TIGbus is used for delivering interrupts, and access to the flash ROM. I'm not sure that we need to implement it at all. */
... previously, it was clear that Typhoon owns the entire address space layout.
With this moved to dp264.c, the "address space hole" comment is out of context
and makes no sense.
Would it be too weird to pass in a MemoryRegion* to typhoon_init and leave the memory_region_add_subregion() call where it is?
r~
Re: [PATCH 08/21] hw/alpha/dp264: Create the RAM in the board
Quoted 33 lines · Richard Henderson
hw/alpha/dp264.c static void clipper_init(MachineState *machine) · line 83
Quoted 11 lines · Philippe Mathieu-Daudé
hw/alpha/dp264.c +7
-0@@ -73,8 +74,16 @@ static void clipper_init(MachineState *machine) cpus[0 ]->env.trap_arg1 =0 ; cpus[0 ]->env.trap_arg2 = smp_cpus; +/* +* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, +* but the address space hole reserved at this point is 8TB. +*/ +memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , + ram_size); +memory_region_add_subregion (get_system_memory (),0 , &ram_region);The thing that I don't like about this is that ...
hw/alpha/typhoon.c PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, · line 853
Quoted 13 lines
hw/alpha/typhoon.c +0
-6@@ -849,12 +848,6 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, *p_rtc_irq =qemu_allocate_irq (typhoon_set_timer_irq, s,0 ); -/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, -but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,NULL ,"ram" , - ram_size); -memory_region_add_subregion (addr_space,0 , &s->ram_region); -/* TIGbus, 0x801.0000.0000, 1GB. */ /* ??? The TIGbus is used for delivering interrupts, and access to the flash ROM. I'm not sure that we need to implement it at all. */ ... previously, it was clear that Typhoon owns the entire address space layout.
With this moved todp264.c, the "address space hole" comment is out of context
and makes no sense.
Quoted 2 lines
Would it be too weird to pass in a MemoryRegion* to
typhoon_initand leave thememory_region_add_subregion()call where it is?
Yes, this will also better match the hardware.
I have a WiP series that first QOM'ify the CY82C693UB southbridge then the Typhoon northbridge and pass the DRAM MemoryRegion* as a link, so in the non-QOM form your suggestion is the same. I'll do your change.
PATCH 9/21 hw: Let memory_region_allocate_system_memory take MachineState argument
In reply to Philippe Mathieu-DaudéAll the codebase calls memory_region_allocate_system_memory() with a NULL 'owner' from the board_init() function.
Let pass a MachineState argument, and enforce the QOM ownership of the system memory.
--- hw/core/numa.c | 11 +++++++---- include/hw/boards.h | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-)
hw/core/numa.c +7 -4
@@ -520,21 +520,24 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,vmstate_register_ram_global (mr); } -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size) {uint64_t addr =0 ;int i; -MachineState *ms =MACHINE (qdev_get_machine ()); + +if (!ms) { + ms =MACHINE (qdev_get_machine ()); + }if (ms->numa_state ==NULL || ms->numa_state->num_nodes ==0 || !have_memdevs) { -allocate_system_memory_nonnuma (mr, owner, name, ram_size); +allocate_system_memory_nonnuma (mr,OBJECT (ms), name, ram_size);return ; } -memory_region_init (mr, owner, name, ram_size); +memory_region_init (mr,OBJECT (ms), name, ram_size);for (i =0 ; i < ms->numa_state->num_nodes; i++) {uint64_t size = ms->numa_state->nodes[i].node_mem;HostMemoryBackend *backend = ms->numa_state->nodes[i].node_memdev;
include/hw/boards.h +4 -2
@@ -14,7 +14,7 @@/** * memory_region_allocate_system_memory - Allocate a board's main memory * @mr: the #MemoryRegion to be initialized -* @owner: the object that tracks the region's reference count +* @ms: the #MachineState object that own the system memory * @name: name of the memory region * @ram_size: size of the region in bytes *
@@ -38,8 +38,10 @@* Smaller pieces of memory (display RAM, static RAMs, etc) don't need * to be backed via the -mem-path memory backend and can simply * be created via memory_region_init_ram(). +* +* The #MachineState object will track the region's reference count. */ -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size);
Signature · 1 line
2.21.0
Re: [PATCH 09/21] hw: Let memory_region_allocate_system_memory take MachineState argument
Quoted 2 lines · Philippe Mathieu-Daudé
All the codebase calls
memory_region_allocate_system_memory()with a NULL 'owner' from theboard_init()function.
It's a little bit weird that you first changed the owner to NULL in patch 7, just to change the type of the parameter here and then change the parameter back to the machine afterwards. I think I'd rather squash pash 7 (and the follow-up patches like 14) into this one here - it's just four files that need to be adapted, so I think that's still fine, and finally that's less churn to be reviewed.
Quoted 2 lines
Let pass a MachineState argument, and enforce the QOM ownership of the system memory.
BTW, good idea!
Quoted 44 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/core/numa.c | 11 +++++++---- include/hw/boards.h | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-)hw/core/numa.c +7
-4@@ -520,21 +520,24 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,vmstate_register_ram_global (mr); } -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size) {uint64_t addr =0 ;int i; -MachineState *ms =MACHINE (qdev_get_machine ()); + +if (!ms) { + ms =MACHINE (qdev_get_machine ()); + }if (ms->numa_state ==NULL || ms->numa_state->num_nodes ==0 || !have_memdevs) { -allocate_system_memory_nonnuma (mr, owner, name, ram_size); +allocate_system_memory_nonnuma (mr,OBJECT (ms), name, ram_size);return ; } -memory_region_init (mr, owner, name, ram_size); +memory_region_init (mr,OBJECT (ms), name, ram_size);for (i =0 ; i < ms->numa_state->num_nodes; i++) {uint64_t size = ms->numa_state->nodes[i].node_mem;HostMemoryBackend *backend = ms->numa_state->nodes[i].node_memdev;include/hw/boards.h +0
-0
include/hw/boards.h line 17
Quoted 5 lines
include/hw/boards.h +1
-1@@ -14,7 +14,7 @@/** * memory_region_allocate_system_memory - Allocate a board's main memory * @mr: the #MemoryRegion to be initialized -* @owner: the object that tracks the region's reference count +* @ms: the #MachineState object that own the system memory
s/own/owns/
Quoted 6 lines
include/hw/boards.h +0
-0* @name: name of the memory region * @ram_size: size of the region in bytes * @@ -38,8 +38,10 @@* Smaller pieces of memory (display RAM, static RAMs, etc) don't need
include/hw/boards.h line 47
Quoted 10 lines
include/hw/boards.h +3
-1* to be backed via the -mem-path memory backend and can simply * be created via memory_region_init_ram(). +* +* The #MachineState object will track the region's reference count. */ -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size);
Thomas
Re: [PATCH 09/21] hw: Let memory_region_allocate_system_memory take MachineState argument
Quoted 10 lines · Thomas Huth
Quoted 2 lines · Philippe Mathieu-Daudé
All the codebase calls
memory_region_allocate_system_memory()with a NULL 'owner' from theboard_init()function.It's a little bit weird that you first changed the owner to NULL in patch 7, just to change the type of the parameter here and then change the parameter back to the machine afterwards. I think I'd rather squash pash 7 (and the follow-up patches like 14) into this one here - it's just four files that need to be adapted, so I think that's still fine, and finally that's less churn to be reviewed.
I haven't thought of it and like your suggestion :)
Quoted 4 lines
Quoted 2 lines
Let pass a MachineState argument, and enforce the QOM ownership of the system memory.
BTW, good idea!
Thanks :)
Quoted 72 lines
Quoted 45 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/core/numa.c | 11 +++++++---- include/hw/boards.h | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-)hw/core/numa.c +7
-4@@ -520,21 +520,24 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,vmstate_register_ram_global (mr); } -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size) {uint64_t addr =0 ;int i; -MachineState *ms =MACHINE (qdev_get_machine ()); + +if (!ms) { + ms =MACHINE (qdev_get_machine ()); + }if (ms->numa_state ==NULL || ms->numa_state->num_nodes ==0 || !have_memdevs) { -allocate_system_memory_nonnuma (mr, owner, name, ram_size); +allocate_system_memory_nonnuma (mr,OBJECT (ms), name, ram_size);return ; } -memory_region_init (mr, owner, name, ram_size); +memory_region_init (mr,OBJECT (ms), name, ram_size);for (i =0 ; i < ms->numa_state->num_nodes; i++) {uint64_t size = ms->numa_state->nodes[i].node_mem;HostMemoryBackend *backend = ms->numa_state->nodes[i].node_memdev;include/hw/boards.h +0
-0include/hw/boards.h line 17
Quoted 5 lines
include/hw/boards.h +1
-1@@ -14,7 +14,7 @@/** * memory_region_allocate_system_memory - Allocate a board's main memory * @mr: the #MemoryRegion to be initialized -* @owner: the object that tracks the region's reference count +* @ms: the #MachineState object that own the system memory s/own/owns/
Quoted 6 lines
include/hw/boards.h +0
-0* @name: name of the memory region * @ram_size: size of the region in bytes * @@ -38,8 +38,10 @@* Smaller pieces of memory (display RAM, static RAMs, etc) don't need include/hw/boards.h line 47
Quoted 10 lines
include/hw/boards.h +3
-1* to be backed via the -mem-path memory backend and can simply * be created via memory_region_init_ram(). +* +* The #MachineState object will track the region's reference count. */ -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size);Thomas
Re: [PATCH 09/21] hw: Let memory_region_allocate_system_memory take MachineState argument
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
All the codebase calls
memory_region_allocate_system_memory()with a NULL 'owner' from theboard_init()function.
Let pass a MachineState argument, and enforce the QOM ownership of the system memory.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 67 lines
--- hw/core/numa.c | 11 +++++++---- include/hw/boards.h | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-)hw/core/numa.c +7
-4@@ -520,21 +520,24 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,vmstate_register_ram_global (mr); } -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size) {uint64_t addr =0 ;int i; -MachineState *ms =MACHINE (qdev_get_machine ()); + +if (!ms) { + ms =MACHINE (qdev_get_machine ()); + }if (ms->numa_state ==NULL || ms->numa_state->num_nodes ==0 || !have_memdevs) { -allocate_system_memory_nonnuma (mr, owner, name, ram_size); +allocate_system_memory_nonnuma (mr,OBJECT (ms), name, ram_size);return ; } -memory_region_init (mr, owner, name, ram_size); +memory_region_init (mr,OBJECT (ms), name, ram_size);for (i =0 ; i < ms->numa_state->num_nodes; i++) {uint64_t size = ms->numa_state->nodes[i].node_mem;HostMemoryBackend *backend = ms->numa_state->nodes[i].node_memdev;include/hw/boards.h +4
-3@@ -14,7 +14,7 @@/** * memory_region_allocate_system_memory - Allocate a board's main memory * @mr: the #MemoryRegion to be initialized -* @owner: the object that tracks the region's reference count +* @ms: the #MachineState object that own the system memory * @name: name of the memory region * @ram_size: size of the region in bytes * @@ -38,8 +38,10 @@* Smaller pieces of memory (display RAM, static RAMs, etc) don't need * to be backed via the -mem-path memory backend and can simply * be created via memory_region_init_ram(). +* +* The #MachineState object will track the region's reference count. */ -void memory_region_allocate_system_memory (MemoryRegion *mr,Object *owner, +void memory_region_allocate_system_memory (MemoryRegion *mr,MachineState *ms,const char *name,uint64_t ram_size); --2.21.0
PATCH 10/21 hw/core: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/core/null-machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/null-machine.c +1 -1
@@ -35,7 +35,7 @@ static void machine_none_init(MachineState *mch)if (mch->ram_size) {MemoryRegion *ram =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram,NULL ,"ram" , mch->ram_size); +memory_region_allocate_system_memory (ram, mch,"ram" , mch->ram_size);memory_region_add_subregion (get_system_memory (),0 , ram); }
Signature · 1 line
2.21.0
Re: [PATCH 10/21] hw/core: Let the machine be the owner of the system memory
Quoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 21 lines
--- hw/core/null-machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/core/null-machine.c +1
-2@@ -35,7 +35,7 @@ static void machine_none_init(MachineState *mch)if (mch->ram_size) {MemoryRegion *ram =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram,NULL ,"ram" , mch->ram_size); +memory_region_allocate_system_memory (ram, mch,"ram" , mch->ram_size);memory_region_add_subregion (get_system_memory (),0 , ram); } --2.21.0
PATCH 11/21 hw/alpha: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/alpha/dp264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/alpha/dp264.c +1 -1
@@ -78,7 +78,7 @@ static void clipper_init(MachineState *machine)* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, * but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , +memory_region_allocate_system_memory (&ram_region, machine,"ram" , ram_size);memory_region_add_subregion (get_system_memory (),0 , &ram_region);
Signature · 1 line
2.21.0
Re: [PATCH 11/21] hw/alpha: Let the machine be the owner of the system memory
Quoted 11 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/alpha/dp264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/alpha/dp264.c +0
-0
hw/alpha/dp264.c static void clipper_init(MachineState *machine) · line 84
Quoted 8 lines
hw/alpha/dp264.c +1
-1@@ -78,7 +78,7 @@ static void clipper_init(MachineState *machine)* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, * but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , +memory_region_allocate_system_memory (&ram_region, machine,"ram" , ram_size);memory_region_add_subregion (get_system_memory (),0 , &ram_region);
I take it this squishes into the squish of patches 7+9?
r~
Re: [PATCH 11/21] hw/alpha: Let the machine be the owner of the system memory
Quoted 6 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/alpha/dp264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines
hw/alpha/dp264.c +0
-0hw/alpha/dp264.c static void clipper_init(MachineState *machine) · line 84
Quoted 8 lines
hw/alpha/dp264.c +1
-1@@ -78,7 +78,7 @@ static void clipper_init(MachineState *machine)* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, * but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , +memory_region_allocate_system_memory (&ram_region, machine,"ram" , ram_size);memory_region_add_subregion (get_system_memory (),0 , &ram_region);I take it this squishes into the squish of patches 7+9?
Ah, no, it was the TyphoonState that had owned the ram prior to patch 7.
r~
Re: [PATCH 11/21] hw/alpha: Let the machine be the owner of the system memory
Quoted 24 lines · Richard Henderson
Quoted 6 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/alpha/dp264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 16 lines
Quoted 6 lines
hw/alpha/dp264.c +0
-0hw/alpha/dp264.c static void clipper_init(MachineState *machine) · line 84
Quoted 8 lines
hw/alpha/dp264.c +1
-1@@ -78,7 +78,7 @@ static void clipper_init(MachineState *machine)* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, * but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&ram_region,NULL ,"ram" , +memory_region_allocate_system_memory (&ram_region, machine,"ram" , ram_size);memory_region_add_subregion (get_system_memory (),0 , &ram_region);I take it this squishes into the squish of patches 7+9?
Quoted 1 line
Ah, no, it was the TyphoonState that had owned the ram prior to patch 7.
Indeed, I'll squash them and document in the commit description that I dropped Typhoon ownership. I'm not sure what's best here, keep it unassigned until patch #11 (this), or reassign to OBJECT(machine).
New squashed patch is:
-- 8< --
hw/alpha/alpha_sys.h +1 -1
@@ -10,7 +10,7 @@#include "hw/i386/pc.h" -PCIBus *typhoon_init (ram_addr_t ,ISABus **,qemu_irq *,AlphaCPU *[4 ], +PCIBus *typhoon_init (ISABus **,qemu_irq *,AlphaCPU *[4 ],pci_map_irq_fn );/* alpha_pci.c. */
hw/alpha/dp264.c +9 -1
@@ -62,6 +62,7 @@ static void clipper_init(MachineState *machine)uint64_t palcode_entry, palcode_low, palcode_high;uint64_t kernel_entry, kernel_low, kernel_high;unsigned int smp_cpus = machine->smp.cpus; +MemoryRegion *ram =g_new (MemoryRegion,1 );/* Create up to 4 cpus. */ memset (cpus,0 ,sizeof (cpus));
@@ -73,8 +74,15 @@ static void clipper_init(MachineState *machine) cpus[0 ]->env.trap_arg1 =0 ; cpus[0 ]->env.trap_arg2 = smp_cpus; +/* +* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, +* but the address space hole reserved at this point is 8TB. +*/ +memory_region_allocate_system_memory (ram,OBJECT (machine),"ram" , ram_size); +memory_region_add_subregion (get_system_memory (),0 , ram); +/* Init the chipset. */ - pci_bus =typhoon_init (ram_size, &isa_bus, &rtc_irq, cpus, + pci_bus =typhoon_init (&isa_bus, &rtc_irq, cpus, clipper_pci_map_irq);/* Since we have an SRM-compatible PALcode, use the SRM epoch. */
hw/alpha/typhoon.c +1 -8
@@ -58,7 +58,6 @@ typedef struct TyphoonState {TyphoonCchip cchip;TyphoonPchip pchip;MemoryRegion dchip_region; -MemoryRegion ram_region; } TyphoonState;/* Called when one of DRIR or DIM changes. */
@@ -817,7 +816,7 @@ static void typhoon_alarm_timer(void *opaque)cpu_interrupt (CPU (s->cchip.cpu[cpu]),CPU_INTERRUPT_TIMER ); } -PCIBus *typhoon_init (ram_addr_t ram_size,ISABus **isa_bus, +PCIBus *typhoon_init (ISABus **isa_bus,qemu_irq *p_rtc_irq,AlphaCPU *cpus[4 ],pci_map_irq_fn sys_map_irq) {
@@ -849,12 +848,6 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus, *p_rtc_irq =qemu_allocate_irq (typhoon_set_timer_irq, s,0 ); -/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB, -but the address space hole reserved at this point is 8TB. */ -memory_region_allocate_system_memory (&s->ram_region,OBJECT (s),"ram" , - ram_size); -memory_region_add_subregion (addr_space,0 , &s->ram_region); -/* TIGbus, 0x801.0000.0000, 1GB. */ /* ??? The TIGbus is used for delivering interrupts, and access to the flash ROM. I'm not sure that we need to implement it at
all. */
---
PATCH 12/21 hw/arm: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/arm/aspeed.c | 2 +- hw/arm/collie.c | 2 +- hw/arm/cubieboard.c | 2 +- hw/arm/digic_boards.c | 7 ++++--- hw/arm/highbank.c | 3 ++- hw/arm/imx25_pdk.c | 2 +- hw/arm/integratorcp.c | 2 +- hw/arm/kzm.c | 2 +- hw/arm/mcimx6ul-evk.c | 2 +- hw/arm/mcimx7d-sabre.c | 2 +- hw/arm/mps2-tz.c | 4 ++-- hw/arm/mps2.c | 4 ++-- hw/arm/musicpal.c | 2 +- hw/arm/nseries.c | 2 +- hw/arm/omap_sx1.c | 2 +- hw/arm/palm.c | 2 +- hw/arm/raspi.c | 2 +- hw/arm/sabrelite.c | 2 +- hw/arm/sbsa-ref.c | 2 +- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 4 ++-- hw/arm/virt.c | 2 +- hw/arm/xilinx_zynq.c | 2 +- hw/arm/xlnx-versal-virt.c | 2 +- hw/arm/xlnx-zcu102.c | 2 +- 25 files changed, 32 insertions(+), 30 deletions(-)
hw/arm/aspeed.c +1 -1
@@ -212,7 +212,7 @@ static void aspeed_board_init(MachineState *machine, ram_size =object_property_get_uint (OBJECT (&bmc->soc),"ram-size" , &error_abort); -memory_region_allocate_system_memory (&bmc->ram,NULL ,"ram" , ram_size); +memory_region_allocate_system_memory (&bmc->ram, machine,"ram" , ram_size);memory_region_add_subregion (&bmc->ram_container,0 , &bmc->ram); memory_region_add_subregion(get_system_memory(), sc->memmap[ASPEED_SDRAM],
hw/arm/collie.c +1 -1
@@ -31,7 +31,7 @@ static void collie_init(MachineState *machine) s =sa1110_init (machine->cpu_type); -memory_region_allocate_system_memory (sdram,NULL ,"strongarm.sdram" , +memory_region_allocate_system_memory (sdram, machine,"strongarm.sdram" , collie_binfo.ram_size);memory_region_add_subregion (get_system_memory (),SA_SDCS0 , sdram);
hw/arm/cubieboard.c +1 -1
@@ -65,7 +65,7 @@ static void cubieboard_init(MachineState *machine)exit (1 ); } -memory_region_allocate_system_memory (&s->sdram,NULL ,"cubieboard.ram" , +memory_region_allocate_system_memory (&s->sdram, machine,"cubieboard.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),AW_A10_SDRAM_BASE , &s->sdram);
hw/arm/digic_boards.c +4 -3
@@ -53,7 +53,7 @@ typedef struct DigicBoard {const char *rom1_def_filename; } DigicBoard; -static void digic4_board_init (DigicBoard *board) +static void digic4_board_init (MachineState *machine,DigicBoard *board) {Error *err =NULL ;
@@ -66,7 +66,8 @@ static void digic4_board_init(DigicBoard *board)exit (1 ); } -memory_region_allocate_system_memory (&s->ram,NULL ,"ram" , board->ram_size); +memory_region_allocate_system_memory (&s->ram, machine,"ram" , + board->ram_size);memory_region_add_subregion (get_system_memory (),0 , &s->ram);if (board->add_rom0) {
@@ -142,7 +143,7 @@ static DigicBoard digic4_board_canon_a1100 = {static void canon_a1100_init (MachineState *machine) { -digic4_board_init (&digic4_board_canon_a1100); +digic4_board_init (machine, &digic4_board_canon_a1100); }static void canon_a1100_machine_init (MachineClass *mc)
hw/arm/highbank.c +2 -1
@@ -290,7 +290,8 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) sysmem =get_system_memory (); dram =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (dram,NULL ,"highbank.dram" , ram_size); +memory_region_allocate_system_memory (dram, machine,"highbank.dram" , + ram_size);/* SDRAM at address zero. */ memory_region_add_subregion (sysmem,0 , dram);
hw/arm/imx25_pdk.c +1 -1
@@ -84,7 +84,7 @@ static void imx25_pdk_init(MachineState *machine) machine->ram_size =FSL_IMX25_SDRAM0_SIZE +FSL_IMX25_SDRAM1_SIZE ; } -memory_region_allocate_system_memory (&s->ram,NULL ,"imx25.ram" , +memory_region_allocate_system_memory (&s->ram, machine,"imx25.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),FSL_IMX25_SDRAM0_ADDR , &s->ram);
hw/arm/integratorcp.c +1 -1
@@ -605,7 +605,7 @@ static void integratorcp_init(MachineState *machine) cpu =ARM_CPU (cpuobj); -memory_region_allocate_system_memory (ram,NULL ,"integrator.ram" , +memory_region_allocate_system_memory (ram, machine,"integrator.ram" , ram_size);/* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */ /* ??? RAM should repeat to fill physical memory space. */
hw/arm/kzm.c +1 -1
@@ -84,7 +84,7 @@ static void kzm_init(MachineState *machine) machine->ram_size =FSL_IMX31_SDRAM0_SIZE +FSL_IMX31_SDRAM1_SIZE ; } -memory_region_allocate_system_memory (&s->ram,NULL ,"kzm.ram" , +memory_region_allocate_system_memory (&s->ram, machine,"kzm.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),FSL_IMX31_SDRAM0_ADDR , &s->ram);
hw/arm/mcimx6ul-evk.c +1 -1
@@ -48,7 +48,7 @@ static void mcimx6ul_evk_init(MachineState *machine)object_property_set_bool (OBJECT (&s->soc), true,"realized" , &error_fatal); -memory_region_allocate_system_memory (&s->ram,NULL ,"mcimx6ul-evk.ram" , +memory_region_allocate_system_memory (&s->ram, machine,"mcimx6ul-evk.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),FSL_IMX6UL_MMDC_ADDR , &s->ram);
hw/arm/mcimx7d-sabre.c +1 -1
@@ -50,7 +50,7 @@ static void mcimx7d_sabre_init(MachineState *machine) TYPE_FSL_IMX7, &error_fatal, NULL);object_property_set_bool (OBJECT (&s->soc), true,"realized" , &error_fatal); -memory_region_allocate_system_memory (&s->ram,NULL ,"mcimx7d-sabre.ram" , +memory_region_allocate_system_memory (&s->ram, machine,"mcimx7d-sabre.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),FSL_IMX7_MMDC_ADDR , &s->ram);
hw/arm/mps2-tz.c +2 -2
@@ -458,8 +458,8 @@ static void mps2tz_common_init(MachineState *machine)* tradeoffs. For QEMU they're all just RAM, though. We arbitrarily * call the 16MB our "system memory", as it's the largest lump. */ -memory_region_allocate_system_memory (&mms->psram, -NULL ,"mps.ram" ,16 * MiB); +memory_region_allocate_system_memory (&mms->psram, machine, +"mps.ram" ,16 * MiB);memory_region_add_subregion (system_memory,0x80000000 , &mms->psram);/* The overflow IRQs for all UARTs are ORed together.
hw/arm/mps2.c +2 -2
@@ -146,8 +146,8 @@ static void mps2_common_init(MachineState *machine)* This is of no use for QEMU so we don't implement it (as if * zbt_boot_ctrl is always zero). */ -memory_region_allocate_system_memory (&mms->psram, -NULL ,"mps.ram" ,16 * MiB); +memory_region_allocate_system_memory (&mms->psram, machine, +"mps.ram" ,16 * MiB);memory_region_add_subregion (system_memory,0x21000000 , &mms->psram);switch (mmc->fpga_type) {
hw/arm/musicpal.c +1 -1
@@ -1596,7 +1596,7 @@ static void musicpal_init(MachineState *machine) cpu =ARM_CPU (cpu_create (machine->cpu_type));/* For now we use a fixed - the original - RAM size */ -memory_region_allocate_system_memory (ram,NULL ,"musicpal.ram" , +memory_region_allocate_system_memory (ram, machine,"musicpal.ram" ,MP_RAM_DEFAULT_SIZE );memory_region_add_subregion (address_space_mem,0 , ram);
hw/arm/nseries.c +1 -1
@@ -1315,7 +1315,7 @@ static void n8x0_init(MachineState *machine,struct n800_s *s = (struct n800_s *)g_malloc0 (sizeof (*s));uint64_t sdram_size = binfo->ram_size; -memory_region_allocate_system_memory (sdram,NULL ,"omap2.dram" , +memory_region_allocate_system_memory (sdram, machine,"omap2.dram" , sdram_size);memory_region_add_subregion (get_system_memory (),OMAP2_Q2_BASE , sdram);
hw/arm/omap_sx1.c +1 -1
@@ -119,7 +119,7 @@ static void sx1_init(MachineState *machine, const int version) flash_size = flash2_size; } -memory_region_allocate_system_memory (dram,NULL ,"omap1.dram" , +memory_region_allocate_system_memory (dram, machine,"omap1.dram" , sx1_binfo.ram_size);memory_region_add_subregion (address_space,OMAP_EMIFF_BASE , dram);
hw/arm/palm.c +1 -1
@@ -199,7 +199,7 @@ static void palmte_init(MachineState *machine)MemoryRegion *flash =g_new (MemoryRegion,1 );MemoryRegion *cs =g_new (MemoryRegion,4 ); -memory_region_allocate_system_memory (dram,NULL ,"omap1.dram" , +memory_region_allocate_system_memory (dram, machine,"omap1.dram" , palmte_binfo.ram_size);memory_region_add_subregion (address_space_mem,OMAP_EMIFF_BASE , dram);
hw/arm/raspi.c +1 -1
@@ -182,7 +182,7 @@ static void raspi_init(MachineState *machine, int version) &error_abort, NULL);/* Allocate and map RAM */ -memory_region_allocate_system_memory (&s->ram,NULL ,"ram" , +memory_region_allocate_system_memory (&s->ram, machine,"ram" , machine->ram_size);/* FIXME: Remove when we have custom CPU address space support */ memory_region_add_subregion_overlap (get_system_memory (),0 , &s->ram,0 );
hw/arm/sabrelite.c +1 -1
@@ -64,7 +64,7 @@ static void sabrelite_init(MachineState *machine)exit (1 ); } -memory_region_allocate_system_memory (&s->ram,NULL ,"sabrelite.ram" , +memory_region_allocate_system_memory (&s->ram, machine,"sabrelite.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),FSL_IMX6_MMDC_ADDR , &s->ram);
hw/arm/sbsa-ref.c +1 -1
@@ -687,7 +687,7 @@ static void sbsa_ref_init(MachineState *machine)object_unref (cpuobj); } -memory_region_allocate_system_memory (ram,NULL ,"sbsa-ref.ram" , +memory_region_allocate_system_memory (ram, machine,"sbsa-ref.ram" , machine->ram_size);memory_region_add_subregion (sysmem, sbsa_ref_memmap[SBSA_MEM ].base, ram);
hw/arm/versatilepb.c +1 -1
@@ -220,7 +220,7 @@ static void versatile_init(MachineState *machine, int board_id) cpu =ARM_CPU (cpuobj); -memory_region_allocate_system_memory (ram,NULL ,"versatile.ram" , +memory_region_allocate_system_memory (ram, machine,"versatile.ram" , machine->ram_size);/* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero. */
hw/arm/vexpress.c +2 -2
@@ -283,7 +283,7 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,exit (1 ); } -memory_region_allocate_system_memory (ram,NULL ,"vexpress.highmem" , +memory_region_allocate_system_memory (ram, machine,"vexpress.highmem" , ram_size); low_ram_size = ram_size;if (low_ram_size >0x4000000 ) {
@@ -375,7 +375,7 @@ static void a15_daughterboard_init(const VexpressMachineState *vms, } } -memory_region_allocate_system_memory (ram,NULL ,"vexpress.highmem" , +memory_region_allocate_system_memory (ram, machine,"vexpress.highmem" , ram_size);/* RAM is from 0x80000000 upwards; there is no low-memory alias for it. */ memory_region_add_subregion (sysmem,0x80000000 , ram);
hw/arm/virt.c +1 -1
@@ -1702,7 +1702,7 @@ static void machvirt_init(MachineState *machine) } } -memory_region_allocate_system_memory (ram,NULL ,"mach-virt.ram" , +memory_region_allocate_system_memory (ram, machine,"mach-virt.ram" , machine->ram_size);memory_region_add_subregion (sysmem, vms->memmap[VIRT_MEM ].base, ram);if (machine->device_memory) {
hw/arm/xilinx_zynq.c +1 -1
@@ -190,7 +190,7 @@ static void zynq_init(MachineState *machine) }/* DDR remapped to address zero. */ -memory_region_allocate_system_memory (ext_ram,NULL ,"zynq.ext_ram" , +memory_region_allocate_system_memory (ext_ram, machine,"zynq.ext_ram" , ram_size);memory_region_add_subregion (address_space_mem,0 , ext_ram);
hw/arm/xlnx-versal-virt.c +1 -1
@@ -414,7 +414,7 @@ static void versal_virt_init(MachineState *machine) psci_conduit =QEMU_PSCI_CONDUIT_SMC ; } -memory_region_allocate_system_memory (&s->mr_ddr,NULL ,"ddr" , +memory_region_allocate_system_memory (&s->mr_ddr, machine,"ddr" , machine->ram_size); sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc,
hw/arm/xlnx-zcu102.c +1 -1
@@ -87,7 +87,7 @@ static void xlnx_zcu102_init(MachineState *machine) ram_size); } -memory_region_allocate_system_memory (&s->ddr_ram,NULL ,"ddr-ram" , +memory_region_allocate_system_memory (&s->ddr_ram, machine,"ddr-ram" , ram_size); object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
Signature · 1 line
2.21.0
Re: [PATCH 12/21] hw/arm: Let the machine be the owner of the system memory
Quoted 5 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/arm/virt.c | 2 +-
I think from a quick code scan that this is ok, but did you test that migration compat from old to new still works? I vaguely recall that there are some cases when adding an owner to a memory region changes the name string used for identifying the ramblock in migration.
thanks
-- PMM
Re: [PATCH 12/21] hw/arm: Let the machine be the owner of the system memory
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 7 lines
Quoted 1 line
hw/arm/virt.c | 2 +-I think from a quick code scan that this is ok, but did you test that migration compat from old to new still works? I vaguely recall that there are some cases when adding an owner to a memory region changes the name string used for identifying the ramblock in migration.
It seems to still works:
$ make check-qtest-aarch64 V=1 QTEST_QEMU_BINARY=aarch64-softmmu/qemu-system-aarch64 QTEST_QEMU_IMG=qemu-img tests/migration-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="migration-test" PASS 1 migration-test /aarch64/migration/deprecated PASS 2 migration-test /aarch64/migration/bad_dest PASS 3 migration-test /aarch64/migration/fd_proto PASS 4 migration-test /aarch64/migration/validate_uuid PASS 5 migration-test /aarch64/migration/validate_uuid_error PASS 6 migration-test /aarch64/migration/validate_uuid_src_not_set PASS 7 migration-test /aarch64/migration/validate_uuid_dst_not_set PASS 8 migration-test /aarch64/migration/auto_converge PASS 9 migration-test /aarch64/migration/postcopy/unix PASS 10 migration-test /aarch64/migration/postcopy/recovery PASS 11 migration-test /aarch64/migration/precopy/unix PASS 12 migration-test /aarch64/migration/precopy/tcp PASS 13 migration-test /aarch64/migration/xbzrle/unix
This test migrate the virt machine.
Is this enough?
Regards,
Phil.
Re: [PATCH 12/21] hw/arm: Let the machine be the owner of the system memory
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 7 lines
Quoted 1 line
hw/arm/virt.c | 2 +-I think from a quick code scan that this is ok, but did you test that migration compat from old to new still works? I vaguely recall that there are some cases when adding an owner to a memory region changes the name string used for identifying the ramblock in migration.
Quoted 7 lines
It seems to still works:
$ make check-qtest-aarch64 V=1This test migrate the virt machine.
Is this enough?
No, you need to test migration from a QEMU binary without this patchset to a QEMU binary that has it. Otherwise you're only checking that the new version can migrate from itself to itself. I find the easiest way to test this is just to use the 'savevm' command to save a state snapshot to a qcow2 disk image while running the old binary, and then run 'loadvm' with the new binary and check it restored OK.
thanks
-- PMM
Re: [PATCH 12/21] hw/arm: Let the machine be the owner of the system memory
Cc'ing Paolo/David.
Quoted 24 lines · Peter Maydell
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 7 lines
Quoted 1 line
hw/arm/virt.c | 2 +-I think from a quick code scan that this is ok, but did you test that migration compat from old to new still works? I vaguely recall that there are some cases when adding an owner to a memory region changes the name string used for identifying the ramblock in migration.
Quoted 7 lines
It seems to still works:
$ make check-qtest-aarch64 V=1This test migrate the virt machine.
Is this enough?
Quoted 7 lines
No, you need to test migration from a QEMU binary without this patchset to a QEMU binary that has it. Otherwise you're only checking that the new version can migrate from itself to itself. I find the easiest way to test this is just to use the 'savevm' command to save a state snapshot to a qcow2 disk image while running the old binary, and then run 'loadvm' with the new binary and check it restored OK.
I did not think if this case.
I followed your blog post [*] and tested the migration works OK.
Paolo, now thinking about regular testing, we should add this testing to patchew too. Something like:
- when mainstream/master is updated, patchew build QEMU (it should be already mostly ccached) and generate some vm dumps with 'savevm'.
- build/test the series
- if series succeeded testing, run 'loadvm' tests
[*] https://translatedcode.wordpress.com/2015/07/06/tricks-for-debugging-qemu-savevm-snapshots/
Re: [PATCH 12/21] hw/arm: Let the machine be the owner of the system memory
Quoted 42 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Cc'ing Paolo/David.
Quoted 24 lines · Peter Maydell
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 7 lines
Quoted 1 line
hw/arm/virt.c | 2 +-I think from a quick code scan that this is ok, but did you test that migration compat from old to new still works? I vaguely recall that there are some cases when adding an owner to a memory region changes the name string used for identifying the ramblock in migration.
Quoted 7 lines
It seems to still works:
$ make check-qtest-aarch64 V=1This test migrate the virt machine.
Is this enough?
Quoted 7 lines
No, you need to test migration from a QEMU binary without this patchset to a QEMU binary that has it. Otherwise you're only checking that the new version can migrate from itself to itself. I find the easiest way to test this is just to use the 'savevm' command to save a state snapshot to a qcow2 disk image while running the old binary, and then run 'loadvm' with the new binary and check it restored OK.
I did not think if this case.
I followed your blog post [*] and tested the migration works OK.
Paolo, now thinking about regular testing, we should add this testing to patchew too. Something like:
Quoted 8 lines
- when mainstream/master is updated, patchew build QEMU (it should be already mostly ccached) and generate some vm dumps with 'savevm'.
- build/test the series
- if series succeeded testing, run 'loadvm' tests
[*] https://translatedcode.wordpress.com/2015/07/06/tricks-for-debugging-qemu-savevm-snapshots/
Avocado certainly already has an option for specifying source and destination qemu separately; I've used that for testing cross version in the past.
The challenge is finding a command line/set of devices for each architecture that's expected to be stable.
You want a command line with as big a set of devices as possible (for coverage) yet really is tied to machine type.
Dave
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH 12/21] hw/arm: Let the machine be the owner of the system memory
Cc'ing avocado-devel for test idea.
Quoted 66 lines · Dr. David Alan Gilbert
Quoted 42 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Cc'ing Paolo/David.
Quoted 24 lines · Peter Maydell
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 7 lines
Quoted 1 line
hw/arm/virt.c | 2 +-I think from a quick code scan that this is ok, but did you test that migration compat from old to new still works? I vaguely recall that there are some cases when adding an owner to a memory region changes the name string used for identifying the ramblock in migration.
Quoted 7 lines
It seems to still works:
$ make check-qtest-aarch64 V=1This test migrate the virt machine.
Is this enough?
Quoted 7 lines
No, you need to test migration from a QEMU binary without this patchset to a QEMU binary that has it. Otherwise you're only checking that the new version can migrate from itself to itself. I find the easiest way to test this is just to use the 'savevm' command to save a state snapshot to a qcow2 disk image while running the old binary, and then run 'loadvm' with the new binary and check it restored OK.
I did not think if this case.
I followed your blog post [*] and tested the migration works OK.
Paolo, now thinking about regular testing, we should add this testing to patchew too. Something like:
Quoted 8 lines
- when mainstream/master is updated, patchew build QEMU (it should be already mostly ccached) and generate some vm dumps with 'savevm'.
- build/test the series
- if series succeeded testing, run 'loadvm' tests
[*] https://translatedcode.wordpress.com/2015/07/06/tricks-for-debugging-qemu-savevm-snapshots/
Avocado certainly already has an option for specifying source and destination qemu separately; I've used that for testing cross version in the past.
The challenge is finding a command line/set of devices for each architecture that's expected to be stable.
You want a command line with as big a set of devices as possible (for coverage) yet really is tied to machine type.Dave
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
PATCH 13/21 hw/cris: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/cris/axis_dev88.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/cris/axis_dev88.c +1 -1
@@ -270,7 +270,7 @@ void axisdev88_init(MachineState *machine) env = &cpu->env;/* allocate RAM */ -memory_region_allocate_system_memory (phys_ram,NULL ,"axisdev88.ram" , +memory_region_allocate_system_memory (phys_ram, machine,"axisdev88.ram" , ram_size);memory_region_add_subregion (address_space_mem,0x40000000 , phys_ram);
Signature · 1 line
2.21.0
Re: [PATCH 13/21] hw/cris: Let the machine be the owner of the system memory
Quoted 4 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/cris/axis_dev88.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Re: [PATCH 13/21] hw/cris: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 21 lines
--- hw/cris/axis_dev88.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/cris/axis_dev88.c +1
-2@@ -270,7 +270,7 @@ void axisdev88_init(MachineState *machine) env = &cpu->env;/* allocate RAM */ -memory_region_allocate_system_memory (phys_ram,NULL ,"axisdev88.ram" , +memory_region_allocate_system_memory (phys_ram, machine,"axisdev88.ram" , ram_size);memory_region_add_subregion (address_space_mem,0x40000000 , phys_ram); --2.21.0
PATCH 14/21 hw/hppa: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/hppa/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/hppa/machine.c +1 -1
@@ -96,7 +96,7 @@ static void machine_hppa_init(MachineState *machine)/* Main memory region. */ ram_region =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram_region,NULL , +memory_region_allocate_system_memory (ram_region, machine,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , ram_region);
Signature · 1 line
2.21.0
Re: [PATCH 14/21] hw/hppa: Let the machine be the owner of the system memory
Quoted 4 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/hppa/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Re: [PATCH 14/21] hw/hppa: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 21 lines
--- hw/hppa/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/hppa/machine.c +1
-2@@ -96,7 +96,7 @@ static void machine_hppa_init(MachineState *machine)/* Main memory region. */ ram_region =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram_region,NULL , +memory_region_allocate_system_memory (ram_region, machine,"ram" , ram_size);memory_region_add_subregion (addr_space,0 , ram_region); --2.21.0
PATCH 15/21 hw/i386: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/pc.c +1 -1
@@ -1655,7 +1655,7 @@ void pc_memory_init(PCMachineState *pcms,* with older qemus that used qemu_ram_alloc(). */ ram =g_malloc (sizeof (*ram)); -memory_region_allocate_system_memory (ram,NULL ,"pc.ram" , +memory_region_allocate_system_memory (ram, machine,"pc.ram" , machine->ram_size); *ram_memory = ram; ram_below_4g =g_malloc (sizeof (*ram_below_4g));
Signature · 1 line
2.21.0
Re: [PATCH 15/21] hw/i386: Let the machine be the owner of the system memory
Quoted 4 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Re: [PATCH 15/21] hw/i386: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 21 lines
--- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/i386/pc.c +1
-2@@ -1655,7 +1655,7 @@ void pc_memory_init(PCMachineState *pcms,* with older qemus that used qemu_ram_alloc(). */ ram =g_malloc (sizeof (*ram)); -memory_region_allocate_system_memory (ram,NULL ,"pc.ram" , +memory_region_allocate_system_memory (ram, machine,"pc.ram" , machine->ram_size); *ram_memory = ram; ram_below_4g =g_malloc (sizeof (*ram_below_4g)); --2.21.0
PATCH 16/21 hw/lm32: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/lm32/lm32_boards.c | 4 ++-- hw/lm32/milkymist.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/lm32/lm32_boards.c +2 -2
@@ -107,7 +107,7 @@ static void lm32_evr_init(MachineState *machine) reset_info->flash_base = flash_base; -memory_region_allocate_system_memory (phys_ram,NULL ,"lm32_evr.sdram" , +memory_region_allocate_system_memory (phys_ram, machine,"lm32_evr.sdram" , ram_size);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);
@@ -200,7 +200,7 @@ static void lm32_uclinux_init(MachineState *machine) reset_info->flash_base = flash_base; -memory_region_allocate_system_memory (phys_ram,NULL , +memory_region_allocate_system_memory (phys_ram, machine,"lm32_uclinux.sdram" , ram_size);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);
hw/lm32/milkymist.c +1 -1
@@ -116,7 +116,7 @@ milkymist_init(MachineState *machine)cpu_lm32_set_phys_msb_ignore (env,1 ); -memory_region_allocate_system_memory (phys_sdram,NULL ,"milkymist.sdram" , +memory_region_allocate_system_memory (phys_sdram, machine,"milkymist.sdram" , sdram_size);memory_region_add_subregion (address_space_mem, sdram_base, phys_sdram);
Signature · 1 line
2.21.0
Re: [PATCH 16/21] hw/lm32: Let the machine be the owner of the system memory
Quoted 5 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/lm32/lm32_boards.c | 4 ++-- hw/lm32/milkymist.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
r~
Re: [PATCH 16/21] hw/lm32: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 44 lines
--- hw/lm32/lm32_boards.c | 4 ++-- hw/lm32/milkymist.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)hw/lm32/lm32_boards.c +2
-2@@ -107,7 +107,7 @@ static void lm32_evr_init(MachineState *machine) reset_info->flash_base = flash_base; -memory_region_allocate_system_memory (phys_ram,NULL ,"lm32_evr.sdram" , +memory_region_allocate_system_memory (phys_ram, machine,"lm32_evr.sdram" , ram_size);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);@@ -200,7 +200,7 @@ static void lm32_uclinux_init(MachineState *machine) reset_info->flash_base = flash_base; -memory_region_allocate_system_memory (phys_ram,NULL , +memory_region_allocate_system_memory (phys_ram, machine,"lm32_uclinux.sdram" , ram_size);memory_region_add_subregion (address_space_mem, ram_base, phys_ram);hw/lm32/milkymist.c +1
-2@@ -116,7 +116,7 @@ milkymist_init(MachineState *machine)cpu_lm32_set_phys_msb_ignore (env,1 ); -memory_region_allocate_system_memory (phys_sdram,NULL ,"milkymist.sdram" , +memory_region_allocate_system_memory (phys_sdram, machine,"milkymist.sdram" , sdram_size);memory_region_add_subregion (address_space_mem, sdram_base, phys_sdram); --2.21.0
PATCH 17/21 hw/m68k: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/m68k/an5206.c | 2 +- hw/m68k/mcf5208.c | 2 +- hw/m68k/next-cube.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
hw/m68k/an5206.c +1 -1
@@ -46,7 +46,7 @@ static void an5206_init(MachineState *machine) env->rambar0 =AN5206_RAMBAR_ADDR |1 ;/* DRAM at address zero */ -memory_region_allocate_system_memory (ram,NULL ,"an5206.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"an5206.ram" , ram_size);memory_region_add_subregion (address_space_mem,0 , ram);/* Internal SRAM. */
hw/m68k/mcf5208.c +1 -1
@@ -248,7 +248,7 @@ static void mcf5208evb_init(MachineState *machine)memory_region_add_subregion (address_space_mem,0x00000000 , rom);/* DRAM at 0x40000000 */ -memory_region_allocate_system_memory (ram,NULL ,"mcf5208.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mcf5208.ram" , ram_size);memory_region_add_subregion (address_space_mem,0x40000000 , ram);/* Internal SRAM. */
hw/m68k/next-cube.c +1 -1
@@ -893,7 +893,7 @@ static void next_cube_init(MachineState *machine)memcpy (ns->rtc.ram, rtc_ram2,32 );/* 64MB RAM starting at 0x04000000 */ -memory_region_allocate_system_memory (ram,NULL ,"next.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"next.ram" , ram_size);memory_region_add_subregion (sysmem,0x04000000 , ram);/* Framebuffer */
Signature · 1 line
2.21.0
Re: [PATCH 17/21] hw/m68k: Let the machine be the owner of the system memory
Quoted 39 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/m68k/an5206.c | 2 +- hw/m68k/mcf5208.c | 2 +- hw/m68k/next-cube.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)hw/m68k/an5206.c +1
-1@@ -46,7 +46,7 @@ static void an5206_init(MachineState *machine) env->rambar0 =AN5206_RAMBAR_ADDR |1 ;/* DRAM at address zero */ -memory_region_allocate_system_memory (ram,NULL ,"an5206.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"an5206.ram" , ram_size);memory_region_add_subregion (address_space_mem,0 , ram);/* Internal SRAM. */ hw/m68k/mcf5208.c +1
-1@@ -248,7 +248,7 @@ static void mcf5208evb_init(MachineState *machine)memory_region_add_subregion (address_space_mem,0x00000000 , rom);/* DRAM at 0x40000000 */ -memory_region_allocate_system_memory (ram,NULL ,"mcf5208.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mcf5208.ram" , ram_size);memory_region_add_subregion (address_space_mem,0x40000000 , ram);/* Internal SRAM. */ hw/m68k/next-cube.c +0
-0
hw/m68k/next-cube.c static void next_cube_init(MachineState *machine) · line 899
Quoted 8 lines
hw/m68k/next-cube.c +1
-1@@ -893,7 +893,7 @@ static void next_cube_init(MachineState *machine)memcpy (ns->rtc.ram, rtc_ram2,32 );/* 64MB RAM starting at 0x04000000 */ -memory_region_allocate_system_memory (ram,NULL ,"next.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"next.ram" , ram_size);memory_region_add_subregion (sysmem,0x04000000 , ram);/* Framebuffer */
Re: [PATCH 17/21] hw/m68k: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/m68k/an5206.c | 2 +- hw/m68k/mcf5208.c | 2 +- hw/m68k/next-cube.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
r~
Re: [PATCH 17/21] hw/m68k: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 49 lines
--- hw/m68k/an5206.c | 2 +- hw/m68k/mcf5208.c | 2 +- hw/m68k/next-cube.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)hw/m68k/an5206.c +1
-1@@ -46,7 +46,7 @@ static void an5206_init(MachineState *machine) env->rambar0 =AN5206_RAMBAR_ADDR |1 ;/* DRAM at address zero */ -memory_region_allocate_system_memory (ram,NULL ,"an5206.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"an5206.ram" , ram_size);memory_region_add_subregion (address_space_mem,0 , ram);/* Internal SRAM. */ hw/m68k/mcf5208.c +1
-1@@ -248,7 +248,7 @@ static void mcf5208evb_init(MachineState *machine)memory_region_add_subregion (address_space_mem,0x00000000 , rom);/* DRAM at 0x40000000 */ -memory_region_allocate_system_memory (ram,NULL ,"mcf5208.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mcf5208.ram" , ram_size);memory_region_add_subregion (address_space_mem,0x40000000 , ram);/* Internal SRAM. */ hw/m68k/next-cube.c +1
-2@@ -893,7 +893,7 @@ static void next_cube_init(MachineState *machine)memcpy (ns->rtc.ram, rtc_ram2,32 );/* 64MB RAM starting at 0x04000000 */ -memory_region_allocate_system_memory (ram,NULL ,"next.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"next.ram" , ram_size);memory_region_add_subregion (sysmem,0x04000000 , ram);/* Framebuffer */ --2.21.0
PATCH 18/21 hw/mips: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/mips/boston.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-)
hw/mips/boston.c +1 -1
@@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine)memory_region_add_subregion_overlap (sys_mem,0x18000000 , flash,0 ); ddr =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ddr,NULL ,"boston.ddr" , +memory_region_allocate_system_memory (ddr, machine,"boston.ddr" , machine->ram_size);memory_region_add_subregion_overlap (sys_mem,0x80000000 , ddr,0 );
hw/mips/mips_fulong2e.c +2 -1
@@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size =256 * MiB;/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"fulong2e.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine, +"fulong2e.ram" , ram_size);memory_region_init_ram (bios,NULL ,"fulong2e.bios" ,BIOS_SIZE , &error_fatal);memory_region_set_readonly (bios, true);
hw/mips/mips_jazz.c +1 -1
@@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed;/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"mips_jazz.ram" , +memory_region_allocate_system_memory (ram, machine,"mips_jazz.ram" , machine->ram_size);memory_region_add_subregion (address_space,0 , ram);
hw/mips/mips_malta.c +1 -1
@@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) }/* register RAM at high address where it is undisturbed by IO */ -memory_region_allocate_system_memory (ram_high,NULL ,"mips_malta.ram" , +memory_region_allocate_system_memory (ram_high, machine,"mips_malta.ram" , ram_size);memory_region_add_subregion (system_memory,0x80000000 , ram_high);
hw/mips/mips_mipssim.c +1 -1
@@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate RAM. */ -memory_region_allocate_system_memory (ram,NULL ,"mips_mipssim.ram" , +memory_region_allocate_system_memory (ram, machine,"mips_mipssim.ram" , ram_size);memory_region_init_ram (bios,NULL ,"mips_mipssim.bios" ,BIOS_SIZE , &error_fatal);
hw/mips/mips_r4k.c +2 -1
@@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB);exit (1 ); } -memory_region_allocate_system_memory (ram,NULL ,"mips_r4k.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mips_r4k.ram" , + ram_size);memory_region_add_subregion (address_space_mem,0 , ram);
Signature · 1 line
2.21.0
Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
Quoted 11 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/boston.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-)
Philippe, can this patch be applied independently (on other patches of this series)?
Thanks,
A.
Quoted 90 lines
hw/mips/boston.c +1
-1@@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine)memory_region_add_subregion_overlap (sys_mem,0x18000000 , flash,0 ); ddr =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ddr,NULL ,"boston.ddr" , +memory_region_allocate_system_memory (ddr, machine,"boston.ddr" , machine->ram_size);memory_region_add_subregion_overlap (sys_mem,0x80000000 , ddr,0 );hw/mips/mips_fulong2e.c +2
-1@@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size =256 * MiB;/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"fulong2e.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine, +"fulong2e.ram" , ram_size);memory_region_init_ram (bios,NULL ,"fulong2e.bios" ,BIOS_SIZE , &error_fatal);memory_region_set_readonly(bios, true);hw/mips/mips_jazz.c +1
-1@@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed;/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"mips_jazz.ram" , +memory_region_allocate_system_memory (ram, machine,"mips_jazz.ram" , machine->ram_size);memory_region_add_subregion (address_space,0 , ram);hw/mips/mips_malta.c +1
-1@@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) }/* register RAM at high address where it is undisturbed by IO */ -memory_region_allocate_system_memory (ram_high,NULL ,"mips_malta.ram" , +memory_region_allocate_system_memory (ram_high, machine,"mips_malta.ram" , ram_size);memory_region_add_subregion(system_memory, 0x80000000, ram_high);hw/mips/mips_mipssim.c +1
-1@@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate RAM. */ -memory_region_allocate_system_memory (ram,NULL ,"mips_mipssim.ram" , +memory_region_allocate_system_memory (ram, machine,"mips_mipssim.ram" , ram_size); memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,&error_fatal);hw/mips/mips_r4k.c +2
-2@@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB);exit (1 ); } -memory_region_allocate_system_memory (ram,NULL ,"mips_r4k.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mips_r4k.ram" , + ram_size);memory_region_add_subregion (address_space_mem,0 , ram); --2.21.0
Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
Hi Aleksandar,
Quoted 16 lines · Aleksandar Markovic
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
Signed-off-by Philippe Mathieu-Daudé <[email protected]<mailto:[email protected]>>
---
hw/mips/boston.c | 2 +-hw/mips/mips_fulong2e.c| 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++-
6 files changed, 8 insertions(+), 6 deletions(-)
Quoted 1 line
Philippe, can this patch be applied independently (on other patches of this series)?
Unfortunately not because patch #9 changed the prototype of memory_region_allocate_system_memory() so this patch alone won't build.
I rather expect this series goes as a whole via the machine-next tree.
Do you mind giving your Acked-by tag to this patch?
Thanks,
Phil.
Quoted 93 lines
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index ca7d813a52..8445fee0f1 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine)
memory_region_add_subregion_overlap(sys_mem, 0x18000000,
flash, 0);
ddr = g_new(MemoryRegion, 1);
- memory_region_allocate_system_memory(ddr, NULL, "boston.ddr",
+ memory_region_allocate_system_memory(ddr, machine, "boston.ddr",
machine->ram_size);
memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index cf537dd7e6..d5a5cef619 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState
*machine)
ram_size = 256 * MiB;
/* allocate RAM */
- memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram",
ram_size);
+ memory_region_allocate_system_memory(ram, machine,
+ "fulong2e.ram", ram_size);
memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE,
&error_fatal);
memory_region_set_readonly(bios, true);
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 8d010a0b6e..88b125855f 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine,
cc->do_transaction_failed = mips_jazz_do_transaction_failed;
/* allocate RAM */
- memory_region_allocate_system_memory(ram, NULL, "mips_jazz.ram",
+ memory_region_allocate_system_memory(ram, machine, "mips_jazz.ram",
machine->ram_size);
memory_region_add_subregion(address_space, 0, ram);
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 4d9c64b36a..af56a29ccb 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine)
}
/* register RAM at high address where it is undisturbed by IO */
- memory_region_allocate_system_memory(ram_high, NULL,
"mips_malta.ram",
+ memory_region_allocate_system_memory(ram_high, machine,
"mips_malta.ram",
ram_size);
memory_region_add_subregion(system_memory, 0x80000000, ram_high);
diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
index 282bbecb24..c1933231e2 100644
--- a/hw/mips/mips_mipssim.c
+++ b/hw/mips/mips_mipssim.c
@@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine)
qemu_register_reset(main_cpu_reset, reset_info);
/* Allocate RAM. */
- memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram",
+ memory_region_allocate_system_memory(ram, machine,
"mips_mipssim.ram",
ram_size);
memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
&error_fatal);
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index bc0be26544..59f8cacfb6 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine)
" maximum 256MB", ram_size / MiB);
exit(1);
}
- memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram",
ram_size);
+ memory_region_allocate_system_memory(ram, machine, "mips_r4k.ram",
+ ram_size);
memory_region_add_subregion(address_space_mem, 0, ram);
--
2.21.0Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
Quoted 25 lines · Philippe Mathieu-Daudé
Hi Aleksandar,
Quoted 17 lines · Aleksandar Markovic
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
Signed-off-by: Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> --- hw/mips/boston.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-)Quoted 3 lines
Philippe, can this patch be applied independently (on other patches of this series)?
Quoted 10 lines
Unfortunately not because patch #9 changed the prototype of
memory_region_allocate_system_memory()so this patch alone won't build.I rather expect this series goes as a whole via the machine-next tree.
Do you mind giving your Acked-by tag to this patch?
I can't, sorry, for MIPS target, we don't accept patches with empty commit messages.
A.
Quoted 104 lines
Thanks,
Phil.
Quoted 99 lines
diff --git a/hw/mips/boston.c b/hw/mips/boston.c index ca7d813a52..8445fee0f1 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine) memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0); ddr = g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ddr, NULL, "boston.ddr", + memory_region_allocate_system_memory(ddr, machine, "boston.ddr", machine->ram_size); memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr,0);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index cf537dd7e6..d5a5cef619 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size = 256 * MiB; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, + "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 8d010a0b6e..88b125855f 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "mips_jazz.ram", + memory_region_allocate_system_memory(ram, machine, "mips_jazz.ram", machine->ram_size); memory_region_add_subregion(address_space, 0, ram); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 4d9c64b36a..af56a29ccb 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) } /* register RAM at high address where it is undisturbed by IO */ - memory_region_allocate_system_memory(ram_high, NULL, "mips_malta.ram", + memory_region_allocate_system_memory(ram_high, machine, "mips_malta.ram", ram_size); memory_region_add_subregion(system_memory, 0x80000000,
ram_high);diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 282bbecb24..c1933231e2 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine) qemu_register_reset(main_cpu_reset, reset_info); /* Allocate RAM. */ - memory_region_allocate_system_memory(ram, NULL,"mips_mipssim.ram",
+ memory_region_allocate_system_memory(ram, machine,
"mips_mipssim.ram",
ram_size);
memory_region_init_ram(bios, NULL, "mips_mipssim.bios",BIOS_SIZE,&error_fatal); diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index bc0be26544..59f8cacfb6 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB); exit(1); } - memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, "mips_r4k.ram", + ram_size); memory_region_add_subregion(address_space_mem, 0, ram); -- 2.21.0
Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
Quoted 35 lines · Aleksandar Markovic
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
Hi Aleksandar,
On 10/21/19 8:25 AM, Aleksandar Markovic wrote:
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote:
Signed-off-by Philippe Mathieu-Daudé <[email protected]<mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>>
---
hw/mips/boston.c | 2 +-hw/mips/mips_fulong2e.c| 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++-
6 files changed, 8 insertions(+), 6 deletions(-)Philippe, can this patch be applied independently (on other patches of this series)?
Unfortunately not because patch #9 changed the prototype of
memory_region_allocate_system_memory()so this patch alone won't build.
Quoted 7 lines
I rather expect this series goes as a whole via the machine-next tree.
Do you mind giving your Acked-by tag to this patch?
I can't, sorry, for MIPS target, we don't accept patches with empty commit messages.
I see, I'v been wondering what to do, if simply repeating the patch subject or the cover, but since the series applies to all targets, this seems overkill. I think I'll simply repeat the subject then.
Quoted 118 lines
A.
Thanks, Phil. diff --git a/hw/mips/boston.c b/hw/mips/boston.c index ca7d813a52..8445fee0f1 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine) memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0); ddr = g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ddr, NULL, "boston.ddr", + memory_region_allocate_system_memory(ddr, machine, "boston.ddr", machine->ram_size); memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index cf537dd7e6..d5a5cef619 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size = 256 * MiB; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, + "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 8d010a0b6e..88b125855f 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "mips_jazz.ram", + memory_region_allocate_system_memory(ram, machine, "mips_jazz.ram", machine->ram_size); memory_region_add_subregion(address_space, 0, ram); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 4d9c64b36a..af56a29ccb 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) } /* register RAM at high address where it is undisturbed by IO */ - memory_region_allocate_system_memory(ram_high, NULL, "mips_malta.ram", + memory_region_allocate_system_memory(ram_high, machine, "mips_malta.ram", ram_size); memory_region_add_subregion(system_memory, 0x80000000, ram_high); diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 282bbecb24..c1933231e2 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine) qemu_register_reset(main_cpu_reset, reset_info); /* Allocate RAM. */ - memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram", + memory_region_allocate_system_memory(ram, machine, "mips_mipssim.ram", ram_size); memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE, &error_fatal); diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index bc0be26544..59f8cacfb6 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB); exit(1); } - memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, "mips_r4k.ram", + ram_size); memory_region_add_subregion(address_space_mem, 0, ram); -- 2.21.0
Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
Quoted 44 lines · Philippe Mathieu-Daudé
Quoted 42 lines · Aleksandar Markovic
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
Hi Aleksandar,
On 10/21/19 8:25 AM, Aleksandar Markovic wrote:
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote:
Signed-off-by Philippe Mathieu-Daudé <[email protected]<mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>>
---
hw/mips/boston.c| 2 +-
hw/mips/mips_fulong2e.c| 3 ++-
hw/mips/mips_jazz.c| 2 +-
hw/mips/mips_malta.c| 2 +-
hw/mips/mips_mipssim.c| 2 +-
hw/mips/mips_r4k.c| 3 ++-
6 files changed, 8 insertions(+), 6 deletions(-)Philippe, can this patch be applied independently (on other patches of this series)?
Unfortunately not because patch #9 changed the prototype of
memory_region_allocate_system_memory()so this patch alone won't build.I rather expect this series goes as a whole via the machine-next tree.
Do you mind giving your Acked-by tag to this patch?
Quoted 9 lines
Quoted 3 lines
I can't, sorry, for MIPS target, we don't accept patches with empty commit messages.
I see, I'v been wondering what to do, if simply repeating the patch subject or the cover, but since the series applies to all targets, this seems overkill. I think I'll simply repeat the subject then.
Can't you at least add a sentence on why is this needed, or what is achieved?
Thanks,
A.
Quoted 125 lines
Quoted 125 lines
A.
Thanks, Phil. diff --git a/hw/mips/boston.c b/hw/mips/boston.c index ca7d813a52..8445fee0f1 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine) memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0); ddr = g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ddr, NULL, "boston.ddr", + memory_region_allocate_system_memory(ddr, machine, "boston.ddr",machine->ram_size); memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index cf537dd7e6..d5a5cef619 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size = 256 * MiB; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, + "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 8d010a0b6e..88b125855f 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "mips_jazz.ram", + memory_region_allocate_system_memory(ram, machine, "mips_jazz.ram",machine->ram_size); memory_region_add_subregion(address_space, 0, ram); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 4d9c64b36a..af56a29ccb 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) } /* register RAM at high address where it is undisturbed by IO */ - memory_region_allocate_system_memory(ram_high, NULL, "mips_malta.ram", + memory_region_allocate_system_memory(ram_high, machine, "mips_malta.ram", ram_size); memory_region_add_subregion(system_memory, 0x80000000, ram_high); diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 282bbecb24..c1933231e2 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine) qemu_register_reset(main_cpu_reset, reset_info); /* Allocate RAM. */ - memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram", + memory_region_allocate_system_memory(ram, machine, "mips_mipssim.ram", ram_size); memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE, &error_fatal); diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index bc0be26544..59f8cacfb6 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB); exit(1); } - memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, "mips_r4k.ram", + ram_size); memory_region_add_subregion(address_space_mem, 0,ram);
-- 2.21.0
Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
Quoted 57 lines · Aleksandar Markovic
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
On 10/21/19 12:56 PM, Aleksandar Markovic wrote:
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote:
Hi Aleksandar,
On 10/21/19 8:25 AM, Aleksandar Markovic wrote:
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>
<mailto:[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>>> wrote:Signed-off-by: Philippe Mathieu-Daudé
<[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>> <mailto:[email protected]
<mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>>>
---
hw/mips/boston.c | 2 +-hw/mips/mips_fulong2e.c| 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++-
6 files changed, 8 insertions(+), 6 deletions(-)Philippe, can this patch be applied independently (on other patches of this series)?
Unfortunately not because patch #9 changed the prototype of
memory_region_allocate_system_memory()so this patch alone won't build.I rather expect this series goes as a whole via the
machine-next
tree.Do you mind giving your Acked-by tag to this patch?
I can't, sorry, for MIPS target, we don't accept patches with empty commit messages.
Quoted 6 lines
I see, I'v been wondering what to do, if simply repeating the patch subject or the cover, but since the series applies to all targets, this seems overkill. I think I'll simply repeat the subject then.
Can't you at least add a sentence on why is this needed, or what is achieved?
You are alright, I'll do.
Quoted 146 lines
Thanks,
A.
A. Thanks, Phil. diff --git a/hw/mips/boston.c b/hw/mips/boston.c index ca7d813a52..8445fee0f1 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine) memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0); ddr = g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ddr, NULL, "boston.ddr", + memory_region_allocate_system_memory(ddr, machine, "boston.ddr", machine->ram_size); memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index cf537dd7e6..d5a5cef619 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size = 256 * MiB; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, + "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 8d010a0b6e..88b125855f 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "mips_jazz.ram", + memory_region_allocate_system_memory(ram, machine, "mips_jazz.ram", machine->ram_size); memory_region_add_subregion(address_space, 0, ram); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 4d9c64b36a..af56a29ccb 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) } /* register RAM at high address where it is undisturbed by IO */ - memory_region_allocate_system_memory(ram_high, NULL, "mips_malta.ram", + memory_region_allocate_system_memory(ram_high, machine, "mips_malta.ram", ram_size); memory_region_add_subregion(system_memory, 0x80000000, ram_high); diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 282bbecb24..c1933231e2 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine) qemu_register_reset(main_cpu_reset, reset_info); /* Allocate RAM. */ - memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram", + memory_region_allocate_system_memory(ram, machine, "mips_mipssim.ram", ram_size); memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE, &error_fatal); diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index bc0be26544..59f8cacfb6 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB); exit(1); } - memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, "mips_r4k.ram", + ram_size); memory_region_add_subregion(address_space_mem, 0, ram); -- 2.21.0
Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
Quoted 66 lines · Philippe Mathieu-Daudé
Quoted 64 lines · Aleksandar Markovic
On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:
On 10/21/19 12:56 PM, Aleksandar Markovic wrote: On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote: Hi Aleksandar, On 10/21/19 8:25 AM, Aleksandar Markovic wrote: On Monday, October 21, 2019, Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>> <mailto:[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>>> wrote: Signed-off-by: Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>> <mailto:[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>>> --- hw/mips/boston.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-) Philippe, can this patch be applied independently (onother
patches of this series)?Unfortunately not because patch #9 changed the prototype of
memory_region_allocate_system_memory()so this patch alone won't build.I rather expect this series goes as a whole via the
machine-next
tree.Do you mind giving your Acked-by tag to this patch?
I can't, sorry, for MIPS target, we don't accept patches with empty commit messages.
I see, I'v been wondering what to do, if simply repeating the patch subject or the cover, but since the series applies to all targets, this seems overkill. I think I'll simply repeat the subject then.
Quoted 5 lines
Quoted 3 lines
Can't you at least add a sentence on why is this needed, or what is achieved?
You are alright, I'll do.
Cool, I'd appreciate it very much.
A.
Quoted 157 lines
Quoted 157 lines
Thanks,
A.
A. Thanks, Phil. diff --git a/hw/mips/boston.c b/hw/mips/boston.c index ca7d813a52..8445fee0f1 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine) memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0); ddr = g_new(MemoryRegion, 1); - memory_region_allocate_system_memory(ddr, NULL, "boston.ddr", + memory_region_allocate_system_memory(ddr, machine, "boston.ddr",machine->ram_size); memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index cf537dd7e6..d5a5cef619 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size = 256 * MiB; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, + "fulong2e.ram", ram_size); memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); memory_region_set_readonly(bios, true); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 8d010a0b6e..88b125855f 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed; /* allocate RAM */ - memory_region_allocate_system_memory(ram, NULL, "mips_jazz.ram", + memory_region_allocate_system_memory(ram, machine, "mips_jazz.ram",machine->ram_size); memory_region_add_subregion(address_space, 0, ram); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 4d9c64b36a..af56a29ccb 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) } /* register RAM at high address where it is undisturbed by IO */ - memory_region_allocate_system_memory(ram_high,NULL,
"mips_malta.ram",
+ memory_region_allocate_system_memory(ram_high,
machine,"mips_malta.ram",ram_size); memory_region_add_subregion(system_memory, 0x80000000, ram_high); diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 282bbecb24..c1933231e2 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine) qemu_register_reset(main_cpu_reset,
reset_info);/* Allocate RAM. */
- memory_region_allocate_system_memory(ram,
NULL,"mips_mipssim.ram", + memory_region_allocate_system_memory(ram, machine, "mips_mipssim.ram",ram_size); memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE, &error_fatal); diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index bc0be26544..59f8cacfb6 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB); exit(1); } - memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size); + memory_region_allocate_system_memory(ram, machine, "mips_r4k.ram", + ram_size); memory_region_add_subregion(address_space_mem,0, ram);
-- 2.21.0
Re: [EXTERNAL][PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 9 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/boston.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-)
When the commit message is completed:
________________________________________
From: Philippe Mathieu-Daudé <[email protected]>
Sent: Monday, October 21, 2019 12:56 AM
To: Paolo Bonzini; Igor Mammedov; [email protected]; Markus Armbruster; Eduardo Habkost
Cc: Thomas Huth; Antony Pavlov; Michael Walle; David Gibson; [email protected]; KONRAD Frederic; Cédric Le Goater; Fabien Chouteau; Andrey Smirnov; Joel Stanley; Peter Chubb; Andrew Jeffery; Helge Deller; Aurelien Jarno; Jean-Christophe Dubois; Jan Kiszka; Paul Burton; [email protected]; Hervé Poussineau; Andrew Baumann; Mark Cave-Ayland; Beniamino Galvani; Artyom Tarasenko; Edgar E. Iglesias; Leif Lindholm; Aleksandar Markovic; Michael S. Tsirkin; Radoslaw Biernacki; Rob Herring; Richard Henderson; Alistair Francis; Andrzej Zaborowski; Marcel Apfelbaum; Philippe Mathieu-Daudé; Aleksandar Rikalo; Peter Maydell
Subject: [EXTERNAL][PATCH 18/21] hw/mips: Let the machine be the owner of the system memory
--- hw/mips/boston.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_mipssim.c | 2 +- hw/mips/mips_r4k.c | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-)
hw/mips/boston.c +1 -1
@@ -474,7 +474,7 @@ static void boston_mach_init(MachineState *machine)memory_region_add_subregion_overlap (sys_mem,0x18000000 , flash,0 ); ddr =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ddr,NULL ,"boston.ddr" , +memory_region_allocate_system_memory (ddr, machine,"boston.ddr" , machine->ram_size);memory_region_add_subregion_overlap (sys_mem,0x80000000 , ddr,0 );
hw/mips/mips_fulong2e.c +2 -1
@@ -318,7 +318,8 @@ static void mips_fulong2e_init(MachineState *machine) ram_size =256 * MiB;/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"fulong2e.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine, +"fulong2e.ram" , ram_size);memory_region_init_ram (bios,NULL ,"fulong2e.bios" ,BIOS_SIZE , &error_fatal);memory_region_set_readonly (bios, true);
hw/mips/mips_jazz.c +1 -1
@@ -188,7 +188,7 @@ static void mips_jazz_init(MachineState *machine, cc->do_transaction_failed = mips_jazz_do_transaction_failed;/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"mips_jazz.ram" , +memory_region_allocate_system_memory (ram, machine,"mips_jazz.ram" , machine->ram_size);memory_region_add_subregion (address_space,0 , ram);
hw/mips/mips_malta.c +1 -1
@@ -1267,7 +1267,7 @@ void mips_malta_init(MachineState *machine) }/* register RAM at high address where it is undisturbed by IO */ -memory_region_allocate_system_memory (ram_high,NULL ,"mips_malta.ram" , +memory_region_allocate_system_memory (ram_high, machine,"mips_malta.ram" , ram_size);memory_region_add_subregion (system_memory,0x80000000 , ram_high);
hw/mips/mips_mipssim.c +1 -1
@@ -166,7 +166,7 @@ mips_mipssim_init(MachineState *machine)qemu_register_reset (main_cpu_reset, reset_info);/* Allocate RAM. */ -memory_region_allocate_system_memory (ram,NULL ,"mips_mipssim.ram" , +memory_region_allocate_system_memory (ram, machine,"mips_mipssim.ram" , ram_size);memory_region_init_ram (bios,NULL ,"mips_mipssim.bios" ,BIOS_SIZE , &error_fatal);
hw/mips/mips_r4k.c +2 -1
@@ -203,7 +203,8 @@ void mips_r4k_init(MachineState *machine) " maximum 256MB", ram_size / MiB);exit (1 ); } -memory_region_allocate_system_memory (ram,NULL ,"mips_r4k.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mips_r4k.ram" , + ram_size);memory_region_add_subregion (address_space_mem,0 , ram);
--
2.21.0
PATCH 19/21 hw/ppc: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/ppc/e500.c | 3 ++- hw/ppc/mac_newworld.c | 3 ++- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pnv.c | 2 +- hw/ppc/ppc405_boards.c | 6 +++--- hw/ppc/prep.c | 3 ++- hw/ppc/spapr.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- 8 files changed, 13 insertions(+), 10 deletions(-)
hw/ppc/e500.c +2 -1
@@ -912,7 +912,8 @@ void ppce500_init(MachineState *machine) machine->ram_size = ram_size;/* Register Memory */ -memory_region_allocate_system_memory (ram,NULL ,"mpc8544ds.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mpc8544ds.ram" , + ram_size);memory_region_add_subregion (address_space_mem,0 , ram); dev =qdev_create (NULL ,"e500-ccsr" );
hw/ppc/mac_newworld.c +2 -1
@@ -152,7 +152,8 @@ static void ppc_core99_init(MachineState *machine) }/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"ppc_core99.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"ppc_core99.ram" , + ram_size);memory_region_add_subregion (get_system_memory (),0 , ram);/* allocate and load BIOS */
hw/ppc/mac_oldworld.c +1 -1
@@ -127,7 +127,7 @@ static void ppc_heathrow_init(MachineState *machine)exit (1 ); } -memory_region_allocate_system_memory (ram,NULL ,"ppc_heathrow.ram" , +memory_region_allocate_system_memory (ram, machine,"ppc_heathrow.ram" , ram_size);memory_region_add_subregion (sysmem,0 , ram);
hw/ppc/pnv.c +1 -1
@@ -640,7 +640,7 @@ static void pnv_init(MachineState *machine) } ram =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram,NULL ,"pnv.ram" , +memory_region_allocate_system_memory (ram, machine,"pnv.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),0 , ram);
hw/ppc/ppc405_boards.c +3 -3
@@ -162,8 +162,8 @@ static void ref405ep_init(MachineState *machine)MemoryRegion *sysmem =get_system_memory ();/* XXX: fix this */ -memory_region_allocate_system_memory (&ram_memories[0 ],NULL ,"ef405ep.ram" , -0x08000000 ); +memory_region_allocate_system_memory (&ram_memories[0 ], machine, +"ef405ep.ram" ,128 * MiB); ram_bases[0 ] =0 ; ram_sizes[0 ] =0x08000000 ;memory_region_init (&ram_memories[1 ],NULL ,"ef405ep.ram1" ,0 );
@@ -427,7 +427,7 @@ static void taihu_405ep_init(MachineState *machine)/* RAM is soldered to the board so the size cannot be changed */ ram_size =0x08000000 ; -memory_region_allocate_system_memory (ram,NULL ,"taihu_405ep.ram" , +memory_region_allocate_system_memory (ram, machine,"taihu_405ep.ram" , ram_size); ram_bases[0 ] =0 ;
hw/ppc/prep.c +2 -1
@@ -445,7 +445,8 @@ static void ppc_prep_init(MachineState *machine) }/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"ppc_prep.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"ppc_prep.ram" , + ram_size);memory_region_add_subregion (sysmem,0 , ram);if (linux_boot) {
hw/ppc/spapr.c +1 -1
@@ -2840,7 +2840,7 @@ static void spapr_machine_init(MachineState *machine) }/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"ppc_spapr.ram" , +memory_region_allocate_system_memory (ram, machine,"ppc_spapr.ram" , machine->ram_size);memory_region_add_subregion (sysmem,0 , ram);
hw/ppc/virtex_ml507.c +1 -1
@@ -224,7 +224,7 @@ static void virtex_init(MachineState *machine)qemu_register_reset (main_cpu_reset, cpu); -memory_region_allocate_system_memory (phys_ram,NULL ,"ram" , ram_size); +memory_region_allocate_system_memory (phys_ram, machine,"ram" , ram_size);memory_region_add_subregion (address_space_mem, ram_base, phys_ram); dinfo =drive_get (IF_PFLASH ,0 ,0 );
Signature · 1 line
2.21.0
Re: [PATCH 19/21] hw/ppc: Let the machine be the owner of the system memory
Quoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 129 lines
--- hw/ppc/e500.c | 3 ++- hw/ppc/mac_newworld.c | 3 ++- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pnv.c | 2 +- hw/ppc/ppc405_boards.c | 6 +++--- hw/ppc/prep.c | 3 ++- hw/ppc/spapr.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- 8 files changed, 13 insertions(+), 10 deletions(-)hw/ppc/e500.c +2
-1@@ -912,7 +912,8 @@ void ppce500_init(MachineState *machine) machine->ram_size = ram_size;/* Register Memory */ -memory_region_allocate_system_memory (ram,NULL ,"mpc8544ds.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"mpc8544ds.ram" , + ram_size);memory_region_add_subregion (address_space_mem,0 , ram); dev =qdev_create (NULL ,"e500-ccsr" );hw/ppc/mac_newworld.c +2
-1@@ -152,7 +152,8 @@ static void ppc_core99_init(MachineState *machine) }/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"ppc_core99.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"ppc_core99.ram" , + ram_size);memory_region_add_subregion (get_system_memory (),0 , ram);/* allocate and load BIOS */ hw/ppc/mac_oldworld.c +1
-1@@ -127,7 +127,7 @@ static void ppc_heathrow_init(MachineState *machine)exit (1 ); } -memory_region_allocate_system_memory (ram,NULL ,"ppc_heathrow.ram" , +memory_region_allocate_system_memory (ram, machine,"ppc_heathrow.ram" , ram_size);memory_region_add_subregion (sysmem,0 , ram);hw/ppc/pnv.c +1
-1@@ -640,7 +640,7 @@ static void pnv_init(MachineState *machine) } ram =g_new (MemoryRegion,1 ); -memory_region_allocate_system_memory (ram,NULL ,"pnv.ram" , +memory_region_allocate_system_memory (ram, machine,"pnv.ram" , machine->ram_size);memory_region_add_subregion (get_system_memory (),0 , ram);hw/ppc/ppc405_boards.c +3
-3@@ -162,8 +162,8 @@ static void ref405ep_init(MachineState *machine)MemoryRegion *sysmem =get_system_memory ();/* XXX: fix this */ -memory_region_allocate_system_memory (&ram_memories[0 ],NULL ,"ef405ep.ram" , -0x08000000 ); +memory_region_allocate_system_memory (&ram_memories[0 ], machine, +"ef405ep.ram" ,128 * MiB); ram_bases[0 ] =0 ; ram_sizes[0 ] =0x08000000 ;memory_region_init (&ram_memories[1 ],NULL ,"ef405ep.ram1" ,0 );@@ -427,7 +427,7 @@ static void taihu_405ep_init(MachineState *machine)/* RAM is soldered to the board so the size cannot be changed */ ram_size =0x08000000 ; -memory_region_allocate_system_memory (ram,NULL ,"taihu_405ep.ram" , +memory_region_allocate_system_memory (ram, machine,"taihu_405ep.ram" , ram_size); ram_bases[0 ] =0 ;hw/ppc/prep.c +2
-1@@ -445,7 +445,8 @@ static void ppc_prep_init(MachineState *machine) }/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"ppc_prep.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"ppc_prep.ram" , + ram_size);memory_region_add_subregion (sysmem,0 , ram);if (linux_boot) {hw/ppc/spapr.c +1
-1@@ -2840,7 +2840,7 @@ static void spapr_machine_init(MachineState *machine) }/* allocate RAM */ -memory_region_allocate_system_memory (ram,NULL ,"ppc_spapr.ram" , +memory_region_allocate_system_memory (ram, machine,"ppc_spapr.ram" , machine->ram_size);memory_region_add_subregion (sysmem,0 , ram);hw/ppc/virtex_ml507.c +1
-1@@ -224,7 +224,7 @@ static void virtex_init(MachineState *machine)qemu_register_reset (main_cpu_reset, cpu); -memory_region_allocate_system_memory (phys_ram,NULL ,"ram" , ram_size); +memory_region_allocate_system_memory (phys_ram, machine,"ram" , ram_size);memory_region_add_subregion (address_space_mem, ram_base, phys_ram); dinfo =drive_get (IF_PFLASH ,0 ,0 );
Signature · 4 lines
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
Re: [PATCH 19/21] hw/ppc: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/ppc/e500.c | 3 ++- hw/ppc/mac_newworld.c | 3 ++- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/pnv.c | 2 +- hw/ppc/ppc405_boards.c | 6 +++--- hw/ppc/prep.c | 3 ++- hw/ppc/spapr.c | 2 +- hw/ppc/virtex_ml507.c | 2 +- 8 files changed, 13 insertions(+), 10 deletions(-)
r~
PATCH 20/21 hw/sparc: Let the machine be the owner of the system memory
In reply to Philippe Mathieu-Daudé--- hw/sparc/leon3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/sparc/leon3.c +1 -1
@@ -244,7 +244,7 @@ static void leon3_generic_hw_init(MachineState *machine)exit (1 ); } -memory_region_allocate_system_memory (ram,NULL ,"leon3.ram" , ram_size); +memory_region_allocate_system_memory (ram, machine,"leon3.ram" , ram_size);memory_region_add_subregion (address_space_mem,LEON3_RAM_OFFSET , ram);/* Allocate BIOS */
Signature · 1 line
2.21.0
Re: [PATCH 20/21] hw/sparc: Let the machine be the owner of the system memory
Quoted 4 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/sparc/leon3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 21/21 hw/core: Assert memory_region_allocate_system_memory has machine owner
In reply to Philippe Mathieu-DaudéAll the memory_region_allocate_system_memory() pass a MachineState argument. Add an assertion to ensure the new boards/machines added set this argument, so all system memory object have the machine as its QOM owner.
--- hw/core/numa.c | 4 +--- include/hw/boards.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
hw/core/numa.c +1 -3
@@ -527,9 +527,7 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, MachineState *ms,uint64_t addr =0 ;int i; -if (!ms) { - ms =MACHINE (qdev_get_machine ()); - } +g_assert (ms);if (ms->numa_state ==NULL || ms->numa_state->num_nodes ==0 || !have_memdevs) {
include/hw/boards.h +1 -1
@@ -14,7 +14,7 @@/** * memory_region_allocate_system_memory - Allocate a board's main memory * @mr: the #MemoryRegion to be initialized -* @ms: the #MachineState object that own the system memory +* @ms: the #MachineState object that own the system memory (must not be NULL) * @name: name of the memory region * @ram_size: size of the region in bytes *
Signature · 1 line
2.21.0
Re: [PATCH 21/21] hw/core: Assert memory_region_allocate_system_memory has machine owner
Quoted 10 lines · Philippe Mathieu-Daudé
All the
memory_region_allocate_system_memory()pass a MachineState argument. Add an assertion to ensure the new boards/machines added set this argument, so all system memory object have the machine as its QOM owner.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/core/numa.c | 4 +--- include/hw/boards.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
It would be a good idea to add __attribute__((nonnull(x,y,z))) as well, but since we don't currently have any markup for that in qemu, that can go in a separate patch set.
r~
Re: [PATCH 21/21] hw/core: Assert memory_region_allocate_system_memory has machine owner
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
All the
memory_region_allocate_system_memory()pass a MachineState argument. Add an assertion to ensure the new boards/machines added set this argument, so all system memory object have the machine as its QOM owner.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Alistair
Quoted 37 lines
--- hw/core/numa.c | 4 +--- include/hw/boards.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)hw/core/numa.c +1
-3@@ -527,9 +527,7 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, MachineState *ms,uint64_t addr =0 ;int i; -if (!ms) { - ms =MACHINE (qdev_get_machine ()); - } +g_assert (ms);if (ms->numa_state ==NULL || ms->numa_state->num_nodes ==0 || !have_memdevs) {include/hw/boards.h +1
-2@@ -14,7 +14,7 @@/** * memory_region_allocate_system_memory - Allocate a board's main memory * @mr: the #MemoryRegion to be initialized -* @ms: the #MachineState object that own the system memory +* @ms: the #MachineState object that own the system memory (must not be NULL) * @name: name of the memory region * @ram_size: size of the region in bytes * -- 2.21.0
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [PATCH 00/21] hw: Let the machine be the owner of the system memory
Type: series
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Switched to a new branch 'test'
23b4e9a hw/core: Assert memory_region_allocate_system_memory has machine owner 67caaf0 hw/sparc: Let the machine be the owner of the system memory 9610d69 hw/ppc: Let the machine be the owner of the system memory 3cf0c55 hw/mips: Let the machine be the owner of the system memory c6cd486 hw/m68k: Let the machine be the owner of the system memory dd8e9a6 hw/lm32: Let the machine be the owner of the system memory c7b9ccd hw/i386: Let the machine be the owner of the system memory 655182f hw/hppa: Let the machine be the owner of the system memory 20dc622 hw/cris: Let the machine be the owner of the system memory fc3c6d2 hw/arm: Let the machine be the owner of the system memory e9f1ebc hw/alpha: Let the machine be the owner of the system memory 3ef111b hw/core: Let the machine be the owner of the system memory 31bd838 hw: Let memory_region_allocate_system_memory take MachineState argument dae9d11 hw/alpha/dp264: Create the RAM in the board
c31eba0 hw: Drop QOM ownership on memory_region_allocate_system_memory() calls 728aa65 hw/arm/digic4: Inline digic4_board_setup_ram() function c2a9052 hw/arm/omap1: Create the RAM in the board
4f4977f hw/arm/omap2: Create the RAM in the board
d1959b2 hw/arm/collie: Create the RAM in the board
815f5c1 hw/arm/mps2: Use the IEC binary prefix definitions
103190f hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
=== OUTPUT BEGIN ===
1/21 Checking commit 103190fd9b28 (hw/arm/xilinx_zynq: Use the IEC binary prefix definitions) 2/21 Checking commit 815f5c166924 (hw/arm/mps2: Use the IEC binary prefix definitions) 3/21 Checking commit d1959b2d3e49 (hw/arm/collie: Create the RAM in the board)
4/21 Checking commit 4f4977fa8205 (hw/arm/omap2: Create the RAM in the board)
5/21 Checking commit c2a90524bd33 (hw/arm/omap1: Create the RAM in the board)
6/21 Checking commit 728aa65672f4 (hw/arm/digic4: Inline digic4_board_setup_ram() function) 7/21 Checking commit c31eba0d025b (hw: Drop QOM ownership on memory_region_allocate_system_memory() calls) 8/21 Checking commit dae9d111acb1 (hw/alpha/dp264: Create the RAM in the board)
ERROR: spaces required around that '*' (ctx:WxV)
#24: FILE: hw/alpha/alpha_sys.h:13:
+PCIBus *typhoon_init(ISABus **, qemu_irq *, AlphaCPU *[4],
^
total: 1 errors, 0 warnings, 59 lines checked
Patch 8/21 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
9/21 Checking commit 31bd838d2d79 (hw: Let memory_region_allocate_system_memory take MachineState argument) 10/21 Checking commit 3ef111b6a62a (hw/core: Let the machine be the owner of the system memory) 11/21 Checking commit e9f1ebcb1624 (hw/alpha: Let the machine be the owner of the system memory) 12/21 Checking commit fc3c6d23b63f (hw/arm: Let the machine be the owner of the system memory) 13/21 Checking commit 20dc622c1df3 (hw/cris: Let the machine be the owner of the system memory) 14/21 Checking commit 655182f6e74a (hw/hppa: Let the machine be the owner of the system memory) 15/21 Checking commit c7b9ccda7442 (hw/i386: Let the machine be the owner of the system memory) 16/21 Checking commit dd8e9a66c1f0 (hw/lm32: Let the machine be the owner of the system memory) 17/21 Checking commit c6cd4866d6a0 (hw/m68k: Let the machine be the owner of the system memory) 18/21 Checking commit 3cf0c55fcc1b (hw/mips: Let the machine be the owner of the system memory) 19/21 Checking commit 9610d6908cbc (hw/ppc: Let the machine be the owner of the system memory) 20/21 Checking commit 67caaf05019b (hw/sparc: Let the machine be the owner of the system memory) 21/21 Checking commit 23b4e9a52318 (hw/core: Assert memory_region_allocate_system_memory has machine owner) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 48 lines · Philippe Mathieu-Daudé
Hi,
This series is based on Igor's "eliminate remaining places that abuse
memory_region_allocate_system_memory()":
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg01601.htmlIt is quite simple, we enforce all machines to be the QOM owner of the system memory.
This changes the memory tree from:
(qemu) info mtree -o
memory-region: pc.ram0000000000000000-0000000007ffffff (prio 0, ram): pc.ram parent:{obj path=/machine/unattached}to:
(qemu) info mtree -o
memory-region: pc.ram0000000000000000-0000000007ffffff (prio 0, ram): pc.ram owner:{obj path=/machine}Few patches are required to clean the codebase first, to unify the creation of the system memory in the board/machine code. Mostly some old ARM machines (pre-QOM) were affected.
Please review (as a generic codebase cleanup).
Regards,
Phil.
Based-on: <[email protected]>
Philippe Mathieu-Daudé (21):
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: Inlinedigic4_board_setup_ram()function
hw: Drop QOM ownership onmemory_region_allocate_system_memory()calls hw/alpha/dp264: Create the RAM in the board
hw: Letmemory_region_allocate_system_memorytake MachineState
argument
hw/core: Let the machine be the owner of the system memory hw/alpha: Let the machine be the owner of the system memory hw/arm: Let the machine be the owner of the system memory hw/cris: Let the machine be the owner of the system memory
Quoted 8 lines
hw/hppa: Let the machine be the owner of the system memory hw/i386: Let the machine be the owner of the system memory hw/lm32: Let the machine be the owner of the system memory hw/m68k: Let the machine be the owner of the system memory hw/mips: Let the machine be the owner of the system memory hw/ppc: Let the machine be the owner of the system memory hw/sparc: Let the machine be the owner of the system memory hw/core: Assert
memory_region_allocate_system_memoryhas machine owner
I forgot 4 other calls:
hw/ppc/ppc4xx_devs.c:708: memory_region_allocate_system_memory(ram, NULL, "ppc4xx.sdram", ram_size);hw/s390x/s390-virtio-ccw.c:164: memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size);hw/sparc/sun4m.c:791: memory_region_allocate_system_memory(&d->ram, NULL, "sun4m.ram",hw/sparc64/niagara.c:114: memory_region_allocate_system_memory(&s->partition_ram, NULL,
Hi Peter,
Quoted 58 lines · Philippe Mathieu-Daudé
Quoted 48 lines · Philippe Mathieu-Daudé
Hi,
This series is based on Igor's "eliminate remaining places that abuse
memory_region_allocate_system_memory()":
https://lists.gnu.org/archive/html/qemu-devel/2019-10/msg01601.htmlIt is quite simple, we enforce all machines to be the QOM owner of the system memory.
This changes the memory tree from:
(qemu) info mtree -o
memory-region: pc.ram
0000000000000000-0000000007ffffff (prio 0, ram): pc.ram parent:{obj path=/machine/unattached}to:
(qemu) info mtree -o
memory-region: pc.ram
0000000000000000-0000000007ffffff (prio 0, ram): pc.ram owner:{obj path=/machine}Few patches are required to clean the codebase first, to unify the creation of the system memory in the board/machine code. Mostly some old ARM machines (pre-QOM) were affected.
Please review (as a generic codebase cleanup).
Regards,
Phil.
Based-on: <[email protected]>
Philippe Mathieu-Daudé (21):
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: Inlinedigic4_board_setup_ram()function
hw: Drop QOM ownership onmemory_region_allocate_system_memory()calls hw/alpha/dp264: Create the RAM in the board
hw: Letmemory_region_allocate_system_memorytake MachineState argument
hw/core: Let the machine be the owner of the system memory hw/alpha: Let the machine be the owner of the system memory hw/arm: Let the machine be the owner of the system memory hw/cris: Let the machine be the owner of the system memoryQuoted 8 lines
hw/hppa: Let the machine be the owner of the system memory hw/i386: Let the machine be the owner of the system memory hw/lm32: Let the machine be the owner of the system memory hw/m68k: Let the machine be the owner of the system memory hw/mips: Let the machine be the owner of the system memory hw/ppc: Let the machine be the owner of the system memory hw/sparc: Let the machine be the owner of the system memory hw/core: Assert
memory_region_allocate_system_memoryhas machine owner
Quoted 6 lines
I forgot 4 other calls:
hw/ppc/ppc4xx_devs.c:708:
memory_region_allocate_system_memory(ram, NULL, "ppc4xx.sdram", ram_size);hw/s390x/s390-virtio-ccw.c:164:memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size); hw/sparc/sun4m.c:791: memory_region_allocate_system_memory(&d->ram, NULL, "sun4m.ram",hw/sparc64/niagara.c:114: memory_region_allocate_system_memory(&s->partition_ram, NULL,
I'll need to respin this series because of this omission, but
- hw/ppc requires more cleanup patches as ARM has,
- hw/sparc is blocked until Igor sent his "convert memory_region_allocate_system_memory() to memdev" series.
I don't plan to rework on the ARM cleanups patches (1-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
Maybe you can take them directly in arm-next once they are reviewed, then the rest can go via machine-next.
Thanks,
Phil.