hw/cpu/arm: Remove one use of qemu_get_cpu() in A7/A15 MPCore priv
Subsystems (6)
cover hw/cpu/arm: Remove one use of qemu_get_cpu() in A7/A15 MPCore priv
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
This eventually allow removing one qemu_get_cpu() use, which we want to remove in heterogeneous machines (machines using MPCore are candidate for heterogeneous emulation).
Maybe these hw/cpu/arm/ files belong to hw/arm/...
Regards,
Phil.
Philippe Mathieu-Daudé (33):
hw/arm/boot: Propagate vCPU to arm_load_dtb() hw/arm/fsl-imx6: Add a local 'gic' variable hw/arm/fsl-imx6ul: Add a local 'gic' variable hw/arm/fsl-imx7: Add a local 'gic' variable
hw/cpu: Remove dead Kconfig
hw/cpu/arm: Rename 'busdev' -> 'gicsbd' in a15mp_priv_realize() hw/cpu/arm: Alias 'num-cpu' property on TYPE_REALVIEW_MPCORE hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro hw/cpu/arm: Merge {a9mpcore.h, a15mpcore.h} as cortex_mpcore.h hw/cpu/arm: Introduce abstract CORTEX_MPCORE_PRIV QOM type hw/cpu/arm: Have A9MPCORE/A15MPCORE inheritate common
CORTEX_MPCORE_PRIV
hw/cpu/arm: Create MPCore container in QOM parent hw/cpu/arm: Handle 'num_cores' property once in MPCore parent hw/cpu/arm: Handle 'has_el2/3' properties once in MPCore parent hw/cpu/arm: Handle 'gic-irq' property once in MPCore parent hw/cpu/arm: Handle GIC once in MPCore parent
hw/cpu/arm: Document more properties of CORTEX_MPCORE_PRIV QOM type hw/cpu/arm: Replace A15MPPrivState by CortexMPPrivState hw/cpu/arm: Introduce TYPE_A7MPCORE_PRIV for Cortex-A7 MPCore hw/cpu/arm: Consolidate check on max GIC spi supported hw/cpu/arm: Create CPUs once in MPCore parent hw/arm/aspeed_ast2600: Let the A7MPcore create/wire the CPU cores hw/arm/exynos4210: Let the A9MPcore create/wire the CPU cores hw/arm/fsl-imx6: Let the A9MPcore create/wire the CPU cores hw/arm/fsl-imx6ul: Let the A7MPcore create/wire the CPU cores hw/arm/fsl-imx7: Let the A7MPcore create/wire the CPU cores hw/arm/highbank: Let the A9/A15MPcore create/wire the CPU cores hw/arm/vexpress: Let the A9/A15MPcore create/wire the CPU cores hw/arm/xilinx_zynq: Let the A9MPcore create/wire the CPU cores hw/arm/npcm7xx: Let the A9MPcore create/wire the CPU cores hw/cpu/a9mpcore: Remove legacy code
hw/cpu/arm: Remove 'num-cpu' property alias
hw/cpu/arm: Remove use of qemu_get_cpu() in A7/A15 realize()
MAINTAINERS | 3 +- include/hw/arm/aspeed_soc.h | 5 +- include/hw/arm/boot.h | 4 +- include/hw/arm/exynos4210.h | 6 +- include/hw/arm/fsl-imx6.h | 6 +- include/hw/arm/fsl-imx6ul.h | 8 +- include/hw/arm/fsl-imx7.h | 8 +- include/hw/arm/npcm7xx.h | 3 +- include/hw/cpu/a15mpcore.h | 44 ------- include/hw/cpu/a9mpcore.h | 39 ------- include/hw/cpu/cortex_mpcore.h | 135 ++++++++++++++++++++++ hw/arm/aspeed_ast2600.c | 61 ++++------ hw/arm/boot.c | 11 +- hw/arm/exynos4210.c | 60 ++++------ hw/arm/exynos4_boards.c | 6 +- hw/arm/fsl-imx6.c | 84 ++++---------- hw/arm/fsl-imx6ul.c | 65 ++++------- hw/arm/fsl-imx7.c | 103 +++++------------ hw/arm/highbank.c | 56 ++------- hw/arm/mcimx6ul-evk.c | 3 +- hw/arm/mcimx7d-sabre.c | 3 +- hw/arm/npcm7xx.c | 48 ++------ hw/arm/realview.c | 4 +- hw/arm/sabrelite.c | 4 +- hw/arm/vexpress.c | 60 +++------- hw/arm/virt.c | 2 +- hw/arm/xilinx_zynq.c | 30 ++--- hw/cpu/a15mpcore.c | 179 +++++++++++++---------------- hw/cpu/a9mpcore.c | 138 +++++++++------------- hw/cpu/arm11mpcore.c | 23 ++-- hw/cpu/cortex_mpcore.c | 202 +++++++++++++++++++++++++++++++++ hw/cpu/realview_mpcore.c | 30 ++--- hw/arm/Kconfig | 8 +- hw/cpu/Kconfig | 8 -- hw/cpu/meson.build | 1 + 35 files changed, 689 insertions(+), 761 deletions(-) delete mode 100644 include/hw/cpu/a15mpcore.h delete mode 100644 include/hw/cpu/a9mpcore.h create mode 100644 include/hw/cpu/cortex_mpcore.h create mode 100644 hw/cpu/cortex_mpcore.c delete mode 100644 hw/cpu/Kconfig
Signature · 1 line
2.41.0
PATCH 1/33 hw/arm/boot: Propagate vCPU to arm_load_dtb()
In heterogeneous setup the first vCPU might not be the one expected, better pass it explicitly.
--- include/hw/arm/boot.h | 4 +++- hw/arm/boot.c | 11 ++++++----- hw/arm/virt.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-)
include/hw/arm/boot.h +3 -1
@@ -160,6 +160,7 @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu,* @binfo: struct describing the boot environment * @addr_limit: upper limit of the available memory area at @addr * @as: address space to load image to +* @cpu: ARM CPU object * * Load a device tree supplied by the machine or by the user with the * '-dtb' command line option, and put it at offset @addr in target
@@ -176,7 +177,8 @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu,* Note: Must not be called unless have_dtb(binfo) is true. */ int arm_load_dtb (hwaddr addr,const struct arm_boot_info *binfo, -hwaddr addr_limit,AddressSpace *as,MachineState *ms); +hwaddr addr_limit,AddressSpace *as,MachineState *ms, +ARMCPU *cpu);/* Write a secure board setup routine with a dummy handler for SMCs */ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
hw/arm/boot.c +6 -5
@@ -432,13 +432,12 @@ out:return ret; } -static void fdt_add_psci_node (void *fdt) +static void fdt_add_psci_node (void *fdt,ARMCPU *armcpu) {uint32_t cpu_suspend_fn;uint32_t cpu_off_fn;uint32_t cpu_on_fn;uint32_t migrate_fn; -ARMCPU *armcpu =ARM_CPU (qemu_get_cpu (0 ));const char *psci_method;int64_t psci_conduit;int rc;
@@ -512,7 +511,8 @@ static void fdt_add_psci_node(void *fdt) }int arm_load_dtb (hwaddr addr,const struct arm_boot_info *binfo, -hwaddr addr_limit,AddressSpace *as,MachineState *ms) +hwaddr addr_limit,AddressSpace *as,MachineState *ms, +ARMCPU *cpu) {void *fdt =NULL ;int size, rc, n =0 ;
@@ -655,7 +655,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, } } -fdt_add_psci_node (fdt); +fdt_add_psci_node (fdt, cpu);if (binfo->modify_dtb) { binfo->modify_dtb (binfo, fdt);
@@ -1321,7 +1321,8 @@ void arm_load_kernel(ARMCPU *cpu, MachineState *ms, struct arm_boot_info *info)* decided whether to enable PSCI and set the psci-conduit CPU properties. */ if (!info->skip_dtb_autoload &&have_dtb (info)) { -if (arm_load_dtb (info->dtb_start, info, info->dtb_limit, as, ms) <0 ) { +if (arm_load_dtb (info->dtb_start, info, info->dtb_limit, + as, ms, cpu) <0 ) {exit (1 ); } }
hw/arm/virt.c +1 -1
@@ -1678,7 +1678,7 @@ void virt_machine_done(Notifier *notifier, void *data) vms->memmap[VIRT_PLATFORM_BUS ].size, vms->irqmap[VIRT_PLATFORM_BUS]); } -if (arm_load_dtb (info->dtb_start, info, info->dtb_limit, as, ms) <0 ) { +if (arm_load_dtb (info->dtb_start, info, info->dtb_limit, as, ms, cpu) <0 ) {exit (1 ); }
Signature · 1 line
2.41.0
Re: [PATCH 01/33] hw/arm/boot: Propagate vCPU to arm_load_dtb()
Quoted 4 lines · Philippe Mathieu-Daudé
In heterogeneous setup the first vCPU might not be the one expected, better pass it explicitly.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 2/33 hw/arm/fsl-imx6: Add a local 'gic' variable
In reply to Philippe Mathieu-DaudéThe A9MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable.
--- hw/arm/fsl-imx6.c | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-)
hw/arm/fsl-imx6.c +13 -24
@@ -111,6 +111,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)uint16_t i;Error *err =NULL ;unsigned int smp_cpus = ms->smp.cpus; +DeviceState *gic =DEVICE (&s->a9mpcore);if (smp_cpus >FSL_IMX6_NUM_CPUS ) { error_setg(errp, "%s: Only %d CPUs are supported (%d requested)",
@@ -186,8 +187,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->uart[i]),0 , serial_table[i].addr);sysbus_connect_irq (SYS_BUS_DEVICE (&s->uart[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - serial_table[i].irq)); +qdev_get_gpio_in (gic, serial_table[i].irq)); } s->gpt.ccm =IMX_CCM (&s->ccm);
@@ -198,8 +198,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->gpt),0 ,FSL_IMX6_GPT_ADDR );sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpt),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), -FSL_IMX6_GPT_IRQ )); +qdev_get_gpio_in (gic,FSL_IMX6_GPT_IRQ ));/* Initialize all EPIT timers */ for (i =0 ; i <FSL_IMX6_NUM_EPITS ; i++) {
@@ -219,8 +218,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->epit[i]),0 , epit_table[i].addr);sysbus_connect_irq (SYS_BUS_DEVICE (&s->epit[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - epit_table[i].irq)); +qdev_get_gpio_in (gic, epit_table[i].irq)); }/* Initialize all I2C */
@@ -240,8 +238,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->i2c[i]),0 , i2c_table[i].addr);sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - i2c_table[i].irq)); +qdev_get_gpio_in (gic, i2c_table[i].irq)); }/* Initialize all GPIOs */
@@ -298,11 +295,9 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->gpio[i]),0 , gpio_table[i].addr);sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - gpio_table[i].irq_low)); +qdev_get_gpio_in (gic, gpio_table[i].irq_low));sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio[i]),1 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - gpio_table[i].irq_high)); +qdev_get_gpio_in (gic, gpio_table[i].irq_high)); }/* Initialize all SDHC */
@@ -329,8 +324,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) }sysbus_mmio_map (SYS_BUS_DEVICE (&s->esdhc[i]),0 , esdhc_table[i].addr);sysbus_connect_irq (SYS_BUS_DEVICE (&s->esdhc[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - esdhc_table[i].irq)); +qdev_get_gpio_in (gic, esdhc_table[i].irq)); }/* USB */
@@ -351,8 +345,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->usb[i]),0 ,FSL_IMX6_USBOH3_USB_ADDR + i *0x200 );sysbus_connect_irq (SYS_BUS_DEVICE (&s->usb[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - FSL_IMX6_USBn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6_USBn_IRQ[i])); }/* Initialize all ECSPI */
@@ -375,8 +368,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->spi[i]),0 , spi_table[i].addr);sysbus_connect_irq (SYS_BUS_DEVICE (&s->spi[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - spi_table[i].irq)); +qdev_get_gpio_in (gic, spi_table[i].irq)); } object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num,
@@ -387,11 +379,9 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) }sysbus_mmio_map (SYS_BUS_DEVICE (&s->eth),0 ,FSL_IMX6_ENET_ADDR );sysbus_connect_irq (SYS_BUS_DEVICE (&s->eth),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), -FSL_IMX6_ENET_MAC_IRQ )); +qdev_get_gpio_in (gic,FSL_IMX6_ENET_MAC_IRQ ));sysbus_connect_irq (SYS_BUS_DEVICE (&s->eth),1 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), -FSL_IMX6_ENET_MAC_1588_IRQ )); +qdev_get_gpio_in (gic,FSL_IMX6_ENET_MAC_1588_IRQ ));/* * SNVS
@@ -418,8 +408,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->wdt[i]),0 , FSL_IMX6_WDOGn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->wdt[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a9mpcore), - FSL_IMX6_WDOGn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6_WDOGn_IRQ[i])); }/* ROM memory */
Signature · 1 line
2.41.0
Re: [PATCH 02/33] hw/arm/fsl-imx6: Add a local 'gic' variable
Quoted 4 lines · Philippe Mathieu-Daudé
The A9MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 3/33 hw/arm/fsl-imx6ul: Add a local 'gic' variable
In reply to Philippe Mathieu-DaudéThe A7MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable.
--- hw/arm/fsl-imx6ul.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-)
hw/arm/fsl-imx6ul.c +14 -24
@@ -156,6 +156,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) {MachineState *ms =MACHINE (qdev_get_machine ());FslIMX6ULState *s =FSL_IMX6UL (dev); +DeviceState *gic;int i;char name[NAME_SIZE ];SysBusDevice *sbd;
@@ -177,6 +178,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL, &error_abort);sysbus_realize (SYS_BUS_DEVICE (&s->a7mpcore), &error_abort);sysbus_mmio_map (SYS_BUS_DEVICE (&s->a7mpcore),0 ,FSL_IMX6UL_A7MPCORE_ADDR ); + gic =DEVICE (&s->a7mpcore); sbd =SYS_BUS_DEVICE (&s->a7mpcore); d =DEVICE (&s->cpu);
@@ -213,8 +215,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_GPTn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpt[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_GPTn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_GPTn_IRQ[i])); }/*
@@ -238,8 +239,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_EPITn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->epit[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_EPITn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_EPITn_IRQ[i])); }/*
@@ -276,12 +276,10 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_GPIOn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_GPIOn_LOW_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_GPIOn_LOW_IRQ[i]));sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio[i]),1 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_GPIOn_HIGH_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_GPIOn_HIGH_IRQ[i])); }/*
@@ -335,8 +333,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_SPIn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->spi[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_SPIn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_SPIn_IRQ[i])); }/*
@@ -361,8 +358,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->i2c[i]),0 , FSL_IMX6UL_I2Cn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_I2Cn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_I2Cn_IRQ[i])); }/*
@@ -399,8 +395,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_UARTn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->uart[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_UARTn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_UARTn_IRQ[i])); }/*
@@ -449,12 +444,10 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_ENETn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->eth[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_ENETn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_ENETn_IRQ[i]));sysbus_connect_irq (SYS_BUS_DEVICE (&s->eth[i]),1 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_ENETn_TIMER_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_ENETn_TIMER_IRQ[i])); }/*
@@ -490,8 +483,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->usb[i]),0 , FSL_IMX6UL_USB02_USBn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->usb[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_USBn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_USBn_IRQ[i])); }/*
@@ -516,8 +508,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_USDHCn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->usdhc[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_USDHCn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_USDHCn_IRQ[i])); }/*
@@ -549,8 +540,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->wdt[i]),0 , FSL_IMX6UL_WDOGn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->wdt[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX6UL_WDOGn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX6UL_WDOGn_IRQ[i])); }/*
Signature · 1 line
2.41.0
Re: [PATCH 03/33] hw/arm/fsl-imx6ul: Add a local 'gic' variable
Quoted 4 lines · Philippe Mathieu-Daudé
The A7MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 4/33 hw/arm/fsl-imx7: Add a local 'gic' variable
In reply to Philippe Mathieu-DaudéThe A7MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable.
--- hw/arm/fsl-imx7.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-)
hw/arm/fsl-imx7.c +17 -21
@@ -163,6 +163,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) {MachineState *ms =MACHINE (qdev_get_machine ());FslIMX7State *s =FSL_IMX7 (dev); +DeviceState *gic;Object *o;int i;qemu_irq irq;
@@ -209,6 +210,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_realize (SYS_BUS_DEVICE (&s->a7mpcore), &error_abort);sysbus_mmio_map (SYS_BUS_DEVICE (&s->a7mpcore),0 ,FSL_IMX7_A7MPCORE_ADDR ); + gic =DEVICE (&s->a7mpcore);for (i =0 ; i < smp_cpus; i++) {SysBusDevice *sbd =SYS_BUS_DEVICE (&s->a7mpcore);
@@ -252,8 +254,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_realize (SYS_BUS_DEVICE (&s->gpt[i]), &error_abort);sysbus_mmio_map (SYS_BUS_DEVICE (&s->gpt[i]),0 , FSL_IMX7_GPTn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpt[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX7_GPTn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX7_GPTn_IRQ[i])); }/*
@@ -295,12 +296,10 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) FSL_IMX7_GPIOn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX7_GPIOn_LOW_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX7_GPIOn_LOW_IRQ[i]));sysbus_connect_irq (SYS_BUS_DEVICE (&s->gpio[i]),1 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX7_GPIOn_HIGH_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX7_GPIOn_HIGH_IRQ[i])); }/*
@@ -352,8 +351,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->spi[i]),0 , FSL_IMX7_SPIn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->spi[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX7_SPIn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX7_SPIn_IRQ[i])); }/*
@@ -378,8 +376,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->i2c[i]),0 , FSL_IMX7_I2Cn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX7_I2Cn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX7_I2Cn_IRQ[i])); }/*
@@ -413,7 +410,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->uart[i]),0 , FSL_IMX7_UARTn_ADDR[i]); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore), FSL_IMX7_UARTn_IRQ[i]); + irq =qdev_get_gpio_in (gic, FSL_IMX7_UARTn_IRQ[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->uart[i]),0 , irq); }
@@ -451,9 +448,9 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->eth[i]),0 , FSL_IMX7_ENETn_ADDR[i]); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore),FSL_IMX7_ENET_IRQ (i,0 )); + irq =qdev_get_gpio_in (gic,FSL_IMX7_ENET_IRQ (i,0 ));sysbus_connect_irq (SYS_BUS_DEVICE (&s->eth[i]),0 , irq); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore),FSL_IMX7_ENET_IRQ (i,3 )); + irq =qdev_get_gpio_in (gic,FSL_IMX7_ENET_IRQ (i,3 ));sysbus_connect_irq (SYS_BUS_DEVICE (&s->eth[i]),1 , irq); }
@@ -480,7 +477,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->usdhc[i]),0 , FSL_IMX7_USDHCn_ADDR[i]); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore), FSL_IMX7_USDHCn_IRQ[i]); + irq =qdev_get_gpio_in (gic, FSL_IMX7_USDHCn_IRQ[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->usdhc[i]),0 , irq); }
@@ -519,8 +516,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->wdt[i]),0 , FSL_IMX7_WDOGn_ADDR[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->wdt[i]),0 , -qdev_get_gpio_in (DEVICE (&s->a7mpcore), - FSL_IMX7_WDOGn_IRQ[i])); +qdev_get_gpio_in (gic, FSL_IMX7_WDOGn_IRQ[i])); }/*
@@ -596,13 +592,13 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_realize (SYS_BUS_DEVICE (&s->pcie), &error_abort);sysbus_mmio_map (SYS_BUS_DEVICE (&s->pcie),0 ,FSL_IMX7_PCIE_REG_ADDR ); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore),FSL_IMX7_PCI_INTA_IRQ ); + irq =qdev_get_gpio_in (gic,FSL_IMX7_PCI_INTA_IRQ );sysbus_connect_irq (SYS_BUS_DEVICE (&s->pcie),0 , irq); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore),FSL_IMX7_PCI_INTB_IRQ ); + irq =qdev_get_gpio_in (gic,FSL_IMX7_PCI_INTB_IRQ );sysbus_connect_irq (SYS_BUS_DEVICE (&s->pcie),1 , irq); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore),FSL_IMX7_PCI_INTC_IRQ ); + irq =qdev_get_gpio_in (gic,FSL_IMX7_PCI_INTC_IRQ );sysbus_connect_irq (SYS_BUS_DEVICE (&s->pcie),2 , irq); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore),FSL_IMX7_PCI_INTD_IRQ ); + irq =qdev_get_gpio_in (gic,FSL_IMX7_PCI_INTD_IRQ );sysbus_connect_irq (SYS_BUS_DEVICE (&s->pcie),3 , irq);/*
@@ -631,7 +627,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->usb[i]),0 , FSL_IMX7_USBn_ADDR[i]); - irq =qdev_get_gpio_in (DEVICE (&s->a7mpcore), FSL_IMX7_USBn_IRQ[i]); + irq =qdev_get_gpio_in (gic, FSL_IMX7_USBn_IRQ[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->usb[i]),0 , irq);snprintf (name,NAME_SIZE ,"usbmisc%d" , i);
Signature · 1 line
2.41.0
Re: [PATCH 04/33] hw/arm/fsl-imx7: Add a local 'gic' variable
Quoted 4 lines · Philippe Mathieu-Daudé
The A7MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 5/33 hw/cpu: Remove dead Kconfig
In reply to Philippe Mathieu-DaudéARM MPCore Kconfig are defined in hw/arm/Kconfig. hw/cpu/Kconfig is never used, remove it.
--- hw/cpu/Kconfig | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 hw/cpu/Kconfig
hw/cpu/Kconfig deleted +0 -8
@@ -1,8 +0,0 @@ -config ARM11MPCORE - bool - -config A9MPCORE - bool - -config A15MPCORE - bool
Signature · 1 line
2.41.0
Re: [PATCH 05/33] hw/cpu: Remove dead Kconfig
Quoted 5 lines · Philippe Mathieu-Daudé
ARM MPCore
Kconfigare defined in hw/arm/Kconfig.
hw/cpu/Kconfig is never used, remove it.Fixes 82f5181777 ("kconfig: introduce kconfig files")Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 6/33 hw/cpu/arm: Rename 'busdev' -> 'gicsbd' in a15mp_priv_realize()
In reply to Philippe Mathieu-Daudé'busdev' is the internal GIC as SysBus device.
Since we already have a 'gicdev' variable for the GIC as QDev, rename 'busdev' as 'gicsbd' to make it clear we access the IRQ lines from the GIC.
--- hw/cpu/a15mpcore.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
hw/cpu/a15mpcore.c +8 -8
@@ -51,7 +51,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A15MPPrivState *s =A15MPCORE_PRIV (dev);DeviceState *gicdev; -SysBusDevice *busdev; +SysBusDevice *gicsbd;int i;bool has_el3;bool has_el2 = false;
@@ -78,10 +78,10 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)if (!sysbus_realize (SYS_BUS_DEVICE (&s->gic), errp)) {return ; } - busdev =SYS_BUS_DEVICE (&s->gic); + gicsbd =SYS_BUS_DEVICE (&s->gic);/* Pass through outbound IRQ lines from the GIC */ -sysbus_pass_irq (sbd, busdev); +sysbus_pass_irq (sbd, gicsbd);/* Pass through inbound GPIO lines to the GIC */ qdev_init_gpio_in (dev, a15mp_priv_set_irq, s->num_irq -32 );
@@ -126,17 +126,17 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)* 0x6000-0x7fff -- GIC virtual CPU interface */ memory_region_add_subregion (&s->container,0x1000 , -sysbus_mmio_get_region (busdev,0 )); +sysbus_mmio_get_region (gicsbd,0 ));memory_region_add_subregion (&s->container,0x2000 , -sysbus_mmio_get_region (busdev,1 )); +sysbus_mmio_get_region (gicsbd,1 ));if (has_el2) {memory_region_add_subregion (&s->container,0x4000 , -sysbus_mmio_get_region (busdev,2 )); +sysbus_mmio_get_region (gicsbd,2 ));memory_region_add_subregion (&s->container,0x6000 , -sysbus_mmio_get_region (busdev,3 )); +sysbus_mmio_get_region (gicsbd,3 ));for (i =0 ; i < s->num_cpu; i++) {hwaddr base =0x5000 + i *0x200 ; -MemoryRegion *mr =sysbus_mmio_get_region (busdev, +MemoryRegion *mr =sysbus_mmio_get_region (gicsbd,4 + s->num_cpu + i);memory_region_add_subregion (&s->container, base, mr); }
Signature · 1 line
2.41.0
Re: [PATCH 06/33] hw/cpu/arm: Rename 'busdev' -> 'gicsbd' in a15mp_priv_realize()
Quoted 6 lines · Philippe Mathieu-Daudé
'busdev' is the internal GIC as SysBus device.
Since we already have a 'gicdev' variable for the GIC as QDev, rename 'busdev' as 'gicsbd' to make it clear we access the IRQ lines from the GIC.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 7/33 hw/cpu/arm: Alias 'num-cpu' property on TYPE_REALVIEW_MPCORE
In reply to Philippe Mathieu-DaudéNo need to duplicate and forward the 'num-cpu' property from TYPE_ARM11MPCORE_PRIV to TYPE_REALVIEW_MPCORE, alias it with QOM object_property_add_alias().
--- hw/cpu/realview_mpcore.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
hw/cpu/realview_mpcore.c +1 -8
@@ -14,7 +14,6 @@#include "hw/cpu/arm11mpcore.h" #include "hw/intc/realview_gic.h" #include "hw/irq.h" -#include "hw/qdev-properties.h" #include "qom/object.h" #define TYPE_REALVIEW_MPCORE_RIRQ "realview_mpcore"
@@ -68,7 +67,6 @@ static void realview_mpcore_realize(DeviceState *dev, Error **errp)int n;int i; -qdev_prop_set_uint32 (priv,"num-cpu" , s->num_cpu);if (!sysbus_realize (SYS_BUS_DEVICE (&s->priv), errp)) {return ; }
@@ -100,6 +98,7 @@ static void mpcore_rirq_init(Object *obj)int i;object_initialize_child (obj,"a11priv" , &s->priv,TYPE_ARM11MPCORE_PRIV ); +object_property_add_alias (obj,"num-cpu" ,OBJECT (&s->priv),"num-cpu" ); privbusdev =SYS_BUS_DEVICE (&s->priv);sysbus_init_mmio (sbd,sysbus_mmio_get_region (privbusdev,0 ));
@@ -108,17 +107,11 @@ static void mpcore_rirq_init(Object *obj) } } -static Property mpcore_rirq_properties[] = { -DEFINE_PROP_UINT32 ("num-cpu" , mpcore_rirq_state, num_cpu,1 ), -DEFINE_PROP_END_OF_LIST (), -}; -static void mpcore_rirq_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); dc->realize = realview_mpcore_realize; -device_class_set_props (dc, mpcore_rirq_properties); }static const TypeInfo mpcore_rirq_info = {
Signature · 1 line
2.41.0
Re: [PATCH 07/33] hw/cpu/arm: Alias 'num-cpu' property on TYPE_REALVIEW_MPCORE
Quoted 5 lines · Philippe Mathieu-Daudé
No need to duplicate and forward the 'num-cpu' property from
TYPE_ARM11MPCORE_PRIVtoTYPE_REALVIEW_MPCORE, alias it with QOMobject_property_add_alias().Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 8/33 hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro
In reply to Philippe Mathieu-DaudéWhen multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review.
--- hw/cpu/a15mpcore.c | 21 +++++++++------------ hw/cpu/a9mpcore.c | 21 +++++++++------------ hw/cpu/arm11mpcore.c | 21 +++++++++------------ hw/cpu/realview_mpcore.c | 21 +++++++++------------ 4 files changed, 36 insertions(+), 48 deletions(-)
hw/cpu/a15mpcore.c +9 -12
@@ -164,17 +164,14 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data)/* We currently have no saveable state */ } -static const TypeInfo a15mp_priv_info = { - .name =TYPE_A15MPCORE_PRIV , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (A15MPPrivState), - .instance_init = a15mp_priv_initfn, - .class_init = a15mp_priv_class_init, +static const TypeInfo a15mp_types[] = { + { + .name =TYPE_A15MPCORE_PRIV , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (A15MPPrivState), + .instance_init = a15mp_priv_initfn, + .class_init = a15mp_priv_class_init, + }, }; -static void a15mp_register_types (void ) -{ -type_register_static (&a15mp_priv_info); -} - -type_init (a15mp_register_types) +DEFINE_TYPES (a15mp_types)
hw/cpu/a9mpcore.c +9 -12
@@ -178,17 +178,14 @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data)device_class_set_props (dc, a9mp_priv_properties); } -static const TypeInfo a9mp_priv_info = { - .name =TYPE_A9MPCORE_PRIV , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (A9MPPrivState), - .instance_init = a9mp_priv_initfn, - .class_init = a9mp_priv_class_init, +static const TypeInfo a9mp_types[] = { + { + .name =TYPE_A9MPCORE_PRIV , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (A9MPPrivState), + .instance_init = a9mp_priv_initfn, + .class_init = a9mp_priv_class_init, + }, }; -static void a9mp_register_types (void ) -{ -type_register_static (&a9mp_priv_info); -} - -type_init (a9mp_register_types) +DEFINE_TYPES (a9mp_types)
hw/cpu/arm11mpcore.c +9 -12
@@ -153,17 +153,14 @@ static void mpcore_priv_class_init(ObjectClass *klass, void *data)device_class_set_props (dc, mpcore_priv_properties); } -static const TypeInfo mpcore_priv_info = { - .name =TYPE_ARM11MPCORE_PRIV , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (ARM11MPCorePriveState), - .instance_init = mpcore_priv_initfn, - .class_init = mpcore_priv_class_init, +static const TypeInfo arm11mp_types[] = { + { + .name =TYPE_ARM11MPCORE_PRIV , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (ARM11MPCorePriveState), + .instance_init = mpcore_priv_initfn, + .class_init = mpcore_priv_class_init, + }, }; -static void arm11mpcore_register_types (void ) -{ -type_register_static (&mpcore_priv_info); -} - -type_init (arm11mpcore_register_types) +DEFINE_TYPES (arm11mp_types)
hw/cpu/realview_mpcore.c +9 -12
@@ -114,17 +114,14 @@ static void mpcore_rirq_class_init(ObjectClass *klass, void *data) dc->realize = realview_mpcore_realize; } -static const TypeInfo mpcore_rirq_info = { - .name =TYPE_REALVIEW_MPCORE_RIRQ , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (mpcore_rirq_state), - .instance_init = mpcore_rirq_init, - .class_init = mpcore_rirq_class_init, +static const TypeInfo realview_mpcore_types[] = { + { + .name =TYPE_REALVIEW_MPCORE_RIRQ , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (mpcore_rirq_state), + .instance_init = mpcore_rirq_init, + .class_init = mpcore_rirq_class_init, + }, }; -static void realview_mpcore_register_types (void ) -{ -type_register_static (&mpcore_rirq_info); -} - -type_init (realview_mpcore_register_types) +DEFINE_TYPES (realview_mpcore_types)
Signature · 1 line
2.41.0
Re: [PATCH 08/33] hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro
Quoted 6 lines · Philippe Mathieu-Daudé
When multiple QOM types are registered in the same file, it is simpler to use the the
DEFINE_TYPES()macro. In particular because type array declared with such macro are easier to review.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 9/33 hw/cpu/arm: Merge {a9mpcore.h, a15mpcore.h} as cortex_mpcore.h
In reply to Philippe Mathieu-DaudéMerge Cortex-A{9,15} MPCore devices in the same header.
---
MAINTAINERS | 3 +-
include/hw/arm/aspeed_soc.h | 2 +-
include/hw/arm/exynos4210.h | 2 +-
include/hw/arm/fsl-imx6.h | 2 +-
include/hw/arm/fsl-imx6ul.h | 2 +-
include/hw/arm/fsl-imx7.h | 2 +-
include/hw/arm/npcm7xx.h | 2 +-
include/hw/cpu/a15mpcore.h | 44 -------------------
.../hw/cpu/{a9mpcore.h => cortex_mpcore.h} | 29 ++++++++----
hw/arm/exynos4210.c | 2 +-
hw/arm/highbank.c | 3 +-
hw/arm/realview.c | 2 +-
hw/arm/vexpress.c | 3 +-
hw/arm/xilinx_zynq.c | 2 +-
hw/cpu/a15mpcore.c | 2 +-
hw/cpu/a9mpcore.c | 2 +-
16 files changed, 35 insertions(+), 69 deletions(-)
delete mode 100644 include/hw/cpu/a15mpcore.h
rename include/hw/cpu/{a9mpcore.h => cortex_mpcore.h} (57%)MAINTAINERS +2 -1
@@ -203,7 +203,8 @@ F: tests/tcg/aarch64/ F: tests/qtest/arm-cpu-features.c F: hw/arm/ F: hw/cpu/a*mpcore.c -F: include/hw/cpu/a*mpcore.h +F: include/hw/cpu/arm11mpcore.h +F: include/hw/cpu/cortex_mpcore.h F: docs/system/target-arm.rst F: docs/system/arm/cpu-features.rst
include/hw/arm/aspeed_soc.h +1 -1
@@ -12,7 +12,7 @@#ifndef ASPEED_SOC_H #define ASPEED_SOC_H -#include "hw/cpu/a15mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/arm/armv7m.h" #include "hw/intc/aspeed_vic.h" #include "hw/misc/aspeed_scu.h"
include/hw/arm/exynos4210.h +1 -1
@@ -26,7 +26,7 @@#include "hw/or-irq.h" #include "hw/sysbus.h" -#include "hw/cpu/a9mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/intc/exynos4210_gic.h" #include "hw/intc/exynos4210_combiner.h" #include "hw/core/split-irq.h"
include/hw/arm/fsl-imx6.h +1 -1
@@ -17,7 +17,7 @@#ifndef FSL_IMX6_H #define FSL_IMX6_H -#include "hw/cpu/a9mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/misc/imx6_ccm.h" #include "hw/misc/imx6_src.h" #include "hw/misc/imx7_snvs.h"
include/hw/arm/fsl-imx6ul.h +1 -1
@@ -17,7 +17,7 @@#ifndef FSL_IMX6UL_H #define FSL_IMX6UL_H -#include "hw/cpu/a15mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/misc/imx6ul_ccm.h" #include "hw/misc/imx6_src.h" #include "hw/misc/imx7_snvs.h"
include/hw/arm/fsl-imx7.h +1 -1
@@ -19,7 +19,7 @@#ifndef FSL_IMX7_H #define FSL_IMX7_H -#include "hw/cpu/a15mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/intc/imx_gpcv2.h" #include "hw/misc/imx7_ccm.h" #include "hw/misc/imx7_snvs.h"
include/hw/arm/npcm7xx.h +1 -1
@@ -19,7 +19,7 @@#include "hw/boards.h" #include "hw/adc/npcm7xx_adc.h" #include "hw/core/split-irq.h" -#include "hw/cpu/a9mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/gpio/npcm7xx_gpio.h" #include "hw/i2c/npcm7xx_smbus.h" #include "hw/mem/npcm7xx_mc.h"
include/hw/cpu/a15mpcore.h deleted +0 -44
44 lines not on this page · raw message
include/hw/cpu/cortex_mpcore.h renamed from include/hw/cpu/a9mpcore.h +20 -9
@@ -1,29 +1,27 @@/* -* Cortex-A9MPCore internal peripheral emulation. +* Cortex-MPCore internal peripheral emulation. * * Copyright (c) 2009 CodeSourcery. -* Copyright (c) 2011 Linaro Limited. +* Copyright (c) 2011, 2012, 2023 Linaro Limited. * Written by Paul Brook, Peter Maydell. * -* This code is licensed under the GPL. +* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef HW_CPU_A9MPCORE_H -#define HW_CPU_A9MPCORE_H +#ifndef HW_CPU_CORTEX_MPCORE_H +#define HW_CPU_CORTEX_MPCORE_H +#include "qom/object.h" #include "hw/sysbus.h" #include "hw/intc/arm_gic.h" #include "hw/misc/a9scu.h" -#include "hw/timer/arm_mptimer.h" #include "hw/timer/a9gtimer.h" -#include "qom/object.h" +#include "hw/timer/arm_mptimer.h" #define TYPE_A9MPCORE_PRIV "a9mpcore_priv" OBJECT_DECLARE_SIMPLE_TYPE(A9MPPrivState, A9MPCORE_PRIV) struct A9MPPrivState { - /*< private >*/ SysBusDevice parent_obj; - /*< public >*/ uint32_t num_cpu; MemoryRegion container;
@@ -36,4 +34,17 @@ struct A9MPPrivState {ARMMPTimerState wdt; }; +#define TYPE_A15MPCORE_PRIV "a15mpcore_priv" +OBJECT_DECLARE_SIMPLE_TYPE(A15MPPrivState, A15MPCORE_PRIV) + +struct A15MPPrivState { +SysBusDevice parent_obj; + +uint32_t num_cpu; +uint32_t num_irq; +MemoryRegion container; + +GICState gic; +}; +#endif
hw/arm/exynos4210.c +1 -1
@@ -24,7 +24,7 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "cpu.h" -#include "hw/cpu/a9mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/irq.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h"
hw/arm/highbank.c +1 -2
@@ -31,8 +31,7 @@#include "qemu/error-report.h" #include "hw/char/pl011.h" #include "hw/ide/ahci.h" -#include "hw/cpu/a9mpcore.h" -#include "hw/cpu/a15mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "qemu/log.h" #include "qom/object.h" #include "cpu.h"
hw/arm/realview.c +1 -1
@@ -24,7 +24,7 @@#include "hw/i2c/i2c.h" #include "qemu/error-report.h" #include "hw/char/pl011.h" -#include "hw/cpu/a9mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/intc/realview_gic.h" #include "hw/irq.h" #include "hw/i2c/arm_sbcon_i2c.h"
hw/arm/vexpress.c +1 -2
@@ -39,8 +39,7 @@#include "qemu/error-report.h" #include <libfdt.h> #include "hw/char/pl011.h" -#include "hw/cpu/a9mpcore.h" -#include "hw/cpu/a15mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/i2c/arm_sbcon_i2c.h" #include "hw/sd/sd.h" #include "qapi/qmp/qlist.h"
hw/arm/xilinx_zynq.c +1 -1
@@ -33,7 +33,7 @@#include "hw/sd/sdhci.h" #include "hw/char/cadence_uart.h" #include "hw/net/cadence_gem.h" -#include "hw/cpu/a9mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/qdev-clock.h" #include "sysemu/reset.h" #include "qom/object.h"
hw/cpu/a15mpcore.c +1 -1
@@ -21,7 +21,7 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" -#include "hw/cpu/a15mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "sysemu/kvm.h"
hw/cpu/a9mpcore.c +1 -1
@@ -11,7 +11,7 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" -#include "hw/cpu/a9mpcore.h" +#include "hw/cpu/cortex_mpcore.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/core/cpu.h"
Signature · 1 line
2.41.0
Re: [PATCH 09/33] hw/cpu/arm: Merge {a9mpcore.h, a15mpcore.h} as cortex_mpcore.h
Quoted 3 lines · Philippe Mathieu-Daudé
Merge Cortex-A{9,15} MPCore devices in the same header.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 10/33 hw/cpu/arm: Introduce abstract CORTEX_MPCORE_PRIV QOM type
In reply to Philippe Mathieu-DaudéThis type will be common to A9MPCORE/A15MPCORE devices.
--- include/hw/cpu/cortex_mpcore.h | 21 +++++++++++++++++++++ hw/cpu/cortex_mpcore.c | 22 ++++++++++++++++++++++ hw/arm/Kconfig | 3 +++ hw/cpu/meson.build | 1 + 4 files changed, 47 insertions(+) create mode 100644 hw/cpu/cortex_mpcore.c
include/hw/cpu/cortex_mpcore.h +21 -0
@@ -17,6 +17,27 @@#include "hw/timer/a9gtimer.h" #include "hw/timer/arm_mptimer.h" +/* +* This is a model of the Arm Cortex-A MPCore family of hardware. +* +* The A7 and A15 MPCore contain: +* up to 4 Cortex-A cores +* a GIC +* The A9 MPCore additionally contains: +* a System Control Unit +* some timers and watchdogs +*/ +#define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv" +OBJECT_DECLARE_TYPE(CortexMPPrivState, CortexMPPrivClass, CORTEX_MPCORE_PRIV) + +struct CortexMPPrivClass { +SysBusDeviceClass parent_class; +}; + +struct CortexMPPrivState { +SysBusDevice parent_obj; +}; +#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"OBJECT_DECLARE_SIMPLE_TYPE (A9MPPrivState,A9MPCORE_PRIV )
hw/cpu/cortex_mpcore.c new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Cortex-MPCore internal peripheral emulation. +* +* Copyright (c) 2023 Linaro Limited. +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "hw/cpu/cortex_mpcore.h" + +static const TypeInfo cortex_mpcore_types[] = { + { + .name =TYPE_CORTEX_MPCORE_PRIV , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (CortexMPPrivState), + .class_size =sizeof (CortexMPPrivClass), + .abstract = true, + }, +}; + +DEFINE_TYPES (cortex_mpcore_types)
hw/arm/Kconfig +3 -0
@@ -643,6 +643,9 @@ config ZAURUS select NAND select ECC +config CORTEX_MPCORE + bool + config A9MPCORE bool select A9_GTIMER
hw/cpu/meson.build +1 -0
@@ -2,5 +2,6 @@ system_ss.add(files('core.c', 'cluster.c')) system_ss.add(when: 'CONFIG_ARM11MPCORE', if_true: files('arm11mpcore.c')) system_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview_mpcore.c')) +specific_ss.add(when: 'CONFIG_CORTEX_MPCORE', if_true: files('cortex_mpcore.c')) specific_ss.add(when: 'CONFIG_A9MPCORE', if_true: files('a9mpcore.c')) specific_ss.add(when: 'CONFIG_A15MPCORE', if_true: files('a15mpcore.c'))
Signature · 1 line
2.41.0
Re: [PATCH 10/33] hw/cpu/arm: Introduce abstract CORTEX_MPCORE_PRIV QOM type
Quoted 2 lines · Philippe Mathieu-Daudé
This type will be common to A9MPCORE/A15MPCORE devices.
Thanks,
C.
PATCH 11/33 hw/cpu/arm: Have A9MPCORE/A15MPCORE inheritate common CORTEX_MPCORE_PRIV
In reply to Philippe Mathieu-DaudéTYPE_CORTEX_MPCORE_PRIV becomes the common parent to TYPE_A9MPCORE_PRIV and TYPE_A15MPCORE_PRIV.
--- include/hw/cpu/cortex_mpcore.h | 6 ++++-- hw/cpu/a15mpcore.c | 14 ++++++++++++-- hw/cpu/a9mpcore.c | 13 +++++++++++-- hw/arm/Kconfig | 2 ++ 4 files changed, 29 insertions(+), 6 deletions(-)
include/hw/cpu/cortex_mpcore.h +4 -2
@@ -32,6 +32,8 @@ OBJECT_DECLARE_TYPE(CortexMPPrivState, CortexMPPrivClass, CORTEX_MPCORE_PRIV)struct CortexMPPrivClass {SysBusDeviceClass parent_class; + +DeviceRealize parent_realize; };struct CortexMPPrivState {
@@ -42,7 +44,7 @@ struct CortexMPPrivState { OBJECT_DECLARE_SIMPLE_TYPE(A9MPPrivState, A9MPCORE_PRIV)struct A9MPPrivState { -SysBusDevice parent_obj; +CortexMPPrivState parent_obj;uint32_t num_cpu;MemoryRegion container;
@@ -59,7 +61,7 @@ struct A9MPPrivState { OBJECT_DECLARE_SIMPLE_TYPE(A15MPPrivState, A15MPCORE_PRIV)struct A15MPPrivState { -SysBusDevice parent_obj; +CortexMPPrivState parent_obj;uint32_t num_cpu;uint32_t num_irq;
hw/cpu/a15mpcore.c +12 -2
@@ -48,15 +48,23 @@ static void a15mp_priv_initfn(Object *obj)static void a15mp_priv_realize (DeviceState *dev,Error **errp) { +CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_GET_CLASS (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A15MPPrivState *s =A15MPCORE_PRIV (dev);DeviceState *gicdev;SysBusDevice *gicsbd; +Error *local_err =NULL ;int i;bool has_el3;bool has_el2 = false;Object *cpuobj; + cc->parent_realize (dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + gicdev =DEVICE (&s->gic);qdev_prop_set_uint32 (gicdev,"num-cpu" , s->num_cpu);qdev_prop_set_uint32 (gicdev,"num-irq" , s->num_irq);
@@ -158,8 +166,10 @@ static Property a15mp_priv_properties[] = {static void a15mp_priv_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_CLASS (klass); - dc->realize = a15mp_priv_realize; +device_class_set_parent_realize (dc, a15mp_priv_realize, + &cc->parent_realize);device_class_set_props (dc, a15mp_priv_properties);/* We currently have no saveable state */ }
@@ -167,7 +177,7 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data)static const TypeInfo a15mp_types[] = { { .name =TYPE_A15MPCORE_PRIV , - .parent =TYPE_SYS_BUS_DEVICE , + .parent =TYPE_CORTEX_MPCORE_PRIV , .instance_size =sizeof (A15MPPrivState), .instance_init = a15mp_priv_initfn, .class_init = a15mp_priv_class_init,
hw/cpu/a9mpcore.c +11 -2
@@ -46,11 +46,13 @@ static void a9mp_priv_initfn(Object *obj)static void a9mp_priv_realize (DeviceState *dev,Error **errp) { +CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_GET_CLASS (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A9MPPrivState *s =A9MPCORE_PRIV (dev);DeviceState *scudev, *gicdev, *gtimerdev, *mptimerdev, *wdtdev;SysBusDevice *scubusdev, *gicbusdev, *gtimerbusdev, *mptimerbusdev, *wdtbusdev; +Error *local_err =NULL ;int i;bool has_el3;CPUState *cpu0;
@@ -65,6 +67,12 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)return ; } + cc->parent_realize (dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + scudev =DEVICE (&s->scu);qdev_prop_set_uint32 (scudev,"num-cpu" , s->num_cpu);if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {
@@ -173,15 +181,16 @@ static Property a9mp_priv_properties[] = {static void a9mp_priv_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_CLASS (klass); - dc->realize = a9mp_priv_realize; +device_class_set_parent_realize (dc, a9mp_priv_realize, &cc->parent_realize);device_class_set_props (dc, a9mp_priv_properties); }static const TypeInfo a9mp_types[] = { { .name =TYPE_A9MPCORE_PRIV , - .parent =TYPE_SYS_BUS_DEVICE , + .parent =TYPE_CORTEX_MPCORE_PRIV , .instance_size =sizeof (A9MPPrivState), .instance_init = a9mp_priv_initfn, .class_init = a9mp_priv_class_init,
hw/arm/Kconfig +2 -0
@@ -648,6 +648,7 @@ config CORTEX_MPCORE config A9MPCORE bool + select CORTEX_MPCORE select A9_GTIMER select A9SCU # snoop control unit select ARM_GIC
@@ -655,6 +656,7 @@ config A9MPCORE config A15MPCORE bool + select CORTEX_MPCORE select ARM_GIC config ARM11MPCORE
Signature · 1 line
2.41.0
Re: [PATCH 11/33] hw/cpu/arm: Have A9MPCORE/A15MPCORE inheritate common CORTEX_MPCORE_PRIV
Quoted 4 lines · Philippe Mathieu-Daudé
TYPE_CORTEX_MPCORE_PRIVbecomes the common parent toTYPE_A9MPCORE_PRIVandTYPE_A15MPCORE_PRIV.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 12/33 hw/cpu/arm: Create MPCore container in QOM parent
In reply to Philippe Mathieu-DaudéMove the memory region container creation to the abstract QOM parent. Children set the region size via the class 'container_size' field.
--- include/hw/cpu/cortex_mpcore.h | 10 ++++++++-- hw/cpu/a15mpcore.c | 17 ++++++++--------- hw/cpu/a9mpcore.c | 18 +++++++++--------- hw/cpu/cortex_mpcore.c | 14 ++++++++++++++ 4 files changed, 39 insertions(+), 20 deletions(-)
include/hw/cpu/cortex_mpcore.h +8 -2
@@ -30,14 +30,22 @@#define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv"OBJECT_DECLARE_TYPE (CortexMPPrivState, CortexMPPrivClass,CORTEX_MPCORE_PRIV ) +/** +* CortexMPPrivClass: +* @container_size - size of the device's MMIO region + */struct CortexMPPrivClass {SysBusDeviceClass parent_class;DeviceRealize parent_realize; + +uint64_t container_size; };struct CortexMPPrivState {SysBusDevice parent_obj; + +MemoryRegion container; };#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"
@@ -47,7 +55,6 @@ struct A9MPPrivState {CortexMPPrivState parent_obj;uint32_t num_cpu; -MemoryRegion container;uint32_t num_irq;A9SCUState scu;
@@ -65,7 +72,6 @@ struct A15MPPrivState {uint32_t num_cpu;uint32_t num_irq; -MemoryRegion container;GICState gic; };
hw/cpu/a15mpcore.c +8 -9
@@ -36,12 +36,8 @@ static void a15mp_priv_set_irq(void *opaque, int irq, int level)static void a15mp_priv_initfn (Object *obj) { -SysBusDevice *sbd =SYS_BUS_DEVICE (obj);A15MPPrivState *s =A15MPCORE_PRIV (obj); -memory_region_init (&s->container, obj,"a15mp-priv-container" ,0x8000 ); -sysbus_init_mmio (sbd, &s->container); -object_initialize_child (obj,"gic" , &s->gic,gic_class_name ());qdev_prop_set_uint32 (DEVICE (&s->gic),"revision" ,2 ); }
@@ -51,6 +47,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_GET_CLASS (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A15MPPrivState *s =A15MPCORE_PRIV (dev); +CortexMPPrivState *c =CORTEX_MPCORE_PRIV (dev);DeviceState *gicdev;SysBusDevice *gicsbd;Error *local_err =NULL ;
@@ -133,20 +130,20 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)* 0x5600-0x57ff -- GIC virtual interface control for CPU 3 * 0x6000-0x7fff -- GIC virtual CPU interface */ -memory_region_add_subregion (&s->container,0x1000 , +memory_region_add_subregion (&c->container,0x1000 ,sysbus_mmio_get_region (gicsbd,0 )); -memory_region_add_subregion (&s->container,0x2000 , +memory_region_add_subregion (&c->container,0x2000 ,sysbus_mmio_get_region (gicsbd,1 ));if (has_el2) { -memory_region_add_subregion (&s->container,0x4000 , +memory_region_add_subregion (&c->container,0x4000 ,sysbus_mmio_get_region (gicsbd,2 )); -memory_region_add_subregion (&s->container,0x6000 , +memory_region_add_subregion (&c->container,0x6000 ,sysbus_mmio_get_region (gicsbd,3 ));for (i =0 ; i < s->num_cpu; i++) {hwaddr base =0x5000 + i *0x200 ;MemoryRegion *mr =sysbus_mmio_get_region (gicsbd,4 + s->num_cpu + i); -memory_region_add_subregion (&s->container, base, mr); +memory_region_add_subregion (&c->container, base, mr); } } }
@@ -168,6 +165,8 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_CLASS (klass); + cc->container_size =0x8000 ; +device_class_set_parent_realize (dc, a15mp_priv_realize, &cc->parent_realize);device_class_set_props (dc, a15mp_priv_properties);
hw/cpu/a9mpcore.c +9 -9
@@ -30,9 +30,6 @@ static void a9mp_priv_initfn(Object *obj) {A9MPPrivState *s =A9MPCORE_PRIV (obj); -memory_region_init (&s->container, obj,"a9mp-priv-container" ,0x2000 ); -sysbus_init_mmio (SYS_BUS_DEVICE (obj), &s->container); -object_initialize_child (obj,"scu" , &s->scu,TYPE_A9_SCU );object_initialize_child (obj,"gic" , &s->gic,TYPE_ARM_GIC );
@@ -47,6 +44,7 @@ static void a9mp_priv_initfn(Object *obj)static void a9mp_priv_realize (DeviceState *dev,Error **errp) {CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_GET_CLASS (dev); +CortexMPPrivState *c =CORTEX_MPCORE_PRIV (dev);SysBusDevice *sbd =SYS_BUS_DEVICE (dev);A9MPPrivState *s =A9MPCORE_PRIV (dev);DeviceState *scudev, *gicdev, *gtimerdev, *mptimerdev, *wdtdev;
@@ -134,21 +132,21 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)* 0x0700-0x0fff -- nothing * 0x1000-0x1fff -- GIC Distributor */ -memory_region_add_subregion (&s->container,0 , +memory_region_add_subregion (&c->container,0 ,sysbus_mmio_get_region (scubusdev,0 ));/* GIC CPU interface */ -memory_region_add_subregion (&s->container,0x100 , +memory_region_add_subregion (&c->container,0x100 ,sysbus_mmio_get_region (gicbusdev,1 )); -memory_region_add_subregion (&s->container,0x200 , +memory_region_add_subregion (&c->container,0x200 ,sysbus_mmio_get_region (gtimerbusdev,0 ));/* Note that the A9 exposes only the "timer/watchdog for this core" * memory region, not the "timer/watchdog for core X" ones 11MPcore has. */ -memory_region_add_subregion (&s->container,0x600 , +memory_region_add_subregion (&c->container,0x600 ,sysbus_mmio_get_region (mptimerbusdev,0 )); -memory_region_add_subregion (&s->container,0x620 , +memory_region_add_subregion (&c->container,0x620 ,sysbus_mmio_get_region (wdtbusdev,0 )); -memory_region_add_subregion (&s->container,0x1000 , +memory_region_add_subregion (&c->container,0x1000 ,sysbus_mmio_get_region (gicbusdev,0 ));/* Wire up the interrupt from each watchdog and timer.
@@ -183,6 +181,8 @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_CLASS (klass); + cc->container_size =0x2000 ; +device_class_set_parent_realize (dc, a9mp_priv_realize, &cc->parent_realize);device_class_set_props (dc, a9mp_priv_properties); }
hw/cpu/cortex_mpcore.c +14 -0
@@ -7,13 +7,27 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/cpu/cortex_mpcore.h" +static void cortex_mpcore_priv_instance_init (Object *obj) +{ +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); +CortexMPPrivState *s =CORTEX_MPCORE_PRIV (obj); +CortexMPPrivClass *k =CORTEX_MPCORE_PRIV_GET_CLASS (obj); + +assert (k->container_size >0 ); +memory_region_init (&s->container, obj, +"mpcore-priv-container" , k->container_size); +sysbus_init_mmio (sbd, &s->container); +} +static const TypeInfo cortex_mpcore_types[] = { { .name =TYPE_CORTEX_MPCORE_PRIV , .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (CortexMPPrivState), + .instance_init = cortex_mpcore_priv_instance_init, .class_size =sizeof (CortexMPPrivClass), .abstract = true, },
Signature · 1 line
2.41.0
Re: [PATCH 12/33] hw/cpu/arm: Create MPCore container in QOM parent
Quoted 5 lines · Philippe Mathieu-Daudé
Move the memory region container creation to the abstract QOM parent. Children set the region size via the class '
container_size' field.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
PATCH 13/33 hw/cpu/arm: Handle 'num_cores' property once in MPCore parent
In reply to Philippe Mathieu-DaudéMove the 'num_cpu' property to the abstract QOM parent. Rename it as 'num_cores', keeping it aliased as 'num_cpu'.
--- include/hw/cpu/cortex_mpcore.h | 9 +++++++-- hw/arm/aspeed_ast2600.c | 2 +- hw/arm/exynos4210.c | 2 +- hw/arm/fsl-imx6.c | 2 +- hw/arm/fsl-imx6ul.c | 2 +- hw/arm/fsl-imx7.c | 2 +- hw/arm/npcm7xx.c | 2 +- hw/arm/realview.c | 2 +- hw/cpu/a15mpcore.c | 11 +++++------ hw/cpu/a9mpcore.c | 14 ++++++-------- hw/cpu/arm11mpcore.c | 3 ++- hw/cpu/cortex_mpcore.c | 17 +++++++++++++++++ hw/cpu/realview_mpcore.c | 3 ++- 13 files changed, 46 insertions(+), 25 deletions(-)
include/hw/cpu/cortex_mpcore.h +7 -2
@@ -26,6 +26,10 @@* The A9 MPCore additionally contains: * a System Control Unit * some timers and watchdogs +* +* QEMU interface: +* + QOM property "num-cores" which set the number of cores present in +* the cluster. */ #define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv"OBJECT_DECLARE_TYPE (CortexMPPrivState, CortexMPPrivClass,CORTEX_MPCORE_PRIV )
@@ -46,6 +50,9 @@ struct CortexMPPrivState {SysBusDevice parent_obj;MemoryRegion container; + +/* Properties */ +uint32_t num_cores; };#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"
@@ -54,7 +61,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(A9MPPrivState, A9MPCORE_PRIV)struct A9MPPrivState {CortexMPPrivState parent_obj; -uint32_t num_cpu;uint32_t num_irq;A9SCUState scu;
@@ -70,7 +76,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(A15MPPrivState, A15MPCORE_PRIV)struct A15MPPrivState {CortexMPPrivState parent_obj; -uint32_t num_cpu;uint32_t num_irq;GICState gic;
hw/arm/aspeed_ast2600.c +1 -1
@@ -330,7 +330,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) }/* A7MPCORE */ -object_property_set_int (OBJECT (&a->a7mpcore),"num-cpu" , sc->num_cpus, +object_property_set_int (OBJECT (&a->a7mpcore),"num-cores" , sc->num_cpus, &error_abort); object_property_set_int(OBJECT(&a->a7mpcore), "num-irq", ROUND_UP(AST2600_MAX_IRQ + GIC_INTERNAL, 32),
hw/arm/exynos4210.c +1 -1
@@ -582,7 +582,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) }/* Private memory region and Internal GIC */ -qdev_prop_set_uint32 (DEVICE (&s->a9mpcore),"num-cpu" ,EXYNOS4210_NCPUS ); +qdev_prop_set_uint32 (DEVICE (&s->a9mpcore),"num-cores" ,EXYNOS4210_NCPUS ); busdev =SYS_BUS_DEVICE (&s->a9mpcore);sysbus_realize (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,EXYNOS4210_SMP_PRIVATE_BASE_ADDR );
hw/arm/fsl-imx6.c +1 -1
@@ -138,7 +138,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) } } -object_property_set_int (OBJECT (&s->a9mpcore),"num-cpu" , smp_cpus, +object_property_set_int (OBJECT (&s->a9mpcore),"num-cores" , smp_cpus, &error_abort); object_property_set_int(OBJECT(&s->a9mpcore), "num-irq",
hw/arm/fsl-imx6ul.c +1 -1
@@ -173,7 +173,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)/* * A7MPCORE */ -object_property_set_int (OBJECT (&s->a7mpcore),"num-cpu" ,1 , &error_abort); +object_property_set_int (OBJECT (&s->a7mpcore),"num-cores" ,1 , &error_abort);object_property_set_int (OBJECT (&s->a7mpcore),"num-irq" ,FSL_IMX6UL_MAX_IRQ +GIC_INTERNAL , &error_abort);sysbus_realize (SYS_BUS_DEVICE (&s->a7mpcore), &error_abort);
hw/arm/fsl-imx7.c +1 -1
@@ -203,7 +203,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)/* * A7MPCORE */ -object_property_set_int (OBJECT (&s->a7mpcore),"num-cpu" , smp_cpus, +object_property_set_int (OBJECT (&s->a7mpcore),"num-cores" , smp_cpus, &error_abort);object_property_set_int (OBJECT (&s->a7mpcore),"num-irq" ,FSL_IMX7_MAX_IRQ +GIC_INTERNAL , &error_abort);
hw/arm/npcm7xx.c +1 -1
@@ -491,7 +491,7 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) }/* A9MPCORE peripherals. Can only fail if we pass bad parameters here. */ -object_property_set_int (OBJECT (&s->a9mpcore),"num-cpu" , nc->num_cpus, +object_property_set_int (OBJECT (&s->a9mpcore),"num-cores" , nc->num_cpus, &error_abort);object_property_set_int (OBJECT (&s->a9mpcore),"num-irq" ,NPCM7XX_NUM_IRQ , &error_abort);
hw/arm/realview.c +1 -1
@@ -187,7 +187,7 @@ static void realview_init(MachineState *machine,if (is_mpcore) { dev =qdev_new (is_pb ?TYPE_A9MPCORE_PRIV :"realview_mpcore" ); -qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); +qdev_prop_set_uint32 (dev,"num-cores" , smp_cpus); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 , periphbase);
hw/cpu/a15mpcore.c +5 -6
@@ -63,7 +63,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) } gicdev =DEVICE (&s->gic); -qdev_prop_set_uint32 (gicdev,"num-cpu" , s->num_cpu); +qdev_prop_set_uint32 (gicdev,"num-cpu" , c->num_cores);qdev_prop_set_uint32 (gicdev,"num-irq" , s->num_irq);if (!kvm_irqchip_in_kernel ()) {
@@ -94,7 +94,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)/* Wire the outputs from each CPU's generic timer to the * appropriate GIC PPI inputs */ -for (i =0 ; i < s->num_cpu; i++) { +for (i =0 ; i < c->num_cores; i++) {DeviceState *cpudev =DEVICE (qemu_get_cpu (i));int ppibase = s->num_irq -32 + i *32 ;int irq;
@@ -114,7 +114,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) }if (has_el2) {/* Connect the GIC maintenance interrupt to PPI ID 25 */ -sysbus_connect_irq (SYS_BUS_DEVICE (gicdev), i +4 * s->num_cpu, +sysbus_connect_irq (SYS_BUS_DEVICE (gicdev), i +4 * c->num_cores,qdev_get_gpio_in (gicdev, ppibase +25 )); } }
@@ -139,17 +139,16 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(gicsbd, 2));memory_region_add_subregion (&c->container,0x6000 ,sysbus_mmio_get_region (gicsbd,3 )); -for (i =0 ; i < s->num_cpu; i++) { +for (i =0 ; i < c->num_cores; i++) {hwaddr base =0x5000 + i *0x200 ;MemoryRegion *mr =sysbus_mmio_get_region (gicsbd, -4 + s->num_cpu + i); +4 + c->num_cores + i);memory_region_add_subregion (&c->container, base, mr); } } }static Property a15mp_priv_properties[] = { -DEFINE_PROP_UINT32 ("num-cpu" , A15MPPrivState, num_cpu,1 ),/* The Cortex-A15MP may have anything from 0 to 224 external interrupt * IRQ lines (with another 32 internal). We default to 128+32, which * is the number provided by the Cortex-A15MP test chip in the
hw/cpu/a9mpcore.c +6 -8
@@ -51,7 +51,6 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *scubusdev, *gicbusdev, *gtimerbusdev, *mptimerbusdev, *wdtbusdev;Error *local_err =NULL ; -int i;bool has_el3;CPUState *cpu0;Object *cpuobj;
@@ -72,14 +71,14 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) } scudev =DEVICE (&s->scu); -qdev_prop_set_uint32 (scudev,"num-cpu" , s->num_cpu); +qdev_prop_set_uint32 (scudev,"num-cpu" , c->num_cores);if (!sysbus_realize (SYS_BUS_DEVICE (&s->scu), errp)) {return ; } scubusdev =SYS_BUS_DEVICE (&s->scu); gicdev =DEVICE (&s->gic); -qdev_prop_set_uint32 (gicdev,"num-cpu" , s->num_cpu); +qdev_prop_set_uint32 (gicdev,"num-cpu" , c->num_cores);qdev_prop_set_uint32 (gicdev,"num-irq" , s->num_irq);qdev_prop_set_uint32 (gicdev,"num-priority-bits" ,A9_GIC_NUM_PRIORITY_BITS );
@@ -103,21 +102,21 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)qdev_init_gpio_in (dev, a9mp_priv_set_irq, s->num_irq -32 ); gtimerdev =DEVICE (&s->gtimer); -qdev_prop_set_uint32 (gtimerdev,"num-cpu" , s->num_cpu); +qdev_prop_set_uint32 (gtimerdev,"num-cpu" , c->num_cores);if (!sysbus_realize (SYS_BUS_DEVICE (&s->gtimer), errp)) {return ; } gtimerbusdev =SYS_BUS_DEVICE (&s->gtimer); mptimerdev =DEVICE (&s->mptimer); -qdev_prop_set_uint32 (mptimerdev,"num-cpu" , s->num_cpu); +qdev_prop_set_uint32 (mptimerdev,"num-cpu" , c->num_cores);if (!sysbus_realize (SYS_BUS_DEVICE (&s->mptimer), errp)) {return ; } mptimerbusdev =SYS_BUS_DEVICE (&s->mptimer); wdtdev =DEVICE (&s->wdt); -qdev_prop_set_uint32 (wdtdev,"num-cpu" , s->num_cpu); +qdev_prop_set_uint32 (wdtdev,"num-cpu" , c->num_cores);if (!sysbus_realize (SYS_BUS_DEVICE (&s->wdt), errp)) {return ; }
@@ -153,7 +152,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)* For each core the global timer is PPI 27, the private * timer is PPI 29 and the watchdog PPI 30. */ -for (i =0 ; i < s->num_cpu; i++) { +for (unsigned i =0 ; i < c->num_cores; i++) {int ppibase = (s->num_irq -32 ) + i *32 ;sysbus_connect_irq (gtimerbusdev, i,qdev_get_gpio_in (gicdev, ppibase +27 ));
@@ -165,7 +164,6 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) }static Property a9mp_priv_properties[] = { -DEFINE_PROP_UINT32 ("num-cpu" , A9MPPrivState, num_cpu,1 ),/* The Cortex-A9MP may have anything from 0 to 224 external interrupt * IRQ lines (with another 32 internal). We default to 64+32, which * is the number provided by the Cortex-A9MP test chip in the
hw/cpu/arm11mpcore.c +2 -1
@@ -132,7 +132,8 @@ static void mpcore_priv_initfn(Object *obj) }static Property mpcore_priv_properties[] = { -DEFINE_PROP_UINT32 ("num-cpu" , ARM11MPCorePriveState, num_cpu,1 ), +DEFINE_PROP_UINT32 ("num-cores" , ARM11MPCorePriveState, num_cpu,1 ), +DEFINE_PROP_UINT32 ("num-cpu" , ARM11MPCorePriveState, num_cpu,1 ),/* alias */ /* The ARM11 MPCORE TRM says the on-chip controller may have * anything from 0 to 224 external interrupt IRQ lines (with another * 32 internal). We default to 32+32, which is the number provided by
hw/cpu/cortex_mpcore.c +17 -0
@@ -8,6 +8,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "hw/qdev-properties.h" #include "hw/cpu/cortex_mpcore.h" static void cortex_mpcore_priv_instance_init (Object *obj)
@@ -22,6 +23,21 @@ static void cortex_mpcore_priv_instance_init(Object *obj)sysbus_init_mmio (sbd, &s->container); } +static Property cortex_mpcore_priv_properties[] = { +DEFINE_PROP_UINT32 ("num-cores" , CortexMPPrivState, num_cores,1 ), +DEFINE_PROP_UINT32 ("num-cpu" , CortexMPPrivState, num_cores,1 ),/* alias */ + +DEFINE_PROP_END_OF_LIST (), +}; + +static void cortex_mpcore_priv_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + +device_class_set_props (dc, cortex_mpcore_priv_properties); +/* We currently have no saveable state */ +} +static const TypeInfo cortex_mpcore_types[] = { { .name =TYPE_CORTEX_MPCORE_PRIV ,
@@ -29,6 +45,7 @@ static const TypeInfo cortex_mpcore_types[] = { .instance_size = sizeof(CortexMPPrivState), .instance_init = cortex_mpcore_priv_instance_init, .class_size = sizeof(CortexMPPrivClass), + .class_init = cortex_mpcore_priv_class_init, .abstract = true, }, };
hw/cpu/realview_mpcore.c +2 -1
@@ -98,7 +98,8 @@ static void mpcore_rirq_init(Object *obj)int i;object_initialize_child (obj,"a11priv" , &s->priv,TYPE_ARM11MPCORE_PRIV ); -object_property_add_alias (obj,"num-cpu" ,OBJECT (&s->priv),"num-cpu" ); +object_property_add_alias (obj,"num-cores" ,OBJECT (&s->priv),"num-cores" ); +object_property_add_alias (obj,"num-cpu" ,OBJECT (&s->priv),"num-cores" ); privbusdev =SYS_BUS_DEVICE (&s->priv);sysbus_init_mmio (sbd,sysbus_mmio_get_region (privbusdev,0 ));
Signature · 1 line
2.41.0
PATCH 14/33 hw/cpu/arm: Handle 'has_el2/3' properties once in MPCore parent
In reply to Philippe Mathieu-DaudéMove the 'has_el2' and 'has_el3' properties to the abstract QOM parent.
--- include/hw/cpu/cortex_mpcore.h | 5 +++++ hw/arm/exynos4210.c | 10 ++++++++-- hw/arm/vexpress.c | 6 ++++++ hw/arm/xilinx_zynq.c | 6 ++++++ hw/cpu/a15mpcore.c | 18 ++++++------------ hw/cpu/a9mpcore.c | 5 +---- hw/cpu/cortex_mpcore.c | 3 +++ 7 files changed, 35 insertions(+), 18 deletions(-)
include/hw/cpu/cortex_mpcore.h +5 -0
@@ -30,6 +30,8 @@* QEMU interface: * + QOM property "num-cores" which set the number of cores present in * the cluster. +* + QOM properties "cpu-has-el3", "cpu-has-el2" which set whether the CPUs +* have the exception level features present. */ #define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv"OBJECT_DECLARE_TYPE (CortexMPPrivState, CortexMPPrivClass,CORTEX_MPCORE_PRIV )
@@ -53,6 +55,9 @@ struct CortexMPPrivState {/* Properties */ uint32_t num_cores; + +bool cpu_has_el3; +bool cpu_has_el2; };#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"
hw/arm/exynos4210.c +8 -2
@@ -548,7 +548,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)Exynos4210State *s =EXYNOS4210_SOC (socdev);MemoryRegion *system_mem =get_system_memory ();SysBusDevice *busdev; -DeviceState *dev, *uart[4 ], *pl330[3 ]; +DeviceState *dev, *mpdev, *uart[4 ], *pl330[3 ];int i, n;for (n =0 ; n <EXYNOS4210_NCPUS ; n++) {
@@ -582,7 +582,13 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) }/* Private memory region and Internal GIC */ -qdev_prop_set_uint32 (DEVICE (&s->a9mpcore),"num-cores" ,EXYNOS4210_NCPUS ); + mpdev =DEVICE (&s->a9mpcore); +qdev_prop_set_uint32 (mpdev,"num-cores" ,EXYNOS4210_NCPUS ); +/* +* By default A9 CPUs have EL3 enabled. This board does not currently +* support EL3 so the CPU EL3 property is disabled before realization. +*/ +qdev_prop_set_bit (mpdev,"cpu-has-el3" , false); busdev =SYS_BUS_DEVICE (&s->a9mpcore);sysbus_realize (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,EXYNOS4210_SMP_PRIVATE_BASE_ADDR );
hw/arm/vexpress.c +6 -0
@@ -239,6 +239,12 @@ static void init_cpus(MachineState *ms, const char *cpu_type,* wires itself up to the CPU's generic_timer gpio out lines. */ dev =qdev_new (privdev); +if (!secure) { +qdev_prop_set_bit (dev,"cpu-has-el3" , false); + } +if (!virt) { +qdev_prop_set_bit (dev,"cpu-has-el2" , false); + }qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);
hw/arm/xilinx_zynq.c +6 -0
@@ -240,6 +240,12 @@ static void zynq_init(MachineState *machine) dev =qdev_new (TYPE_A9MPCORE_PRIV );qdev_prop_set_uint32 (dev,"num-cpu" ,1 ); +/* +* By default A9 CPUs have EL3 enabled. This board does not +* currently support EL3 so the CPU EL3 property is disabled before +* realization. +*/ +qdev_prop_set_bit (dev,"cpu-has-el3" , false); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,MPCORE_PERIPHBASE );
hw/cpu/a15mpcore.c +6 -12
@@ -52,9 +52,6 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *gicsbd;Error *local_err =NULL ;int i; -bool has_el3; -bool has_el2 = false; -Object *cpuobj; cc->parent_realize (dev, &local_err);if (local_err) {
@@ -70,14 +67,11 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)/* Make the GIC's TZ support match the CPUs. We assume that * either all the CPUs have TZ, or none do. */ - cpuobj =OBJECT (qemu_get_cpu (0 )); - has_el3 =object_property_find (cpuobj,"has_el3" ) && -object_property_get_bool (cpuobj,"has_el3" , &error_abort); -qdev_prop_set_bit (gicdev,"has-security-extensions" , has_el3); +qdev_prop_set_bit (gicdev,"has-security-extensions" , + c->cpu_has_el3);/* Similarly for virtualization support */ - has_el2 =object_property_find (cpuobj,"has_el2" ) && -object_property_get_bool (cpuobj,"has_el2" , &error_abort); -qdev_prop_set_bit (gicdev,"has-virtualization-extensions" , has_el2); +qdev_prop_set_bit (gicdev,"has-virtualization-extensions" , + c->cpu_has_el2); }if (!sysbus_realize (SYS_BUS_DEVICE (&s->gic), errp)) {
@@ -112,7 +106,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)qdev_get_gpio_in (gicdev, ppibase + timer_irq[irq])); } -if (has_el2) { +if (c->cpu_has_el2) {/* Connect the GIC maintenance interrupt to PPI ID 25 */ sysbus_connect_irq (SYS_BUS_DEVICE (gicdev), i +4 * c->num_cores,qdev_get_gpio_in (gicdev, ppibase +25 ));
@@ -134,7 +128,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(gicsbd, 0));memory_region_add_subregion (&c->container,0x2000 ,sysbus_mmio_get_region (gicsbd,1 )); -if (has_el2) { +if (c->cpu_has_el2) {memory_region_add_subregion (&c->container,0x4000 ,sysbus_mmio_get_region (gicsbd,2 )); memory_region_add_subregion(&c->container, 0x6000,
hw/cpu/a9mpcore.c +1 -4
@@ -51,7 +51,6 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *scubusdev, *gicbusdev, *gtimerbusdev, *mptimerbusdev, *wdtbusdev;Error *local_err =NULL ; -bool has_el3;CPUState *cpu0;Object *cpuobj;
@@ -86,9 +85,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)/* Make the GIC's TZ support match the CPUs. We assume that * either all the CPUs have TZ, or none do. */ - has_el3 =object_property_find (cpuobj,"has_el3" ) && -object_property_get_bool (cpuobj,"has_el3" , &error_abort); -qdev_prop_set_bit (gicdev,"has-security-extensions" , has_el3); +qdev_prop_set_bit (gicdev,"has-security-extensions" , c->cpu_has_el3);if (!sysbus_realize (SYS_BUS_DEVICE (&s->gic), errp)) {return ;
hw/cpu/cortex_mpcore.c +3 -0
@@ -27,6 +27,9 @@ static Property cortex_mpcore_priv_properties[] = {DEFINE_PROP_UINT32 ("num-cores" , CortexMPPrivState, num_cores,1 ),DEFINE_PROP_UINT32 ("num-cpu" , CortexMPPrivState, num_cores,1 ),/* alias */ +DEFINE_PROP_BOOL ("cpu-has-el3" , CortexMPPrivState, cpu_has_el3, true), +DEFINE_PROP_BOOL ("cpu-has-el2" , CortexMPPrivState, cpu_has_el2, false), + DEFINE_PROP_END_OF_LIST(), };
Signature · 1 line
2.41.0
Re: [PATCH 14/33] hw/cpu/arm: Handle 'has_el2/3' properties once in MPCore parent
Quoted 178 lines · Philippe Mathieu-Daudé
Move the '
has_el2' and 'has_el3' properties to the abstract QOM parent.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/cpu/cortex_mpcore.h | 5 +++++ hw/arm/exynos4210.c | 10 ++++++++-- hw/arm/vexpress.c | 6 ++++++ hw/arm/xilinx_zynq.c | 6 ++++++ hw/cpu/a15mpcore.c | 18 ++++++------------ hw/cpu/a9mpcore.c | 5 +---- hw/cpu/cortex_mpcore.c | 3 +++ 7 files changed, 35 insertions(+), 18 deletions(-)include/hw/cpu/cortex_mpcore.h +5
-0@@ -30,6 +30,8 @@* QEMU interface: * + QOM property "num-cores" which set the number of cores present in * the cluster. +* + QOM properties "cpu-has-el3", "cpu-has-el2" which set whether the CPUs +* have the exception level features present. */ #define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv"OBJECT_DECLARE_TYPE (CortexMPPrivState, CortexMPPrivClass,CORTEX_MPCORE_PRIV )@@ -53,6 +55,9 @@ struct CortexMPPrivState {/* Properties */ uint32_t num_cores; + +bool cpu_has_el3; +bool cpu_has_el2; };#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"hw/arm/exynos4210.c +8
-2@@ -548,7 +548,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)Exynos4210State *s =EXYNOS4210_SOC (socdev);MemoryRegion *system_mem =get_system_memory ();SysBusDevice *busdev; -DeviceState *dev, *uart[4 ], *pl330[3 ]; +DeviceState *dev, *mpdev, *uart[4 ], *pl330[3 ];int i, n;for (n =0 ; n <EXYNOS4210_NCPUS ; n++) {@@ -582,7 +582,13 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) }/* Private memory region and Internal GIC */ -qdev_prop_set_uint32 (DEVICE (&s->a9mpcore),"num-cores" ,EXYNOS4210_NCPUS ); + mpdev =DEVICE (&s->a9mpcore); +qdev_prop_set_uint32 (mpdev,"num-cores" ,EXYNOS4210_NCPUS ); +/* +* By default A9 CPUs have EL3 enabled. This board does not currently +* support EL3 so the CPU EL3 property is disabled before realization. +*/ +qdev_prop_set_bit (mpdev,"cpu-has-el3" , false); busdev =SYS_BUS_DEVICE (&s->a9mpcore);sysbus_realize (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,EXYNOS4210_SMP_PRIVATE_BASE_ADDR );hw/arm/vexpress.c +6
-0@@ -239,6 +239,12 @@ static void init_cpus(MachineState *ms, const char *cpu_type,* wires itself up to the CPU's generic_timer gpio out lines. */ dev =qdev_new (privdev); +if (!secure) { +qdev_prop_set_bit (dev,"cpu-has-el3" , false); + } +if (!virt) { +qdev_prop_set_bit (dev,"cpu-has-el2" , false); + }qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);hw/arm/xilinx_zynq.c +6
-0@@ -240,6 +240,12 @@ static void zynq_init(MachineState *machine) dev =qdev_new (TYPE_A9MPCORE_PRIV );qdev_prop_set_uint32 (dev,"num-cpu" ,1 ); +/* +* By default A9 CPUs have EL3 enabled. This board does not +* currently support EL3 so the CPU EL3 property is disabled before +* realization. +*/ +qdev_prop_set_bit (dev,"cpu-has-el3" , false); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,MPCORE_PERIPHBASE );hw/cpu/a15mpcore.c +6
-12@@ -52,9 +52,6 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *gicsbd;Error *local_err =NULL ;int i; -bool has_el3; -bool has_el2 = false; -Object *cpuobj; cc->parent_realize (dev, &local_err);if (local_err) {@@ -70,14 +67,11 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)/* Make the GIC's TZ support match the CPUs. We assume that * either all the CPUs have TZ, or none do. */ - cpuobj =OBJECT (qemu_get_cpu (0 )); - has_el3 =object_property_find (cpuobj,"has_el3" ) && -object_property_get_bool (cpuobj,"has_el3" , &error_abort); -qdev_prop_set_bit (gicdev,"has-security-extensions" , has_el3); +qdev_prop_set_bit (gicdev,"has-security-extensions" , + c->cpu_has_el3);/* Similarly for virtualization support */ - has_el2 =object_property_find (cpuobj,"has_el2" ) && -object_property_get_bool (cpuobj,"has_el2" , &error_abort); -qdev_prop_set_bit (gicdev,"has-virtualization-extensions" , has_el2); +qdev_prop_set_bit (gicdev,"has-virtualization-extensions" , + c->cpu_has_el2); }if (!sysbus_realize (SYS_BUS_DEVICE (&s->gic), errp)) {@@ -112,7 +106,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)qdev_get_gpio_in (gicdev, ppibase + timer_irq[irq])); } -if (has_el2) { +if (c->cpu_has_el2) {/* Connect the GIC maintenance interrupt to PPI ID 25 */ sysbus_connect_irq (SYS_BUS_DEVICE (gicdev), i +4 * c->num_cores,qdev_get_gpio_in (gicdev, ppibase +25 ));@@ -134,7 +128,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(gicsbd, 0));memory_region_add_subregion (&c->container,0x2000 ,sysbus_mmio_get_region (gicsbd,1 )); -if (has_el2) { +if (c->cpu_has_el2) {memory_region_add_subregion (&c->container,0x4000 ,sysbus_mmio_get_region (gicsbd,2 )); memory_region_add_subregion(&c->container, 0x6000,hw/cpu/a9mpcore.c +1
-4@@ -51,7 +51,6 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *scubusdev, *gicbusdev, *gtimerbusdev, *mptimerbusdev, *wdtbusdev;Error *local_err =NULL ; -bool has_el3;CPUState *cpu0;Object *cpuobj;@@ -86,9 +85,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)/* Make the GIC's TZ support match the CPUs. We assume that * either all the CPUs have TZ, or none do. */ - has_el3 =object_property_find (cpuobj,"has_el3" ) && -object_property_get_bool (cpuobj,"has_el3" , &error_abort); -qdev_prop_set_bit (gicdev,"has-security-extensions" , has_el3); +qdev_prop_set_bit (gicdev,"has-security-extensions" , c->cpu_has_el3);if (!sysbus_realize (SYS_BUS_DEVICE (&s->gic), errp)) {return ;hw/cpu/cortex_mpcore.c +0
-0
hw/cpu/cortex_mpcore.c static Property cortex_mpcore_priv_properties[] = { · line 31
Quoted 5 lines
hw/cpu/cortex_mpcore.c +2
-0@@ -27,6 +27,9 @@ static Property cortex_mpcore_priv_properties[] = {DEFINE_PROP_UINT32 ("num-cores" , CortexMPPrivState, num_cores,1 ),DEFINE_PROP_UINT32 ("num-cpu" , CortexMPPrivState, num_cores,1 ),/* alias */ +DEFINE_PROP_BOOL ("cpu-has-el3" , CortexMPPrivState, cpu_has_el3, true), + DEFINE_PROP_BOOL("cpu-has-el2", CortexMPPrivState, cpu_has_el2, false),
Are we missing setting cpu_has_el2 somewhere else? This^ results in fewer cpregs being registered and is what breaks migration.
You can test with:
$ (echo "migrate file:migfile"; echo "quit") | ./qemu-system-arm -M ast2600-evb -monitor stdio $ ./scripts/analyze-migration.py -f migfile | grep array_len
Before series:
$ ./scripts/analyze-migration.py -f migfile | grep array_len
"cpreg_vmstate_array_len": "0x0000010a",
"cpreg_vmstate_array_len": "0x0000010a",After series:
$ ./scripts/analyze-migration.py -f migfile | grep array_len
"cpreg_vmstate_array_len": "0x000000df",
"cpreg_vmstate_array_len": "0x000000df",Re: [PATCH 14/33] hw/cpu/arm: Handle 'has_el2/3' properties once in MPCore parent
Quoted 82 lines · Fabiano Rosas
Quoted 65 lines · Philippe Mathieu-Daudé
Move the '
has_el2' and 'has_el3' properties to the abstract QOM parent.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/cpu/cortex_mpcore.h | 5 +++++ hw/arm/exynos4210.c | 10 ++++++++-- hw/arm/vexpress.c | 6 ++++++ hw/arm/xilinx_zynq.c | 6 ++++++ hw/cpu/a15mpcore.c | 18 ++++++------------ hw/cpu/a9mpcore.c | 5 +---- hw/cpu/cortex_mpcore.c | 3 +++ 7 files changed, 35 insertions(+), 18 deletions(-)include/hw/cpu/cortex_mpcore.h +5
-0@@ -30,6 +30,8 @@* QEMU interface: * + QOM property "num-cores" which set the number of cores present in * the cluster. +* + QOM properties "cpu-has-el3", "cpu-has-el2" which set whether the CPUs +* have the exception level features present. */ #define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv"OBJECT_DECLARE_TYPE (CortexMPPrivState, CortexMPPrivClass,CORTEX_MPCORE_PRIV )@@ -53,6 +55,9 @@ struct CortexMPPrivState {/* Properties */ uint32_t num_cores; + +bool cpu_has_el3; +bool cpu_has_el2; };hw/cpu/a9mpcore.c +1
-4@@ -51,7 +51,6 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)SysBusDevice *scubusdev, *gicbusdev, *gtimerbusdev, *mptimerbusdev, *wdtbusdev;Error *local_err =NULL ; -bool has_el3;CPUState *cpu0;Object *cpuobj;@@ -86,9 +85,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)/* Make the GIC's TZ support match the CPUs. We assume that * either all the CPUs have TZ, or none do. */ - has_el3 =object_property_find (cpuobj,"has_el3" ) && -object_property_get_bool (cpuobj,"has_el3" , &error_abort); -qdev_prop_set_bit (gicdev,"has-security-extensions" , has_el3); +qdev_prop_set_bit (gicdev,"has-security-extensions" , c->cpu_has_el3);if (!sysbus_realize (SYS_BUS_DEVICE (&s->gic), errp)) {return ;hw/cpu/cortex_mpcore.c +0
-0hw/cpu/cortex_mpcore.c static Property cortex_mpcore_priv_properties[] = { · line 31
Quoted 5 lines
hw/cpu/cortex_mpcore.c +2
-0@@ -27,6 +27,9 @@ static Property cortex_mpcore_priv_properties[] = {DEFINE_PROP_UINT32 ("num-cores" , CortexMPPrivState, num_cores,1 ),DEFINE_PROP_UINT32 ("num-cpu" , CortexMPPrivState, num_cores,1 ),/* alias */ +DEFINE_PROP_BOOL ("cpu-has-el3" , CortexMPPrivState, cpu_has_el3, true), + DEFINE_PROP_BOOL("cpu-has-el2", CortexMPPrivState, cpu_has_el2, false),Are we missing setting
cpu_has_el2somewhere else? This^ results in fewer cpregs being registered and is what breaks migration.You can test with:
$ (echo "migrate file:migfile"; echo "quit") | ./qemu-system-arm -M ast2600-evb -monitor stdio $ ./scripts/analyze-migration.py -f migfile | grep array_lenBefore series:
Quoted 8 lines
$ ./scripts/analyze-migration.py -f migfile | grep array_len "cpreg_vmstate_array_len": "0x0000010a", "cpreg_vmstate_array_len": "0x0000010a",After series:
$ ./scripts/analyze-migration.py -f migfile | grep array_len "cpreg_vmstate_array_len": "0x000000df", "cpreg_vmstate_array_len": "0x000000df",
Thank you Fabiano for helping debugging. Indeed there is a problem with properties, so this patch is bogus.
The good news is the QOM reparenting happened 2 commits earlier, so this discarded the doubts on qom-path change possibly affecting migration :)
Regards,
Phil.
PATCH 15/33 hw/cpu/arm: Handle 'gic-irq' property once in MPCore parent
In reply to Philippe Mathieu-DaudéMove the 'num-irq' property to the abstract QOM parent. Rename it as 'gic-irq', keeping it aliased as 'num-irq'.
--- include/hw/cpu/cortex_mpcore.h | 13 +++++++++---- hw/cpu/a15mpcore.c | 28 +++++++++++++--------------- hw/cpu/a9mpcore.c | 28 +++++++++++++--------------- hw/cpu/cortex_mpcore.c | 5 +++++ 4 files changed, 40 insertions(+), 34 deletions(-)
include/hw/cpu/cortex_mpcore.h +9 -4
@@ -32,6 +32,8 @@* the cluster. * + QOM properties "cpu-has-el3", "cpu-has-el2" which set whether the CPUs * have the exception level features present. +* + QOM property "gic-spi-num" sets the number of GIC Shared Peripheral +* Interrupts. */ #define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv"OBJECT_DECLARE_TYPE (CortexMPPrivState, CortexMPPrivClass,CORTEX_MPCORE_PRIV )
@@ -39,6 +41,8 @@ OBJECT_DECLARE_TYPE(CortexMPPrivState, CortexMPPrivClass, CORTEX_MPCORE_PRIV)/** * CortexMPPrivClass: * @container_size - size of the device's MMIO region +* @gic_spi_default - default number of GIC SPIs +* @gic_spi_max - maximum number of GIC SPIs */ struct CortexMPPrivClass {SysBusDeviceClass parent_class;
@@ -46,6 +50,9 @@ struct CortexMPPrivClass {DeviceRealize parent_realize;uint64_t container_size; + +unsigned gic_spi_default; +unsigned gic_spi_max; };struct CortexMPPrivState {
@@ -58,6 +65,8 @@ struct CortexMPPrivState {bool cpu_has_el3;bool cpu_has_el2; + +uint32_t gic_spi_num; };#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"
@@ -66,8 +75,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(A9MPPrivState, A9MPCORE_PRIV)struct A9MPPrivState {CortexMPPrivState parent_obj; -uint32_t num_irq; -A9SCUState scu;GICState gic;A9GTimerState gtimer;
@@ -81,8 +88,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(A15MPPrivState, A15MPCORE_PRIV)struct A15MPPrivState {CortexMPPrivState parent_obj; -uint32_t num_irq; -GICState gic; };
hw/cpu/a15mpcore.c +13 -15
@@ -61,7 +61,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) gicdev =DEVICE (&s->gic);qdev_prop_set_uint32 (gicdev,"num-cpu" , c->num_cores); -qdev_prop_set_uint32 (gicdev,"num-irq" , s->num_irq); +qdev_prop_set_uint32 (gicdev,"num-irq" , c->gic_spi_num);if (!kvm_irqchip_in_kernel ()) {/* Make the GIC's TZ support match the CPUs. We assume that
@@ -83,14 +83,14 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)sysbus_pass_irq (sbd, gicsbd);/* Pass through inbound GPIO lines to the GIC */ -qdev_init_gpio_in (dev, a15mp_priv_set_irq, s->num_irq -32 ); +qdev_init_gpio_in (dev, a15mp_priv_set_irq, c->gic_spi_num -32 );/* Wire the outputs from each CPU's generic timer to the * appropriate GIC PPI inputs */ for (i =0 ; i < c->num_cores; i++) {DeviceState *cpudev =DEVICE (qemu_get_cpu (i)); -int ppibase = s->num_irq -32 + i *32 ; +int ppibase = c->gic_spi_num -32 + i *32 ;int irq;/* Mapping from the output timer irq lines from the CPU to the * GIC PPI inputs used on the A15:
@@ -142,17 +142,6 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) } } -static Property a15mp_priv_properties[] = { -/* The Cortex-A15MP may have anything from 0 to 224 external interrupt -* IRQ lines (with another 32 internal). We default to 128+32, which -* is the number provided by the Cortex-A15MP test chip in the -* Versatile Express A15 development board. -* Other boards may differ and should set this property appropriately. -*/ -DEFINE_PROP_UINT32 ("num-irq" , A15MPPrivState, num_irq,160 ), -DEFINE_PROP_END_OF_LIST (), -}; -static void a15mp_priv_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -160,9 +149,18 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data) cc->container_size =0x8000 ; +/* +* The Cortex-A15MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 128+32, which +* is the number provided by the Cortex-A15MP test chip in the +* Versatile Express A15 development board. +* Other boards may differ and should set this property appropriately. +*/ + cc->gic_spi_default =160 ; + cc->gic_spi_max =224 ; +device_class_set_parent_realize (dc, a15mp_priv_realize, &cc->parent_realize); -device_class_set_props (dc, a15mp_priv_properties);/* We currently have no saveable state */ }
hw/cpu/a9mpcore.c +13 -15
@@ -78,7 +78,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) gicdev =DEVICE (&s->gic);qdev_prop_set_uint32 (gicdev,"num-cpu" , c->num_cores); -qdev_prop_set_uint32 (gicdev,"num-irq" , s->num_irq); +qdev_prop_set_uint32 (gicdev,"num-irq" , c->gic_spi_num);qdev_prop_set_uint32 (gicdev,"num-priority-bits" ,A9_GIC_NUM_PRIORITY_BITS );
@@ -96,7 +96,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)sysbus_pass_irq (sbd, gicbusdev);/* Pass through inbound GPIO lines to the GIC */ -qdev_init_gpio_in (dev, a9mp_priv_set_irq, s->num_irq -32 ); +qdev_init_gpio_in (dev, a9mp_priv_set_irq, c->gic_spi_num -32 ); gtimerdev =DEVICE (&s->gtimer);qdev_prop_set_uint32 (gtimerdev,"num-cpu" , c->num_cores);
@@ -150,7 +150,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)* timer is PPI 29 and the watchdog PPI 30. */ for (unsigned i =0 ; i < c->num_cores; i++) { -int ppibase = (s->num_irq -32 ) + i *32 ; +int ppibase = (c->gic_spi_num -32 ) + i *32 ;sysbus_connect_irq (gtimerbusdev, i,qdev_get_gpio_in (gicdev, ppibase +27 )); sysbus_connect_irq(mptimerbusdev, i,
@@ -160,17 +160,6 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) } } -static Property a9mp_priv_properties[] = { -/* The Cortex-A9MP may have anything from 0 to 224 external interrupt -* IRQ lines (with another 32 internal). We default to 64+32, which -* is the number provided by the Cortex-A9MP test chip in the -* Realview PBX-A9 and Versatile Express A9 development boards. -* Other boards may differ and should set this property appropriately. -*/ -DEFINE_PROP_UINT32 ("num-irq" , A9MPPrivState, num_irq,96 ), -DEFINE_PROP_END_OF_LIST (), -}; -static void a9mp_priv_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -178,8 +167,17 @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data) cc->container_size =0x2000 ; +/* +* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ + cc->gic_spi_default =96 ; + cc->gic_spi_max =224 ; +device_class_set_parent_realize (dc, a9mp_priv_realize, &cc->parent_realize); -device_class_set_props (dc, a9mp_priv_properties); }static const TypeInfo a9mp_types[] = {
hw/cpu/cortex_mpcore.c +5 -0
@@ -21,6 +21,8 @@ static void cortex_mpcore_priv_instance_init(Object *obj)memory_region_init (&s->container, obj,"mpcore-priv-container" , k->container_size);sysbus_init_mmio (sbd, &s->container); + + s->gic_spi_num = k->gic_spi_default; }static Property cortex_mpcore_priv_properties[] = {
@@ -30,6 +32,9 @@ static Property cortex_mpcore_priv_properties[] = {DEFINE_PROP_BOOL ("cpu-has-el3" , CortexMPPrivState, cpu_has_el3, true),DEFINE_PROP_BOOL ("cpu-has-el2" , CortexMPPrivState, cpu_has_el2, false), +DEFINE_PROP_UINT32 ("gic-spi-num" , CortexMPPrivState, gic_spi_num,0 ), +DEFINE_PROP_UINT32 ("num-irq" , CortexMPPrivState, gic_spi_num,0 ),/* alias */ + DEFINE_PROP_END_OF_LIST(), };
Signature · 1 line
2.41.0
PATCH 16/33 hw/cpu/arm: Handle GIC once in MPCore parent
In reply to Philippe Mathieu-DaudéMove the GIC instance creation to the abstract QOM parent.
--- include/hw/cpu/cortex_mpcore.h | 31 +++++++++++++++++-- hw/cpu/a15mpcore.c | 56 ++++------------------------------ hw/cpu/a9mpcore.c | 43 +++++--------------------- hw/cpu/cortex_mpcore.c | 46 ++++++++++++++++++++++++++++ hw/arm/Kconfig | 3 +- 5 files changed, 88 insertions(+), 91 deletions(-)
include/hw/cpu/cortex_mpcore.h +28 -3
@@ -34,6 +34,28 @@* have the exception level features present. * + QOM property "gic-spi-num" sets the number of GIC Shared Peripheral * Interrupts. +* QEMU interface forwarded from the GIC: +* + unnamed GPIO inputs: (where P is number of GIC SPIs, i.e. num-irq - 32) +* [0..P-1] GIC SPIs +* [P..P+31] PPIs for CPU 0 +* [P+32..P+63] PPIs for CPU 1 +* ... +* + sysbus output IRQs: (in order; number will vary depending on number of +* cores) +* - IRQ for CPU 0 +* - IRQ for CPU 1 +* ... +* - FIQ for CPU 0 +* - FIQ for CPU 1 +* ... +* - VIRQ for CPU 0 (exists even if virt extensions not present) +* - VIRQ for CPU 1 (exists even if virt extensions not present) +* ... +* - VFIQ for CPU 0 (exists even if virt extensions not present) +* - VFIQ for CPU 1 (exists even if virt extensions not present) +* ... +* - maintenance IRQ for CPU i/f 0 (only if virt extensions present) +* - maintenance IRQ for CPU i/f 1 (only if virt extensions present) */ #define TYPE_CORTEX_MPCORE_PRIV "cortex_mpcore_priv"OBJECT_DECLARE_TYPE (CortexMPPrivState, CortexMPPrivClass,CORTEX_MPCORE_PRIV )
@@ -41,8 +63,10 @@ OBJECT_DECLARE_TYPE(CortexMPPrivState, CortexMPPrivClass, CORTEX_MPCORE_PRIV)/** * CortexMPPrivClass: * @container_size - size of the device's MMIO region +* @gic_class_name - GIC QOM class name * @gic_spi_default - default number of GIC SPIs * @gic_spi_max - maximum number of GIC SPIs +* @gic_revision - revision of the GIC */ struct CortexMPPrivClass {SysBusDeviceClass parent_class;
@@ -51,14 +75,18 @@ struct CortexMPPrivClass {uint64_t container_size; +const char *gic_class_name;unsigned gic_spi_default;unsigned gic_spi_max; +unsigned gic_revision; +uint32_t gic_priority_bits; };struct CortexMPPrivState {SysBusDevice parent_obj;MemoryRegion container; +GICState gic;/* Properties */ uint32_t num_cores;
@@ -76,7 +104,6 @@ struct A9MPPrivState {CortexMPPrivState parent_obj;A9SCUState scu; -GICState gic;A9GTimerState gtimer;ARMMPTimerState mptimer;ARMMPTimerState wdt;
@@ -87,8 +114,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(A15MPPrivState, A15MPCORE_PRIV)struct A15MPPrivState {CortexMPPrivState parent_obj; - -GICState gic; };#endif
hw/cpu/a15mpcore.c +6 -50
85 lines not on this page · raw message
hw/cpu/a9mpcore.c +7 -36
80 lines not on this page · raw message
hw/cpu/cortex_mpcore.c +46 -0
64 lines not on this page · raw message
hw/arm/Kconfig +1 -2
@@ -645,19 +645,18 @@ config ZAURUS config CORTEX_MPCORE bool + select ARM_GIC config A9MPCORE bool select CORTEX_MPCORE select A9_GTIMER select A9SCU # snoop control unit - select ARM_GIC select ARM_MPTIMER config A15MPCORE bool select CORTEX_MPCORE - select ARM_GIC config ARM11MPCORE bool
Signature · 1 line
2.41.0
PATCH 17/33 hw/cpu/arm: Document more properties of CORTEX_MPCORE_PRIV QOM type
In reply to Philippe Mathieu-Daudé--- include/hw/cpu/cortex_mpcore.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/hw/cpu/cortex_mpcore.h +7 -0
@@ -28,10 +28,17 @@* some timers and watchdogs * * QEMU interface: +* + QOM property "cluster-id" which set the cluster ID and its affinity. * + QOM property "num-cores" which set the number of cores present in * the cluster. +* + QOM property "cpu-type" is the CPU model typename. * + QOM properties "cpu-has-el3", "cpu-has-el2" which set whether the CPUs * have the exception level features present. +* + QOM properties "cpu-has-vfp-d32", "cpu-has-neon" which set whether the +* CPUs have the FPU features present. +* + QOM property "cpu-freq-hz" is the frequency of each core +* + QOM property "cpu-memory" is a MemoryRegion containing the devices +* provided by the board model. * + QOM property "gic-spi-num" sets the number of GIC Shared Peripheral * Interrupts. * QEMU interface forwarded from the GIC:
Signature · 1 line
2.41.0
PATCH 18/33 hw/cpu/arm: Replace A15MPPrivState by CortexMPPrivState
In reply to Philippe Mathieu-DaudéA15MPPrivState doesn't contain anything else but its parent, CortexMPPrivState. Remove it in favor of the parent.
--- include/hw/arm/aspeed_soc.h | 2 +- include/hw/arm/fsl-imx6ul.h | 2 +- include/hw/arm/fsl-imx7.h | 2 +- include/hw/cpu/cortex_mpcore.h | 5 ----- hw/cpu/a15mpcore.c | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-)
include/hw/arm/aspeed_soc.h +1 -1
@@ -108,7 +108,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState, ASPEED2400_SOC)struct Aspeed2600SoCState {AspeedSoCState parent; -A15MPPrivState a7mpcore; +CortexMPPrivState a7mpcore;ARMCPU cpu[ASPEED_CPUS_NUM ];/* XXX belong to a7mpcore */ };
include/hw/arm/fsl-imx6ul.h +1 -1
@@ -68,7 +68,7 @@ struct FslIMX6ULState {/*< public >*/ ARMCPU cpu; -A15MPPrivState a7mpcore; +CortexMPPrivState a7mpcore;IMXGPTState gpt[FSL_IMX6UL_NUM_GPTS ];IMXEPITState epit[FSL_IMX6UL_NUM_EPITS ];IMXGPIOState gpio[FSL_IMX6UL_NUM_GPIOS ];
include/hw/arm/fsl-imx7.h +1 -1
@@ -68,7 +68,7 @@ struct FslIMX7State {/*< public >*/ ARMCPU cpu[FSL_IMX7_NUM_CPUS ]; -A15MPPrivState a7mpcore; +CortexMPPrivState a7mpcore;IMXGPTState gpt[FSL_IMX7_NUM_GPTS ];IMXGPIOState gpio[FSL_IMX7_NUM_GPIOS ];IMX7CCMState ccm;
include/hw/cpu/cortex_mpcore.h +0 -5
@@ -117,10 +117,5 @@ struct A9MPPrivState { };#define TYPE_A15MPCORE_PRIV "a15mpcore_priv" -OBJECT_DECLARE_SIMPLE_TYPE(A15MPPrivState, A15MPCORE_PRIV) - -struct A15MPPrivState { -CortexMPPrivState parent_obj; -};#endif
hw/cpu/a15mpcore.c +1 -1
@@ -125,7 +125,7 @@ static const TypeInfo a15mp_types[] = { { .name = TYPE_A15MPCORE_PRIV, .parent = TYPE_CORTEX_MPCORE_PRIV, - .instance_size = sizeof(A15MPPrivState), + .instance_size = sizeof(CortexMPPrivState), .class_init = a15mp_priv_class_init, }, };
Signature · 1 line
2.41.0
PATCH 19/33 hw/cpu/arm: Introduce TYPE_A7MPCORE_PRIV for Cortex-A7 MPCore
In reply to Philippe Mathieu-DaudéFor QEMU modelling, the only difference between the A15 and A7 MPCore is the latter can have up to 480 SPIs.
In particular, since commit b151de69f6 ("hw/arm: ast2600: Set AST2600_MAX_IRQ to value from datasheet") the AST2600 machine initializes its GIC with 256 SPIs, which is more than the 224 maximum of the A15.
Since the A7 was not available, few boards were using the A15. Replace them by a A7 MPCore.
---
The comment in a7mp_priv_class_init() is a bit off.
--- include/hw/cpu/cortex_mpcore.h | 2 ++ hw/arm/aspeed_ast2600.c | 3 +-- hw/arm/fsl-imx6ul.c | 3 +-- hw/arm/fsl-imx7.c | 3 +-- hw/cpu/a15mpcore.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 35 insertions(+), 6 deletions(-)
include/hw/cpu/cortex_mpcore.h +2 -0
@@ -118,4 +118,6 @@ struct A9MPPrivState {#define TYPE_A15MPCORE_PRIV "a15mpcore_priv" +#define TYPE_A7MPCORE_PRIV "a7mpcore_priv" +#endif
hw/arm/aspeed_ast2600.c +1 -2
@@ -171,8 +171,7 @@ static void aspeed_soc_ast2600_init(Object *obj)object_property_add_alias (obj,"hw-prot-key" ,OBJECT (&s->scu),"hw-prot-key" ); -object_initialize_child (obj,"a7mpcore" , &a->a7mpcore, -TYPE_A15MPCORE_PRIV ); +object_initialize_child (obj,"a7mpcore" , &a->a7mpcore,TYPE_A7MPCORE_PRIV );object_initialize_child (obj,"rtc" , &s->rtc,TYPE_ASPEED_RTC );
hw/arm/fsl-imx6ul.c +1 -2
@@ -40,8 +40,7 @@ static void fsl_imx6ul_init(Object *obj)/* * A7MPCORE */ -object_initialize_child (obj,"a7mpcore" , &s->a7mpcore, -TYPE_A15MPCORE_PRIV ); +object_initialize_child (obj,"a7mpcore" , &s->a7mpcore,TYPE_A7MPCORE_PRIV );/* * CCM
hw/arm/fsl-imx7.c +1 -2
@@ -48,8 +48,7 @@ static void fsl_imx7_init(Object *obj)/* * A7MPCORE */ -object_initialize_child (obj,"a7mpcore" , &s->a7mpcore, -TYPE_A15MPCORE_PRIV ); +object_initialize_child (obj,"a7mpcore" , &s->a7mpcore,TYPE_A7MPCORE_PRIV );/* * GPIOs
hw/cpu/a15mpcore.c +30 -0
@@ -121,6 +121,30 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data)/* We currently have no saveable state */ } +static void a7mp_priv_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +CortexMPPrivClass *cc =CORTEX_MPCORE_PRIV_CLASS (klass); + + cc->container_size =0x8000 ; + + cc->gic_class_name =gic_class_name (); + cc->gic_revision =2 ; +/* +* The Cortex-A7MP may have anything from 0 to 480 external interrupt +* IRQ lines (with another 32 internal). We default to 128+32, which +* is the number provided by the Cortex-A15MP test chip in the +* Versatile Express A15 development board. +* Other boards may differ and should set this property appropriately. +*/ + cc->gic_spi_default =160 ; + cc->gic_spi_max =480 ; + +device_class_set_parent_realize (dc, a15mp_priv_realize, + &cc->parent_realize); +/* We currently have no saveable state */ +} +static const TypeInfo a15mp_types[] = { { .name =TYPE_A15MPCORE_PRIV ,
@@ -128,6 +152,12 @@ static const TypeInfo a15mp_types[] = { .instance_size = sizeof(CortexMPPrivState), .class_init = a15mp_priv_class_init, }, + { + .name = TYPE_A7MPCORE_PRIV, + .parent = TYPE_CORTEX_MPCORE_PRIV, + .instance_size = sizeof(CortexMPPrivState), + .class_init = a7mp_priv_class_init, + }, };DEFINE_TYPES (a15mp_types)
Signature · 1 line
2.41.0
PATCH 20/33 hw/cpu/arm: Consolidate check on max GIC spi supported
In reply to Philippe Mathieu-Daudé--- hw/cpu/cortex_mpcore.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/cpu/cortex_mpcore.c +7 -0
@@ -43,6 +43,13 @@ static void cortex_mpcore_priv_realize(DeviceState *dev, Error **errp)CortexMPPrivClass *k =CORTEX_MPCORE_PRIV_GET_CLASS (dev);DeviceState *gicdev =DEVICE (&s->gic); +if (s->gic_spi_num > k->gic_spi_max) { +error_setg (errp, +"At most %u GIC SPI are supported (requested %u)" , + k->gic_spi_max, s->gic_spi_num); +return ; + } +qdev_prop_set_uint32 (gicdev,"num-cpu" , s->num_cores);qdev_prop_set_uint32 (gicdev,"num-irq" , s->gic_spi_num);if (k->gic_priority_bits) {
Signature · 1 line
2.41.0
PATCH 21/33 hw/cpu/arm: Create CPUs once in MPCore parent
In reply to Philippe Mathieu-DaudéAdd support for creating the MPCore CPU cluster in the abstract TYPE_CORTEX_MPCORE_PRIV parent realize() handler.
Only do so if the 'cpu-type' property is set, so current behavior is not modified. Boards will be converted by setting this property.
--- include/hw/cpu/cortex_mpcore.h | 12 +++++ hw/cpu/cortex_mpcore.c | 88 ++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+)
include/hw/cpu/cortex_mpcore.h +12 -0
@@ -16,6 +16,7 @@#include "hw/misc/a9scu.h" #include "hw/timer/a9gtimer.h" #include "hw/timer/arm_mptimer.h" +#include "target/arm/cpu-qom.h" /* * This is a model of the Arm Cortex-A MPCore family of hardware.
@@ -93,13 +94,24 @@ struct CortexMPPrivState {SysBusDevice parent_obj;MemoryRegion container; +ARMCPU *cpu[4 ];GICState gic;/* Properties */ +uint8_t cluster_id;uint32_t num_cores; +char *cpu_type;bool cpu_has_el3;bool cpu_has_el2; +bool cpu_has_vfp_d32; +bool cpu_has_neon; +uint64_t cpu_freq_hz; +uint64_t cpu_midr; +uint32_t cpu_psci_conduit; +uint64_t cpu_reset_cbar; +bool cpu_reset_hivecs; +MemoryRegion *cpu_memory;uint32_t gic_spi_num; };
hw/cpu/cortex_mpcore.c +88 -0
114 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH 22/33 hw/arm/aspeed_ast2600: Let the A7MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the a7mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- include/hw/arm/aspeed_soc.h | 1 - hw/arm/aspeed_ast2600.c | 58 ++++++++++++------------------------- 2 files changed, 18 insertions(+), 41 deletions(-)
include/hw/arm/aspeed_soc.h +0 -1
@@ -109,7 +109,6 @@ struct Aspeed2600SoCState {AspeedSoCState parent;CortexMPPrivState a7mpcore; -ARMCPU cpu[ASPEED_CPUS_NUM ];/* XXX belong to a7mpcore */ };#define TYPE_ASPEED2600_SOC "aspeed2600-soc"
hw/arm/aspeed_ast2600.c +18 -40
94 lines not on this page · raw message
Signature · 1 line
2.41.0
Re: [PATCH 22/33] hw/arm/aspeed_ast2600: Let the A7MPcore create/wire the CPU cores
Quoted 4 lines · Philippe Mathieu-Daudé
Set the properties on the a7mpcore object to let it create and wire the CPU cores. Remove the redundant code.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
PATCH 23/33 hw/arm/exynos4210: Let the A9MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the a9mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- include/hw/arm/exynos4210.h | 4 +-- hw/arm/exynos4210.c | 62 +++++++++++++------------------------ hw/arm/exynos4_boards.c | 6 ++-- 3 files changed, 26 insertions(+), 46 deletions(-)
include/hw/arm/exynos4210.h +1 -3
@@ -83,10 +83,8 @@#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38)struct Exynos4210State { -/*< private >*/ SysBusDevice parent_obj; -/*< public >*/ -ARMCPU *cpu[EXYNOS4210_NCPUS ]; +qemu_irq irq_table[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ ];MemoryRegion chipid_mem;
hw/arm/exynos4210.c +21 -41
82 lines not on this page · raw message
hw/arm/exynos4_boards.c +4 -2
@@ -136,18 +136,20 @@ static void nuri_init(MachineState *machine) {Exynos4BoardState *s =exynos4_boards_init_common (machine,EXYNOS4_BOARD_NURI ); +CortexMPPrivState *mp =CORTEX_MPCORE_PRIV (&s->soc.a9mpcore); -arm_load_kernel (s->soc.cpu[0 ], machine, &exynos4_board_binfo); +arm_load_kernel (mp->cpu[0 ], machine, &exynos4_board_binfo); }static void smdkc210_init (MachineState *machine) {Exynos4BoardState *s =exynos4_boards_init_common (machine,EXYNOS4_BOARD_SMDKC210 ); +CortexMPPrivState *mp =CORTEX_MPCORE_PRIV (&s->soc.a9mpcore);lan9215_init (SMDK_LAN9118_BASE_ADDR ,qemu_irq_invert (s->soc.irq_table[exynos4210_get_irq (37 ,1 )])); -arm_load_kernel (s->soc.cpu[0 ], machine, &exynos4_board_binfo); +arm_load_kernel (mp->cpu[0 ], machine, &exynos4_board_binfo); }static void nuri_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.41.0
PATCH 24/33 hw/arm/fsl-imx6: Let the A9MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the a9mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- include/hw/arm/fsl-imx6.h | 4 ---- hw/arm/fsl-imx6.c | 47 +++++++-------------------------------- hw/arm/sabrelite.c | 4 +++- 3 files changed, 11 insertions(+), 44 deletions(-)
include/hw/arm/fsl-imx6.h +0 -4
@@ -33,7 +33,6 @@#include "hw/usb/chipidea.h" #include "hw/usb/imx-usb-phy.h" #include "exec/memory.h" -#include "cpu.h" #include "qom/object.h" #define TYPE_FSL_IMX6 "fsl-imx6"
@@ -51,11 +50,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(FslIMX6State, FSL_IMX6)#define FSL_IMX6_NUM_USBS 4struct FslIMX6State { -/*< private >*/ DeviceState parent_obj; -/*< public >*/ -ARMCPU cpu[FSL_IMX6_NUM_CPUS ];A9MPPrivState a9mpcore;IMX6CCMState ccm;IMX6SRCState src;
hw/arm/fsl-imx6.c +8 -39
74 lines not on this page · raw message
hw/arm/sabrelite.c +3 -1
@@ -99,7 +99,9 @@ static void sabrelite_init(MachineState *machine) sabrelite_binfo.secondary_cpu_reset_hook = sabrelite_reset_secondary;if (!qtest_enabled ()) { -arm_load_kernel (&s->cpu[0 ], machine, &sabrelite_binfo); +CortexMPPrivState *mp =CORTEX_MPCORE_PRIV (&s->a9mpcore); + +arm_load_kernel (mp->cpu[0 ], machine, &sabrelite_binfo); } }
Signature · 1 line
2.41.0
PATCH 25/33 hw/arm/fsl-imx6ul: Let the A7MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the a7mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- include/hw/arm/fsl-imx6ul.h | 4 ---- hw/arm/fsl-imx6ul.c | 24 ++++++------------------ hw/arm/mcimx6ul-evk.c | 3 ++- 3 files changed, 8 insertions(+), 23 deletions(-)
include/hw/arm/fsl-imx6ul.h +0 -4
@@ -34,7 +34,6 @@#include "hw/usb/chipidea.h" #include "hw/usb/imx-usb-phy.h" #include "exec/memory.h" -#include "cpu.h" #include "qom/object.h" #include "qemu/units.h"
@@ -63,11 +62,8 @@ enum FslIMX6ULConfiguration { };struct FslIMX6ULState { -/*< private >*/ DeviceState parent_obj; -/*< public >*/ -ARMCPU cpu;CortexMPPrivState a7mpcore;IMXGPTState gpt[FSL_IMX6UL_NUM_GPTS ];IMXEPITState epit[FSL_IMX6UL_NUM_EPITS ];
hw/arm/fsl-imx6ul.c +6 -18
@@ -25,6 +25,7 @@#include "sysemu/sysemu.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "target/arm/cpu.h" /* qom */ #define NAME_SIZE 20
@@ -34,9 +35,6 @@ static void fsl_imx6ul_init(Object *obj)char name[NAME_SIZE ];int i; -object_initialize_child (obj,"cpu0" , &s->cpu, -ARM_CPU_TYPE_NAME ("cortex-a7" )); -/* * A7MPCORE */
@@ -158,8 +156,6 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)DeviceState *gic;int i;char name[NAME_SIZE ]; -SysBusDevice *sbd; -DeviceState *d;if (ms->smp.cpus >1 ) { error_setg(errp, "%s: Only a single CPU is supported (%d requested)",
@@ -167,26 +163,18 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)return ; } -qdev_realize (DEVICE (&s->cpu),NULL , &error_abort); -/* * A7MPCORE */ -object_property_set_int (OBJECT (&s->a7mpcore),"num-cores" ,1 , &error_abort); -object_property_set_int (OBJECT (&s->a7mpcore),"num-irq" , -FSL_IMX6UL_MAX_IRQ +GIC_INTERNAL , &error_abort); +qdev_prop_set_uint32 (DEVICE (&s->a7mpcore),"num-cores" ,1 ); +qdev_prop_set_string (DEVICE (&s->a7mpcore),"cpu-type" , +ARM_CPU_TYPE_NAME ("cortex-a7" )); +qdev_prop_set_uint32 (DEVICE (&s->a7mpcore),"gic-spi-num" , +FSL_IMX6UL_MAX_IRQ +GIC_INTERNAL );sysbus_realize (SYS_BUS_DEVICE (&s->a7mpcore), &error_abort);sysbus_mmio_map (SYS_BUS_DEVICE (&s->a7mpcore),0 ,FSL_IMX6UL_A7MPCORE_ADDR ); gic =DEVICE (&s->a7mpcore); - sbd =SYS_BUS_DEVICE (&s->a7mpcore); - d =DEVICE (&s->cpu); - -sysbus_connect_irq (sbd,0 ,qdev_get_gpio_in (d,ARM_CPU_IRQ )); -sysbus_connect_irq (sbd,1 ,qdev_get_gpio_in (d,ARM_CPU_FIQ )); -sysbus_connect_irq (sbd,2 ,qdev_get_gpio_in (d,ARM_CPU_VIRQ )); -sysbus_connect_irq (sbd,3 ,qdev_get_gpio_in (d,ARM_CPU_VFIQ )); -/* * A7MPCORE DAP */
hw/arm/mcimx6ul-evk.c +2 -1
@@ -18,6 +18,7 @@#include "hw/qdev-properties.h" #include "qemu/error-report.h" #include "sysemu/qtest.h" +#include "target/arm/cpu.h" /* qom */ static void mcimx6ul_evk_init (MachineState *machine) {
@@ -64,7 +65,7 @@ static void mcimx6ul_evk_init(MachineState *machine) }if (!qtest_enabled ()) { -arm_load_kernel (&s->cpu, machine, &boot_info); +arm_load_kernel (s->a7mpcore.cpu[0 ], machine, &boot_info); } }
Signature · 1 line
2.41.0
PATCH 26/33 hw/arm/fsl-imx7: Let the A7MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the a7mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- include/hw/arm/fsl-imx7.h | 4 --- hw/arm/fsl-imx7.c | 62 +++++---------------------------------- hw/arm/mcimx7d-sabre.c | 3 +- 3 files changed, 10 insertions(+), 59 deletions(-)
include/hw/arm/fsl-imx7.h +0 -4
@@ -36,7 +36,6 @@#include "hw/net/imx_fec.h" #include "hw/pci-host/designware.h" #include "hw/usb/chipidea.h" -#include "cpu.h" #include "qom/object.h" #include "qemu/units.h"
@@ -63,11 +62,8 @@ enum FslIMX7Configuration { };struct FslIMX7State { -/*< private >*/ DeviceState parent_obj; -/*< public >*/ -ARMCPU cpu[FSL_IMX7_NUM_CPUS ];CortexMPPrivState a7mpcore;IMXGPTState gpt[FSL_IMX7_NUM_GPTS ];IMXGPIOState gpio[FSL_IMX7_NUM_GPIOS ];
hw/arm/fsl-imx7.c +8 -54
96 lines not on this page · raw message
hw/arm/mcimx7d-sabre.c +2 -1
@@ -20,6 +20,7 @@#include "hw/qdev-properties.h" #include "qemu/error-report.h" #include "sysemu/qtest.h" +#include "target/arm/cpu.h" /* qom */ static void mcimx7d_sabre_init (MachineState *machine) {
@@ -64,7 +65,7 @@ static void mcimx7d_sabre_init(MachineState *machine) }if (!qtest_enabled ()) { -arm_load_kernel (&s->cpu[0 ], machine, &boot_info); +arm_load_kernel (s->a7mpcore.cpu[0 ], machine, &boot_info); } }
Signature · 1 line
2.41.0
PATCH 27/33 hw/arm/highbank: Let the A9/A15MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- hw/arm/highbank.c | 53 +++++++---------------------------------------- 1 file changed, 8 insertions(+), 45 deletions(-)
hw/arm/highbank.c +8 -45
@@ -180,47 +180,10 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)SysBusDevice *busdev;qemu_irq pic[128 ];int n; -unsigned int smp_cpus = machine->smp.cpus; -qemu_irq cpu_irq[4 ]; -qemu_irq cpu_fiq[4 ]; -qemu_irq cpu_virq[4 ]; -qemu_irq cpu_vfiq[4 ];MemoryRegion *sysram;MemoryRegion *sysmem;char *sysboot_filename; -switch (machine_id) { -case CALXEDA_HIGHBANK : - machine->cpu_type =ARM_CPU_TYPE_NAME ("cortex-a9" ); -break ; -case CALXEDA_MIDWAY : - machine->cpu_type =ARM_CPU_TYPE_NAME ("cortex-a15" ); -break ; -default : -assert (0 ); - } - -for (n =0 ; n < smp_cpus; n++) { -Object *cpuobj; -ARMCPU *cpu; - - cpuobj =object_new (machine->cpu_type); - cpu =ARM_CPU (cpuobj); - -object_property_set_int (cpuobj,"psci-conduit" ,QEMU_PSCI_CONDUIT_SMC , - &error_abort); - -if (object_property_find (cpuobj,"reset-cbar" )) { -object_property_set_int (cpuobj,"reset-cbar" ,MPCORE_PERIPHBASE , - &error_abort); - } -qdev_realize (DEVICE (cpuobj),NULL , &error_fatal); - cpu_irq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_IRQ ); - cpu_fiq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_FIQ ); - cpu_virq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_VIRQ ); - cpu_vfiq[n] =qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_VFIQ ); - } - sysmem =get_system_memory ();/* SDRAM at address zero. */ memory_region_add_subregion (sysmem,0 , machine->ram);
@@ -251,22 +214,22 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)sysbus_mmio_map (busdev,0 ,0xfff12000 ); dev =qdev_new (TYPE_A9MPCORE_PRIV ); +qdev_prop_set_string (dev,"cpu-type" ,ARM_CPU_TYPE_NAME ("cortex-a9" ));break ;case CALXEDA_MIDWAY : dev =qdev_new (TYPE_A15MPCORE_PRIV ); +qdev_prop_set_string (dev,"cpu-type" ,ARM_CPU_TYPE_NAME ("cortex-a15" ));break ; +default : +g_assert_not_reached (); } -qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); -qdev_prop_set_uint32 (dev,"num-irq" ,NIRQ_GIC ); +qdev_prop_set_uint32 (dev,"num-cores" , machine->smp.cpus); +qdev_prop_set_uint32 (dev,"cpu-psci-conduit" ,QEMU_PSCI_CONDUIT_SMC ); +qdev_prop_set_uint64 (dev,"cpu-reset-cbar" ,MPCORE_PERIPHBASE ); +qdev_prop_set_uint32 (dev,"gic-spi-num" ,NIRQ_GIC ); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,MPCORE_PERIPHBASE ); -for (n =0 ; n < smp_cpus; n++) { -sysbus_connect_irq (busdev, n, cpu_irq[n]); -sysbus_connect_irq (busdev, n + smp_cpus, cpu_fiq[n]); -sysbus_connect_irq (busdev, n +2 * smp_cpus, cpu_virq[n]); -sysbus_connect_irq (busdev, n +3 * smp_cpus, cpu_vfiq[n]); - }for (n =0 ; n <128 ; n++) { pic[n] =qdev_get_gpio_in (dev, n);
Signature · 1 line
2.41.0
PATCH 28/33 hw/arm/vexpress: Let the A9/A15MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- hw/arm/vexpress.c | 51 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 45 deletions(-)
hw/arm/vexpress.c +6 -45
@@ -210,45 +210,19 @@ static void init_cpus(MachineState *ms, const char *cpu_type, qemu_irq *pic, bool secure, bool virt) { DeviceState *dev; -SysBusDevice *busdev; -int n; -unsigned int smp_cpus = ms->smp.cpus; -/* Create the actual CPUs */ -for (n =0 ; n < smp_cpus; n++) { -Object *cpuobj =object_new (cpu_type); - -if (!secure) { -object_property_set_bool (cpuobj,"has_el3" , false,NULL ); - } -if (!virt) { -if (object_property_find (cpuobj,"has_el2" )) { -object_property_set_bool (cpuobj,"has_el2" , false,NULL ); - } - } - -if (object_property_find (cpuobj,"reset-cbar" )) { -object_property_set_int (cpuobj,"reset-cbar" , periphbase, - &error_abort); - } -qdev_realize (DEVICE (cpuobj),NULL , &error_fatal); - } - -/* Create the private peripheral devices (including the GIC); -* this must happen after the CPUs are created because a15mpcore_priv -* wires itself up to the CPU's generic_timer gpio out lines. -*/ dev =qdev_new (privdev); +qdev_prop_set_uint32 (dev,"num-cores" , ms->smp.cpus); +qdev_prop_set_string (dev,"cpu-type" , cpu_type);if (!secure) {qdev_prop_set_bit (dev,"cpu-has-el3" , false); }if (!virt) {qdev_prop_set_bit (dev,"cpu-has-el2" , false); } -qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); - busdev =SYS_BUS_DEVICE (dev); -sysbus_realize_and_unref (busdev, &error_fatal); -sysbus_mmio_map (busdev,0 , periphbase); +qdev_prop_set_uint64 (dev,"cpu-reset-cbar" , periphbase); +sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 , periphbase);/* Interrupts [42:0] are from the motherboard; * [47:43] are reserved; [63:48] are daughterboard
@@ -256,22 +230,9 @@ static void init_cpus(MachineState *ms, const char *cpu_type,* external interrupts starting from 32 (because there * are internal interrupts 0..31). */ -for (n =0 ; n <64 ; n++) { +for (int n =0 ; n <64 ; n++) { pic[n] =qdev_get_gpio_in (dev, n); } - -/* Connect the CPUs to the GIC */ -for (n =0 ; n < smp_cpus; n++) { -DeviceState *cpudev =DEVICE (qemu_get_cpu (n)); - -sysbus_connect_irq (busdev, n,qdev_get_gpio_in (cpudev,ARM_CPU_IRQ )); -sysbus_connect_irq (busdev, n + smp_cpus, -qdev_get_gpio_in (cpudev,ARM_CPU_FIQ )); -sysbus_connect_irq (busdev, n +2 * smp_cpus, -qdev_get_gpio_in (cpudev,ARM_CPU_VIRQ )); -sysbus_connect_irq (busdev, n +3 * smp_cpus, -qdev_get_gpio_in (cpudev,ARM_CPU_VFIQ )); - } } static void a9_daughterboard_init(VexpressMachineState *vms,
Signature · 1 line
2.41.0
PATCH 29/33 hw/arm/xilinx_zynq: Let the A9MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- hw/arm/xilinx_zynq.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
hw/arm/xilinx_zynq.c +5 -17
@@ -192,22 +192,6 @@ static void zynq_init(MachineState *machine)exit (EXIT_FAILURE ); } - cpu =ARM_CPU (object_new (machine->cpu_type)); - -/* By default A9 CPUs have EL3 enabled. This board does not -* currently support EL3 so the CPU EL3 property is disabled before -* realization. -*/ -if (object_property_find (OBJECT (cpu),"has_el3" )) { -object_property_set_bool (OBJECT (cpu),"has_el3" , false, &error_fatal); - } - -object_property_set_int (OBJECT (cpu),"midr" ,ZYNQ_BOARD_MIDR , - &error_fatal); -object_property_set_int (OBJECT (cpu),"reset-cbar" ,MPCORE_PERIPHBASE , - &error_fatal); -qdev_realize (DEVICE (cpu),NULL , &error_fatal); -/* DDR remapped to address zero. */ memory_region_add_subregion (address_space_mem,0 , machine->ram);
@@ -239,15 +223,19 @@ static void zynq_init(MachineState *machine)sysbus_mmio_map (SYS_BUS_DEVICE (slcr),0 ,0xF8000000 ); dev =qdev_new (TYPE_A9MPCORE_PRIV ); -qdev_prop_set_uint32 (dev,"num-cpu" ,1 ); +qdev_prop_set_uint32 (dev,"num-cores" ,1 ); +qdev_prop_set_string (dev,"cpu-type" , machine->cpu_type);/* * By default A9 CPUs have EL3 enabled. This board does not * currently support EL3 so the CPU EL3 property is disabled before * realization. */ qdev_prop_set_bit (dev,"cpu-has-el3" , false); +qdev_prop_set_uint64 (dev,"cpu-reset-cbar" ,MPCORE_PERIPHBASE ); +qdev_prop_set_uint64 (dev,"cpu-midr" ,ZYNQ_BOARD_MIDR ); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal); + cpu =CORTEX_MPCORE_PRIV (dev)->cpu[0 ];sysbus_mmio_map (busdev,0 ,MPCORE_PERIPHBASE );sysbus_connect_irq (busdev,0 ,qdev_get_gpio_in (DEVICE (cpu),ARM_CPU_IRQ ));
Signature · 1 line
2.41.0
PATCH 30/33 hw/arm/npcm7xx: Let the A9MPcore create/wire the CPU cores
In reply to Philippe Mathieu-DaudéSet the properties on the mpcore object to let it create and wire the CPU cores. Remove the redundant code.
--- include/hw/arm/npcm7xx.h | 1 - hw/arm/npcm7xx.c | 48 ++++++++++------------------------------ 2 files changed, 12 insertions(+), 37 deletions(-)
include/hw/arm/npcm7xx.h +0 -1
@@ -80,7 +80,6 @@ typedef struct NPCM7xxMachineClass {struct NPCM7xxState {DeviceState parent; -ARMCPU cpu[NPCM7XX_MAX_NUM_CPUS ];A9MPPrivState a9mpcore;MemoryRegion sram;
hw/arm/npcm7xx.c +12 -36
72 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH 31/33 hw/cpu/a9mpcore: Remove legacy code
In reply to Philippe Mathieu-DaudéNow that all boards set the "cpu-type" property,
the legacy code can be removed.
--- hw/cpu/a9mpcore.c | 8 +++----- hw/cpu/cortex_mpcore.c | 8 +++++--- 2 files changed, 8 insertions(+), 8 deletions(-)
hw/cpu/a9mpcore.c +3 -5
@@ -41,12 +41,10 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)DeviceState *scudev, *gtimerdev, *mptimerdev, *wdtdev;SysBusDevice *scubusdev, *gtimerbusdev, *mptimerbusdev, *wdtbusdev;Error *local_err =NULL ; -CPUState *cpu0; -Object *cpuobj; - cpu0 =qemu_get_cpu (0 ); - cpuobj =OBJECT (cpu0); -if (strcmp (object_get_typename (cpuobj),ARM_CPU_TYPE_NAME ("cortex-a9" ))) { +if (!c->cpu_type) { +qdev_prop_set_string (dev,"cpu-type" ,ARM_CPU_TYPE_NAME ("cortex-a9" )); + }else if (strcmp (c->cpu_type,ARM_CPU_TYPE_NAME ("cortex-a9" ))) {/* We might allow Cortex-A5 once we model it */ error_setg (errp,"Cortex-A9MPCore peripheral can only use Cortex-A9 CPU" );
hw/cpu/cortex_mpcore.c +5 -3
@@ -57,6 +57,11 @@ static void cortex_mpcore_priv_realize(DeviceState *dev, Error **errp)return ; } +if (!s->cpu_type) { +error_setg (errp,"'cpu-type' property is not set" ); +return ; + } +qdev_prop_set_uint32 (gicdev,"num-cpu" , s->num_cores);qdev_prop_set_uint32 (gicdev,"num-irq" , s->gic_spi_num);if (k->gic_priority_bits) {
@@ -85,9 +90,6 @@ static void cortex_mpcore_priv_realize(DeviceState *dev, Error **errp)/* CPU */ -if (!s->cpu_type) { -return ; - }for (int i =0 ; i < s->num_cores; i++) {Object *cpuobj;
Signature · 1 line
2.41.0
PATCH 32/33 hw/cpu/arm: Remove 'num-cpu' property alias
In reply to Philippe Mathieu-DaudéAll callers access the 'num-cores' property.
---
Better to squash earlier and replace in place, so no need for alias?
--- hw/cpu/arm11mpcore.c | 1 - hw/cpu/cortex_mpcore.c | 2 -- hw/cpu/realview_mpcore.c | 1 - 3 files changed, 4 deletions(-)
hw/cpu/arm11mpcore.c +0 -1
@@ -133,7 +133,6 @@ static void mpcore_priv_initfn(Object *obj)static Property mpcore_priv_properties[] = {DEFINE_PROP_UINT32 ("num-cores" , ARM11MPCorePriveState, num_cpu,1 ), -DEFINE_PROP_UINT32 ("num-cpu" , ARM11MPCorePriveState, num_cpu,1 ),/* alias */ /* The ARM11 MPCORE TRM says the on-chip controller may have * anything from 0 to 224 external interrupt IRQ lines (with another * 32 internal). We default to 32+32, which is the number provided by
hw/cpu/cortex_mpcore.c +0 -2
@@ -156,7 +156,6 @@ static void cortex_mpcore_priv_realize(DeviceState *dev, Error **errp)static Property cortex_mpcore_priv_properties[] = {DEFINE_PROP_UINT8 ("cluster-id" , CortexMPPrivState, cluster_id,0 ),DEFINE_PROP_UINT32 ("num-cores" , CortexMPPrivState, num_cores,1 ), -DEFINE_PROP_UINT32 ("num-cpu" , CortexMPPrivState, num_cores,1 ),/* alias */ DEFINE_PROP_STRING ("cpu-type" , CortexMPPrivState, cpu_type),DEFINE_PROP_BOOL ("cpu-has-el3" , CortexMPPrivState, cpu_has_el3, true),
@@ -175,7 +174,6 @@ static Property cortex_mpcore_priv_properties[] = { TYPE_MEMORY_REGION, MemoryRegion *),DEFINE_PROP_UINT32 ("gic-spi-num" , CortexMPPrivState, gic_spi_num,0 ), -DEFINE_PROP_UINT32 ("num-irq" , CortexMPPrivState, gic_spi_num,0 ),/* alias */ DEFINE_PROP_END_OF_LIST(), };
hw/cpu/realview_mpcore.c +0 -1
@@ -99,7 +99,6 @@ static void mpcore_rirq_init(Object *obj)object_initialize_child (obj,"a11priv" , &s->priv,TYPE_ARM11MPCORE_PRIV );object_property_add_alias (obj,"num-cores" ,OBJECT (&s->priv),"num-cores" ); -object_property_add_alias (obj,"num-cpu" ,OBJECT (&s->priv),"num-cores" ); privbusdev =SYS_BUS_DEVICE (&s->priv);sysbus_init_mmio (sbd,sysbus_mmio_get_region (privbusdev,0 ));
Signature · 1 line
2.41.0
PATCH 33/33 hw/cpu/arm: Remove use of qemu_get_cpu() in A7/A15 realize()
In reply to Philippe Mathieu-DaudéPrevious commits (in particular "Create CPUs once in MPCore parent") allowed creating the MPCore private container vCPUs within the container. We don't need to call qemu_get_cpu(), which is unsafe in hegerogeneous context.
Directly access the CortexMPPrivState::cpu array.
--- hw/cpu/a15mpcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/cpu/a15mpcore.c +1 -1
@@ -44,7 +44,7 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)* appropriate GIC PPI inputs */ for (i =0 ; i < c->num_cores; i++) { -DeviceState *cpudev =DEVICE (qemu_get_cpu (i)); +DeviceState *cpudev =DEVICE (c->cpu[i]);int ppibase = c->gic_spi_num -32 + i *32 ;int irq;/* Mapping from the output timer irq lines from the CPU to the
Signature · 1 line
2.41.0
Hi,
ping for review?
Quoted 54 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
This eventually allow removing one
qemu_get_cpu()use, which we want to remove in heterogeneous machines (machines using MPCore are candidate for heterogeneous emulation).Maybe these hw/cpu/arm/ files belong to hw/arm/...
Regards,
Phil.
Philippe Mathieu-Daudé (33):
hw/arm/boot: Propagate vCPU toarm_load_dtb()hw/arm/fsl-imx6: Add a local 'gic' variable hw/arm/fsl-imx6ul: Add a local 'gic' variable hw/arm/fsl-imx7: Add a local 'gic' variable
hw/cpu: Remove deadKconfig
hw/cpu/arm: Rename 'busdev' -> 'gicsbd' ina15mp_priv_realize()hw/cpu/arm: Alias 'num-cpu' property onTYPE_REALVIEW_MPCOREhw/cpu/arm: Declare CPU QOM types usingDEFINE_TYPES()macro hw/cpu/arm: Merge {a9mpcore.h,a15mpcore.h} ascortex_mpcore.hhw/cpu/arm: Introduce abstractCORTEX_MPCORE_PRIVQOM type hw/cpu/arm: Have A9MPCORE/A15MPCORE inheritate common
CORTEX_MPCORE_PRIV
hw/cpu/arm: Create MPCore container in QOM parent hw/cpu/arm: Handle 'num_cores' property once in MPCore parent hw/cpu/arm: Handle 'has_el2/3' properties once in MPCore parent hw/cpu/arm: Handle 'gic-irq' property once in MPCore parent hw/cpu/arm: Handle GIC once in MPCore parent
hw/cpu/arm: Document more properties ofCORTEX_MPCORE_PRIVQOM type hw/cpu/arm: Replace A15MPPrivState by CortexMPPrivState hw/cpu/arm: IntroduceTYPE_A7MPCORE_PRIVfor Cortex-A7 MPCore hw/cpu/arm: Consolidate check on max GIC spi supported hw/cpu/arm: Create CPUs once in MPCore parent hw/arm/aspeed_ast2600: Let the A7MPcore create/wire the CPU cores hw/arm/exynos4210: Let the A9MPcore create/wire the CPU cores hw/arm/fsl-imx6: Let the A9MPcore create/wire the CPU cores hw/arm/fsl-imx6ul: Let the A7MPcore create/wire the CPU cores hw/arm/fsl-imx7: Let the A7MPcore create/wire the CPU cores hw/arm/highbank: Let the A9/A15MPcore create/wire the CPU cores hw/arm/vexpress: Let the A9/A15MPcore create/wire the CPU cores hw/arm/xilinx_zynq: Let the A9MPcore create/wire the CPU cores hw/arm/npcm7xx: Let the A9MPcore create/wire the CPU cores hw/cpu/a9mpcore: Remove legacy code
hw/cpu/arm: Remove 'num-cpu' property alias
hw/cpu/arm: Remove use ofqemu_get_cpu()in A7/A15realize()
Quoted 8 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
I don't have a good solution to propose to overcome this problem :/
C.
Quoted 89 lines
This eventually allow removing one
qemu_get_cpu()use, which we want to remove in heterogeneous machines (machines using MPCore are candidate for heterogeneous emulation).Maybe these hw/cpu/arm/ files belong to hw/arm/...
Regards,
Phil.
Philippe Mathieu-Daudé (33):
hw/arm/boot: Propagate vCPU toarm_load_dtb()hw/arm/fsl-imx6: Add a local 'gic' variable hw/arm/fsl-imx6ul: Add a local 'gic' variable hw/arm/fsl-imx7: Add a local 'gic' variable
hw/cpu: Remove deadKconfig
hw/cpu/arm: Rename 'busdev' -> 'gicsbd' ina15mp_priv_realize()hw/cpu/arm: Alias 'num-cpu' property onTYPE_REALVIEW_MPCOREhw/cpu/arm: Declare CPU QOM types usingDEFINE_TYPES()macro hw/cpu/arm: Merge {a9mpcore.h,a15mpcore.h} ascortex_mpcore.hhw/cpu/arm: Introduce abstractCORTEX_MPCORE_PRIVQOM type hw/cpu/arm: Have A9MPCORE/A15MPCORE inheritate common
CORTEX_MPCORE_PRIV
hw/cpu/arm: Create MPCore container in QOM parent hw/cpu/arm: Handle 'num_cores' property once in MPCore parent hw/cpu/arm: Handle 'has_el2/3' properties once in MPCore parent hw/cpu/arm: Handle 'gic-irq' property once in MPCore parent hw/cpu/arm: Handle GIC once in MPCore parent
hw/cpu/arm: Document more properties ofCORTEX_MPCORE_PRIVQOM type hw/cpu/arm: Replace A15MPPrivState by CortexMPPrivState hw/cpu/arm: IntroduceTYPE_A7MPCORE_PRIVfor Cortex-A7 MPCore hw/cpu/arm: Consolidate check on max GIC spi supported hw/cpu/arm: Create CPUs once in MPCore parent hw/arm/aspeed_ast2600: Let the A7MPcore create/wire the CPU cores hw/arm/exynos4210: Let the A9MPcore create/wire the CPU cores hw/arm/fsl-imx6: Let the A9MPcore create/wire the CPU cores hw/arm/fsl-imx6ul: Let the A7MPcore create/wire the CPU cores hw/arm/fsl-imx7: Let the A7MPcore create/wire the CPU cores hw/arm/highbank: Let the A9/A15MPcore create/wire the CPU cores hw/arm/vexpress: Let the A9/A15MPcore create/wire the CPU cores hw/arm/xilinx_zynq: Let the A9MPcore create/wire the CPU cores hw/arm/npcm7xx: Let the A9MPcore create/wire the CPU cores hw/cpu/a9mpcore: Remove legacy code
hw/cpu/arm: Remove 'num-cpu' property alias
hw/cpu/arm: Remove use ofqemu_get_cpu()in A7/A15realize()MAINTAINERS | 3 +- include/hw/arm/aspeed_soc.h | 5 +- include/hw/arm/boot.h | 4 +- include/hw/arm/exynos4210.h | 6 +- include/hw/arm/fsl-imx6.h | 6 +- include/hw/arm/fsl-imx6ul.h | 8 +- include/hw/arm/fsl-imx7.h | 8 +- include/hw/arm/npcm7xx.h | 3 +- include/hw/cpu/a15mpcore.h | 44 ------- include/hw/cpu/a9mpcore.h | 39 ------- include/hw/cpu/cortex_mpcore.h | 135 ++++++++++++++++++++++ hw/arm/aspeed_ast2600.c | 61 ++++------ hw/arm/boot.c | 11 +- hw/arm/exynos4210.c | 60 ++++------ hw/arm/exynos4_boards.c | 6 +- hw/arm/fsl-imx6.c | 84 ++++---------- hw/arm/fsl-imx6ul.c | 65 ++++------- hw/arm/fsl-imx7.c | 103 +++++------------ hw/arm/highbank.c | 56 ++------- hw/arm/mcimx6ul-evk.c | 3 +- hw/arm/mcimx7d-sabre.c | 3 +- hw/arm/npcm7xx.c | 48 ++------ hw/arm/realview.c | 4 +- hw/arm/sabrelite.c | 4 +- hw/arm/vexpress.c | 60 +++------- hw/arm/virt.c | 2 +- hw/arm/xilinx_zynq.c | 30 ++--- hw/cpu/a15mpcore.c | 179 +++++++++++++---------------- hw/cpu/a9mpcore.c | 138 +++++++++------------- hw/cpu/arm11mpcore.c | 23 ++-- hw/cpu/cortex_mpcore.c | 202 +++++++++++++++++++++++++++++++++ hw/cpu/realview_mpcore.c | 30 ++--- hw/arm/Kconfig | 8 +- hw/cpu/Kconfig | 8 -- hw/cpu/meson.build | 1 + 35 files changed, 689 insertions(+), 761 deletions(-)delete mode 100644
include/hw/cpu/a15mpcore.hdelete mode 100644include/hw/cpu/a9mpcore.hcreate mode 100644include/hw/cpu/cortex_mpcore.hcreate mode 100644hw/cpu/cortex_mpcore.cdelete mode 100644 hw/cpu/Kconfig
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
Quoted 22 lines
I don't have a good solution to propose to overcome this problem :/
C.
Quoted 16 lines
This eventually allow removing one
qemu_get_cpu()use, which we want to remove in heterogeneous machines (machines using MPCore are candidate for heterogeneous emulation).include/hw/arm/aspeed_soc.h | 5 +- include/hw/arm/boot.h | 4 +- include/hw/arm/exynos4210.h | 6 +- include/hw/arm/fsl-imx6.h | 6 +- include/hw/arm/fsl-imx6ul.h | 8 +- include/hw/arm/fsl-imx7.h | 8 +- include/hw/arm/npcm7xx.h | 3 +- include/hw/cpu/a15mpcore.h | 44 ------- include/hw/cpu/a9mpcore.h | 39 -------
include/hw/cpu/cortex_mpcore.h| 135 ++++++++++++++++++++++
Quoted 18 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
Quoted 4 lines
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
We broke migration compatibility by moving the IC object in the QOM hierarchy of the pseries machines in the past. These changes might be different. Here is the QOM tree of the ast2600 SoC.
before :
/soc (ast2600-a3)
/a7mpcore (a15mpcore_priv)
/a15mp-priv-container[0] (memory-region)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/gic_vcpu[0] (memory-region)
/gic_viface[0] (memory-region)
/gic_viface[1] (memory-region)
/gic_viface[2] (memory-region)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)after :
/soc (ast2600-a3)
/a7mpcore (a7mpcore_priv)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/mpcore-priv-container[0] (memory-region)Thanks,
C.
+Peter/Fabiano
Quoted 64 lines · Cédric Le Goater
Quoted 18 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
Quoted 4 lines
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
We broke migration compatibility by moving the IC object in the QOM hierarchy of the pseries machines in the past. These changes might be different. Here is the QOM tree of the ast2600 SoC.
before :
/soc (ast2600-a3)
/a7mpcore (a15mpcore_priv)
/a15mp-priv-container[0] (memory-region)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/gic_vcpu[0] (memory-region)
/gic_viface[0] (memory-region)
/gic_viface[1] (memory-region)
/gic_viface[2] (memory-region)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)after :
/soc (ast2600-a3)
/a7mpcore (a7mpcore_priv)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/mpcore-priv-container[0] (memory-region)Thanks,
C.
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
1- https://gitlab.com/farosas/qemu/-/jobs/5853599533
Quoted 41 lines
Quoted 41 lines
We broke migration compatibility by moving the IC object in the QOM hierarchy of the pseries machines in the past. These changes might be different. Here is the QOM tree of the ast2600 SoC.
before :
/soc (ast2600-a3)
/a7mpcore (a15mpcore_priv)
/a15mp-priv-container[0] (memory-region)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/gic_vcpu[0] (memory-region)
/gic_viface[0] (memory-region)
/gic_viface[1] (memory-region)
/gic_viface[2] (memory-region)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)after :
/soc (ast2600-a3)
/a7mpcore (a7mpcore_priv)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/mpcore-priv-container[0] (memory-region)Thanks,
C.
Quoted 29 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
Quoted 6 lines
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
it happens we do.
Quoted 2 lines
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat, at least on the Aspeed SoC. The question is : do we care ? For Aspeed probably not, but the series should say so.
Thanks,
C.
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
We broke migration compatibility by moving the IC object in the QOM hierarchy of the pseries machines in the past. These changes might be different. Here is the QOM tree of the ast2600 SoC.
before :
/soc (ast2600-a3)
/a7mpcore (a15mpcore_priv)
/a15mp-priv-container[0] (memory-region)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/gic_vcpu[0] (memory-region)
/gic_viface[0] (memory-region)
/gic_viface[1] (memory-region)
/gic_viface[2] (memory-region)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)after :
/soc (ast2600-a3)
/a7mpcore (a7mpcore_priv)
/cpu[0] (cortex-a7-arm-cpu)
/cpu[1] (cortex-a7-arm-cpu)
/gic (arm_gic)
/gic_cpu[0] (memory-region)
/gic_cpu[1] (memory-region)
/gic_cpu[2] (memory-region)
/gic_dist[0] (memory-region)
/mpcore-priv-container[0] (memory-region)Thanks,
C.
Quoted 30 lines · Cédric Le Goater
Quoted 29 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
Quoted 9 lines
Quoted 6 lines
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Quoted 7 lines
Quoted 2 lines
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration so I could take a look?
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of 5bc8d26de20c ("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg : 46f7afa37096 ("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Regarding aspeed, this series breaks compat. Not that we care much but this caught my attention because of my past experience on pseries. Same kind of QOM change which could impact other machines, like virt. Since you checked that migration compat is preserved on virt, we should be fine.
Thanks,
C.
Quoted 63 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Quoted 8 lines
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path. No one wants to be policing QOM hierarchy changes in every single series that shows up on the list.
Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 63 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Quoted 8 lines
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
Quoted 11 lines
No one wants
to be policing QOM hierarchy changes in every single series that shows up on the list.Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Quoted 5 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
If I read it right, the commit 46f7afa37096 example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.
Quoted 10 lines
Quoted 10 lines
No one wants
to be policing QOM hierarchy changes in every single series that shows up on the list.Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Things like that might be able to be detected via vmstate-static-checker.py. But I'm not 100% sure, also its coverage is limited.
For example, I don't think it can detect changes to objects that will only be created dynamically, e.g., I think sometimes we create objects after some guest behaviors (consider guest enables the device, then QEMU emulation creates some objects on demand of device setup?), and since the static checker shouldn't ever start the VM and run any code, they won't trigger.
Signature · 1 line
Peter Xu
Quoted 86 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.
Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
The problem was the removal of useless objects, because this also removed their vmstate.
The fix was adding the vmstate back as a dummy.
The QOM patch changes are *not* part of the problem.
Correct?
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
No one wants
to be policing QOM hierarchy changes in every single series that shows up on the list.Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Quoted 7 lines
Things like that might be able to be detected via
vmstate-static-checker.py. But I'm not 100% sure, also its coverage is limited.For example, I don't think it can detect changes to objects that will only be created dynamically, e.g., I think sometimes we create objects after some guest behaviors (consider guest enables the device, then QEMU emulation creates some objects on demand of device setup?),
Feels nuts to me.
In real hardware, software enabling a device that is disabled by default doesn't create the device. The device is always there, it just happens to be inactive unless enabled. We should model the device just like that.
Quoted 3 lines
and since the
static checker shouldn't ever start the VM and run any code, they won't trigger.
Quoted 102 lines · Markus Armbruster
Quoted 86 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
Quoted 8 lines
The problem was the removal of useless objects, because this also removed their vmstate.
The fix was adding the vmstate back as a dummy.
The QOM patch changes are *not* part of the problem.
Correct?
[I'd leave this to Cedric]
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
No one wants
to be policing QOM hierarchy changes in every single series that shows up on the list.Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Quoted 7 lines
Things like that might be able to be detected via
vmstate-static-checker.py. But I'm not 100% sure, also its coverage is limited.For example, I don't think it can detect changes to objects that will only be created dynamically, e.g., I think sometimes we create objects after some guest behaviors (consider guest enables the device, then QEMU emulation creates some objects on demand of device setup?),
Quoted 6 lines
Feels nuts to me.
In real hardware, software enabling a device that is disabled by default doesn't create the device. The device is always there, it just happens to be inactive unless enabled. We should model the device just like that.
It doesn't need to be the device itself to be dynamically created, but some other sub-objects that do not require to exist until the device is enabled, or some specific function of that device is enabled. It is logically doable.
Is the example Cedric provided looks like some case like this? I am not sure, that's also why I'm not sure the static checker would work here. But logically it seems possible, e.g. with migration VMSD needed() facilities. Consider a device has a sub-function that requires a sub-object. It may not need to migrate that object if that sub-feature is not even enabled. If that object is very large, it might be wise to do so if possible to not send chunks of junk during the VM downtime.
But then after a 2nd thought I do agree it's probably not sensible, because even if the src may know whether the sub-object will be needed, there's probably no good way for the dest QEMU to know. It can only know in something like a post_load() hook, but logically that can happen only after a full load of that device state, so might already be too late.
Thanks,
Signature · 1 line
Peter Xu
Quoted 7 lines · Peter Xu
Quoted 6 lines · Markus Armbruster
Quoted 4 lines · Peter Xu
Quoted 3 lines · Philippe Mathieu-Daudé
Hi Fabiano,
On 9/1/24 21:21, Fabiano Rosas wrote:
[...]
Quoted 37 lines
Quoted 18 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
No one wants
to be policing QOM hierarchy changes in every single series that shows up on the list.Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Quoted 7 lines
Things like that might be able to be detected via
vmstate-static-checker.py. But I'm not 100% sure, also its coverage is limited.For example, I don't think it can detect changes to objects that will only be created dynamically, e.g., I think sometimes we create objects after some guest behaviors (consider guest enables the device, then QEMU emulation creates some objects on demand of device setup?),
Quoted 6 lines
Feels nuts to me.
In real hardware, software enabling a device that is disabled by default doesn't create the device. The device is always there, it just happens to be inactive unless enabled. We should model the device just like that.
It doesn't need to be the device itself to be dynamically created, but some other sub-objects that do not require to exist until the device is enabled, or some specific function of that device is enabled. It is logically doable.
Is the example Cedric provided looks like some case like this? I am not sure, that's also why I'm not sure the static checker would work here. But logically it seems possible, e.g. with migration VMSD
needed()facilities. Consider a device has a sub-function that requires a sub-object. It may not need to migrate that object if that sub-feature is not even enabled. If that object is very large, it might be wise to do so if possible to not send chunks of junk during the VM downtime.
Quoted 7 lines
But then after a 2nd thought I do agree it's probably not sensible, because even if the src may know whether the sub-object will be needed, there's probably no good way for the dest QEMU to know. It can only know in something like a
post_load()hook, but logically that can happen only after a full load of that device state, so might already be too late.Thanks,
If an object has state that needs to be migrated only sometimes, and that part of the state is large enough to bother, we can put it in an optional subsection, can't we?
Destination: if present, take it. If absent, initialize to default.
Source: send unless (known to be) in default state.
Quoted 7 lines · Markus Armbruster
If an object has state that needs to be migrated only sometimes, and that part of the state is large enough to bother, we can put it in an optional subsection, can't we?
Destination: if present, take it. If absent, initialize to default.
Source: send unless (known to be) in default state.
Hmm.. correct. I think I messed up VMSD's needed() hook with field_exists() of the fields; my apologies.
The trick should be that VMSD's subsections is more flexible, due to the fact that vmstate_subsection_load() has:
while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {
...
sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr);
...
}So it tolerates the case where the subsection doesn't exist, or out of order subsections.
While field_exists() hook seems not that flexible, as it's implemented as this in vmstate_load_state():
while (field->name) {
...
if (vmstate_field_exists(vmsd, field, opaque, version_id)) {
...
}
...
field++;
}So that vmstate_field_exists() needs to be known even on dest before the main vmsd got loaded, and it should always return the same value as the source. Also, the field has ordering requirements.
Then yes, subsection should work for dynamic objects.
Thanks,
Signature · 1 line
Peter Xu
Quoted 152 lines · Peter Xu
Quoted 102 lines · Markus Armbruster
Quoted 86 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 14 lines · Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote:
Hi,When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine
and some fixups are then required to maintain migration compatibility.
This can become a real headache for KVM machines like virt for which
migration compatibility is a feature, less for emulated ones.All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
Quoted 8 lines
The problem was the removal of useless objects, because this also removed their vmstate.
The fix was adding the vmstate back as a dummy.
The QOM patch changes are *not* part of the problem.
Correct?
[I'd leave this to Cedric]
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
No one wants
to be policing QOM hierarchy changes in every single series that shows up on the list.Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Quoted 7 lines
Things like that might be able to be detected via
vmstate-static-checker.py. But I'm not 100% sure, also its coverage is limited.For example, I don't think it can detect changes to objects that will only be created dynamically, e.g., I think sometimes we create objects after some guest behaviors (consider guest enables the device, then QEMU emulation creates some objects on demand of device setup?),
Quoted 6 lines
Feels nuts to me.
In real hardware, software enabling a device that is disabled by default doesn't create the device. The device is always there, it just happens to be inactive unless enabled. We should model the device just like that.
It doesn't need to be the device itself to be dynamically created, but some other sub-objects that do not require to exist until the device is enabled, or some specific function of that device is enabled. It is logically doable.
Is the example Cedric provided looks like some case like this? I am not sure, that's also why I'm not sure the static checker would work here. But logically it seems possible, e.g. with migration VMSD
needed()facilities. Consider a device has a sub-function that requires a sub-object. It may not need to migrate that object if that sub-feature is not even enabled. If that object is very large, it might be wise to do so if possible to not send chunks of junk during the VM downtime.
Quoted 5 lines
But then after a 2nd thought I do agree it's probably not sensible, because even if the src may know whether the sub-object will be needed, there's probably no good way for the dest QEMU to know. It can only know in something like a
post_load()hook, but logically that can happen only after a full load of that device state, so might already be too late.
If features can be dynamically enabled by the OS, after negotiation with the platform, the source should prepare for all possible scenarios and migrate all models supported for a given configuration. The OS could choose to enable a feature on the target which was not enabled on the source before migration.
Thanks,
C.
Quoted 80 lines · Markus Armbruster
Quoted 78 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Unfortunately the original fix doesn't mention _what_ actually broke with migration. I assumed the QOM path was needed because otherwise I don't think the fix makes sense. The thread discussing that patch also directly mentions the QOM path:
https://www.mail-archive.com/[email protected]/msg450912.html
But I probably misunderstood something while reading that thread.
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.
Quoted 7 lines
Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
The problem was the removal of useless objects, because this also removed their vmstate.
If you checkout at the removal commit (5bc8d26de20c), the vmstate has been kept untouched.
Quoted 2 lines
The fix was adding the vmstate back as a dummy.
Since the vmstate was kept I don't see why would we need a dummy. The incoming migration stream would still have the state, only at a different point in the stream. It's surprising to me that that would cause an issue, but I'm not well versed in that code.
Quoted 2 lines
The QOM patch changes are *not* part of the problem.
The only explanation I can come up with is that after the patch migration has broken after a hotplug or similar operation. In such situation, the preallocated state would always be present before the patch, but sometimes not present after the patch in case, say, a hot-unplug has taken away a cpu + ICPState.
Quoted 121 lines · Fabiano Rosas
Quoted 80 lines · Markus Armbruster
Quoted 78 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 14 lines · Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote:
Hi,When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine
and some fixups are then required to maintain migration compatibility.
This can become a real headache for KVM machines like virt for which
migration compatibility is a feature, less for emulated ones.All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Unfortunately the original fix doesn't mention _what_ actually broke with migration. I assumed the QOM path was needed because otherwise I don't think the fix makes sense. The thread discussing that patch also directly mentions the QOM path:
https://www.mail-archive.com/[email protected]/msg450912.html
But I probably misunderstood something while reading that thread.
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.Quoted 7 lines
Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
The problem was the removal of useless objects, because this also removed their vmstate.
If you checkout at the removal commit (
5bc8d26de20c), the vmstate has been kept untouched.Quoted 1 line
Quoted 6 lines
Quoted 1 line
The fix was adding the vmstate back as a dummy.
Since the vmstate was kept I don't see why would we need a dummy. The incoming migration stream would still have the state, only at a different point in the stream. It's surprising to me that that would cause an issue, but I'm not well versed in that code.
Alright, I understand neither the problem nor the fix :)
Quoted 7 lines
Quoted 1 line
The QOM patch changes are *not* part of the problem.
The only explanation I can come up with is that after the patch migration has broken after a hotplug or similar operation. In such situation, the preallocated state would always be present before the patch, but sometimes not present after the patch in case, say, a hot-unplug has taken away a cpu + ICPState.
My head hurts... Oh, we're talking migration! Perfectly normal then.
Quoted 129 lines · Fabiano Rosas
Quoted 80 lines · Markus Armbruster
Quoted 78 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 14 lines · Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote:
Hi,When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine
and some fixups are then required to maintain migration compatibility.
This can become a real headache for KVM machines like virt for which
migration compatibility is a feature, less for emulated ones.All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Unfortunately the original fix doesn't mention _what_ actually broke with migration. I assumed the QOM path was needed because otherwise I don't think the fix makes sense. The thread discussing that patch also directly mentions the QOM path:
https://www.mail-archive.com/[email protected]/msg450912.html
But I probably misunderstood something while reading that thread.
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.Quoted 7 lines
Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
The problem was the removal of useless objects, because this also removed their vmstate.
If you checkout at the removal commit (
5bc8d26de20c), the vmstate has been kept untouched.Quoted 2 lines
The fix was adding the vmstate back as a dummy.
Since the vmstate was kept I don't see why would we need a dummy. The incoming migration stream would still have the state, only at a different point in the stream. It's surprising to me that that would cause an issue, but I'm not well versed in that code.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
The QOM patch changes are *not* part of the problem.
The only explanation I can come up with is that after the patch migration has broken after a hotplug or similar operation. In such situation, the preallocated state would always be present before the patch, but sometimes not present after the patch in case, say, a hot-unplug has taken away a cpu + ICPState.
May be. It has been a while.
For a better understanding, I tried to reproduce. QEMU 2.9 still compiles on a f38 (memfd_create needs a fix). However, a QEMU-2.9/pseries-2.9 machine won't start any recent OS because something broke the OS/platform negotiation process (CAS) ...
I removed the pre_2_10_has_unused_icps hack and worked around another migration compat issue in IOMMU ... Here are the last trace-events for migration :
QEMU-mainline/pseries-2.9 -> QEMU-2.9/pseries-2.9
[email protected]:vmstate_load spapr, spapr [email protected]:vmstate_load_state spapr v3 [email protected]:vmstate_load_state_field spapr:unused [email protected]:vmstate_load_state_field spapr:rtc_offset [email protected]:vmstate_load_state_field spapr:tb [email protected]:vmstate_n_elems tb: 1 [email protected]:vmstate_load_state timebase v1 [email protected]:vmstate_load_state_field timebase:guest_timebase [email protected]:vmstate_n_elems guest_timebase: 1 [email protected]:vmstate_load_state_field timebase:time_of_the_day_ns [email protected]:vmstate_n_elems time_of_the_day_ns: 1 [email protected]:vmstate_subsection_load timebase [email protected]:vmstate_subsection_load_bad timebase: spapr_option_vector_ov5_cas/(prefix) [email protected]:vmstate_load_state_end timebase end/0 [email protected]:vmstate_subsection_load spapr [email protected]:vmstate_load_state spapr_option_vector_ov5_cas v1 [email protected]:vmstate_load_state_field spapr_option_vector_ov5_cas:ov5_cas [email protected]:vmstate_n_elems ov5_cas: 1 [email protected]:vmstate_load_state spapr_option_vector v1 [email protected]:vmstate_load_state_field spapr_option_vector:bitmap [email protected]:vmstate_n_elems bitmap: 1 [email protected]:vmstate_subsection_load spapr_option_vector [email protected]:vmstate_subsection_load_bad spapr_option_vector: (short)/ [email protected]:vmstate_load_state_end spapr_option_vector end/0 [email protected]:vmstate_subsection_load spapr_option_vector_ov5_cas [email protected]:vmstate_subsection_load_bad spapr_option_vector_ov5_cas: (short)/ [email protected]:vmstate_load_state_end spapr_option_vector_ov5_cas end/0 [email protected]:vmstate_subsection_load_bad spapr: spapr/cap/htm/(lookup)
qemu-system-ppc64: error while loading state for instance 0x0 of device 'spapr'
Hope it helps,
Thanks,
C.
Quoted 138 lines · Cédric Le Goater
Quoted 129 lines · Fabiano Rosas
Quoted 80 lines · Markus Armbruster
Quoted 78 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
On 2/1/24 15:55, Cédric Le Goater wrote:
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote:
Hi,When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine
and some fixups are then required to maintain migration compatibility.
This can become a real headache for KVM machines like virt for which
migration compatibility is a feature, less for emulated ones.All changes are either moving properties (which are not migrated)
or moving non-migrated QOM members (i.e. pointers of ARMCPU, which
is still migrated elsewhere). So I don't see any obvious migration
problem, but I might be missing something, so I Cc'ed Juan :>FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Unfortunately the original fix doesn't mention _what_ actually broke with migration. I assumed the QOM path was needed because otherwise I don't think the fix makes sense. The thread discussing that patch also directly mentions the QOM path:
https://www.mail-archive.com/[email protected]/msg450912.html
But I probably misunderstood something while reading that thread.
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.Quoted 7 lines
Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
The problem was the removal of useless objects, because this also removed their vmstate.
If you checkout at the removal commit (
5bc8d26de20c), the vmstate has been kept untouched.Quoted 2 lines
The fix was adding the vmstate back as a dummy.
Since the vmstate was kept I don't see why would we need a dummy. The incoming migration stream would still have the state, only at a different point in the stream. It's surprising to me that that would cause an issue, but I'm not well versed in that code.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
The QOM patch changes are *not* part of the problem.
The only explanation I can come up with is that after the patch migration has broken after a hotplug or similar operation. In such situation, the preallocated state would always be present before the patch, but sometimes not present after the patch in case, say, a hot-unplug has taken away a cpu + ICPState.
Quoted 6 lines
May be. It has been a while.
For a better understanding, I tried to reproduce. QEMU 2.9 still compiles on a f38 (
memfd_createneeds a fix). However, a QEMU-2.9/pseries-2.9 machine won't start any recent OS because something broke the OS/platform negotiation process (CAS) ...
Thanks for letting us know it still builds. That motivated me to try as well. Although it took me a while because of python's brokenness.
The issue was indeed the difference in preallocation vs. no preallocation. I don't remember how to do hotplug in ppc anymore, but maxcpus was sufficient to reproduce:
src 2.9.0:
$ ./ppc64-softmmu/qemu-system-ppc64 -serial mon:stdio -nographic -vga none -display none -accel tcg -machine pseries -smp 4,maxcpus=8 -m 256M -nodefaults
dst 2.9.0 prior to 46f7afa:
$ ./ppc64-softmmu/qemu-system-ppc64 -serial mon:stdio -display none -accel tcg -machine pseries-2.9 -smp 4,maxcpus=8 -m 256M -nodefaults -incoming defer
(qemu) migrate_incoming tcp:localhost:1234
(qemu) qemu-system-ppc64: Unknown savevm section or instance 'icp/server' 4
qemu-system-ppc64: load of migration failed: Invalid argument
As you can see, both use 4 cpus, but the src will try to migrate all 8 icp/server instances. After the patch, the same migration works.
So this was not related to the QOM path nor the QOM hierarchy, it was just about having state created at machine init vs. cpu realize time. It might be wise to keep an eye on the QOM hierarchy anyway as it could make these kinds of changes more evident during review.
Quoted 27 lines
I removed the
pre_2_10_has_unused_icpshack and worked around another migration compat issue in IOMMU ... Here are the last trace-events for migration :QEMU-mainline/pseries-2.9 -> QEMU-2.9/pseries-2.9[email protected]:vmstate_load spapr, spapr [email protected]:vmstate_load_state spapr v3 [email protected]:vmstate_load_state_field spapr:unused [email protected]:vmstate_load_state_field spapr:rtc_offset [email protected]:vmstate_load_state_field spapr:tb [email protected]:vmstate_n_elems tb: 1 [email protected]:vmstate_load_state timebase v1 [email protected]:vmstate_load_state_field timebase:guest_timebase [email protected]:vmstate_n_elems
guest_timebase: 1 [email protected]:vmstate_load_state_field timebase:time_of_the_day_ns [email protected]:vmstate_n_elemstime_of_the_day_ns: 1 [email protected]:vmstate_subsection_load timebase [email protected]:vmstate_subsection_load_bad timebase: spapr_option_vector_ov5_cas/(prefix) [email protected]:vmstate_load_state_end timebase end/0 [email protected]:vmstate_subsection_load spapr [email protected]:vmstate_load_statespapr_option_vector_ov5_casv1 [email protected]:vmstate_load_state_field spapr_option_vector_ov5_cas:ov5_cas [email protected]:vmstate_n_elemsov5_cas: 1 [email protected]:vmstate_load_statespapr_option_vectorv1 [email protected]:vmstate_load_state_field spapr_option_vector:bitmap [email protected]:vmstate_n_elems bitmap: 1
Quoted 8 lines
[email protected]:vmstate_subsection_load
spapr_option_vector[email protected]:vmstate_subsection_load_badspapr_option_vector: (short)/ [email protected]:vmstate_load_state_endspapr_option_vectorend/0 [email protected]:vmstate_subsection_loadspapr_option_vector_ov5_cas[email protected]:vmstate_subsection_load_badspapr_option_vector_ov5_cas: (short)/ [email protected]:vmstate_load_state_endspapr_option_vector_ov5_casend/0 [email protected]:vmstate_subsection_load_bad spapr: spapr/cap/htm/(lookup)
qemu-system-ppc64: error while loading state for instance0x0of device 'spapr'
This trace this seems to be something else entirely. I'd be amazed if migrating mainline vs. something that old worked at all, even on x86.
Quoted 168 lines · Fabiano Rosas
Quoted 138 lines · Cédric Le Goater
Quoted 129 lines · Fabiano Rosas
Quoted 80 lines · Markus Armbruster
Quoted 78 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
On 1/2/24 17:15, Philippe Mathieu-Daudé wrote:
Hi Cédric,On 2/1/24 15:55, Cédric Le Goater wrote:
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote:
Hi,When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine
and some fixups are then required to maintain migration compatibility.
This can become a real headache for KVM machines like virt for which
migration compatibility is a feature, less for emulated ones.All changes are either moving properties (which are not migrated)
or moving non-migrated QOM members (i.e. pointers of ARMCPU, which
is still migrated elsewhere). So I don't see any obvious migration
problem, but I might be missing something, so I Cc'ed Juan :>FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Unfortunately the original fix doesn't mention _what_ actually broke with migration. I assumed the QOM path was needed because otherwise I don't think the fix makes sense. The thread discussing that patch also directly mentions the QOM path:
https://www.mail-archive.com/[email protected]/msg450912.html
But I probably misunderstood something while reading that thread.
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.Quoted 7 lines
Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
The problem was the removal of useless objects, because this also removed their vmstate.
If you checkout at the removal commit (
5bc8d26de20c), the vmstate has been kept untouched.Quoted 2 lines
The fix was adding the vmstate back as a dummy.
Since the vmstate was kept I don't see why would we need a dummy. The incoming migration stream would still have the state, only at a different point in the stream. It's surprising to me that that would cause an issue, but I'm not well versed in that code.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
The QOM patch changes are *not* part of the problem.
The only explanation I can come up with is that after the patch migration has broken after a hotplug or similar operation. In such situation, the preallocated state would always be present before the patch, but sometimes not present after the patch in case, say, a hot-unplug has taken away a cpu + ICPState.
Quoted 6 lines
May be. It has been a while.
For a better understanding, I tried to reproduce. QEMU 2.9 still compiles on a f38 (
memfd_createneeds a fix). However, a QEMU-2.9/pseries-2.9 machine won't start any recent OS because something broke the OS/platform negotiation process (CAS) ...Thanks for letting us know it still builds. That motivated me to try as well. Although it took me a while because of python's brokenness.
The issue was indeed the difference in preallocation vs. no preallocation. I don't remember how to do hotplug in ppc anymore, but maxcpus was sufficient to reproduce:
src 2.9.0:
$ ./ppc64-softmmu/qemu-system-ppc64 -serial mon:stdio -nographic -vga none(quoted diff) +0
-2-display none -accel tcg -machine pseries -smp 4,maxcpus=8 -m 256M -nodefaultsdst 2.9.0 prior to 46f7afa:
$ ./ppc64-softmmu/qemu-system-ppc64 -serial mon:stdio -display none(quoted diff) +0
-2-accel tcg -machine pseries-2.9 -smp 4,maxcpus=8 -m 256M -nodefaults -incoming defer(qemu)
migrate_incomingtcp:localhost:1234
(qemu) qemu-system-ppc64: Unknown savevm section or instance 'icp/server' 4
qemu-system-ppc64: load of migration failed: Invalid argument
Quoted 5 lines
As you can see, both use 4 cpus, but the src will try to migrate all 8 icp/server instances. After the patch, the same migration works.
So this was not related to the QOM path nor the QOM hierarchy, it was just about having state created at machine init vs. cpu realize time.
Ah ! of course, the machine is created in an init handler.
Thanks Fabiano, for the diagnostic and the time you took to reproduce and analyze. I had this bad assumption of constraint between QOM vs. migration and any change made me uncomfortable. You cleared it.
Good that we are deprecating this hack in a couple of versions.
Quoted 3 lines
It
might be wise to keep an eye on the QOM hierarchy anyway as it could make these kinds of changes more evident during review.
Clearly,
Thanks,
C.
Quoted 38 lines
Quoted 27 lines
I removed the
pre_2_10_has_unused_icpshack and worked around another migration compat issue in IOMMU ... Here are the last trace-events for migration :QEMU-mainline/pseries-2.9 -> QEMU-2.9/pseries-2.9[email protected]:vmstate_load spapr, spapr [email protected]:vmstate_load_state spapr v3 [email protected]:vmstate_load_state_field spapr:unused [email protected]:vmstate_load_state_field spapr:rtc_offset [email protected]:vmstate_load_state_field spapr:tb [email protected]:vmstate_n_elems tb: 1 [email protected]:vmstate_load_state timebase v1 [email protected]:vmstate_load_state_field timebase:guest_timebase [email protected]:vmstate_n_elems
guest_timebase: 1 [email protected]:vmstate_load_state_field timebase:time_of_the_day_ns [email protected]:vmstate_n_elemstime_of_the_day_ns: 1 [email protected]:vmstate_subsection_load timebase [email protected]:vmstate_subsection_load_bad timebase: spapr_option_vector_ov5_cas/(prefix) [email protected]:vmstate_load_state_end timebase end/0 [email protected]:vmstate_subsection_load spapr [email protected]:vmstate_load_statespapr_option_vector_ov5_casv1 [email protected]:vmstate_load_state_field spapr_option_vector_ov5_cas:ov5_cas [email protected]:vmstate_n_elemsov5_cas: 1 [email protected]:vmstate_load_statespapr_option_vectorv1 [email protected]:vmstate_load_state_field spapr_option_vector:bitmap [email protected]:vmstate_n_elems bitmap: 1Quoted 8 lines
[email protected]:vmstate_subsection_load
spapr_option_vector[email protected]:vmstate_subsection_load_badspapr_option_vector: (short)/ [email protected]:vmstate_load_state_endspapr_option_vectorend/0 [email protected]:vmstate_subsection_loadspapr_option_vector_ov5_cas[email protected]:vmstate_subsection_load_badspapr_option_vector_ov5_cas: (short)/ [email protected]:vmstate_load_state_endspapr_option_vector_ov5_casend/0 [email protected]:vmstate_subsection_load_bad spapr: spapr/cap/htm/(lookup)
qemu-system-ppc64: error while loading state for instance0x0of device 'spapr'This trace this seems to be something else entirely. I'd be amazed if migrating mainline vs. something that old worked at all, even on x86.
Quoted 93 lines · Markus Armbruster
Quoted 91 lines · Peter Xu
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Fabiano,
Quoted 74 lines · Fabiano Rosas
Quoted 71 lines · Cédric Le Goater
Quoted 39 lines · Fabiano Rosas
Quoted 37 lines · Cédric Le Goater
Quoted 35 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the
cluster container, not to the board/soc layer. This series move
the creation of vCPUs to the MPCore private container.Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a
central place (abstract MPCore parent).Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
Quoted 5 lines
Quoted 2 lines
it happens we do.
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.Quoted 4 lines
Quoted 2 lines
This feels like something that could be handled by the vmstate code somehow. The state is there, just under a different path.
What, the QOM path is used in migration? ...
Hopefully not..
Quoted 5 lines
See recent discussions on "QOM path stability":
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
Quoted 8 lines
Quoted 3 lines
If I read it right, the commit
46f7afa37096example is pretty special that the QOM path more or less decided more than the hierachy itself but changes the existances of objects.Let's see whether I got this...
We removed some useless objects, moved the useful ones to another home. The move changed their QOM path.
They interrupt controller presenter objects were quite useful :) From what I recall, we moved them from an array under the machine to the CPU object, so the interrupt controller presenter states previously under the machine were not there anymore and this broke migration compatibility.
Sorry for the noise if this is not a problem anymore. It was at the time and we found a way to work around it; I should probably say we hacked our way around it. Nevertheless, this was kind of a trauma too because since I never dared touch the QOM hierarchy of a migratable machine again. Migration is complicated.
Quoted 27 lines
The problem was the removal of useless objects, because this also removed their vmstate.
The fix was adding the vmstate back as a dummy.
The QOM patch changes are *not* part of the problem.
Correct?
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
No one wants
to be policing QOM hierarchy changes in every single series that shows up on the list.Anyway, thanks for the pointers. I'll study that code a bit more, maybe I can come up with some way to handle these cases.
Hopefully between the analyze-migration test and the compat tests we'll catch the next bug of this kind before it gets merged.
Quoted 7 lines
Things like that might be able to be detected via
vmstate-static-checker.py. But I'm not 100% sure, also its coverage is limited.For example, I don't think it can detect changes to objects that will only be created dynamically, e.g., I think sometimes we create objects after some guest behaviors (consider guest enables the device, then QEMU emulation creates some objects on demand of device setup?),
Quoted 6 lines
Feels nuts to me.
In real hardware, software enabling a device that is disabled by default doesn't create the device. The device is always there, it just happens to be inactive unless enabled. We should model the device just like that.
yes. That's how we modeled the two interrupt modes in pseries. The machine has two interrupt controller devices model always present and the cpus, two interrupt presenters. SW negotiates with the platform (QEMU) which mode to activate. This is the only way to support migration with an OS that can choose such complex features.
For the context, POWER9 introduced a new flavor of HW logic for interrupts, which scaled better on large system (16s) and guests with newer OS could dynamically switch the SW interface to choose the new implementation.
Thanks,
C.
Quoted 5 lines
Quoted 4 lines
and since the
static checker shouldn't ever start the VM and run any code, they won't trigger.
Hi Cédric,
Quoted 43 lines · Cédric Le Goater
Quoted 42 lines · Fabiano Rosas
Quoted 39 lines · Cédric Le Goater
Quoted 29 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
Quoted 6 lines
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
it happens we do.
Quoted 8 lines
Quoted 2 lines
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
No no, we want the same for TCG.
Quoted 20 lines
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Quoted 1 line
Regarding aspeed, this series breaks compat.
Can you write down the steps to reproduce please? I'll debug it. We need to understand this.
Quoted 12 lines
Not that we care much
but this caught my attention because of my past experience on pseries. Same kind of QOM change which could impact other machines, like virt. Since you checked that migration compat is preserved on virt, we should be fine.Thanks,
C.
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 43 lines · Cédric Le Goater
Quoted 42 lines · Fabiano Rosas
Quoted 39 lines · Cédric Le Goater
Quoted 29 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
Quoted 6 lines
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
it happens we do.
Quoted 8 lines
Quoted 2 lines
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
No no, we want the same for TCG.
Quoted 20 lines
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Quoted 3 lines
Quoted 1 line
Regarding aspeed, this series breaks compat.
Can you write down the steps to reproduce please? I'll debug it.
Also, have you figured (bisecting) which patch start to break?
Quoted 15 lines
We need to understand this.
Quoted 12 lines
Not that we care much
but this caught my attention because of my past experience on pseries. Same kind of QOM change which could impact other machines, like virt. Since you checked that migration compat is preserved on virt, we should be fine.Thanks,
C.
Quoted 78 lines · Philippe Mathieu-Daudé
Quoted 77 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 43 lines · Cédric Le Goater
Quoted 42 lines · Fabiano Rosas
Quoted 39 lines · Cédric Le Goater
Quoted 29 lines · Fabiano Rosas
Quoted 26 lines · Philippe Mathieu-Daudé
+Peter/Fabiano
Quoted 23 lines · Cédric Le Goater
Quoted 22 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 7 lines · Cédric Le Goater
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container.
Quoted 7 lines
Quoted 2 lines
Doing so we consolidate the QOM model, moving common code in a central place (abstract MPCore parent).
Changing the QOM hierarchy has an impact on the state of the machine and some fixups are then required to maintain migration compatibility. This can become a real headache for KVM machines like virt for which migration compatibility is a feature, less for emulated ones.
All changes are either moving properties (which are not migrated) or moving non-migrated QOM members (i.e. pointers of ARMCPU, which is still migrated elsewhere). So I don't see any obvious migration problem, but I might be missing something, so I Cc'ed Juan :>
Quoted 6 lines
FWIW, I didn't spot anything problematic either.
I've ran this through my migration compatibility series [1] and it doesn't regress aarch64 migration from/to 8.2. The tests use '-M virt -cpu max', so the cortex-a7 and cortex-a15 are not covered. I don't think we even support migration of anything non-KVM on arm.
it happens we do.
Quoted 8 lines
Quoted 2 lines
Oh, sorry, I didn't mean TCG here. Probably meant to say something like non-KVM-capable cpus, as in 32-bit. Nevermind.
Theoretically, we should be able to migrate to a TCG guest. Well, this worked in the past for PPC. When I was doing more KVM related changes, this was very useful for dev. Also, some machines are partially emulated. Anyhow I agree this is not a strong requirement and we often break it. Let's focus on KVM only.
No no, we want the same for TCG.
Quoted 20 lines
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
yes it depends on the QOM hierarchy and virt seems immune to the changes. Good.
However, changing the QOM topology clearly breaks migration compat,
Well, "clearly" is relative =) You've mentioned pseries and aspeed already, do you have a pointer to one of those cases were we broke migration
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Regarding aspeed, this series breaks compat.
Can you write down the steps to reproduce please? I'll debug it.
Also, have you figured (bisecting) which patch start to break?
Sorry I didn't. I wished I had more time for that.
Thanks,
C.
Quoted 10 lines
Quoted 10 lines
Regarding pseries, migration compat broke because of
5bc8d26de20c("spapr: allocate the ICPState object from under sPAPRCPUCore") which is similar to the changes proposed by this series, it impacts the QOM hierarchy. Here is the workaround/fix from Greg :46f7afa37096("spapr: fix migration of ICPState objects from/to older QEMU") which is quite an headache and this turned out to raise another problem some months ago ... :/ That's why I sent [1] to prepare removal of old machines and workarounds becoming a burden.
Quoted 4 lines
Quoted 1 line
Regarding aspeed, this series breaks compat.
Can you write down the steps to reproduce please? I'll debug it. We need to understand this.
Nothing complex,
$ wget https://github.com/legoater/qemu-aspeed-boot/raw/master/images/ast2600-evb/buildroot-2023.11/flash.img
$ qemu-system-arm -M ast2600-evb -net user -drive file=./flash.img,format=raw,if=mtd -nographic -snapshot -serial mon:stdio -trace vmstate* -trace save* -trace load*
$ qemu-system-arm-patch -M ast2600-evb -net user -drive file=./flash.img,format=raw,if=mtd -nographic -snapshot -serial mon:stdio -trace vmstate* -trace save* -trace load* -incoming tcp::1234
stop the VM in U-boot before loading the kernel because QEMU does not support migrating CPU when in secure mode. That's how I understood what Peter told me.
(qemu) migrate tcp:localhost:1234
...vmstate_load_state_field cpu:cpreg_vmstate_array_len vmstate_n_elems cpreg_vmstate_array_len: 1
qemu-system-arm: Invalid value 266 expecting positive value <= 223
qemu-system-arm: Failed to load cpu:cpreg_vmstate_array_len vmstate_load_field_error field "cpreg_vmstate_array_len" load failed, ret = -22
qemu-system-arm: error while loading state for instance 0x0 of device 'cpu'
Thanks,
C.