single-binary: Make hw/arm/ common
Subsystems (4)
v7 cover single-binary: Make hw/arm/ common
Since v6:
- Do not initialize Aspeed CPU in SoC realize (cdrx)
Since v5:
- Unify 'max' CPU type (rth, pm215)
Since v4:
- Add DEFINE_MACHINE_WITH_INTERFACES (Zoltan)
- Use GPtrArray for get_valid_cpu_type (Richard)
- Define InterfaceInfo[] arrays (Richard)
- Collect R-b tags
Since v3:
- QAPI structure renamed as QemuTargetInfo
- MachineClass::get_valid_cpu_types() runtime
- target_aarch64() checking SysEmuTarget value
- Remove CONFIG_TCG #ifdef'ry in hw/arm/
Since v2:
- More comments from Pierrick addressed
- Use GList to register valid CPUs list
- Remove all TARGET_AARCH64 uses in hw/arm/
Since v1:
- Dropped unrelated / irrelevant patches
- Addressed Pierrick comments
- Added R-b tag
- Only considering machines, not CPUs.
Available here, based on my pending patch queue:
https://gitlab.com/philmd/qemu/-/tags/single-binary-hw-arm-rfc-v5
Matthew Penney (1):
tests/qtest: fix discarded const qualifier warning
Philippe Mathieu-Daudé (20):
hw/arm: Build ARM/HVF GICv3 stub once
hw/arm/raspi: Initialize 64-bit CPU types during DeviceRealize() hw/arm/raspi: Build objects once
hw/arm/aspeed: Do not realize 64-bit CPU types under QTest hw/arm/aspeed: Build objects once
hw/arm/meson: Remove now unused arm_ss[] source set target/arm: Introduce common system/user meson source set target/arm: Build gdbstub64.o as common object target/arm: Build cpu64.o as common object target/arm: Restrict IDAU interface to TCG namespace target/arm: Rename Aarch64-specific methods target/arm: Extract common code related to 'max' CPU target/arm: Use make_ccsidr(LEGACY) in 32 bit 'max' CPU type target/arm: Implement DBGDEVID* registers in max AArch32 CPU target/arm: Only set %kvm_target when KVM is enabled target/arm: Factor aarch64_aa32_a57_init() out target/arm: Re-use common aarch64_aa32_a57_init() helper target/arm: Define 'max' CPU type in cpu-max.c target/arm: Build cpu32-system.o as common object target/arm: Build cpu-max.c once
include/hw/arm/armv7m.h | 2 +-
include/hw/misc/tz-msc.h | 2 +-
target/arm/internals.h | 10 +-
target/arm/{ => tcg}/idau.h | 4 +-
hw/arm/armv7m.c | 2 +-
hw/arm/aspeed_ast27x0.c | 14 ++
hw/arm/bcm2836.c | 14 +-
hw/arm/raspi.c | 4 -
target/arm/cpu-max.c | 241 +++++++++++++++++++++
target/arm/cpu.c | 10 +-
target/arm/cpu32-stubs.c | 8 +-
target/arm/cpu64.c | 92 +-------
target/arm/ptw.c | 2 +-
target/arm/tcg/cpu-v7m.c | 11 +
target/arm/tcg/{cpu32.c => cpu32-system.c} | 182 +---------------
target/arm/tcg/stubs32.c | 10 +
tests/qtest/libqtest.c | 2 +-
hw/arm/meson.build | 15 +-
hw/intc/meson.build | 2 +-
target/arm/meson.build | 26 ++-
target/arm/tcg/meson.build | 57 ++---
21 files changed, 356 insertions(+), 354 deletions(-)
rename target/arm/{ => tcg}/idau.h (97%)
create mode 100644 target/arm/cpu-max.c
rename target/arm/tcg/{cpu32.c => cpu32-system.c} (80%)Signature · 1 line
2.53.0
PATCH v7 1/21 tests/qtest: fix discarded const qualifier warning
From: Matthew Penney <[email protected]>
Modern compilers warn that the result of strstr() may discard const qualifiers when assigned to a non-const pointer.
Make 'found' a const char * to fix the warning.
Message-ID: <[email protected]>
--- tests/qtest/libqtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/libqtest.c +1 -1
@@ -2146,7 +2146,7 @@ bool mkimg(const char *file, const char *fmt, unsigned size_mb)bool qtest_verbose (const char *domain) {const char *log =getenv ("QTEST_LOG" ); -char *found; +const char *found;assert (domain);
Signature · 1 line
2.53.0
PATCH v7 2/21 hw/arm: Build ARM/HVF GICv3 stub once
In reply to Philippe Mathieu-DaudéMove arm_gicv3_hvf_stub.c, introduced in commit 48396ad6ce9 ("hw/intc: arm_gicv3_hvf: save/restore Apple GIC state"), to the global stub_ss[] source set which holds stub files being built once for all binaries, instead of one time per system binary. This prevents symbol clash when trying to build a single QEMU system binary:
clang: error: linker command failed with exit code 1 (use -v to see invocation) duplicate symbol '_vmstate_gicv3_hvf' in:
libqemu-aarch64-softmmu.a.p/hw_intc_arm_gicv3_hvf_stub.c.o
libqemu-arm-softmmu.a.p/hw_intc_arm_gicv3_hvf_stub.c.old: 1 duplicate symbols
--- hw/intc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/meson.build +1 -1
@@ -47,7 +47,7 @@ arm_common_ss.add(when: 'CONFIG_ARM_GICV3', if_true: files('arm_gicv3_cpuif.c')) specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) specific_ss.add(when: ['CONFIG_WHPX', 'TARGET_AARCH64'], if_true: files('arm_gicv3_whpx.c')) specific_ss.add(when: ['CONFIG_HVF', 'CONFIG_ARM_GICV3'], if_true: files('arm_gicv3_hvf.c')) -specific_ss.add(when: ['CONFIG_HVF', 'CONFIG_ARM_GICV3'], if_false: files('arm_gicv3_hvf_stub.c')) +stub_ss.add(files('arm_gicv3_hvf_stub.c')) specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) arm_common_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) specific_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_irqmp.c'))
Signature · 1 line
2.53.0
PATCH v7 3/21 hw/arm/raspi: Initialize 64-bit CPU types during DeviceRealize()
In reply to Philippe Mathieu-Daudébcm2836.c models 3 similar SoC: BCM2835, BCM2836 and BCM2837. The BCM2837 is a 64-bit only SoC (Cortex-A53), only available in the 64-bit binary.
If we build this file as common object, all BCM SoCs become available in both 32 and 64-bit binaries; however when running the introspection test on the 32-bit binary, the BCM2837 init() method tries to init the Cortex-A53 type -- although not realizing it -- which is not available. This can be avoided by deferring the CPU type initialization to the SoC DeviceRealize step (this is safe because nothing uses the CPU type before, only the GIC access them, just after their realization).
--- hw/arm/bcm2836.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
hw/arm/bcm2836.c +5 -5
@@ -25,12 +25,7 @@ static void bcm283x_base_init(Object *obj) {BCM283XBaseState *s =BCM283X_BASE (obj);BCM283XBaseClass *bc =BCM283X_BASE_GET_CLASS (obj); -int n; -for (n =0 ; n < bc->core_count; n++) { -object_initialize_child (obj,"cpu[*]" , &s->cpu[n].core, - bc->cpu_type); - }if (bc->core_count >1 ) {qdev_property_add_static (DEVICE (obj), &bcm2836_enabled_cores_property);qdev_prop_set_uint32 (DEVICE (obj),"enabled-cpus" , bc->core_count);
@@ -65,6 +60,11 @@ bool bcm283x_common_realize(DeviceState *dev, BCMSocPeripheralBaseState *ps,BCM283XBaseClass *bc =BCM283X_BASE_GET_CLASS (dev);Object *obj; +for (int n =0 ; n < bc->core_count; n++) { +object_initialize_child (OBJECT (dev),"cpu[*]" , &s->cpu[n].core, + bc->cpu_type); + } +/* common peripherals from bcm2835 */ obj =object_property_get_link (OBJECT (dev),"ram" , &error_abort);
Signature · 1 line
2.53.0
PATCH v7 4/21 hw/arm/raspi: Build objects once
In reply to Philippe Mathieu-DaudéNow than Raspi machines can be filtered when running a qemu-system-arm or qemu-system-aarch64 binary, we can remove the TARGET_AARCH64 #ifdef'ry and compile the aspeed.c file once, moving it from arm_ss[] source set to arm_common_ss[]. Note, we expose the TYPE_BCM2837 and TYPE_BCM2838 types to qemu-system-arm, but they are not user-creatable, so not an issue.
--- hw/arm/bcm2836.c | 4 ---- hw/arm/raspi.c | 4 ---- hw/arm/meson.build | 8 ++++++-- 3 files changed, 6 insertions(+), 10 deletions(-)
hw/arm/bcm2836.c +0 -4
@@ -195,7 +195,6 @@ static void bcm2836_class_init(ObjectClass *oc, const void *data) dc->realize = bcm2836_realize; }; -#ifdef TARGET_AARCH64 static void bcm2837_class_init (ObjectClass *oc,const void *data) {DeviceClass *dc =DEVICE_CLASS (oc);
@@ -208,7 +207,6 @@ static void bcm2837_class_init(ObjectClass *oc, const void *data) bc->clusterid =0x0 ; dc->realize = bcm2836_realize; }; -#endif static const TypeInfo bcm283x_types[] = { {
@@ -219,12 +217,10 @@ static const TypeInfo bcm283x_types[] = { .name = TYPE_BCM2836, .parent = TYPE_BCM283X, .class_init = bcm2836_class_init, -#ifdef TARGET_AARCH64 }, { .name = TYPE_BCM2837, .parent = TYPE_BCM283X, .class_init = bcm2837_class_init, -#endif }, { .name = TYPE_BCM283X, .parent = TYPE_BCM283X_BASE,
hw/arm/raspi.c +0 -4
@@ -367,7 +367,6 @@ static void raspi2b_machine_class_init(ObjectClass *oc, const void *data)raspi_machine_class_init (mc, rmc->board_rev); }; -#ifdef TARGET_AARCH64 static void raspi3ap_machine_class_init (ObjectClass *oc,const void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -387,7 +386,6 @@ static void raspi3b_machine_class_init(ObjectClass *oc, const void *data) rmc->board_rev =0xa02082 ;raspi_machine_class_init (mc, rmc->board_rev); }; -#endif /* TARGET_AARCH64 */ static const TypeInfo raspi_machine_types[] = { {
@@ -405,7 +403,6 @@ static const TypeInfo raspi_machine_types[] = { .parent = TYPE_RASPI_MACHINE, .class_init = raspi2b_machine_class_init, .interfaces = arm_machine_interfaces, -#ifdef TARGET_AARCH64 }, { .name = MACHINE_TYPE_NAME("raspi3ap"), .parent = TYPE_RASPI_MACHINE,
@@ -416,7 +413,6 @@ static const TypeInfo raspi_machine_types[] = { .parent = TYPE_RASPI_MACHINE, .class_init = raspi3b_machine_class_init, .interfaces = aarch64_machine_interfaces, -#endif }, { .name = TYPE_RASPI_MACHINE, .parent = TYPE_RASPI_BASE_MACHINE,
hw/arm/meson.build +6 -2
@@ -27,8 +27,12 @@ arm_common_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c' arm_common_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c')) arm_common_ss.add(when: 'CONFIG_ALLWINNER_R40', if_true: files('allwinner-r40.c', 'bananapi_m2u.c')) arm_common_ss.add(when: 'CONFIG_MAX78000_SOC', if_true: files('max78000_soc.c')) -arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2836.c', 'raspi.c')) -arm_common_ss.add(when: ['CONFIG_RASPI', 'TARGET_AARCH64'], if_true: files('bcm2838.c', 'raspi4b.c')) +arm_common_ss.add(when: 'CONFIG_RASPI', if_true: files( + 'bcm2836.c', + 'bcm2838.c', + 'raspi.c', + 'raspi4b.c' +)) arm_common_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c')) arm_common_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c')) arm_common_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c'))
Signature · 1 line
2.53.0
PATCH v7 5/21 hw/arm/aspeed: Do not realize 64-bit CPU types under QTest
In reply to Philippe Mathieu-Daudéaspeed_ast27x0.c models 2 similar SoC based on a 64-bit only CPU (Cortex-A35), only available in the 64-bit binary.
If we build this file as common object, these SoCs become available in both 32 and 64-bit binaries; however when running the introspection test on the 32-bit binary, the init() method tries to init the Cortex-A35 type -- although not realizing it -- which is not available. Simply skip CPU initialization when running QTests on a 32-bit binary, asserting the realization step is not reached.
--- hw/arm/aspeed_ast27x0.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
hw/arm/aspeed_ast27x0.c +14 -0
@@ -18,6 +18,7 @@#include "qemu/error-report.h" #include "hw/i2c/aspeed_i2c.h" #include "net/net.h" +#include "system/qtest.h" #include "system/system.h" #include "hw/intc/arm_gicv3.h" #include "qobject/qlist.h"
@@ -419,6 +420,15 @@ static void aspeed_soc_ast2700_init(Object *obj) }for (i =0 ; i < sc->num_cpus; i++) { +if (qtest_enabled () && !target_aarch64 ()) { +/* +* Introspection qtest just want to create this object +* without realizing it. ARM_CPU_TYPE_NAME("cortex-a35") +* is not available on 32-bit binary: skip it since we +* won't even realize it. +*/ +continue ; + }object_initialize_child (obj,"cpu[*]" , &a->cpu[i],aspeed_soc_cpu_type (sc->valid_cpu_types)); }
@@ -693,6 +703,10 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)qemu_irq irq;int uart; +if (qtest_enabled () && !target_aarch64 ()) { +g_assert_not_reached (); + } +/* Default boot region (SPI memory or ROMs) */ memory_region_init (&s->spi_boot_container,OBJECT (s),"aspeed.spi_boot_container" ,0x400000000 );
Signature · 1 line
2.53.0
Re: [PATCH v7 05/21] hw/arm/aspeed: Do not realize 64-bit CPU types under QTest
Quoted 11 lines · Philippe Mathieu-Daudé
aspeed_ast27x0.cmodels 2 similar SoC based on a 64-bit only CPU (Cortex-A35), only available in the 64-bit binary.If we build this file as common object, these SoCs become available in both 32 and 64-bit binaries; however when running the introspection test on the 32-bit binary, the
init()method tries to init the Cortex-A35 type -- although not realizing it -- which is not available. Simply skip CPU initialization when running QTests on a 32-bit binary, asserting the realization step is not reached.
Quoted 2 lines
Suggested-by Cédric Le Goater <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 43 lines
--- hw/arm/aspeed_ast27x0.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)hw/arm/aspeed_ast27x0.c +14
-0@@ -18,6 +18,7 @@#include "qemu/error-report.h" #include "hw/i2c/aspeed_i2c.h" #include "net/net.h" +#include "system/qtest.h" #include "system/system.h" #include "hw/intc/arm_gicv3.h" #include "qobject/qlist.h" @@ -419,6 +420,15 @@ static void aspeed_soc_ast2700_init(Object *obj) }for (i =0 ; i < sc->num_cpus; i++) { +if (qtest_enabled () && !target_aarch64 ()) { +/* +* Introspection qtest just want to create this object +* without realizing it. ARM_CPU_TYPE_NAME("cortex-a35") +* is not available on 32-bit binary: skip it since we +* won't even realize it. +*/ +continue ; + }object_initialize_child (obj,"cpu[*]" , &a->cpu[i],aspeed_soc_cpu_type (sc->valid_cpu_types)); }@@ -693,6 +703,10 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)qemu_irq irq;int uart; +if (qtest_enabled () && !target_aarch64 ()) { +g_assert_not_reached (); + } +/* Default boot region (SPI memory or ROMs) */ memory_region_init (&s->spi_boot_container,OBJECT (s),"aspeed.spi_boot_container" ,0x400000000 );
Re: [PATCH v7 05/21] hw/arm/aspeed: Do not realize 64-bit CPU types under QTest
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
aspeed_ast27x0.cmodels 2 similar SoC based on a 64-bit only CPU (Cortex-A35), only available in the 64-bit binary.If we build this file as common object, these SoCs become available in both 32 and 64-bit binaries; however when running the introspection test on the 32-bit binary, the
init()method tries to init the Cortex-A35 type -- although not realizing it -- which is not available. Simply skip CPU initialization when running QTests on a 32-bit binary, asserting the realization step is not reached.
Quoted 6 lines
Suggested-by Cédric Le Goater <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/aspeed_ast27x0.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
PATCH v7 6/21 hw/arm/aspeed: Build objects once
In reply to Philippe Mathieu-DaudéCommit 064f1ce95fe ("hw/arm/aspeed: Split AST2700 EVB machine into a separate source file for maintainability") remove the last TARGET_AARCH64 use.
Now than Aspeed machines can be filtered when running a qemu-system-arm or qemu-system-aarch64 binary, we can compile the aspeed.c file once, moving it from arm_ss[] source set to arm_common_ss[].
--- hw/arm/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
hw/arm/meson.build +2 -3
@@ -43,7 +43,7 @@ arm_common_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal.c', 'x arm_common_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c', 'imx25_pdk.c')) arm_common_ss.add(when: 'CONFIG_FSL_IMX31', if_true: files('fsl-imx31.c', 'kzm.c')) arm_common_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c')) -arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( +arm_common_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed.c', 'aspeed_soc_common.c', 'aspeed_ast2400.c',
@@ -66,8 +66,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_ast2600_gb200nvl.c', 'aspeed_ast2600_rainier.c', 'aspeed_ast10x0.c', - 'aspeed_ast10x0_evb.c')) -arm_common_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files( + 'aspeed_ast10x0_evb.c', 'aspeed_ast1700.c', 'aspeed_ast27x0.c', 'aspeed_ast27x0_evb.c',
Signature · 1 line
2.53.0
Re: [PATCH v7 06/21] hw/arm/aspeed: Build objects once
Quoted 31 lines · Philippe Mathieu-Daudé
Commit
064f1ce95fe("hw/arm/aspeed: Split AST2700 EVB machine into a separate source file for maintainability") remove the lastTARGET_AARCH64use.Now than Aspeed machines can be filtered when running a qemu-system-arm or qemu-system-aarch64 binary, we can compile the
aspeed.cfile once, moving it from arm_ss[] source set to arm_common_ss[].Signed-off-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Pierrick Bouvier <[email protected]>Reviewed-by Richard Henderson <[email protected]>Reviewed-by Manos Pitsidianakis <[email protected]>--- hw/arm/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)hw/arm/meson.build +1
-1@@ -43,7 +43,7 @@ arm_common_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal.c', 'x arm_common_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c', 'imx25_pdk.c')) arm_common_ss.add(when: 'CONFIG_FSL_IMX31', if_true: files('fsl-imx31.c', 'kzm.c')) arm_common_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c')) -arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( +arm_common_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed.c', 'aspeed_soc_common.c', 'aspeed_ast2400.c',
hw/arm/meson.build arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( · line 72
Quoted 9 lines
hw/arm/meson.build +1
-2@@ -66,8 +66,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_ast2600_gb200nvl.c', 'aspeed_ast2600_rainier.c', 'aspeed_ast10x0.c', - 'aspeed_ast10x0_evb.c')) -arm_common_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files( + 'aspeed_ast10x0_evb.c', 'aspeed_ast1700.c', 'aspeed_ast27x0.c', 'aspeed_ast27x0_evb.c',
Thanks,
C.
PATCH v7 7/21 hw/arm/meson: Remove now unused arm_ss[] source set
In reply to Philippe Mathieu-Daudé--- hw/arm/meson.build | 2 -- 1 file changed, 2 deletions(-)
hw/arm/meson.build +0 -2
@@ -1,4 +1,3 @@ -arm_ss = ss.source_set() arm_common_ss = ss.source_set() arm_common_ss.add(when: 'CONFIG_ARM_VIRT', if_true: files('virt.c')) arm_common_ss.add(when: 'CONFIG_ACPI', if_true: files('virt-acpi-build.c'))
@@ -108,5 +107,4 @@ arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c')) arm_common_ss.add(files('boot.c')) -hw_arch += {'arm': arm_ss} hw_common_arch += {'arm': arm_common_ss}
Signature · 1 line
2.53.0
PATCH v7 8/21 target/arm: Introduce common system/user meson source set
In reply to Philippe Mathieu-DaudéIntroduce a source set common to system / user.
No logical change intended.
--- target/arm/meson.build | 21 +++++++++-------- target/arm/tcg/meson.build | 48 ++++++++++++-------------------------- 2 files changed, 26 insertions(+), 43 deletions(-)
target/arm/meson.build +11 -10
@@ -1,6 +1,7 @@ arm_ss = ss.source_set() arm_common_ss = ss.source_set() arm_common_system_ss = ss.source_set() +arm_common_user_system_ss = ss.source_set() arm_system_ss = ss.source_set() arm_stubs_ss = ss.source_set() arm_user_ss = ss.source_set()
@@ -16,6 +17,13 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files( arm_common_ss.add(files( 'mmuidx.c', )) +arm_common_user_system_ss.add(files( + 'cpregs-gcs.c', + 'cpregs-pmu.c', + 'debug_helper.c', + 'helper.c', + 'vfp_fpscr.c', +)) arm_common_system_ss.add(files( 'arm-qmp-cmds.c',
@@ -26,11 +34,6 @@ arm_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c')) arm_user_ss.add(files('cpu.c')) arm_stubs_ss.add(files('cpu32-stubs.c')) arm_user_ss.add(files( - 'cpregs-gcs.c', - 'cpregs-pmu.c', - 'debug_helper.c', - 'helper.c', - 'vfp_fpscr.c', 'el2-stubs.c', 'cpregs-omap-stub.c', ))
@@ -45,15 +48,10 @@ arm_common_system_ss.add(files( 'arch_dump.c', 'arm-powerctl.c', 'cortex-regs.c', - 'cpregs-gcs.c', 'cpregs-omap.c', - 'cpregs-pmu.c', 'cpu-irq.c', - 'debug_helper.c', - 'helper.c', 'machine.c', 'ptw.c', - 'vfp_fpscr.c', )) subdir('hvf')
@@ -65,6 +63,9 @@ else arm_common_system_ss.add(files('tcg-stubs.c')) endif +arm_user_ss.add_all(arm_common_user_system_ss) +arm_common_system_ss.add_all(arm_common_user_system_ss) + target_arch += {'arm': arm_ss} target_system_arch += {'arm': arm_system_ss} target_user_arch += {'arm': arm_user_ss}
target/arm/tcg/meson.build +15 -33
74 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v7 9/21 target/arm: Build gdbstub64.o as common object
In reply to Philippe Mathieu-DaudéWhile gdbstub64.o is already built once, build it as common object, reducing target-specific set in arm_ss[].
--- target/arm/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/arm/meson.build +3 -1
@@ -11,7 +11,6 @@ arm_user_ss.add(files('gdbstub.c')) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'cpu64.c', - 'gdbstub64.c' )) arm_common_ss.add(files(
@@ -24,6 +23,9 @@ arm_common_user_system_ss.add(files( 'helper.c', 'vfp_fpscr.c', )) +arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files( + 'gdbstub64.c' +)) arm_common_system_ss.add(files( 'arm-qmp-cmds.c',
Signature · 1 line
2.53.0
PATCH v7 10/21 target/arm: Build cpu64.o as common object
In reply to Philippe Mathieu-DaudéWhile gdbstub64.o is already built once, build it as common object, reducing target-specific set in arm_ss[].
--- target/arm/tcg/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/arm/tcg/meson.build +3 -1
@@ -35,7 +35,6 @@ arm_ss.add(files( )) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( - 'cpu64.c', 'gengvec64.c', 'translate-a64.c', 'translate-sve.c',
@@ -79,6 +78,9 @@ arm_common_user_system_ss.add( 'vec_helper.c', 'vfp_helper.c', )) +arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files( + 'cpu64.c', +)) arm_common_system_ss.add(files( 'cpregs-at.c',
Signature · 1 line
2.53.0
PATCH v7 11/21 target/arm: Restrict IDAU interface to TCG namespace
In reply to Philippe Mathieu-DaudéEmphasize the IDAU interface is restricted to TCG by moving the header under target/arm/tcg/. Move the definition to cpu-v7m.c which also contains v7/v8 hardware (NVIC), keeping only CPU types in cpu32.c.
---
include/hw/arm/armv7m.h | 2 +-
include/hw/misc/tz-msc.h | 2 +-
target/arm/{ => tcg}/idau.h | 4 ++--
hw/arm/armv7m.c | 2 +-
target/arm/cpu.c | 2 +-
target/arm/ptw.c | 2 +-
target/arm/tcg/cpu-v7m.c | 11 +++++++++++
target/arm/tcg/cpu32.c | 8 --------
8 files changed, 18 insertions(+), 15 deletions(-)
rename target/arm/{ => tcg}/idau.h (97%)include/hw/arm/armv7m.h +1 -1
@@ -13,7 +13,7 @@#include "hw/core/sysbus.h" #include "hw/intc/armv7m_nvic.h" #include "hw/misc/armv7m_ras.h" -#include "target/arm/idau.h" +#include "target/arm/tcg/idau.h" #include "qom/object.h" #include "hw/core/clock.h"
include/hw/misc/tz-msc.h +1 -1
@@ -51,7 +51,7 @@#define TZ_MSC_H #include "hw/core/sysbus.h" -#include "target/arm/idau.h" +#include "target/arm/tcg/idau.h" #include "qom/object.h" #define TYPE_TZ_MSC "tz-msc"
target/arm/tcg/idau.h renamed from target/arm/idau.h +2 -2
@@ -25,8 +25,8 @@* connected to the CPU using a link property. */ -#ifndef TARGET_ARM_IDAU_H -#define TARGET_ARM_IDAU_H +#ifndef TARGET_ARM_TCG_IDAU_H +#define TARGET_ARM_TCG_IDAU_H #include "qom/object.h"
hw/arm/armv7m.c +1 -1
@@ -20,7 +20,7 @@#include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/log.h" -#include "target/arm/idau.h" +#include "target/arm/tcg/idau.h" #include "target/arm/cpu.h" #include "target/arm/cpu-features.h" #include "target/arm/cpu-qom.h"
target/arm/cpu.c +1 -1
@@ -24,7 +24,7 @@#include "qemu/log.h" #include "exec/page-vary.h" #include "system/whpx.h" -#include "target/arm/idau.h" +#include "target/arm/tcg/idau.h" #include "qemu/module.h" #include "qapi/error.h" #include "cpu.h"
target/arm/ptw.c +1 -1
@@ -17,7 +17,7 @@#include "cpu.h" #include "internals.h" #include "cpu-features.h" -#include "idau.h" +#include "target/arm/tcg/idau.h" typedef struct S1Translate { /*
target/arm/tcg/cpu-v7m.c +11 -0
@@ -11,6 +11,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "accel/tcg/cpu-ops.h" +#include "target/arm/tcg/idau.h" #include "internals.h" #if !defined(CONFIG_USER_ONLY )
@@ -40,6 +41,16 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)return ret; } +static const TypeInfo arm_v8m_types[] = { + { + .name =TYPE_IDAU_INTERFACE , + .parent =TYPE_INTERFACE , + .class_size =sizeof (IDAUInterfaceClass), + } +}; + +DEFINE_TYPES(arm_v8m_types) +#endif /* !CONFIG_USER_ONLY */ static void cortex_m0_initfn (Object *obj)
target/arm/tcg/cpu32.c +0 -8
@@ -12,7 +12,6 @@#include "cpu.h" #include "accel/tcg/cpu-ops.h" #include "internals.h" -#include "target/arm/idau.h" #if !defined(CONFIG_USER_ONLY )#include "hw/core/boards.h" #endif
@@ -899,17 +898,10 @@ static const ARMCPUInfo arm_tcg_cpus[] = {#endif }; -static const TypeInfo idau_interface_type_info = { - .name =TYPE_IDAU_INTERFACE , - .parent =TYPE_INTERFACE , - .class_size =sizeof (IDAUInterfaceClass), -}; -static void arm_tcg_cpu_register_types (void ) {size_t i; -type_register_static (&idau_interface_type_info);for (i =0 ; i <ARRAY_SIZE (arm_tcg_cpus); ++i) {arm_cpu_register (&arm_tcg_cpus[i]); }
Signature · 1 line
2.53.0
Re: [PATCH v7 11/21] target/arm: Restrict IDAU interface to TCG namespace
Quoted 8 lines · Philippe Mathieu-Daudé
Emphasize the IDAU interface is restricted to TCG by moving the header under target/arm/tcg/. Move the definition to
cpu-v7m.cwhich also contains v7/v8 hardware (NVIC), keeping only CPU types incpu32.c.Reviewed-by Pierrick Bouvier <[email protected]>Reviewed-by Manos Pitsidianakis <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 12 lines
---
include/hw/arm/armv7m.h | 2 +-
include/hw/misc/tz-msc.h | 2 +-
target/arm/{ => tcg}/idau.h | 4 ++--
hw/arm/armv7m.c | 2 +-
target/arm/cpu.c | 2 +-
target/arm/ptw.c | 2 +-
target/arm/tcg/cpu-v7m.c | 11 +++++++++++
target/arm/tcg/cpu32.c | 8 --------
8 files changed, 18 insertions(+), 15 deletions(-)
rename target/arm/{ => tcg}/idau.h (97%)This patch creates a problem with the (now merged) commit:8d3e31c0d575b3265ae5cacfba10680718ba5a22 "target/arm: Extract IDAU interface to its own unit"
Indeed, it results with TYPE_IDAU_INTERFACE being register twice which fails at startup.
Maybe simply drop current commit?
Regards,
Pierrick
Re: [PATCH v7 11/21] target/arm: Restrict IDAU interface to TCG namespace
Quoted 22 lines · Pierrick Bouvier
Quoted 18 lines · Philippe Mathieu-Daudé
Emphasize the IDAU interface is restricted to TCG by moving the header under target/arm/tcg/. Move the definition to
cpu-v7m.cwhich also contains v7/v8 hardware (NVIC), keeping only CPU types incpu32.c.Reviewed-by Pierrick Bouvier <[email protected]>Reviewed-by Manos Pitsidianakis <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/arm/armv7m.h | 2 +- include/hw/misc/tz-msc.h | 2 +- target/arm/{ => tcg}/idau.h | 4 ++-- hw/arm/armv7m.c | 2 +- target/arm/cpu.c | 2 +- target/arm/ptw.c | 2 +- target/arm/tcg/cpu-v7m.c | 11 +++++++++++ target/arm/tcg/cpu32.c | 8 -------- 8 files changed, 18 insertions(+), 15 deletions(-)Quoted 2 lines
rename target/arm/{ =>
tcg}/idau.h(97%)
Quoted 8 lines
This patch creates a problem with the (now merged) commit:
8d3e31c0d575b3265ae5cacfba10680718ba5a22"target/arm: Extract IDAU interface to its own unit"Indeed, it results with
TYPE_IDAU_INTERFACEbeing register twice which fails at startup.Maybe simply drop current commit?
Yes. I'll repost, but the series still won't apply cleanly when the "discarded const qualifier warning" fix gets merged (just letting know, I don't mind respinning).
Quoted 3 lines
Regards,
Pierrick
Re: [PATCH v7 11/21] target/arm: Restrict IDAU interface to TCG namespace
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 26 lines · Pierrick Bouvier
Quoted 17 lines · Philippe Mathieu-Daudé
Emphasize the IDAU interface is restricted to TCG by moving the header under target/arm/tcg/. Move the definition to
cpu-v7m.cwhich also contains v7/v8 hardware (NVIC), keeping only CPU types incpu32.c.Reviewed-by Pierrick Bouvier <[email protected]>Reviewed-by Manos Pitsidianakis <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
include/hw/arm/armv7m.h | 2 +-
include/hw/misc/tz-msc.h | 2 +-
target/arm/{ =>tcg}/idau.h| 4 ++--
hw/arm/armv7m.c | 2 +-
target/arm/cpu.c | 2 +-
target/arm/ptw.c | 2 +-
target/arm/tcg/cpu-v7m.c | 11 +++++++++++
target/arm/tcg/cpu32.c | 8 --------Quoted 3 lines
8 files changed, 18 insertions(+), 15 deletions(-)rename target/arm/{ =>
tcg}/idau.h(97%)This patch creates a problem with the (now merged) commit:
8d3e31c0d575b3265ae5cacfba10680718ba5a22"target/arm: Extract IDAU interface to its own unit"
Quoted 9 lines
Quoted 4 lines
Indeed, it results with
TYPE_IDAU_INTERFACEbeing register twice which fails at startup.Maybe simply drop current commit?
Yes. I'll repost, but the series still won't apply cleanly when the "discarded const qualifier warning" fix gets merged (just letting know, I don't mind respinning).
No rush to respin, as I fixed it on my side for now :)
Quoted 4 lines
Quoted 3 lines
Regards,
Pierrick
PATCH v7 12/21 target/arm: Rename Aarch64-specific methods
In reply to Philippe Mathieu-Daudé--- target/arm/internals.h | 8 ++++---- target/arm/cpu.c | 8 ++++---- target/arm/cpu32-stubs.c | 8 ++++---- target/arm/cpu64.c | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-)
target/arm/internals.h +4 -4
@@ -1750,10 +1750,10 @@ int aarch64_gdb_get_tag_ctl_reg(CPUState *cs, GByteArray *buf, int reg);int aarch64_gdb_set_tag_ctl_reg (CPUState *cs,uint8_t *buf,int reg);int aarch64_gdb_get_tls_reg (CPUState *cs,GByteArray *buf,int reg);int aarch64_gdb_set_tls_reg (CPUState *cs,uint8_t *buf,int reg); -void arm_cpu_sve_finalize (ARMCPU *cpu,Error **errp); -void arm_cpu_sme_finalize (ARMCPU *cpu,Error **errp); -void arm_cpu_pauth_finalize (ARMCPU *cpu,Error **errp); -void arm_cpu_lpa2_finalize (ARMCPU *cpu,Error **errp); +void aarch64_cpu_sve_finalize (ARMCPU *cpu,Error **errp); +void aarch64_cpu_sme_finalize (ARMCPU *cpu,Error **errp); +void aarch64_cpu_pauth_finalize (ARMCPU *cpu,Error **errp); +void aarch64_cpu_lpa2_finalize (ARMCPU *cpu,Error **errp);void aarch64_max_tcg_initfn (Object *obj);void aarch64_add_pauth_properties (Object *obj);void aarch64_add_sve_properties (Object *obj);
target/arm/cpu.c +4 -4
@@ -1707,25 +1707,25 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp)Error *local_err =NULL ;if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) { -arm_cpu_sve_finalize (cpu, &local_err); +aarch64_cpu_sve_finalize (cpu, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err);return ; } -arm_cpu_sme_finalize (cpu, &local_err); +aarch64_cpu_sme_finalize (cpu, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err);return ; } -arm_cpu_pauth_finalize (cpu, &local_err); +aarch64_cpu_pauth_finalize (cpu, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err);return ; } -arm_cpu_lpa2_finalize (cpu, &local_err); +aarch64_cpu_lpa2_finalize (cpu, &local_err);if (local_err !=NULL ) {error_propagate (errp, local_err);return ;
target/arm/cpu32-stubs.c +4 -4
@@ -4,22 +4,22 @@#include "target/arm/cpu.h" #include "target/arm/internals.h" -void arm_cpu_sme_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_sme_finalize (ARMCPU *cpu,Error **errp) {g_assert_not_reached (); } -void arm_cpu_sve_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_sve_finalize (ARMCPU *cpu,Error **errp) {g_assert_not_reached (); } -void arm_cpu_pauth_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_pauth_finalize (ARMCPU *cpu,Error **errp) {g_assert_not_reached (); } -void arm_cpu_lpa2_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_lpa2_finalize (ARMCPU *cpu,Error **errp) {g_assert_not_reached (); }
target/arm/cpu64.c +6 -6
@@ -60,7 +60,7 @@ int get_sysreg_idx(ARMSysRegs sysreg)#undef DEF -void arm_cpu_sve_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_sve_finalize (ARMCPU *cpu,Error **errp) {/* * If any vector lengths are explicitly enabled with sve<N> properties,
@@ -121,7 +121,7 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)* Disable all SVE extensions as well. Note that some ZFR0 * fields are used also by SME so must not be wiped in * an SME-no-SVE config. We will clear the rest in -* arm_cpu_sme_finalize() if necessary. +* aarch_cpu_sme_finalize() if necessary. */ FIELD_DP64_IDREG (&cpu->isar,ID_AA64ZFR0 ,F64MM ,0 );FIELD_DP64_IDREG (&cpu->isar,ID_AA64ZFR0 ,F32MM ,0 );
@@ -336,7 +336,7 @@ static void cpu_arm_set_sve(Object *obj, bool value, Error **errp)FIELD_DP64_IDREG (&cpu->isar,ID_AA64PFR0 ,SVE , value); } -void arm_cpu_sme_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_sme_finalize (ARMCPU *cpu,Error **errp) {uint32_t vq_map = cpu->sme_vq.map;uint32_t vq_init = cpu->sme_vq.init;
@@ -408,7 +408,7 @@ static void cpu_arm_set_sme(Object *obj, bool value, Error **errp)/* * For now, write 0 for "off" and 1 for "on" into the PFR1 field. * We will correct this value to report the right SME -* level (SME vs SME2) in arm_cpu_sme_finalize() later. +* level (SME vs SME2) in aarch_cpu_sme_finalize() later. */ FIELD_DP64_IDREG (&cpu->isar,ID_AA64PFR1 ,SME , value); }
@@ -548,7 +548,7 @@ void aarch64_add_sme_properties(Object *obj)#endif } -void arm_cpu_pauth_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_pauth_finalize (ARMCPU *cpu,Error **errp) {ARMPauthFeature features =cpu_isar_feature (pauth_feature, cpu);ARMISARegisters *isar = &cpu->isar;
@@ -666,7 +666,7 @@ void aarch64_add_pauth_properties(Object *obj) } } -void arm_cpu_lpa2_finalize (ARMCPU *cpu,Error **errp) +void aarch64_cpu_lpa2_finalize (ARMCPU *cpu,Error **errp) {uint64_t t;
Signature · 1 line
2.53.0
PATCH v7 13/21 target/arm: Extract common code related to 'max' CPU
In reply to Philippe Mathieu-DaudéExtract common code related to 'max' CPU. This commit only move code used by the 32-bit 'max' CPU, but we will soon add the 64-bit counterpart, so name it generically as "cpu-max.c".
--- target/arm/cpu-max.c | 106 +++++++++++++++++++++++++++++++++++++++++ target/arm/tcg/cpu32.c | 96 ------------------------------------- target/arm/meson.build | 1 + 3 files changed, 107 insertions(+), 96 deletions(-) create mode 100644 target/arm/cpu-max.c
target/arm/cpu-max.c new file +106 -0
@@ -0,0 +1,106 @@ +/* +* QEMU ARM 'max' CPU +* +* Copyright (c) 2018 Linaro Ltd +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "target/arm/internals.h" + +/* Share AArch32 -cpu max features with AArch64. */ +void aa32_max_features (ARMCPU *cpu) +{ +uint32_t t; +ARMISARegisters *isar = &cpu->isar; + +/* Add additional features supported by QEMU */ + t =GET_IDREG (isar,ID_ISAR5 ); + t =FIELD_DP32 (t,ID_ISAR5 ,AES ,2 );/* FEAT_PMULL */ + t =FIELD_DP32 (t,ID_ISAR5 ,SHA1 ,1 );/* FEAT_SHA1 */ + t =FIELD_DP32 (t,ID_ISAR5 ,SHA2 ,1 );/* FEAT_SHA256 */ + t =FIELD_DP32 (t,ID_ISAR5 ,CRC32 ,1 ); + t =FIELD_DP32 (t,ID_ISAR5 ,RDM ,1 );/* FEAT_RDM */ + t =FIELD_DP32 (t,ID_ISAR5 ,VCMA ,1 );/* FEAT_FCMA */ +SET_IDREG (isar,ID_ISAR5 , t); + + t =GET_IDREG (isar,ID_ISAR6 ); + t =FIELD_DP32 (t,ID_ISAR6 ,JSCVT ,1 );/* FEAT_JSCVT */ + t =FIELD_DP32 (t,ID_ISAR6 ,DP ,1 );/* Feat_DotProd */ + t =FIELD_DP32 (t,ID_ISAR6 ,FHM ,1 );/* FEAT_FHM */ + t =FIELD_DP32 (t,ID_ISAR6 ,SB ,1 );/* FEAT_SB */ + t =FIELD_DP32 (t,ID_ISAR6 ,SPECRES ,1 );/* FEAT_SPECRES */ + t =FIELD_DP32 (t,ID_ISAR6 ,BF16 ,1 );/* FEAT_AA32BF16 */ + t =FIELD_DP32 (t,ID_ISAR6 ,I8MM ,1 );/* FEAT_AA32I8MM */ +SET_IDREG (isar,ID_ISAR6 , t); + + t = cpu->isar.mvfr1; + t =FIELD_DP32 (t,MVFR1 ,FPHP ,3 );/* FEAT_FP16 */ + t =FIELD_DP32 (t,MVFR1 ,SIMDHP ,2 );/* FEAT_FP16 */ + cpu->isar.mvfr1 = t; + + t = cpu->isar.mvfr2; + t =FIELD_DP32 (t,MVFR2 ,SIMDMISC ,3 );/* SIMD MaxNum */ + t =FIELD_DP32 (t,MVFR2 ,FPMISC ,4 );/* FP MaxNum */ + cpu->isar.mvfr2 = t; + +FIELD_DP32_IDREG (isar,ID_MMFR3 ,PAN ,2 );/* FEAT_PAN2 */ + + t =GET_IDREG (isar,ID_MMFR4 ); + t =FIELD_DP32 (t,ID_MMFR4 ,HPDS ,2 );/* FEAT_HPDS2 */ + t =FIELD_DP32 (t,ID_MMFR4 ,AC2 ,1 );/* ACTLR2, HACTLR2 */ + t =FIELD_DP32 (t,ID_MMFR4 ,CNP ,1 );/* FEAT_TTCNP */ + t =FIELD_DP32 (t,ID_MMFR4 ,XNX ,1 );/* FEAT_XNX */ + t =FIELD_DP32 (t,ID_MMFR4 ,EVT ,2 );/* FEAT_EVT */ +SET_IDREG (isar,ID_MMFR4 , t); + +FIELD_DP32_IDREG (isar,ID_MMFR5 ,ETS ,2 );/* FEAT_ETS2 */ + + t =GET_IDREG (isar,ID_PFR0 ); + t =FIELD_DP32 (t,ID_PFR0 ,CSV2 ,2 );/* FEAT_CSV2 */ + t =FIELD_DP32 (t,ID_PFR0 ,DIT ,1 );/* FEAT_DIT */ + t =FIELD_DP32 (t,ID_PFR0 ,RAS ,1 );/* FEAT_RAS */ +SET_IDREG (isar,ID_PFR0 , t); + + t =GET_IDREG (isar,ID_PFR2 ); + t =FIELD_DP32 (t,ID_PFR2 ,CSV3 ,1 );/* FEAT_CSV3 */ + t =FIELD_DP32 (t,ID_PFR2 ,SSBS ,1 );/* FEAT_SSBS */ +SET_IDREG (isar,ID_PFR2 , t); + + t =GET_IDREG (isar,ID_DFR0 ); + t =FIELD_DP32 (t,ID_DFR0 ,COPDBG ,10 );/* FEAT_Debugv8p8 */ + t =FIELD_DP32 (t,ID_DFR0 ,COPSDBG ,10 );/* FEAT_Debugv8p8 */ + t =FIELD_DP32 (t,ID_DFR0 ,PERFMON ,6 );/* FEAT_PMUv3p5 */ +SET_IDREG (isar,ID_DFR0 , t); + +/* Debug ID registers. */ + +/* Bit[15] is RES1, Bit[13] and Bits[11:0] are RES0. */ + t =0x00008000 ; + t =FIELD_DP32 (t,DBGDIDR ,SE_IMP ,1 ); + t =FIELD_DP32 (t,DBGDIDR ,NSUHD_IMP ,1 ); + t =FIELD_DP32 (t,DBGDIDR ,VERSION ,10 );/* FEAT_Debugv8p8 */ + t =FIELD_DP32 (t,DBGDIDR ,CTX_CMPS ,1 ); + t =FIELD_DP32 (t,DBGDIDR ,BRPS ,5 ); + t =FIELD_DP32 (t,DBGDIDR ,WRPS ,3 ); + cpu->isar.dbgdidr = t; + + t =0 ; + t =FIELD_DP32 (t,DBGDEVID ,PCSAMPLE ,3 ); + t =FIELD_DP32 (t,DBGDEVID ,WPADDRMASK ,1 ); + t =FIELD_DP32 (t,DBGDEVID ,BPADDRMASK ,15 ); + t =FIELD_DP32 (t,DBGDEVID ,VECTORCATCH ,0 ); + t =FIELD_DP32 (t,DBGDEVID ,VIRTEXTNS ,1 ); + t =FIELD_DP32 (t,DBGDEVID ,DOUBLELOCK ,1 ); + t =FIELD_DP32 (t,DBGDEVID ,AUXREGS ,0 ); + t =FIELD_DP32 (t,DBGDEVID ,CIDMASK ,0 ); + cpu->isar.dbgdevid = t; + +/* Bits[31:4] are RES0. */ + t =0 ; + t =FIELD_DP32 (t,DBGDEVID1 ,PCSROFFSET ,2 ); + cpu->isar.dbgdevid1 = t; + +FIELD_DP32_IDREG (isar,ID_DFR1 ,HPMN0 ,1 );/* FEAT_HPMN0 */ +}
target/arm/tcg/cpu32.c +0 -96
102 lines not on this page · raw message
target/arm/meson.build +1 -0
@@ -9,6 +9,7 @@ arm_user_ss = ss.source_set() arm_common_system_ss.add(files('gdbstub.c')) arm_user_ss.add(files('gdbstub.c')) +arm_ss.add(files('cpu-max.c')) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'cpu64.c', ))
Signature · 1 line
2.53.0
PATCH v7 14/21 target/arm: Use make_ccsidr(LEGACY) in 32 bit 'max' CPU type
In reply to Philippe Mathieu-DaudéCommit 676624d757a ("target/arm/tcg: refine cache descriptions with a wrapper") added the make_ccsidr() helper. Use it. Besides being simpler to review, it also makes arm_max_initfn() more in line which aarch64_a57_initfn(), which it almost duplicates.
--- target/arm/tcg/cpu32.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
target/arm/tcg/cpu32.c +7 -3
@@ -9,6 +9,7 @@*/ #include "qemu/osdep.h" +#include "qemu/units.h" #include "cpu.h" #include "accel/tcg/cpu-ops.h" #include "internals.h"
@@ -756,9 +757,12 @@ static void arm_max_initfn(Object *obj)SET_IDREG (isar,ID_ISAR6 ,0 ); cpu->isar.reset_pmcr_el0 =0x41013000 ;SET_IDREG (isar,CLIDR ,0x0a200023 ); - cpu->ccsidr[0 ] =0x701fe00a ;/* 32KB L1 dcache */ - cpu->ccsidr[1 ] =0x201fe012 ;/* 48KB L1 icache */ - cpu->ccsidr[2 ] =0x70ffe07a ;/* 2048KB L2 cache */ +/* 32KB L1 dcache */ + cpu->ccsidr[0 ] =make_ccsidr (CCSIDR_FORMAT_LEGACY ,4 ,64 ,32 * KiB,7 ); +/* 48KB L1 icache */ + cpu->ccsidr[1 ] =make_ccsidr (CCSIDR_FORMAT_LEGACY ,3 ,64 ,48 * KiB,2 ); +/* 2048KB L2 cache */ + cpu->ccsidr[2 ] =make_ccsidr (CCSIDR_FORMAT_LEGACY ,16 ,64 ,2 * MiB,7 );define_cortex_a72_a57_a53_cp_reginfo (cpu);aa32_max_features (cpu);
Signature · 1 line
2.53.0
PATCH v7 15/21 target/arm: Implement DBGDEVID* registers in max AArch32 CPU
In reply to Philippe Mathieu-Daudé32-bit ARM max CPU is a 'Cortex-A57 advertising none of the AArch64 features'. Keep it as close as possible as the A57, by implementing the debug ID registers, following the changes in aarch64_a57_initfn added by commits 48eb3ae64b3 ("target-arm: Adjust debug ID registers per-CPU") and 09754ca867f ("target/arm: Implement AArch32 DBGDEVID, DBGDEVID1, DBGDEVID2").
--- target/arm/tcg/cpu32.c | 3 +++ 1 file changed, 3 insertions(+)
target/arm/tcg/cpu32.c +3 -0
@@ -755,6 +755,9 @@ static void arm_max_initfn(Object *obj)SET_IDREG (isar,ID_ISAR4 ,0x00011142 );SET_IDREG (isar,ID_ISAR5 ,0x00011121 );SET_IDREG (isar,ID_ISAR6 ,0 ); + cpu->isar.dbgdidr =0x3516d000 ; + cpu->isar.dbgdevid =0x01110f13 ; + cpu->isar.dbgdevid1 =0x2 ; cpu->isar.reset_pmcr_el0 =0x41013000 ;SET_IDREG (isar,CLIDR ,0x0a200023 );/* 32KB L1 dcache */
Signature · 1 line
2.53.0
PATCH v7 16/21 target/arm: Only set %kvm_target when KVM is enabled
In reply to Philippe Mathieu-Daudé--- target/arm/cpu64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/arm/cpu64.c +3 -1
@@ -701,7 +701,9 @@ static void aarch64_a57_initfn(Object *obj)set_feature (&cpu->env,ARM_FEATURE_EL2 );set_feature (&cpu->env,ARM_FEATURE_EL3 );set_feature (&cpu->env,ARM_FEATURE_PMU ); - cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A57 ; +if (kvm_enabled ()) { + cpu->kvm_target =QEMU_KVM_ARM_TARGET_CORTEX_A57 ; + } cpu->midr =0x411fd070 ; cpu->revidr =0x00000000 ; cpu->reset_fpsid =0x41034070 ;
Signature · 1 line
2.53.0
PATCH v7 17/21 target/arm: Factor aarch64_aa32_a57_init() out
In reply to Philippe Mathieu-DaudéIn order to make the following commit easier to review, factor aarch64_aa32_a57_init() out of aarch64_a57_initfn() as a preliminary step. We only add a %aa32_only argument to restrict AArch64 features.
--- target/arm/cpu64.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
target/arm/cpu64.c +24 -12
@@ -686,17 +686,20 @@ void aarch64_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)SET_IDREG (&cpu->isar,ID_AA64MMFR0 , t); } -static void aarch64_a57_initfn (Object *obj) +static void aarch64_aa32_a57_init (Object *obj,bool aa32_only) {ARMCPU *cpu =ARM_CPU (obj);ARMISARegisters *isar = &cpu->isar; +const bool aarch64_enabled = !aa32_only; cpu->dtb_compatible ="arm,cortex-a57" ;set_feature (&cpu->env,ARM_FEATURE_V8 );set_feature (&cpu->env,ARM_FEATURE_NEON );set_feature (&cpu->env,ARM_FEATURE_GENERIC_TIMER );set_feature (&cpu->env,ARM_FEATURE_BACKCOMPAT_CNTFRQ ); -set_feature (&cpu->env,ARM_FEATURE_AARCH64 ); +if (aarch64_enabled) { +set_feature (&cpu->env,ARM_FEATURE_AARCH64 ); + }set_feature (&cpu->env,ARM_FEATURE_CBAR_RO );set_feature (&cpu->env,ARM_FEATURE_EL2 );set_feature (&cpu->env,ARM_FEATURE_EL3 );
@@ -727,10 +730,12 @@ static void aarch64_a57_initfn(Object *obj)SET_IDREG (isar,ID_ISAR4 ,0x00011142 );SET_IDREG (isar,ID_ISAR5 ,0x00011121 );SET_IDREG (isar,ID_ISAR6 ,0 ); -SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); -SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 ); -SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); -SET_IDREG (isar,ID_AA64MMFR0 ,0x00001124 ); +if (aarch64_enabled) { +SET_IDREG (isar,ID_AA64PFR0 ,0x00002222 ); +SET_IDREG (isar,ID_AA64DFR0 ,0x10305106 ); +SET_IDREG (isar,ID_AA64ISAR0 ,0x00011120 ); +SET_IDREG (isar,ID_AA64MMFR0 ,0x00001124 ); + } cpu->isar.dbgdidr =0x3516d000 ; cpu->isar.dbgdevid =0x01110f13 ; cpu->isar.dbgdevid1 =0x2 ;
@@ -742,14 +747,21 @@ static void aarch64_a57_initfn(Object *obj) cpu->ccsidr[1 ] =make_ccsidr (CCSIDR_FORMAT_LEGACY ,3 ,64 ,48 * KiB,2 );/* 2048KB L2 cache */ cpu->ccsidr[2 ] =make_ccsidr (CCSIDR_FORMAT_LEGACY ,16 ,64 ,2 * MiB,7 ); -set_dczid_bs (cpu,4 );/* 64 bytes */ - cpu->gic_num_lrs =4 ; - cpu->gic_vpribits =5 ; - cpu->gic_vprebits =5 ; - cpu->gic_pribits =5 ; +if (aarch64_enabled) { +set_dczid_bs (cpu,4 );/* 64 bytes */ + cpu->gic_num_lrs =4 ; + cpu->gic_vpribits =5 ; + cpu->gic_vprebits =5 ; + cpu->gic_pribits =5 ; + }define_cortex_a72_a57_a53_cp_reginfo (cpu); } +static void aarch64_a57_initfn (Object *obj) +{ +aarch64_aa32_a57_init (obj, false); +} +static void aarch64_a53_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj);
@@ -886,7 +898,7 @@ static void aarch64_max_initfn(Object *obj) }if (tcg_enabled () ||qtest_enabled ()) { -aarch64_a57_initfn (obj); +aarch64_aa32_a57_init (obj, false); }/* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
Signature · 1 line
2.53.0
PATCH v7 18/21 target/arm: Re-use common aarch64_aa32_a57_init() helper
In reply to Philippe Mathieu-DaudéMake aarch64_aa32_a57_init() common by exposing its prototype and defining it in cpu-max.c. Call it in arm_max_initfn() restricted to AArch32.
--- target/arm/internals.h | 1 + target/arm/cpu-max.c | 74 ++++++++++++++++++++++++++++++++++++++++++ target/arm/cpu64.c | 71 ---------------------------------------- target/arm/tcg/cpu32.c | 48 ++------------------------- 4 files changed, 77 insertions(+), 117 deletions(-)
target/arm/internals.h +1 -0
@@ -1758,6 +1758,7 @@ void aarch64_max_tcg_initfn(Object *obj);void aarch64_add_pauth_properties (Object *obj);void aarch64_add_sve_properties (Object *obj);void aarch64_add_sme_properties (Object *obj); +void aarch64_aa32_a57_init (Object *obj,bool aa32_only);/* Return true if the gdbstub is presenting an AArch64 CPU */ static inline bool arm_gdbstub_is_aarch64 (ARMCPU *cpu)
target/arm/cpu-max.c +74 -0
81 lines not on this page · raw message
target/arm/cpu64.c +0 -71
77 lines not on this page · raw message
target/arm/tcg/cpu32.c +2 -46
55 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v7 19/21 target/arm: Define 'max' CPU type in cpu-max.c
In reply to Philippe Mathieu-DaudéRather than having the 32-bit 'max' CPU type defined in cpu32.c and the 64-bit counter part in cpu64.c, unify the code in a single place in cpu-max.c. Define stubs for aarch64_host_initfn() and aarch64_max_tcg_initfn() in the 32-bit binary.
--- target/arm/internals.h | 1 + target/arm/cpu-max.c | 65 ++++++++++++++++++++++++++++++++++++++++ target/arm/cpu64.c | 21 +------------ target/arm/tcg/cpu32.c | 29 ------------------ target/arm/tcg/stubs32.c | 10 +++++++ 5 files changed, 77 insertions(+), 49 deletions(-)
target/arm/internals.h +1 -0
@@ -1759,6 +1759,7 @@ void aarch64_add_pauth_properties(Object *obj);void aarch64_add_sve_properties (Object *obj);void aarch64_add_sme_properties (Object *obj);void aarch64_aa32_a57_init (Object *obj,bool aa32_only); +void aarch64_host_initfn (Object *obj);/* Return true if the gdbstub is presenting an AArch64 CPU */ static inline bool arm_gdbstub_is_aarch64 (ARMCPU *cpu)
target/arm/cpu-max.c +65 -0
75 lines not on this page · raw message
target/arm/cpu64.c +1 -20
@@ -791,7 +791,7 @@ static void kvm_arm_set_cpreg_mig_tolerances(ARMCPU *cpu) }#endif -static void aarch64_host_initfn (Object *obj) +void aarch64_host_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj);
@@ -818,28 +818,9 @@ static void aarch64_host_initfn(Object *obj) } } -static void aarch64_max_initfn (Object *obj) -{ -if (hwaccel_enabled ()) { -/* When hardware acceleration enabled, '-cpu max' is identical to '-cpu host' */ -aarch64_host_initfn (obj); -return ; - } - -if (tcg_enabled () ||qtest_enabled ()) { -aarch64_aa32_a57_init (obj, false); - } - -/* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ -if (tcg_enabled ()) { -aarch64_max_tcg_initfn (obj); - } -} -static const ARMCPUInfo aarch64_cpus[] = { { .name ="cortex-a57" , .initfn = aarch64_a57_initfn }, { .name ="cortex-a53" , .initfn = aarch64_a53_initfn }, - { .name ="max" , .initfn = aarch64_max_initfn }, #if defined(CONFIG_KVM) || defined(CONFIG_HVF) || defined(CONFIG_WHPX) { .name ="host" , .initfn = aarch64_host_initfn }, #endif
target/arm/tcg/cpu32.c +0 -29
@@ -711,32 +711,6 @@ static void sa1110_initfn(Object *obj) cpu->reset_sctlr =0x00000070 ; } -#ifndef TARGET_AARCH64 -/* -* -cpu max: a CPU with as many features enabled as our emulation supports. -* The version of '-cpu max' for qemu-system-aarch64 is defined in cpu64.c; -* this only needs to handle 32 bits, and need not care about KVM. -*/ -static void arm_max_initfn (Object *obj) -{ -ARMCPU *cpu =ARM_CPU (obj); - -/* Cortex-A57 advertising none of the aarch64 features */ -aarch64_aa32_a57_init (obj, true); - -aa32_max_features (cpu); - -#ifdef CONFIG_USER_ONLY -/* -* Break with true ARMv8 and add back old-style VFP short-vector support. -* Only do this for user-mode, where -cpu max is the default, so that -* older v6 and v7 programs are more likely to work without adjustment. -*/ - cpu->isar.mvfr0 =FIELD_DP32 (cpu->isar.mvfr0,MVFR0 ,FPSHVEC ,1 ); -#endif -} -#endif /* !TARGET_AARCH64 */ -static const ARMCPUInfo arm_tcg_cpus[] = { { .name ="arm926" , .initfn = arm926_initfn }, { .name ="arm946" , .initfn = arm946_initfn },
@@ -760,9 +734,6 @@ static const ARMCPUInfo arm_tcg_cpus[] = { { .name = "ti925t", .initfn = ti925t_initfn }, { .name = "sa1100", .initfn = sa1100_initfn }, { .name = "sa1110", .initfn = sa1110_initfn }, -#ifndef TARGET_AARCH64 - { .name = "max", .initfn = arm_max_initfn }, -#endif };static void arm_tcg_cpu_register_types (void )
target/arm/tcg/stubs32.c +10 -0
@@ -22,3 +22,13 @@ void aarch64_translate_code(CPUState *cs, TranslationBlock *tb, {g_assert_not_reached (); } + +void aarch64_host_initfn (Object *obj) +{ +g_assert_not_reached (); +} + +void aarch64_max_tcg_initfn (Object *obj) +{ +g_assert_not_reached (); +}
Signature · 1 line
2.53.0
PATCH v7 20/21 target/arm: Build cpu32-system.o as common object
In reply to Philippe Mathieu-Daudécpu32.c only contains CPU types used in 32-bit system emulation:
rename it as cpu32-system.c; always compile the file but only register the QOM types for the 32-bit binary.
---
target/arm/tcg/{cpu32.c => cpu32-system.c} | 10 +---------
target/arm/tcg/meson.build | 5 +----
2 files changed, 2 insertions(+), 13 deletions(-)
rename target/arm/tcg/{cpu32.c => cpu32-system.c} (99%)target/arm/tcg/cpu32-system.c renamed from target/arm/tcg/cpu32.c +1 -9
@@ -1,5 +1,5 @@/* -* QEMU ARM TCG-only CPUs. +* QEMU ARM TCG-only CPUs (not needed for the AArch64 linux-user build) * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -13,15 +13,9 @@#include "cpu.h" #include "accel/tcg/cpu-ops.h" #include "internals.h" -#if !defined(CONFIG_USER_ONLY )#include "hw/core/boards.h" -#endif #include "cpregs.h" - -/* CPU models. These are not needed for the AArch64 linux-user build. */ -#if !defined(CONFIG_USER_ONLY ) || !defined(TARGET_AARCH64 ) -static void arm926_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj);
@@ -746,5 +740,3 @@ static void arm_tcg_cpu_register_types(void) }type_init (arm_tcg_cpu_register_types) - -#endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
target/arm/tcg/meson.build +1 -4
@@ -30,10 +30,6 @@ translate32_d = [ arm_ss.add(when: 'TARGET_AARCH64', if_true: gen_a64) arm_stubs_ss.add(files('stubs32.c')) -arm_ss.add(files( - 'cpu32.c', -)) - arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'gengvec64.c', 'translate-a64.c',
@@ -84,6 +80,7 @@ arm_common_user_system_ss.add(when: 'TARGET_AARCH64', if_true: files( arm_common_system_ss.add(files( 'cpregs-at.c', + 'cpu32-system.c', 'gicv5-cpuif.c', 'psci.c', 'tlb_helper.c',
Signature · 1 line
2.53.0
PATCH v7 21/21 target/arm: Build cpu-max.c once
In reply to Philippe Mathieu-DaudéCall TargetInfo::target_aarch64() at runtime, allowing to remove the target-specific TARGET_AARCH64 definition and build cpu-max.c once as common object.
--- target/arm/cpu-max.c | 8 ++------ target/arm/meson.build | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-)
target/arm/cpu-max.c +2 -6
@@ -8,6 +8,7 @@#include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/target-info.h" #include "system/hw_accel.h" #include "system/kvm.h" #include "system/qtest.h"
@@ -190,12 +191,7 @@ void aa32_max_features(ARMCPU *cpu)static void cpu_max_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj); - -#ifdef TARGET_AARCH64 -const bool aarch64_enabled = true; -#else -const bool aarch64_enabled = false; -#endif /* !TARGET_AARCH64 */ +const bool aarch64_enabled =target_aarch64 ();if (hwaccel_enabled ()) {assert (aarch64_enabled);
target/arm/meson.build +1 -1
@@ -9,7 +9,6 @@ arm_user_ss = ss.source_set() arm_common_system_ss.add(files('gdbstub.c')) arm_user_ss.add(files('gdbstub.c')) -arm_ss.add(files('cpu-max.c')) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'cpu64.c', ))
@@ -20,6 +19,7 @@ arm_common_ss.add(files( arm_common_user_system_ss.add(files( 'cpregs-gcs.c', 'cpregs-pmu.c', + 'cpu-max.c', 'debug_helper.c', 'helper.c', 'vfp_fpscr.c',
Signature · 1 line
2.53.0