target/arm: Extract IDAU interface to its own unit
cover target/arm: Extract IDAU interface to its own unit
Trivial series moving TYPE_IDAU_INTERFACE to its own unit, and moving its header under the tcg/ namespace.
Philippe Mathieu-Daudé (2):
target/arm: Rename Aarch64-specific methods target/arm: Extract IDAU interface to its own unit
include/hw/arm/armv7m.h | 2 +-
include/hw/misc/tz-msc.h | 2 +-
target/arm/internals.h | 8 ++++----
target/arm/{ => tcg}/idau.h | 0
hw/arm/armv7m.c | 2 +-
target/arm/cpu.c | 10 +++++-----
target/arm/cpu32-stubs.c | 8 ++++----
target/arm/cpu64.c | 12 ++++++------
target/arm/ptw.c | 2 +-
target/arm/tcg/cpu32.c | 8 --------
target/arm/tcg/idau.c | 20 ++++++++++++++++++++
target/arm/tcg/meson.build | 1 +
12 files changed, 44 insertions(+), 31 deletions(-)
rename target/arm/{ => tcg}/idau.h (100%)
create mode 100644 target/arm/tcg/idau.cSignature · 1 line
2.53.0
PATCH 1/2 target/arm: Rename Aarch64-specific methods
Various Aarch64 specific methods start with the 'aarch64_' prefix. Rename few more emphasizing Aarch64 specific features.
--- 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
@@ -1746,10 +1746,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
@@ -1682,25 +1682,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
Re: [PATCH 1/2] target/arm: Rename Aarch64-specific methods
Quoted 11 lines · Philippe Mathieu-Daudé
Various Aarch64 specific methods start with the '
aarch64_' prefix. Rename few more emphasizing Aarch64 specific features.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)
PATCH 2/2 target/arm: Extract IDAU interface to its own unit
In reply to Philippe Mathieu-DaudéMove IDAU TypeInfo structure to its own source file and build it once as common ARM object.
---
include/hw/arm/armv7m.h | 2 +-
include/hw/misc/tz-msc.h | 2 +-
target/arm/{ => tcg}/idau.h | 0
hw/arm/armv7m.c | 2 +-
target/arm/cpu.c | 2 +-
target/arm/ptw.c | 2 +-
target/arm/tcg/cpu32.c | 8 --------
target/arm/tcg/idau.c | 20 ++++++++++++++++++++
target/arm/tcg/meson.build | 1 +
9 files changed, 26 insertions(+), 13 deletions(-)
rename target/arm/{ => tcg}/idau.h (100%)
create mode 100644 target/arm/tcg/idau.cinclude/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 +0 -0
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/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]); }
target/arm/tcg/idau.c new file +20 -0
@@ -0,0 +1,20 @@ +/* +* QEMU ARM CPU -- interface for the Arm v8M IDAU +* +* Copyright (c) 2018 Linaro Ltd +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "target/arm/tcg/idau.h" + +static const TypeInfo idau_types[] = { + { + .name =TYPE_IDAU_INTERFACE , + .parent =TYPE_INTERFACE , + .class_size =sizeof (IDAUInterfaceClass), + } +}; + +DEFINE_TYPES (idau_types)
target/arm/tcg/meson.build +1 -0
@@ -56,6 +56,7 @@ arm_common_ss.add(zlib) arm_common_ss.add(files( 'arith_helper.c', 'crypto_helper.c', + 'idau.c', )) arm_common_system_ss.add(
Signature · 1 line
2.53.0
Quoted 79 lines · Philippe Mathieu-Daudé
Move IDAU TypeInfo structure to its own source file and build it once as common ARM object.
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 | 0 hw/arm/armv7m.c | 2 +- target/arm/cpu.c | 2 +- target/arm/ptw.c | 2 +- target/arm/tcg/cpu32.c | 8 -------- target/arm/tcg/idau.c | 20 ++++++++++++++++++++ target/arm/tcg/meson.build | 1 + 9 files changed, 26 insertions(+), 13 deletions(-) rename target/arm/{ => tcg}/idau.h (100%) create mode 100644 target/arm/tcg/idau.cinclude/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 +0
-0hw/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 +0
-0
target/arm/ptw.c line 23
Quoted 8 lines
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 {
The idau.h -> tcg/idau.h change is fine.
/*
Quoted 61 lines
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]); }target/arm/tcg/idau.c new file +20
-0@@ -0,0 +1,20 @@ +/* +* QEMU ARM CPU -- interface for the Arm v8M IDAU +* +* Copyright (c) 2018 Linaro Ltd +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "target/arm/tcg/idau.h" + +static const TypeInfo idau_types[] = { + { + .name =TYPE_IDAU_INTERFACE , + .parent =TYPE_INTERFACE , + .class_size =sizeof (IDAUInterfaceClass), + } +}; + +DEFINE_TYPES (idau_types)target/arm/tcg/meson.build +0
-0
target/arm/tcg/meson.build arm_common_ss.add(zlib) · line 62
Quoted 7 lines
target/arm/tcg/meson.build +1
-0@@ -56,6 +56,7 @@ arm_common_ss.add(zlib) arm_common_ss.add(files( 'arith_helper.c', 'crypto_helper.c', + 'idau.c', )) arm_common_system_ss.add(
Why not, but what does it solves?
The common aspect is not so important since tcg/cpu32.c will be common pretty soon.
Not blocking though, I'm just curious of the reason to extract this:
Regards,
Pierrick
Peter Maydell
AppliedQuoted 7 lines · Philippe Mathieu-Daudé
Trivial series moving
TYPE_IDAU_INTERFACEto its own unit, and moving its header under the tcg/ namespace.Philippe Mathieu-Daudé (2):
target/arm: Rename Aarch64-specific methods target/arm: Extract IDAU interface to its own unit
Applied to target-arm.next, thanks.
-- PMM