target-arm queue
Subsystems (5)
[PULL 01/51] hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
The property names of AST2600 GPIO 1.8V model are one character bigger than the names of the other ASPEED GPIO model. Increase the string buffer size by one and be more strict on the expected pattern of the property name.
This fixes the QOM test of the ast2600-evb machine under :
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Message-id: [email protected]
--- hw/gpio/aspeed_gpio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/gpio/aspeed_gpio.c +4 -4
@@ -733,13 +733,13 @@ static void aspeed_gpio_get_pin(Object *obj, Visitor *v, const char *name, {int pin =0xfff ;bool level = true; -char group[3 ]; +char group[4 ];AspeedGPIOState *s =ASPEED_GPIO (obj);int set_idx, group_idx =0 ;if (sscanf (name,"gpio%2[A-Z]%1d" , group, &pin) !=2 ) {/* 1.8V gpio */ -if (sscanf (name,"gpio%3s%1d" , group, &pin) !=2 ) { +if (sscanf (name,"gpio%3[18A-E]%1d" , group, &pin) !=2 ) {error_setg (errp,"%s: error reading %s" , __func__, name);return ; }
@@ -760,7 +760,7 @@ static void aspeed_gpio_set_pin(Object *obj, Visitor *v, const char *name,Error *local_err =NULL ;bool level;int pin =0xfff ; -char group[3 ]; +char group[4 ];AspeedGPIOState *s =ASPEED_GPIO (obj);int set_idx, group_idx =0 ;
@@ -771,7 +771,7 @@ static void aspeed_gpio_set_pin(Object *obj, Visitor *v, const char *name, }if (sscanf (name,"gpio%2[A-Z]%1d" , group, &pin) !=2 ) {/* 1.8V gpio */ -if (sscanf (name,"gpio%3s%1d" , group, &pin) !=2 ) { +if (sscanf (name,"gpio%3[18A-E]%1d" , group, &pin) !=2 ) {error_setg (errp,"%s: error reading %s" , __func__, name);return ; }
Signature · 1 line
2.20.1
[PULL 04/51] target/arm: Split out rebuild_hflags_a64
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Create a function to compute the values of the TBFLAG_A64 bits that will be cached. For now, the env->hflags variable is not used, and the results are fed back to cpu_get_tb_cpu_state.
Note that not all BTI related flags are cached, so we have to test the BTI feature twice -- once for those bits moved out to rebuild_hflags_a64 and once for those bits that remain in cpu_get_tb_cpu_state.
Message-id: [email protected]
--- target/arm/helper.c | 131 +++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 62 deletions(-)
target/arm/helper.c +69 -62
@@ -11070,6 +11070,71 @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,return flags; } +static uint32_t rebuild_hflags_a64 (CPUARMState *env,int el,int fp_el, +ARMMMUIdx mmu_idx) +{ +ARMMMUIdx stage1 =stage_1_mmu_idx (mmu_idx); +ARMVAParameters p0 =aa64_va_parameters_both (env,0 , stage1); +uint32_t flags =0 ; +uint64_t sctlr; +int tbii, tbid; + + flags =FIELD_DP32 (flags,TBFLAG_ANY ,AARCH64_STATE ,1 ); + +/* FIXME: ARMv8.1-VHE S2 translation regime. */ +if (regime_el (env, stage1) <2 ) { +ARMVAParameters p1 =aa64_va_parameters_both (env,-1 , stage1); + tbid = (p1.tbi <<1 ) | p0.tbi; + tbii = tbid & ~((p1.tbid <<1 ) | p0.tbid); + }else { + tbid = p0.tbi; + tbii = tbid & !p0.tbid; + } + + flags =FIELD_DP32 (flags,TBFLAG_A64 ,TBII , tbii); + flags =FIELD_DP32 (flags,TBFLAG_A64 ,TBID , tbid); + +if (cpu_isar_feature (aa64_sve,env_archcpu (env))) { +int sve_el =sve_exception_el (env, el); +uint32_t zcr_len; + +/* +* If SVE is disabled, but FP is enabled, +* then the effective len is 0. +*/ +if (sve_el !=0 && fp_el ==0 ) { + zcr_len =0 ; + }else { + zcr_len =sve_zcr_len_for_el (env, el); + } + flags =FIELD_DP32 (flags,TBFLAG_A64 ,SVEEXC_EL , sve_el); + flags =FIELD_DP32 (flags,TBFLAG_A64 ,ZCR_LEN , zcr_len); + } + + sctlr =arm_sctlr (env, el); + +if (cpu_isar_feature (aa64_pauth,env_archcpu (env))) { +/* +* In order to save space in flags, we record only whether +* pauth is "inactive", meaning all insns are implemented as +* a nop, or "active" when some action must be performed. +* The decision of which action to take is left to a helper. +*/ +if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) { + flags =FIELD_DP32 (flags,TBFLAG_A64 ,PAUTH_ACTIVE ,1 ); + } + } + +if (cpu_isar_feature (aa64_bti,env_archcpu (env))) { +/* Note that SCTLR_EL[23].BT == SCTLR_BT1. */ +if (sctlr & (el ==0 ?SCTLR_BT0 :SCTLR_BT1 )) { + flags =FIELD_DP32 (flags,TBFLAG_A64 ,BT ,1 ); + } + } + +return rebuild_hflags_common (env, fp_el, mmu_idx, flags); +} +void cpu_get_tb_cpu_state (CPUARMState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) {
@@ -11079,67 +11144,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,uint32_t flags =0 ;if (is_a64 (env)) { -ARMCPU *cpu =env_archcpu (env); -uint64_t sctlr; - *pc = env->pc; - flags =FIELD_DP32 (flags,TBFLAG_ANY ,AARCH64_STATE ,1 ); - -/* Get control bits for tagged addresses. */ - { -ARMMMUIdx stage1 =stage_1_mmu_idx (mmu_idx); -ARMVAParameters p0 =aa64_va_parameters_both (env,0 , stage1); -int tbii, tbid; - -/* FIXME: ARMv8.1-VHE S2 translation regime. */ -if (regime_el (env, stage1) <2 ) { -ARMVAParameters p1 =aa64_va_parameters_both (env,-1 , stage1); - tbid = (p1.tbi <<1 ) | p0.tbi; - tbii = tbid & ~((p1.tbid <<1 ) | p0.tbid); - }else { - tbid = p0.tbi; - tbii = tbid & !p0.tbid; - } - - flags =FIELD_DP32 (flags,TBFLAG_A64 ,TBII , tbii); - flags =FIELD_DP32 (flags,TBFLAG_A64 ,TBID , tbid); - } - -if (cpu_isar_feature (aa64_sve, cpu)) { -int sve_el =sve_exception_el (env, current_el); -uint32_t zcr_len; - -/* If SVE is disabled, but FP is enabled, -* then the effective len is 0. -*/ -if (sve_el !=0 && fp_el ==0 ) { - zcr_len =0 ; - }else { - zcr_len =sve_zcr_len_for_el (env, current_el); - } - flags =FIELD_DP32 (flags,TBFLAG_A64 ,SVEEXC_EL , sve_el); - flags =FIELD_DP32 (flags,TBFLAG_A64 ,ZCR_LEN , zcr_len); - } - - sctlr =arm_sctlr (env, current_el); - -if (cpu_isar_feature (aa64_pauth, cpu)) { -/* -* In order to save space in flags, we record only whether -* pauth is "inactive", meaning all insns are implemented as -* a nop, or "active" when some action must be performed. -* The decision of which action to take is left to a helper. -*/ -if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) { - flags =FIELD_DP32 (flags,TBFLAG_A64 ,PAUTH_ACTIVE ,1 ); - } - } - -if (cpu_isar_feature (aa64_bti, cpu)) { -/* Note that SCTLR_EL[23].BT == SCTLR_BT1. */ -if (sctlr & (current_el ==0 ?SCTLR_BT0 :SCTLR_BT1 )) { - flags =FIELD_DP32 (flags,TBFLAG_A64 ,BT ,1 ); - } + flags =rebuild_hflags_a64 (env, current_el, fp_el, mmu_idx); +if (cpu_isar_feature (aa64_bti,env_archcpu (env))) { flags =FIELD_DP32 (flags,TBFLAG_A64 ,BTYPE , env->btype); } }else {
@@ -11159,9 +11166,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags =FIELD_DP32 (flags,TBFLAG_A32 ,XSCALE_CPAR , env->cp15.c15_cpar); } - } - flags =rebuild_hflags_common (env, fp_el, mmu_idx, flags); + flags =rebuild_hflags_common (env, fp_el, mmu_idx, flags); + }/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine * states defined in the ARM ARM for software singlestep:
Signature · 1 line
2.20.1
[PULL 10/51] target/arm: Split out rebuild_hflags_aprofile
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Create a function to compute the values of the TBFLAG_ANY bits that will be cached, and are used by A-profile.
Message-id: [email protected]
--- target/arm/helper.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
target/arm/helper.c +12 -8
@@ -11106,18 +11106,28 @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el,return rebuild_hflags_common_32 (env, fp_el, mmu_idx, flags); } +static uint32_t rebuild_hflags_aprofile (CPUARMState *env) +{ +int flags =0 ; + + flags =FIELD_DP32 (flags,TBFLAG_ANY ,DEBUG_TARGET_EL , +arm_debug_target_el (env)); +return flags; +} +static uint32_t rebuild_hflags_a32 (CPUARMState *env,int fp_el,ARMMMUIdx mmu_idx) { -return rebuild_hflags_common_32 (env, fp_el, mmu_idx,0 ); +uint32_t flags =rebuild_hflags_aprofile (env); +return rebuild_hflags_common_32 (env, fp_el, mmu_idx, flags); }static uint32_t rebuild_hflags_a64 (CPUARMState *env,int el,int fp_el,ARMMMUIdx mmu_idx) { +uint32_t flags =rebuild_hflags_aprofile (env);ARMMMUIdx stage1 =stage_1_mmu_idx (mmu_idx);ARMVAParameters p0 =aa64_va_parameters_both (env,0 , stage1); -uint32_t flags =0 ;uint64_t sctlr;int tbii, tbid;
@@ -11262,12 +11272,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } -if (!arm_feature (env,ARM_FEATURE_M )) { -int target_el =arm_debug_target_el (env); - - flags =FIELD_DP32 (flags,TBFLAG_ANY ,DEBUG_TARGET_EL , target_el); - } - *pflags = flags; *cs_base =0 ; }
Signature · 1 line
2.20.1
[PULL 12/51] target/arm: Simplify set of PSTATE_SS in cpu_get_tb_cpu_state
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Hoist the variable load for PSTATE into the existing test vs is_a64.
Message-id: [email protected]
--- target/arm/helper.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
target/arm/helper.c +8 -12
@@ -11197,7 +11197,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,ARMMMUIdx mmu_idx =arm_mmu_idx (env);int current_el =arm_current_el (env);int fp_el =fp_exception_el (env, current_el); -uint32_t flags; +uint32_t flags, pstate_for_ss;if (is_a64 (env)) { *pc = env->pc;
@@ -11205,6 +11205,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,if (cpu_isar_feature (aa64_bti,env_archcpu (env))) { flags =FIELD_DP32 (flags,TBFLAG_A64 ,BTYPE , env->btype); } + pstate_for_ss = env->pstate; }else { *pc = env->regs[15 ];
@@ -11257,9 +11258,11 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { flags =FIELD_DP32 (flags,TBFLAG_A32 ,VFPEN ,1 ); } + pstate_for_ss = env->uncached_cpsr; } -/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine +/* +* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine * states defined in the ARM ARM for software singlestep: * SS_ACTIVE PSTATE.SS State * 0 x Inactive (the TB flag for SS is always 0)
@@ -11267,16 +11270,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,* 1 1 Active-not-pending * SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB. */ -if (FIELD_EX32 (flags,TBFLAG_ANY ,SS_ACTIVE )) { -if (is_a64 (env)) { -if (env->pstate &PSTATE_SS ) { - flags =FIELD_DP32 (flags,TBFLAG_ANY ,PSTATE_SS ,1 ); - } - }else { -if (env->uncached_cpsr &PSTATE_SS ) { - flags =FIELD_DP32 (flags,TBFLAG_ANY ,PSTATE_SS ,1 ); - } - } +if (FIELD_EX32 (flags,TBFLAG_ANY ,SS_ACTIVE ) && + (pstate_for_ss &PSTATE_SS )) { + flags =FIELD_DP32 (flags,TBFLAG_ANY ,PSTATE_SS ,1 ); } *pflags = flags;
Signature · 1 line
2.20.1
[PULL 16/51] target/arm: Hoist store to cs_base in cpu_get_tb_cpu_state
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
By performing this store early, we avoid having to save and restore the register holding the address around any function calls.
Message-id: [email protected]
--- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/helper.c +1 -1
@@ -11225,6 +11225,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, {uint32_t flags, pstate_for_ss; + *cs_base =0 ; flags =rebuild_hflags_internal (env);if (is_a64 (env)) {
@@ -11298,7 +11299,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } *pflags = flags; - *cs_base =0 ; }#ifdef TARGET_AARCH64
Signature · 1 line
2.20.1
[PULL 19/51] target/arm: Rebuild hflags at MSR writes
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Continue setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- target/arm/translate-a64.c | 13 +++++++++++-- target/arm/translate.c | 28 +++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-)
target/arm/translate-a64.c +11 -2
@@ -1789,8 +1789,17 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,if ((tb_cflags (s->base.tb) &CF_USE_ICOUNT ) && (ri->type &ARM_CP_IO )) {/* I/O operations must end the TB here (whether read or write) */ s->base.is_jmp =DISAS_UPDATE ; - }else if (!isread && !(ri->type &ARM_CP_SUPPRESS_TB_END )) { -/* We default to ending the TB on a coprocessor register write, + } +if (!isread && !(ri->type &ARM_CP_SUPPRESS_TB_END )) { +/* +* A write to any coprocessor regiser that ends a TB +* must rebuild the hflags for the next TB. +*/ +TCGv_i32 tcg_el =tcg_const_i32 (s->current_el); +gen_helper_rebuild_hflags_a64 (cpu_env, tcg_el); +tcg_temp_free_i32 (tcg_el); +/* +* We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition * (usually only necessary to work around guest bugs). */
target/arm/translate.c +23 -5
@@ -6890,6 +6890,8 @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) ri =get_arm_cp_reginfo (s->cp_regs,ENCODE_CP_REG (cpnum, is64, s->ns, crn, crm, opc1, opc2));if (ri) { +bool need_exit_tb; +/* Check access permissions */ if (!cp_access_ok (s->current_el, ri, isread)) {return 1 ;
@@ -7068,14 +7070,30 @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) } } -if ((tb_cflags (s->base.tb) &CF_USE_ICOUNT ) && (ri->type &ARM_CP_IO )) { -/* I/O operations must end the TB here (whether read or write) */ -gen_lookup_tb (s); - }else if (!isread && !(ri->type &ARM_CP_SUPPRESS_TB_END )) { -/* We default to ending the TB on a coprocessor register write, +/* I/O operations must end the TB here (whether read or write) */ + need_exit_tb = ((tb_cflags (s->base.tb) &CF_USE_ICOUNT ) && + (ri->type &ARM_CP_IO )); + +if (!isread && !(ri->type &ARM_CP_SUPPRESS_TB_END )) { +/* +* A write to any coprocessor regiser that ends a TB +* must rebuild the hflags for the next TB. +*/ +TCGv_i32 tcg_el =tcg_const_i32 (s->current_el); +if (arm_dc_feature (s,ARM_FEATURE_M )) { +gen_helper_rebuild_hflags_m32 (cpu_env, tcg_el); + }else { +gen_helper_rebuild_hflags_a32 (cpu_env, tcg_el); + } +tcg_temp_free_i32 (tcg_el); +/* +* We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition * (usually only necessary to work around guest bugs). */ + need_exit_tb = true; + } +if (need_exit_tb) {gen_lookup_tb (s); }
Signature · 1 line
2.20.1
Probably the last arm pullreq before softfreeze...
The following changes since commit 58560ad254fbda71d4daa6622d71683190070ee2:
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191024' into staging (2019-10-24 16:22:58 +0100)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191024
for you to fetch changes up to a01a4a3e85ae8f6fe21adbedc80f7013faabdcf4:
hw/arm/highbank: Use AddressSpace when using write_secondary_boot() (2019-10-24 17:16:30 +0100)
----------------------------------------------------------------
target-arm queue:
* raspi boards: some cleanup
* raspi: implement the bcm2835 system timer device
* raspi: implement a dummy thermal sensor
* KVM: support providing SVE to the guest
* misc devices: switch to ptimer transaction API
* cache TB flag state to improve performance of cpu_get_tb_cpu_state
* aspeed: Add an AST2600 eval board
----------------------------------------------------------------
Andrew Jones (9):
target/arm/monitor: Introduce qmp_query_cpu_model_expansion
tests: arm: Introduce cpu feature tests
target/arm: Allow SVE to be disabled via a CPU property target/arm/cpu64: max cpu: Introduce sve<N> properties target/arm/kvm64: Add kvm_arch_get/put_sve target/arm/kvm64: max cpu: Enable SVE when available target/arm/kvm: scratch vcpu: Preserve input kvm_vcpu_init features target/arm/cpu64: max cpu: Support sve properties with KVM target/arm/kvm: host cpu: Add support for sve<N> properties
Cédric Le Goater (2):
hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
aspeed: Add an AST2600 eval board
Peter Maydell (8):
hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API hw/timer/xilinx_timer.c: Switch to transaction-based ptimer API hw/dma/xilinx_axidma.c: Switch to transaction-based ptimer API hw/timer/slavio_timer: Remove useless check for NULL t->timer hw/timer/slavio_timer.c: Switch to transaction-based ptimer API hw/timer/grlib_gptimer.c: Switch to transaction-based ptimer API hw/m68k/mcf5206.c: Switch to transaction-based ptimer API hw/watchdog/milkymist-sysctl.c: Switch to transaction-based ptimer API
Philippe Mathieu-Daudé (8):
hw/misc/bcm2835_thermal: Add a dummy BCM2835 thermal sensor hw/arm/bcm2835_peripherals: Use the thermal sensor block hw/timer/bcm2835: Add the BCM2835 SYS_timer hw/arm/bcm2835_peripherals: Use the SYS_timer hw/arm/bcm2836: Make the SoC code modular
hw/arm/bcm2836: Rename cpus[] as cpu[].core
hw/arm/raspi: Use AddressSpace when using arm_boot::write_secondary_boot hw/arm/highbank: Use AddressSpace when using write_secondary_boot()
Richard Henderson (24):
target/arm: Split out rebuild_hflags_common
target/arm: Split out rebuild_hflags_a64
target/arm: Split out rebuild_hflags_common_32
target/arm: Split arm_cpu_data_is_big_endian
target/arm: Split out rebuild_hflags_m32
target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state target/arm: Split out rebuild_hflags_a32
target/arm: Split out rebuild_hflags_aprofile
target/arm: Hoist XSCALE_CPAR, VECLEN, VECSTRIDE in cpu_get_tb_cpu_state target/arm: Simplify set of PSTATE_SS in cpu_get_tb_cpu_state target/arm: Hoist computation of TBFLAG_A32.VFPEN target/arm: Add arm_rebuild_hflags
target/arm: Split out arm_mmu_idx_el
target/arm: Hoist store to cs_base in cpu_get_tb_cpu_state target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32}) target/arm: Rebuild hflags at EL changes
target/arm: Rebuild hflags at MSR writes
target/arm: Rebuild hflags at CPSR writes
target/arm: Rebuild hflags at Xscale SCTLR writes target/arm: Rebuild hflags for M-profile
target/arm: Rebuild hflags for M-profile NVIC linux-user/aarch64: Rebuild hflags for TARGET_WORDS_BIGENDIAN linux-user/arm: Rebuild hflags for TARGET_WORDS_BIGENDIAN target/arm: Rely on hflags correct in cpu_get_tb_cpu_state
hw/misc/Makefile.objs | 1 + hw/timer/Makefile.objs | 1 + tests/Makefile.include | 5 +- qapi/machine-target.json | 6 +- hw/net/fsl_etsec/etsec.h | 1 - include/hw/arm/aspeed.h | 1 + include/hw/arm/bcm2835_peripherals.h | 5 +- include/hw/arm/bcm2836.h | 4 +- include/hw/arm/raspi_platform.h | 1 + include/hw/misc/bcm2835_thermal.h | 27 ++ include/hw/timer/bcm2835_systmr.h | 33 +++ include/qemu/bitops.h | 1 + target/arm/cpu.h | 105 +++++-- target/arm/helper.h | 4 + target/arm/internals.h | 9 + target/arm/kvm_arm.h | 39 +++ hw/arm/aspeed.c | 23 ++ hw/arm/bcm2835_peripherals.c | 30 +- hw/arm/bcm2836.c | 44 +-- hw/arm/highbank.c | 3 +- hw/arm/raspi.c | 14 +- hw/dma/xilinx_axidma.c | 9 +- hw/gpio/aspeed_gpio.c | 8 +- hw/intc/armv7m_nvic.c | 22 +- hw/m68k/mcf5206.c | 15 +- hw/misc/bcm2835_thermal.c | 135 +++++++++ hw/net/fsl_etsec/etsec.c | 9 +- hw/timer/bcm2835_systmr.c | 163 +++++++++++ hw/timer/grlib_gptimer.c | 28 +- hw/timer/milkymist-sysctl.c | 25 +- hw/timer/slavio_timer.c | 32 ++- hw/timer/xilinx_timer.c | 13 +- linux-user/aarch64/cpu_loop.c | 1 + linux-user/arm/cpu_loop.c | 1 + linux-user/syscall.c | 1 + target/arm/cpu.c | 26 +- target/arm/cpu64.c | 364 +++++++++++++++++++++-- target/arm/helper-a64.c | 3 + target/arm/helper.c | 403 +++++++++++++++++--------- target/arm/kvm.c | 25 +- target/arm/kvm32.c | 6 +- target/arm/kvm64.c | 325 ++++++++++++++++++--- target/arm/m_helper.c | 6 + target/arm/machine.c | 1 + target/arm/monitor.c | 158 ++++++++++ target/arm/op_helper.c | 4 + target/arm/translate-a64.c | 13 +- target/arm/translate.c | 33 ++- tests/arm-cpu-features.c | 540 +++++++++++++++++++++++++++++++++++ docs/arm-cpu-features.rst | 317 ++++++++++++++++++++ hw/timer/trace-events | 5 + 51 files changed, 2725 insertions(+), 323 deletions(-) create mode 100644 include/hw/misc/bcm2835_thermal.h create mode 100644 include/hw/timer/bcm2835_systmr.h create mode 100644 hw/misc/bcm2835_thermal.c create mode 100644 hw/timer/bcm2835_systmr.c create mode 100644 tests/arm-cpu-features.c create mode 100644 docs/arm-cpu-features.rst
[PULL 20/51] target/arm: Rebuild hflags at CPSR writes
From: Richard Henderson <[email protected]>
Continue setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- target/arm/op_helper.c | 3 +++ 1 file changed, 3 insertions(+)
target/arm/op_helper.c +3 -0
@@ -224,6 +224,7 @@ uint32_t HELPER(usat16)(CPUARMState *env, uint32_t x, uint32_t shift)void HELPER (setend )(CPUARMState *env) { env->uncached_cpsr ^=CPSR_E ; +arm_rebuild_hflags (env); }/* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped.
@@ -387,6 +388,8 @@ uint32_t HELPER(cpsr_read)(CPUARMState *env)void HELPER (cpsr_write )(CPUARMState *env,uint32_t val,uint32_t mask) {cpsr_write (env, val, mask, CPSRWriteByInstr); +/* TODO: Not all cpsr bits are relevant to hflags. */ +arm_rebuild_hflags (env); }/* Write the CPSR for a 32-bit exception return */
Signature · 1 line
2.20.1
[PULL 02/51] aspeed: Add an AST2600 eval board
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
Message-id: [email protected]
--- include/hw/arm/aspeed.h | 1 + hw/arm/aspeed.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+)
include/hw/arm/aspeed.h +1 -0
@@ -18,6 +18,7 @@ typedef struct AspeedBoardConfig {const char *desc;const char *soc_name;uint32_t hw_strap1; +uint32_t hw_strap2;const char *fmc_model;const char *spi_model;uint32_t num_cs;
hw/arm/aspeed.c +23 -0
@@ -88,6 +88,10 @@ struct AspeedBoardState {/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */ #define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1 +/* AST2600 evb hardware value */ +#define AST2600_EVB_HW_STRAP1 0x000000C0 +#define AST2600_EVB_HW_STRAP2 0x00000003 +/* * The max ram region is for firmwares that scan the address space * with load/store to guess how much RAM the SoC has.
@@ -187,6 +191,8 @@ static void aspeed_board_init(MachineState *machine, &error_abort);object_property_set_int (OBJECT (&bmc->soc), cfg->hw_strap1,"hw-strap1" , &error_abort); +object_property_set_int (OBJECT (&bmc->soc), cfg->hw_strap2,"hw-strap2" , + &error_abort);object_property_set_int (OBJECT (&bmc->soc), cfg->num_cs,"num-cs" , &error_abort); object_property_set_int(OBJECT(&bmc->soc), machine->smp.cpus, "num-cpus",
@@ -308,6 +314,12 @@ static void ast2500_evb_i2c_init(AspeedBoardState *bmc)i2c_create_slave (aspeed_i2c_get_bus (DEVICE (&soc->i2c),11 ),"ds1338" ,0x32 ); } +static void ast2600_evb_i2c_init (AspeedBoardState *bmc) +{ +/* Start with some devices on our I2C busses */ +ast2500_evb_i2c_init (bmc); +} +static void romulus_bmc_i2c_init (AspeedBoardState *bmc) {AspeedSoCState *soc = &bmc->soc;
@@ -455,6 +467,17 @@ static const AspeedBoardConfig aspeed_boards[] = { .num_cs = 2, .i2c_init = witherspoon_bmc_i2c_init, .ram = 512 * MiB, + }, { + .name = MACHINE_TYPE_NAME("ast2600-evb"), + .desc = "Aspeed AST2600 EVB (Cortex A7)", + .soc_name = "ast2600-a0", + .hw_strap1 = AST2600_EVB_HW_STRAP1, + .hw_strap2 = AST2600_EVB_HW_STRAP2, + .fmc_model = "w25q512jv", + .spi_model = "mx66u51235f", + .num_cs = 1, + .i2c_init = ast2600_evb_i2c_init, + .ram = 1 * GiB, }, };
Signature · 1 line
2.20.1
[PULL 03/51] target/arm: Split out rebuild_hflags_common
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Create a function to compute the values of the TBFLAG_ANY bits that will be cached. For now, the env->hflags variable is not used, and the results are fed back to cpu_get_tb_cpu_state.
Message-id: [email protected]
--- target/arm/cpu.h | 29 ++++++++++++++++++----------- target/arm/helper.c | 26 +++++++++++++++++++------- 2 files changed, 37 insertions(+), 18 deletions(-)
target/arm/cpu.h +18 -11
@@ -231,6 +231,9 @@ typedef struct CPUARMState {uint32_t pstate;uint32_t aarch64;/* 1 if CPU is in aarch64 state; inverse of PSTATE.nRW */ +/* Cached TBFLAGS state. See below for which bits are included. */ +uint32_t hflags; +/* Frequently accessed CPSR bits are stored separately for efficiency. This contains all the other bits. Use cpsr_{read,write} to access the whole CPSR. */
@@ -3140,15 +3143,18 @@ typedef ARMCPU ArchCPU;#include "exec/cpu-all.h" -/* Bit usage in the TB flags field: bit 31 indicates whether we are +/* +* Bit usage in the TB flags field: bit 31 indicates whether we are * in 32 or 64 bit mode. The meaning of the other bits depends on that. * We put flags which are shared between 32 and 64 bit mode at the top * of the word, and flags which apply to only one mode at the bottom. +* +* Unless otherwise noted, these bits are cached in env->hflags. */ FIELD(TBFLAG_ANY, AARCH64_STATE, 31, 1) FIELD(TBFLAG_ANY, MMUIDX, 28, 3) FIELD(TBFLAG_ANY, SS_ACTIVE, 27, 1) -FIELD (TBFLAG_ANY ,PSTATE_SS ,26 ,1 ) +FIELD (TBFLAG_ANY ,PSTATE_SS ,26 ,1 )/* Not cached. */ /* Target EL if we take a floating-point-disabled exception */ FIELD(TBFLAG_ANY, FPEXC_EL, 24, 2)FIELD (TBFLAG_ANY ,BE_DATA ,23 ,1 )
@@ -3159,13 +3165,14 @@ FIELD(TBFLAG_ANY, BE_DATA, 23, 1)FIELD (TBFLAG_ANY ,DEBUG_TARGET_EL ,21 ,2 ) /* Bit usage when in AArch32 state: */ -FIELD(TBFLAG_A32, THUMB, 0, 1) -FIELD(TBFLAG_A32, VECLEN, 1, 3) -FIELD (TBFLAG_A32 ,VECSTRIDE ,4 ,2 ) +FIELD(TBFLAG_A32, THUMB, 0, 1) /* Not cached. */ +FIELD(TBFLAG_A32, VECLEN, 1, 3) /* Not cached. */ +FIELD (TBFLAG_A32 ,VECSTRIDE ,4 ,2 )/* Not cached. */ /* * We store the bottom two bits of the CPAR as TB flags and handle * checks on the other bits at runtime. This shares the same bits as * VECSTRIDE, which is OK as no XScale CPU has VFP. +* Not cached, because VECLEN+VECSTRIDE are not cached. */FIELD (TBFLAG_A32 ,XSCALE_CPAR ,4 ,2 )/*
@@ -3174,15 +3181,15 @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2)* the same thing as the current security state of the processor! */ FIELD(TBFLAG_A32, NS, 6, 1) -FIELD(TBFLAG_A32, VFPEN, 7, 1) -FIELD(TBFLAG_A32, CONDEXEC, 8, 8) +FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */ +FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */FIELD (TBFLAG_A32 ,SCTLR_B ,16 ,1 ) /* For M profile only, set if FPCCR.LSPACT is set */ -FIELD (TBFLAG_A32 ,LSPACT ,18 ,1 ) +FIELD (TBFLAG_A32 ,LSPACT ,18 ,1 )/* Not cached. */ /* For M profile only, set if we must create a new FP context */ -FIELD (TBFLAG_A32 ,NEW_FP_CTXT_NEEDED ,19 ,1 ) +FIELD (TBFLAG_A32 ,NEW_FP_CTXT_NEEDED ,19 ,1 )/* Not cached. */ /* For M profile only, set if FPCCR.S does not match current security state */ -FIELD (TBFLAG_A32 ,FPCCR_S_WRONG ,20 ,1 ) +FIELD (TBFLAG_A32 ,FPCCR_S_WRONG ,20 ,1 )/* Not cached. */ /* For M profile only, Handler (ie not Thread) mode */FIELD (TBFLAG_A32 ,HANDLER ,21 ,1 )/* For M profile only, whether we should generate stack-limit checks */
@@ -3194,7 +3201,7 @@ FIELD(TBFLAG_A64, SVEEXC_EL, 2, 2) FIELD(TBFLAG_A64, ZCR_LEN, 4, 4) FIELD(TBFLAG_A64, PAUTH_ACTIVE, 8, 1) FIELD(TBFLAG_A64, BT, 9, 1) -FIELD(TBFLAG_A64, BTYPE, 10, 2) +FIELD(TBFLAG_A64, BTYPE, 10, 2) /* Not cached. */ FIELD(TBFLAG_A64, TBID, 12, 2)static inline bool bswap_code (bool sctlr_b)
target/arm/helper.c +19 -7
@@ -11054,6 +11054,22 @@ ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) }#endif +static uint32_t rebuild_hflags_common (CPUARMState *env,int fp_el, +ARMMMUIdx mmu_idx,uint32_t flags) +{ + flags =FIELD_DP32 (flags,TBFLAG_ANY ,FPEXC_EL , fp_el); + flags =FIELD_DP32 (flags,TBFLAG_ANY ,MMUIDX , +arm_to_core_mmu_idx (mmu_idx)); + +if (arm_cpu_data_is_big_endian (env)) { + flags =FIELD_DP32 (flags,TBFLAG_ANY ,BE_DATA ,1 ); + } +if (arm_singlestep_active (env)) { + flags =FIELD_DP32 (flags,TBFLAG_ANY ,SS_ACTIVE ,1 ); + } +return flags; +} +void cpu_get_tb_cpu_state (CPUARMState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) {
@@ -11145,7 +11161,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } - flags =FIELD_DP32 (flags,TBFLAG_ANY ,MMUIDX ,arm_to_core_mmu_idx (mmu_idx)); + flags =rebuild_hflags_common (env, fp_el, mmu_idx, flags);/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine * states defined in the ARM ARM for software singlestep:
@@ -11153,9 +11169,9 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,* 0 x Inactive (the TB flag for SS is always 0) * 1 0 Active-pending * 1 1 Active-not-pending +* SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB. */ -if (arm_singlestep_active (env)) { - flags =FIELD_DP32 (flags,TBFLAG_ANY ,SS_ACTIVE ,1 ); +if (FIELD_EX32 (flags,TBFLAG_ANY ,SS_ACTIVE )) {if (is_a64 (env)) {if (env->pstate &PSTATE_SS ) { flags =FIELD_DP32 (flags,TBFLAG_ANY ,PSTATE_SS ,1 );
@@ -11166,10 +11182,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } } -if (arm_cpu_data_is_big_endian (env)) { - flags =FIELD_DP32 (flags,TBFLAG_ANY ,BE_DATA ,1 ); - } - flags =FIELD_DP32 (flags,TBFLAG_ANY ,FPEXC_EL , fp_el);if (arm_v7m_is_handler_mode (env)) { flags =FIELD_DP32 (flags,TBFLAG_A32 ,HANDLER ,1 );
Signature · 1 line
2.20.1
[PULL 05/51] target/arm: Split out rebuild_hflags_common_32
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Create a function to compute the values of the TBFLAG_A32 bits that will be cached, and are used by all profiles.
Message-id: [email protected]
--- target/arm/helper.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
target/arm/helper.c +11 -5
@@ -11070,6 +11070,15 @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,return flags; } +static uint32_t rebuild_hflags_common_32 (CPUARMState *env,int fp_el, +ARMMMUIdx mmu_idx,uint32_t flags) +{ + flags =FIELD_DP32 (flags,TBFLAG_A32 ,SCTLR_B ,arm_sctlr_b (env)); + flags =FIELD_DP32 (flags,TBFLAG_A32 ,NS , !access_secure_reg (env)); + +return rebuild_hflags_common (env, fp_el, mmu_idx, flags); +} +static uint32_t rebuild_hflags_a64 (CPUARMState *env,int el,int fp_el,ARMMMUIdx mmu_idx) {
@@ -11141,7 +11150,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,ARMMMUIdx mmu_idx =arm_mmu_idx (env);int current_el =arm_current_el (env);int fp_el =fp_exception_el (env, current_el); -uint32_t flags =0 ; +uint32_t flags;if (is_a64 (env)) { *pc = env->pc;
@@ -11151,12 +11160,11 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } }else { *pc = env->regs[15 ]; + flags =rebuild_hflags_common_32 (env, fp_el, mmu_idx,0 ); flags =FIELD_DP32 (flags,TBFLAG_A32 ,THUMB , env->thumb); flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECLEN , env->vfp.vec_len); flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECSTRIDE , env->vfp.vec_stride); flags =FIELD_DP32 (flags,TBFLAG_A32 ,CONDEXEC , env->condexec_bits); - flags =FIELD_DP32 (flags,TBFLAG_A32 ,SCTLR_B ,arm_sctlr_b (env)); - flags =FIELD_DP32 (flags,TBFLAG_A32 ,NS , !access_secure_reg (env));if (env->vfp.xregs[ARM_VFP_FPEXC ] & (1 <<30 ) ||arm_el_is_aa64 (env,1 ) ||arm_feature (env,ARM_FEATURE_M )) { flags =FIELD_DP32 (flags,TBFLAG_A32 ,VFPEN ,1 );
@@ -11166,8 +11174,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags =FIELD_DP32 (flags,TBFLAG_A32 ,XSCALE_CPAR , env->cp15.c15_cpar); } - - flags =rebuild_hflags_common (env, fp_el, mmu_idx, flags); }/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
Signature · 1 line
2.20.1
[PULL 21/51] target/arm: Rebuild hflags at Xscale SCTLR writes
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Continue setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- target/arm/helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
target/arm/helper.c +10 -0
@@ -4174,6 +4174,16 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,/* ??? Lots of these bits are not implemented. */ /* This may enable/disable the MMU, so do a TLB flush. */ tlb_flush (CPU (cpu)); + +if (ri->type &ARM_CP_SUPPRESS_TB_END ) { +/* +* Normally we would always end the TB on an SCTLR write; see the +* comment in ARMCPRegInfo sctlr initialization below for why Xscale +* is special. Setting ARM_CP_SUPPRESS_TB_END also stops the rebuild +* of hflags from the translator, so do it here. +*/ +arm_rebuild_hflags (env); + } } static CPAccessResult fpexc32_access(CPUARMState *env, const ARMCPRegInfo *ri,
Signature · 1 line
2.20.1
[PULL 06/51] target/arm: Split arm_cpu_data_is_big_endian
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Set TBFLAG_ANY.BE_DATA in rebuild_hflags_common_32 and rebuild_hflags_a64 instead of rebuild_hflags_common, where we do not need to re-test is_a64() nor re-compute the various inputs.
Message-id: [email protected]
--- target/arm/cpu.h | 49 +++++++++++++++++++++++++++------------------ target/arm/helper.c | 16 +++++++++++---- 2 files changed, 42 insertions(+), 23 deletions(-)
target/arm/cpu.h +30 -19
@@ -3108,33 +3108,44 @@ static inline uint64_t arm_sctlr(CPUARMState *env, int el) } } +static inline bool arm_cpu_data_is_big_endian_a32 (CPUARMState *env, +bool sctlr_b) +{ +#ifdef CONFIG_USER_ONLY +/* +* In system mode, BE32 is modelled in line with the +* architecture (as word-invariant big-endianness), where loads +* and stores are done little endian but from addresses which +* are adjusted by XORing with the appropriate constant. So the +* endianness to use for the raw data access is not affected by +* SCTLR.B. +* In user mode, however, we model BE32 as byte-invariant +* big-endianness (because user-only code cannot tell the +* difference), and so we need to use a data access endianness +* that depends on SCTLR.B. +*/ +if (sctlr_b) { +return true; + } +#endif +/* In 32bit endianness is determined by looking at CPSR's E bit */ +return env->uncached_cpsr &CPSR_E ; +} + +static inline bool arm_cpu_data_is_big_endian_a64 (int el,uint64_t sctlr) +{ +return sctlr & (el ?SCTLR_EE :SCTLR_E0E ); +}/* Return true if the processor is in big-endian mode. */ static inline bool arm_cpu_data_is_big_endian (CPUARMState *env) { -/* In 32bit endianness is determined by looking at CPSR's E bit */ if (!is_a64 (env)) { - return -#ifdef CONFIG_USER_ONLY -/* In system mode, BE32 is modelled in line with the -* architecture (as word-invariant big-endianness), where loads -* and stores are done little endian but from addresses which -* are adjusted by XORing with the appropriate constant. So the -* endianness to use for the raw data access is not affected by -* SCTLR.B. -* In user mode, however, we model BE32 as byte-invariant -* big-endianness (because user-only code cannot tell the -* difference), and so we need to use a data access endianness -* that depends on SCTLR.B. -*/ -arm_sctlr_b (env) || -#endif - ((env->uncached_cpsr & CPSR_E) ? 1 : 0); +return arm_cpu_data_is_big_endian_a32 (env,arm_sctlr_b (env)); }else {int cur_el =arm_current_el (env);uint64_t sctlr =arm_sctlr (env, cur_el); - -return (sctlr & (cur_el ?SCTLR_EE :SCTLR_E0E )) !=0 ; +return arm_cpu_data_is_big_endian_a64 (cur_el, sctlr); } }
target/arm/helper.c +12 -4
@@ -11061,9 +11061,6 @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, flags =FIELD_DP32 (flags,TBFLAG_ANY ,MMUIDX ,arm_to_core_mmu_idx (mmu_idx)); -if (arm_cpu_data_is_big_endian (env)) { - flags =FIELD_DP32 (flags,TBFLAG_ANY ,BE_DATA ,1 ); - }if (arm_singlestep_active (env)) { flags =FIELD_DP32 (flags,TBFLAG_ANY ,SS_ACTIVE ,1 ); }
@@ -11073,7 +11070,14 @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,static uint32_t rebuild_hflags_common_32 (CPUARMState *env,int fp_el,ARMMMUIdx mmu_idx,uint32_t flags) { - flags =FIELD_DP32 (flags,TBFLAG_A32 ,SCTLR_B ,arm_sctlr_b (env)); +bool sctlr_b =arm_sctlr_b (env); + +if (sctlr_b) { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,SCTLR_B ,1 ); + } +if (arm_cpu_data_is_big_endian_a32 (env, sctlr_b)) { + flags =FIELD_DP32 (flags,TBFLAG_ANY ,BE_DATA ,1 ); + } flags =FIELD_DP32 (flags,TBFLAG_A32 ,NS , !access_secure_reg (env));return rebuild_hflags_common (env, fp_el, mmu_idx, flags);
@@ -11122,6 +11126,10 @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, sctlr =arm_sctlr (env, el); +if (arm_cpu_data_is_big_endian_a64 (el, sctlr)) { + flags =FIELD_DP32 (flags,TBFLAG_ANY ,BE_DATA ,1 ); + } +if (cpu_isar_feature (aa64_pauth,env_archcpu (env))) {/* * In order to save space in flags, we record only whether
Signature · 1 line
2.20.1
[PULL 08/51] target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Hoist the computation of some TBFLAG_A32 bits that only apply to M-profile under a single test for ARM_FEATURE_M.
Message-id: [email protected]
--- target/arm/helper.c | 49 +++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 26 deletions(-)
target/arm/helper.c +23 -26
@@ -11194,6 +11194,29 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,if (arm_feature (env,ARM_FEATURE_M )) { flags =rebuild_hflags_m32 (env, fp_el, mmu_idx); + +if (arm_feature (env,ARM_FEATURE_M_SECURITY ) && +FIELD_EX32 (env->v7m.fpccr[M_REG_S ],V7M_FPCCR ,S ) + != env->v7m.secure) { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,FPCCR_S_WRONG ,1 ); + } + +if ((env->v7m.fpccr[env->v7m.secure] &R_V7M_FPCCR_ASPEN_MASK ) && + (!(env->v7m.control[M_REG_S ] &R_V7M_CONTROL_FPCA_MASK ) || + (env->v7m.secure && + !(env->v7m.control[M_REG_S ] &R_V7M_CONTROL_SFPA_MASK )))) { +/* +* ASPEN is set, but FPCA/SFPA indicate that there is no +* active FP context; we must create a new FP context before +* executing any FP insn. +*/ + flags =FIELD_DP32 (flags,TBFLAG_A32 ,NEW_FP_CTXT_NEEDED ,1 ); + } + +bool is_secure = env->v7m.fpccr[M_REG_S ] &R_V7M_FPCCR_S_MASK ; +if (env->v7m.fpccr[is_secure] &R_V7M_FPCCR_LSPACT_MASK ) { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,LSPACT ,1 ); + } }else { flags =rebuild_hflags_common_32 (env, fp_el, mmu_idx,0 ); }
@@ -11233,32 +11256,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } -if (arm_feature (env,ARM_FEATURE_M_SECURITY ) && -FIELD_EX32 (env->v7m.fpccr[M_REG_S ],V7M_FPCCR ,S ) != env->v7m.secure) { - flags =FIELD_DP32 (flags,TBFLAG_A32 ,FPCCR_S_WRONG ,1 ); - } - -if (arm_feature (env,ARM_FEATURE_M ) && - (env->v7m.fpccr[env->v7m.secure] &R_V7M_FPCCR_ASPEN_MASK ) && - (!(env->v7m.control[M_REG_S ] &R_V7M_CONTROL_FPCA_MASK ) || - (env->v7m.secure && - !(env->v7m.control[M_REG_S ] &R_V7M_CONTROL_SFPA_MASK )))) { -/* -* ASPEN is set, but FPCA/SFPA indicate that there is no active -* FP context; we must create a new FP context before executing -* any FP insn. -*/ - flags =FIELD_DP32 (flags,TBFLAG_A32 ,NEW_FP_CTXT_NEEDED ,1 ); - } - -if (arm_feature (env,ARM_FEATURE_M )) { -bool is_secure = env->v7m.fpccr[M_REG_S ] &R_V7M_FPCCR_S_MASK ; - -if (env->v7m.fpccr[is_secure] &R_V7M_FPCCR_LSPACT_MASK ) { - flags =FIELD_DP32 (flags,TBFLAG_A32 ,LSPACT ,1 ); - } - } -if (!arm_feature (env,ARM_FEATURE_M )) {int target_el =arm_debug_target_el (env);
Signature · 1 line
2.20.1
[PULL 07/51] target/arm: Split out rebuild_hflags_m32
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Create a function to compute the values of the TBFLAG_A32 bits that will be cached, and are used by M-profile.
Message-id: [email protected]
--- target/arm/helper.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-)
target/arm/helper.c +30 -15
@@ -11083,6 +11083,29 @@ static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el,return rebuild_hflags_common (env, fp_el, mmu_idx, flags); } +static uint32_t rebuild_hflags_m32 (CPUARMState *env,int fp_el, +ARMMMUIdx mmu_idx) +{ +uint32_t flags =0 ; + +if (arm_v7m_is_handler_mode (env)) { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,HANDLER ,1 ); + } + +/* +* v8M always applies stack limit checks unless CCR.STKOFHFNMIGN +* is suppressing them because the requested execution priority +* is less than 0. +*/ +if (arm_feature (env,ARM_FEATURE_V8 ) && + !((mmu_idx &ARM_MMU_IDX_M_NEGPRI ) && + (env->v7m.ccr[env->v7m.secure] &R_V7M_CCR_STKOFHFNMIGN_MASK ))) { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,STACKCHECK ,1 ); + } + +return rebuild_hflags_common_32 (env, fp_el, mmu_idx, flags); +} +static uint32_t rebuild_hflags_a64 (CPUARMState *env,int el,int fp_el,ARMMMUIdx mmu_idx) {
@@ -11168,7 +11191,13 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } }else { *pc = env->regs[15 ]; - flags =rebuild_hflags_common_32 (env, fp_el, mmu_idx,0 ); + +if (arm_feature (env,ARM_FEATURE_M )) { + flags =rebuild_hflags_m32 (env, fp_el, mmu_idx); + }else { + flags =rebuild_hflags_common_32 (env, fp_el, mmu_idx,0 ); + } + flags =FIELD_DP32 (flags,TBFLAG_A32 ,THUMB , env->thumb); flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECLEN , env->vfp.vec_len); flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECSTRIDE , env->vfp.vec_stride);
@@ -11204,20 +11233,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } -if (arm_v7m_is_handler_mode (env)) { - flags =FIELD_DP32 (flags,TBFLAG_A32 ,HANDLER ,1 ); - } - -/* v8M always applies stack limit checks unless CCR.STKOFHFNMIGN is -* suppressing them because the requested execution priority is less than 0. -*/ -if (arm_feature (env,ARM_FEATURE_V8 ) && -arm_feature (env,ARM_FEATURE_M ) && - !((mmu_idx &ARM_MMU_IDX_M_NEGPRI ) && - (env->v7m.ccr[env->v7m.secure] &R_V7M_CCR_STKOFHFNMIGN_MASK ))) { - flags =FIELD_DP32 (flags,TBFLAG_A32 ,STACKCHECK ,1 ); - } -if (arm_feature (env,ARM_FEATURE_M_SECURITY ) &&FIELD_EX32 (env->v7m.fpccr[M_REG_S ],V7M_FPCCR ,S ) != env->v7m.secure) { flags =FIELD_DP32 (flags,TBFLAG_A32 ,FPCCR_S_WRONG ,1 );
Signature · 1 line
2.20.1
[PULL 24/51] linux-user/aarch64: Rebuild hflags for TARGET_WORDS_BIGENDIAN
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Continue setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- linux-user/aarch64/cpu_loop.c | 1 + 1 file changed, 1 insertion(+)
linux-user/aarch64/cpu_loop.c +1 -0
@@ -173,6 +173,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)for (i =1 ; i <4 ; ++i) { env->cp15.sctlr_el[i] |=SCTLR_EE ; } +arm_rebuild_hflags (env);#endif if (cpu_isar_feature (aa64_pauth, cpu)) {
Signature · 1 line
2.20.1
[PULL 22/51] target/arm: Rebuild hflags for M-profile
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Continue setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- target/arm/m_helper.c | 6 ++++++ target/arm/translate.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-)
target/arm/m_helper.c +6 -0
@@ -494,6 +494,7 @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)switch_v7m_security_state (env, dest &1 ); env->thumb =1 ; env->regs[15 ] = dest & ~1 ; +arm_rebuild_hflags (env); }void HELPER (v7m_blxns )(CPUARMState *env,uint32_t dest)
@@ -555,6 +556,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)switch_v7m_security_state (env,0 ); env->thumb =1 ; env->regs[15 ] = dest; +arm_rebuild_hflags (env); } static uint32_t *get_v7m_sp_ptr(CPUARMState *env, bool secure, bool threadmode,
@@ -895,6 +897,7 @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, env->regs[14 ] = lr; env->regs[15 ] = addr &0xfffffffe ; env->thumb = addr &1 ; +arm_rebuild_hflags (env); } static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr,
@@ -1765,6 +1768,7 @@ static void do_v7m_exception_exit(ARMCPU *cpu)/* Otherwise, we have a successful exception exit. */ arm_clear_exclusive (env); +arm_rebuild_hflags (env);qemu_log_mask (CPU_LOG_INT ,"...successful exception return\n" ); }
@@ -1837,6 +1841,7 @@ static bool do_v7m_function_return(ARMCPU *cpu)xpsr_write (env,0 ,XPSR_IT ); env->thumb = newpc &1 ; env->regs[15 ] = newpc & ~1 ; +arm_rebuild_hflags (env);qemu_log_mask (CPU_LOG_INT ,"...function return successful\n" );return true;
@@ -1959,6 +1964,7 @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu)switch_v7m_security_state (env, true);xpsr_write (env,0 ,XPSR_IT ); env->regs[15 ] +=4 ; +arm_rebuild_hflags (env);return true; gen_invep:
target/arm/translate.c +4 -1
@@ -8327,7 +8327,7 @@ static bool trans_MRS_v7m(DisasContext *s, arg_MRS_v7m *a)static bool trans_MSR_v7m (DisasContext *s,arg_MSR_v7m *a) { -TCGv_i32 addr, reg; +TCGv_i32 addr, reg, el;if (!arm_dc_feature (s,ARM_FEATURE_M )) {return false;
@@ -8337,6 +8337,9 @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a)gen_helper_v7m_msr (cpu_env, addr, reg);tcg_temp_free_i32 (addr);tcg_temp_free_i32 (reg); + el =tcg_const_i32 (s->current_el); +gen_helper_rebuild_hflags_m32 (cpu_env, el); +tcg_temp_free_i32 (el);gen_lookup_tb (s);return true; }
Signature · 1 line
2.20.1
[PULL 09/51] target/arm: Split out rebuild_hflags_a32
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Currently a trivial wrapper for rebuild_hflags_common_32.
Message-id: [email protected]
--- target/arm/helper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
target/arm/helper.c +7 -1
@@ -11106,6 +11106,12 @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el,return rebuild_hflags_common_32 (env, fp_el, mmu_idx, flags); } +static uint32_t rebuild_hflags_a32 (CPUARMState *env,int fp_el, +ARMMMUIdx mmu_idx) +{ +return rebuild_hflags_common_32 (env, fp_el, mmu_idx,0 ); +} +static uint32_t rebuild_hflags_a64 (CPUARMState *env,int el,int fp_el,ARMMMUIdx mmu_idx) {
@@ -11218,7 +11224,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags =FIELD_DP32 (flags,TBFLAG_A32 ,LSPACT ,1 ); } }else { - flags =rebuild_hflags_common_32 (env, fp_el, mmu_idx,0 ); + flags =rebuild_hflags_a32 (env, fp_el, mmu_idx); } flags =FIELD_DP32 (flags,TBFLAG_A32 ,THUMB , env->thumb);
Signature · 1 line
2.20.1
[PULL 15/51] target/arm: Split out arm_mmu_idx_el
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Avoid calling arm_current_el() twice.
Message-id: [email protected]
--- target/arm/internals.h | 9 +++++++++ target/arm/helper.c | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-)
target/arm/internals.h +9 -0
@@ -949,6 +949,15 @@ void arm_cpu_update_virq(ARMCPU *cpu);*/ void arm_cpu_update_vfiq (ARMCPU *cpu); +/** +* arm_mmu_idx_el: +* @env: The cpu environment +* @el: The EL to use. +* +* Return the full ARMMMUIdx for the translation regime for EL. +*/ +ARMMMUIdx arm_mmu_idx_el (CPUARMState *env,int el); +/** * arm_mmu_idx: * @env: The cpu environment
target/arm/helper.c +7 -5
@@ -11026,15 +11026,12 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) }#endif -ARMMMUIdx arm_mmu_idx (CPUARMState *env) +ARMMMUIdx arm_mmu_idx_el (CPUARMState *env,int el) { -int el; -if (arm_feature (env,ARM_FEATURE_M )) {return arm_v7m_mmu_idx_for_secstate (env, env->v7m.secure); } - el =arm_current_el (env);if (el <2 &&arm_is_secure_below_el3 (env)) {return ARMMMUIdx_S1SE0 + el; }else {
@@ -11042,6 +11039,11 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) } } +ARMMMUIdx arm_mmu_idx (CPUARMState *env) +{ +return arm_mmu_idx_el (env,arm_current_el (env)); +} +int cpu_mmu_index (CPUARMState *env,bool ifetch) {return arm_to_core_mmu_idx (arm_mmu_idx (env));
@@ -11202,7 +11204,7 @@ static uint32_t rebuild_hflags_internal(CPUARMState *env) {int el =arm_current_el (env);int fp_el =fp_exception_el (env, el); -ARMMMUIdx mmu_idx =arm_mmu_idx (env); +ARMMMUIdx mmu_idx =arm_mmu_idx_el (env, el);if (is_a64 (env)) {return rebuild_hflags_a64 (env, el, fp_el, mmu_idx);
Signature · 1 line
2.20.1
[PULL 26/51] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
This is the payoff.
From perf record -g data of ubuntu 18 boot and shutdown:
BEFORE:
- 23.02% 2.82% qemu-system-aar [.] helper_lookup_tb_ptr
- 20.22% helper_lookup_tb_ptr
+ 10.05% tb_htable_lookup
- 9.13% cpu_get_tb_cpu_state
3.20% aa64_va_parameters_both
0.55% fp_exception_el
- 11.66% 4.74% qemu-system-aar [.] cpu_get_tb_cpu_state
- 6.96% cpu_get_tb_cpu_state
3.63% aa64_va_parameters_both
0.60% fp_exception_el
0.53% sve_exception_elAFTER:
- 16.40% 3.40% qemu-system-aar [.] helper_lookup_tb_ptr
- 13.03% helper_lookup_tb_ptr
+ 11.19% tb_htable_lookup
0.55% cpu_get_tb_cpu_state
0.98% 0.71% qemu-system-aar [.] cpu_get_tb_cpu_state
0.87% 0.24% qemu-system-aar [.] rebuild_hflags_a64Before, helper_lookup_tb_ptr is the second hottest function in the application, consuming almost a quarter of the runtime. Within the entire execution, cpu_get_tb_cpu_state consumes about 12%.
After, helper_lookup_tb_ptr has dropped to the fourth hottest function, with consumption dropping to a sixth of the runtime. Within the entire execution, cpu_get_tb_cpu_state has dropped below 1%, and the supporting function to rebuild hflags also consumes about 1%.
Assertions are retained for --enable-debug-tcg.
Message-id: [email protected]
--- target/arm/helper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
target/arm/helper.c +6 -3
@@ -11259,12 +11259,15 @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el)void cpu_get_tb_cpu_state (CPUARMState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) { -uint32_t flags, pstate_for_ss; +uint32_t flags = env->hflags; +uint32_t pstate_for_ss; *cs_base =0 ; - flags =rebuild_hflags_internal (env); +#ifdef CONFIG_DEBUG_TCG +assert (flags ==rebuild_hflags_internal (env)); +#endif -if (is_a64 (env)) { +if (FIELD_EX32 (flags,TBFLAG_ANY ,AARCH64_STATE )) { *pc = env->pc;if (cpu_isar_feature (aa64_bti,env_archcpu (env))) { flags =FIELD_DP32 (flags,TBFLAG_A64 ,BTYPE , env->btype);
Signature · 1 line
2.20.1
[PULL 23/51] target/arm: Rebuild hflags for M-profile NVIC
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Continue setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- hw/intc/armv7m_nvic.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
hw/intc/armv7m_nvic.c +13 -9
@@ -2251,7 +2251,7 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, } }nvic_irq_update (s); -return MEMTX_OK ; + goto exit_ok; case 0x200 ... 0x23f: /* NVIC Set pend *//* the special logic in armv7m_nvic_set_pending() * is not needed since IRQs are never escalated
@@ -2269,9 +2269,9 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, } }nvic_irq_update (s); -return MEMTX_OK ; + goto exit_ok; case 0x300 ... 0x33f: /* NVIC Active */ -return MEMTX_OK ;/* R/O */ + goto exit_ok;/* R/O */ case 0x400 ... 0x5ef: /* NVIC Priority */ startvec = (offset -0x400 ) +NVIC_FIRST_IRQ ;/* vector # */
@@ -2281,10 +2281,10 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, } }nvic_irq_update (s); -return MEMTX_OK ; + goto exit_ok; case 0xd18 ... 0xd1b: /* System Handler Priority (SHPR1) */if (!arm_feature (&s->cpu->env,ARM_FEATURE_M_MAIN )) { -return MEMTX_OK ; + goto exit_ok; }/* fall through */ case 0xd1c ... 0xd23: /* System Handler Priority (SHPR2, SHPR3) */
@@ -2299,10 +2299,10 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,set_prio (s, hdlidx, sbank, newprio); }nvic_irq_update (s); -return MEMTX_OK ; + goto exit_ok; case 0xd28 ... 0xd2b: /* Configurable Fault Status (CFSR) */if (!arm_feature (&s->cpu->env,ARM_FEATURE_M_MAIN )) { -return MEMTX_OK ; + goto exit_ok; }/* All bits are W1C, so construct 32 bit value with 0s in * the parts not written by the access size
@@ -2322,15 +2322,19 @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,*/ s->cpu->env.v7m.cfsr[M_REG_NS ] &= ~(value &R_V7M_CFSR_BFSR_MASK ); } -return MEMTX_OK ; + goto exit_ok; }if (size ==4 ) {nvic_writel (s, offset, value, attrs); -return MEMTX_OK ; + goto exit_ok; }qemu_log_mask (LOG_GUEST_ERROR ,"NVIC: Bad write of size %d at offset 0x%x\n" , size, offset);/* This is UNPREDICTABLE; treat as RAZ/WI */ + + exit_ok: +/* Ensure any changes made are reflected in the cached hflags. */ +arm_rebuild_hflags (&s->cpu->env);return MEMTX_OK ; }
Signature · 1 line
2.20.1
[PULL 11/51] target/arm: Hoist XSCALE_CPAR, VECLEN, VECSTRIDE in cpu_get_tb_cpu_state
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
We do not need to compute any of these values for M-profile. Further, XSCALE_CPAR overlaps VECSTRIDE so obviously the two sets must be mutually exclusive.
Message-id: [email protected]
--- target/arm/helper.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
target/arm/helper.c +14 -7
@@ -11235,21 +11235,28 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } }else { flags =rebuild_hflags_a32 (env, fp_el, mmu_idx); + +/* +* Note that XSCALE_CPAR shares bits with VECSTRIDE. +* Note that VECLEN+VECSTRIDE are RES0 for M-profile. +*/ +if (arm_feature (env,ARM_FEATURE_XSCALE )) { + flags =FIELD_DP32 (flags,TBFLAG_A32 , +XSCALE_CPAR , env->cp15.c15_cpar); + }else { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECLEN , + env->vfp.vec_len); + flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECSTRIDE , + env->vfp.vec_stride); + } } flags =FIELD_DP32 (flags,TBFLAG_A32 ,THUMB , env->thumb); - flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECLEN , env->vfp.vec_len); - flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECSTRIDE , env->vfp.vec_stride); flags =FIELD_DP32 (flags,TBFLAG_A32 ,CONDEXEC , env->condexec_bits);if (env->vfp.xregs[ARM_VFP_FPEXC ] & (1 <<30 ) ||arm_el_is_aa64 (env,1 ) ||arm_feature (env,ARM_FEATURE_M )) { flags =FIELD_DP32 (flags,TBFLAG_A32 ,VFPEN ,1 ); } -/* Note that XSCALE_CPAR shares bits with VECSTRIDE */ -if (arm_feature (env,ARM_FEATURE_XSCALE )) { - flags =FIELD_DP32 (flags,TBFLAG_A32 , -XSCALE_CPAR , env->cp15.c15_cpar); - } }/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
Signature · 1 line
2.20.1
[PULL 18/51] target/arm: Rebuild hflags at EL changes
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Begin setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- linux-user/syscall.c | 1 + target/arm/cpu.c | 1 + target/arm/helper-a64.c | 3 +++ target/arm/helper.c | 2 ++ target/arm/machine.c | 1 + target/arm/op_helper.c | 1 + 6 files changed, 9 insertions(+)
linux-user/syscall.c +1 -0
@@ -9984,6 +9984,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,aarch64_sve_narrow_vq (env, vq); } env->vfp.zcr_el[1 ] = vq -1 ; +arm_rebuild_hflags (env); ret = vq *16 ; }return ret;
target/arm/cpu.c +1 -0
@@ -406,6 +406,7 @@ static void arm_cpu_reset(CPUState *s)hw_breakpoint_update_all (cpu);hw_watchpoint_update_all (cpu); +arm_rebuild_hflags (env); }bool arm_cpu_exec_interrupt (CPUState *cs,int interrupt_request)
target/arm/helper-a64.c +3 -0
@@ -1025,6 +1025,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) }else { env->regs[15 ] = new_pc & ~0x3 ; } +helper_rebuild_hflags_a32 (env, new_el);qemu_log_mask (CPU_LOG_INT ,"Exception return from AArch64 EL%d to " "AArch32 EL%d PC 0x%" PRIx32"\n" , cur_el, new_el, env->regs[15 ]);
@@ -1036,10 +1037,12 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) }aarch64_restore_sp (env, new_el); env->pc = new_pc; +helper_rebuild_hflags_a64 (env, new_el);qemu_log_mask (CPU_LOG_INT ,"Exception return from AArch64 EL%d to " "AArch64 EL%d PC 0x%" PRIx64"\n" , cur_el, new_el, env->pc); } +/* * Note that cur_el can never be 0. If new_el is 0, then * el0_a64 is return_to_aa64, else el0_a64 is ignored.
target/arm/helper.c +2 -0
@@ -7998,6 +7998,7 @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, env->regs[14 ] = env->regs[15 ] + offset; } env->regs[15 ] = newpc; +arm_rebuild_hflags (env); }static void arm_cpu_do_interrupt_aarch32_hyp (CPUState *cs)
@@ -8345,6 +8346,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)pstate_write (env,PSTATE_DAIF | new_mode); env->aarch64 =1 ;aarch64_restore_sp (env, new_el); +helper_rebuild_hflags_a64 (env, new_el); env->pc = addr;
target/arm/machine.c +1 -0
@@ -756,6 +756,7 @@ static int cpu_post_load(void *opaque, int version_id)if (!kvm_enabled ()) {pmu_op_finish (&cpu->env); } +arm_rebuild_hflags (&cpu->env);return 0 ; }
target/arm/op_helper.c +1 -0
@@ -404,6 +404,7 @@ void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t val)* state. Do the masking now. */ env->regs[15 ] &= (env->thumb ? ~1 : ~3 ); +arm_rebuild_hflags (env);qemu_mutex_lock_iothread ();arm_call_el_change_hook (env_archcpu (env));
Signature · 1 line
2.20.1
[PULL 29/51] hw/dma/xilinx_axidma.c: Switch to transaction-based ptimer API
In reply to Peter MaydellSwitch the xilinx_axidma code away from bottom-half based ptimers to the new transaction-based ptimer API. This just requires adding begin/commit calls around the various places that modify the ptimer state, and using the new ptimer_init() function to create the timer.
Message-id: [email protected]
--- hw/dma/xilinx_axidma.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
hw/dma/xilinx_axidma.c +5 -4
@@ -31,7 +31,6 @@#include "hw/ptimer.h" #include "hw/qdev-properties.h" #include "qemu/log.h" -#include "qemu/main-loop.h" #include "qemu/module.h" #include "hw/stream.h"
@@ -104,7 +103,6 @@ enum { };struct Stream { -QEMUBH *bh;ptimer_state *ptimer;qemu_irq irq;
@@ -242,6 +240,7 @@ static void stream_complete(struct Stream *s)unsigned int comp_delay;/* Start the delayed timer. */ +ptimer_transaction_begin (s->ptimer); comp_delay = s->regs[R_DMACR ] >>24 ;if (comp_delay) {ptimer_stop (s->ptimer);
@@ -255,6 +254,7 @@ static void stream_complete(struct Stream *s) s->regs[R_DMASR ] |=DMASR_IOC_IRQ ;stream_reload_complete_cnt (s); } +ptimer_transaction_commit (s->ptimer); } static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev,
@@ -551,9 +551,10 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp)struct Stream *st = &s->streams[i]; st->nr = i; - st->bh =qemu_bh_new (timer_hit, st); - st->ptimer =ptimer_init_with_bh (st->bh,PTIMER_POLICY_DEFAULT ); + st->ptimer =ptimer_init (timer_hit, st,PTIMER_POLICY_DEFAULT ); +ptimer_transaction_begin (st->ptimer);ptimer_set_freq (st->ptimer, s->freqhz); +ptimer_transaction_commit (st->ptimer); }return ;
Signature · 1 line
2.20.1
[PULL 27/51] hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API
In reply to Peter MaydellSwitch the fsl_etsec code away from bottom-half based ptimers to the new transaction-based ptimer API. This just requires adding begin/commit calls around the various places that modify the ptimer state, and using the new ptimer_init() function to create the timer.
Message-id: [email protected]
--- hw/net/fsl_etsec/etsec.h | 1 - hw/net/fsl_etsec/etsec.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
hw/net/fsl_etsec/etsec.h +0 -1
@@ -141,7 +141,6 @@ typedef struct eTSEC {uint16_t phy_control;/* Polling */ -QEMUBH *bh;struct ptimer_state *ptimer;/* Whether we should flush the rx queue when buffer becomes available. */
hw/net/fsl_etsec/etsec.c +5 -4
@@ -34,7 +34,6 @@#include "etsec.h" #include "registers.h" #include "qemu/log.h" -#include "qemu/main-loop.h" #include "qemu/module.h" /* #define HEX_DUMP */
@@ -195,9 +194,11 @@ static void write_dmactrl(eTSEC *etsec,if (!(value &DMACTRL_WOP )) {/* Start polling */ +ptimer_transaction_begin (etsec->ptimer);ptimer_stop (etsec->ptimer);ptimer_set_count (etsec->ptimer,1 );ptimer_run (etsec->ptimer,1 ); +ptimer_transaction_commit (etsec->ptimer); } }
@@ -391,10 +392,10 @@ static void etsec_realize(DeviceState *dev, Error **errp) object_get_typename(OBJECT(dev)), dev->id, etsec);qemu_format_nic_info_str (qemu_get_queue (etsec->nic), etsec->conf.macaddr.a); - - etsec->bh =qemu_bh_new (etsec_timer_hit, etsec); - etsec->ptimer =ptimer_init_with_bh (etsec->bh,PTIMER_POLICY_DEFAULT ); + etsec->ptimer =ptimer_init (etsec_timer_hit, etsec,PTIMER_POLICY_DEFAULT ); +ptimer_transaction_begin (etsec->ptimer);ptimer_set_freq (etsec->ptimer,100 ); +ptimer_transaction_commit (etsec->ptimer); }static void etsec_instance_init (Object *obj)
Signature · 1 line
2.20.1
[PULL 13/51] target/arm: Hoist computation of TBFLAG_A32.VFPEN
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
There are 3 conditions that each enable this flag. M-profile always enables; A-profile with EL1 as AA64 always enables. Both of these conditions can easily be cached. The final condition relies on the FPEXC register which we are not prepared to cache.
Message-id: [email protected]
--- target/arm/cpu.h | 2 +- target/arm/helper.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-)
target/arm/cpu.h +1 -1
@@ -3192,7 +3192,7 @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2)* the same thing as the current security state of the processor! */ FIELD(TBFLAG_A32, NS, 6, 1) -FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */ +FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Partially cached, minus FPEXC. */ FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */FIELD (TBFLAG_A32 ,SCTLR_B ,16 ,1 )/* For M profile only, set if FPCCR.LSPACT is set */
target/arm/helper.c +10 -4
@@ -11088,6 +11088,9 @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, {uint32_t flags =0 ; +/* v8M always enables the fpu. */ + flags =FIELD_DP32 (flags,TBFLAG_A32 ,VFPEN ,1 ); +if (arm_v7m_is_handler_mode (env)) { flags =FIELD_DP32 (flags,TBFLAG_A32 ,HANDLER ,1 ); }
@@ -11119,6 +11122,10 @@ static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, ARMMMUIdx mmu_idx) {uint32_t flags =rebuild_hflags_aprofile (env); + +if (arm_el_is_aa64 (env,1 )) { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,VFPEN ,1 ); + }return rebuild_hflags_common_32 (env, fp_el, mmu_idx, flags); }
@@ -11250,14 +11257,13 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags =FIELD_DP32 (flags,TBFLAG_A32 ,VECSTRIDE , env->vfp.vec_stride); } +if (env->vfp.xregs[ARM_VFP_FPEXC ] & (1 <<30 )) { + flags =FIELD_DP32 (flags,TBFLAG_A32 ,VFPEN ,1 ); + } } flags =FIELD_DP32 (flags,TBFLAG_A32 ,THUMB , env->thumb); flags =FIELD_DP32 (flags,TBFLAG_A32 ,CONDEXEC , env->condexec_bits); -if (env->vfp.xregs[ARM_VFP_FPEXC ] & (1 <<30 ) - ||arm_el_is_aa64 (env,1 ) ||arm_feature (env,ARM_FEATURE_M )) { - flags =FIELD_DP32 (flags,TBFLAG_A32 ,VFPEN ,1 ); - } pstate_for_ss = env->uncached_cpsr; }
Signature · 1 line
2.20.1
[PULL 17/51] target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32})
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
This functions are given the mode and el state of the cpu and writes the computed value to env->hflags.
Message-id: [email protected]
--- target/arm/helper.h | 4 ++++ target/arm/helper.c | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+)
target/arm/helper.h +4 -0
@@ -90,6 +90,10 @@ DEF_HELPER_4(msr_banked, void, env, i32, i32, i32) DEF_HELPER_2(get_user_reg, i32, env, i32) DEF_HELPER_3(set_user_reg, void, env, i32, i32) +DEF_HELPER_FLAGS_2(rebuild_hflags_m32, TCG_CALL_NO_RWG, void, env, int) +DEF_HELPER_FLAGS_2(rebuild_hflags_a32, TCG_CALL_NO_RWG, void, env, int) +DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int) + DEF_HELPER_1(vfp_get_fpscr, i32, env)DEF_HELPER_2 (vfp_set_fpscr, void, env, i32)
target/arm/helper.c +24 -0
@@ -11220,6 +11220,30 @@ void arm_rebuild_hflags(CPUARMState *env) env->hflags =rebuild_hflags_internal (env); } +void HELPER (rebuild_hflags_m32 )(CPUARMState *env,int el) +{ +int fp_el =fp_exception_el (env, el); +ARMMMUIdx mmu_idx =arm_mmu_idx_el (env, el); + + env->hflags =rebuild_hflags_m32 (env, fp_el, mmu_idx); +} + +void HELPER (rebuild_hflags_a32 )(CPUARMState *env,int el) +{ +int fp_el =fp_exception_el (env, el); +ARMMMUIdx mmu_idx =arm_mmu_idx_el (env, el); + + env->hflags =rebuild_hflags_a32 (env, fp_el, mmu_idx); +} + +void HELPER (rebuild_hflags_a64 )(CPUARMState *env,int el) +{ +int fp_el =fp_exception_el (env, el); +ARMMMUIdx mmu_idx =arm_mmu_idx_el (env, el); + + env->hflags =rebuild_hflags_a64 (env, el, fp_el, mmu_idx); +} +void cpu_get_tb_cpu_state (CPUARMState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) {
Signature · 1 line
2.20.1
[PULL 31/51] hw/timer/slavio_timer.c: Switch to transaction-based ptimer API
In reply to Peter MaydellSwitch the slavio_timer code away from bottom-half based ptimers to the new transaction-based ptimer API. This just requires adding begin/commit calls around the various places that modify the ptimer state, and using the new ptimer_init() function to create the timer.
Message-id: [email protected]
--- hw/timer/slavio_timer.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
hw/timer/slavio_timer.c +16 -4
@@ -30,7 +30,6 @@#include "hw/sysbus.h" #include "migration/vmstate.h" #include "trace.h" -#include "qemu/main-loop.h" #include "qemu/module.h" /*
@@ -213,6 +212,7 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr, saddr = addr >>2 ;switch (saddr) {case TIMER_LIMIT : +ptimer_transaction_begin (t->timer);if (slavio_timer_is_user (tc)) {uint64_t count;
@@ -234,6 +234,7 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr,ptimer_set_limit (t->timer,LIMIT_TO_PERIODS (t->limit),1 ); } } +ptimer_transaction_commit (t->timer);break ;case TIMER_COUNTER :if (slavio_timer_is_user (tc)) {
@@ -245,7 +246,9 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr, t->reached =0 ; count = ((uint64_t )t->counthigh) <<32 | t->count;trace_slavio_timer_mem_writel_limit (timer_index, count); +ptimer_transaction_begin (t->timer);ptimer_set_count (t->timer,LIMIT_TO_PERIODS (t->limit - count)); +ptimer_transaction_commit (t->timer); }else {trace_slavio_timer_mem_writel_counter_invalid (); }
@@ -253,13 +256,16 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr,case TIMER_COUNTER_NORST :// set limit without resetting counter t->limit = val &TIMER_MAX_COUNT32 ; +ptimer_transaction_begin (t->timer);if (t->limit ==0 ) {/* free-run */ ptimer_set_limit (t->timer,LIMIT_TO_PERIODS (TIMER_MAX_COUNT32 ),0 ); }else {ptimer_set_limit (t->timer,LIMIT_TO_PERIODS (t->limit),0 ); } +ptimer_transaction_commit (t->timer);break ;case TIMER_STATUS : +ptimer_transaction_begin (t->timer);if (slavio_timer_is_user (tc)) {// start/stop user counter if (val &1 ) {
@@ -271,6 +277,7 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr, } } t->run = val &1 ; +ptimer_transaction_commit (t->timer);break ;case TIMER_MODE :if (timer_index ==0 ) {
@@ -280,6 +287,7 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr,unsigned int processor =1 << i;CPUTimerState *curr_timer = &s->cputimer[i +1 ]; +ptimer_transaction_begin (curr_timer->timer);// check for a change in timer mode for this processor if ((val & processor) != (s->cputimer_mode & processor)) {if (val & processor) {// counter -> user timer
@@ -306,6 +314,7 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr,trace_slavio_timer_mem_writel_mode_counter (timer_index); } } +ptimer_transaction_commit (curr_timer->timer); } }else {trace_slavio_timer_mem_writel_mode_invalid ();
@@ -365,10 +374,12 @@ static void slavio_timer_reset(DeviceState *d) curr_timer->count =0 ; curr_timer->reached =0 ;if (i <= s->num_cpus) { +ptimer_transaction_begin (curr_timer->timer);ptimer_set_limit (curr_timer->timer,LIMIT_TO_PERIODS (TIMER_MAX_COUNT32 ),1 );ptimer_run (curr_timer->timer,0 ); curr_timer->run =1 ; +ptimer_transaction_commit (curr_timer->timer); } } s->cputimer_mode =0 ;
@@ -378,7 +389,6 @@ static void slavio_timer_init(Object *obj) {SLAVIO_TIMERState *s =SLAVIO_TIMER (obj);SysBusDevice *dev =SYS_BUS_DEVICE (obj); -QEMUBH *bh;unsigned int i;TimerContext *tc;
@@ -390,9 +400,11 @@ static void slavio_timer_init(Object *obj) tc->s = s; tc->timer_index = i; - bh =qemu_bh_new (slavio_timer_irq, tc); - s->cputimer[i].timer =ptimer_init_with_bh (bh,PTIMER_POLICY_DEFAULT ); + s->cputimer[i].timer =ptimer_init (slavio_timer_irq, tc, +PTIMER_POLICY_DEFAULT ); +ptimer_transaction_begin (s->cputimer[i].timer);ptimer_set_period (s->cputimer[i].timer,TIMER_PERIOD ); +ptimer_transaction_commit (s->cputimer[i].timer); size = i ==0 ?SYS_TIMER_SIZE :CPU_TIMER_SIZE ;snprintf (timer_name,sizeof (timer_name),"timer-%i" , i);
Signature · 1 line
2.20.1
[PULL 32/51] hw/timer/grlib_gptimer.c: Switch to transaction-based ptimer API
In reply to Peter MaydellSwitch the grlib_gptimer code away from bottom-half based ptimers to the new transaction-based ptimer API. This just requires adding begin/commit calls around the various places that modify the ptimer state, and using the new ptimer_init() function to create the timer.
Message-id: [email protected]
--- hw/timer/grlib_gptimer.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
hw/timer/grlib_gptimer.c +24 -4
@@ -29,7 +29,6 @@#include "hw/irq.h" #include "hw/ptimer.h" #include "hw/qdev-properties.h" -#include "qemu/main-loop.h" #include "qemu/module.h" #include "trace.h"
@@ -63,7 +62,6 @@ typedef struct GPTimer GPTimer;typedef struct GPTimerUnit GPTimerUnit ;struct GPTimer { -QEMUBH *bh;struct ptimer_state *ptimer;qemu_irq irq;
@@ -93,6 +91,17 @@ struct GPTimerUnit {uint32_t config; }; +static void grlib_gptimer_tx_begin (GPTimer *timer) +{ +ptimer_transaction_begin (timer->ptimer); +} + +static void grlib_gptimer_tx_commit (GPTimer *timer) +{ +ptimer_transaction_commit (timer->ptimer); +} + +/* Must be called within grlib_gptimer_tx_begin/commit block */ static void grlib_gptimer_enable (GPTimer *timer) {assert (timer !=NULL );
@@ -115,6 +124,7 @@ static void grlib_gptimer_enable(GPTimer *timer)ptimer_run (timer->ptimer,1 ); } +/* Must be called within grlib_gptimer_tx_begin/commit block */ static void grlib_gptimer_restart (GPTimer *timer) {assert (timer !=NULL );
@@ -141,7 +151,9 @@ static void grlib_gptimer_set_scaler(GPTimerUnit *unit, uint32_t scaler)trace_grlib_gptimer_set_scaler (scaler, value);for (i =0 ; i < unit->nr_timers; i++) { +ptimer_transaction_begin (unit->timers[i].ptimer);ptimer_set_freq (unit->timers[i].ptimer, value); +ptimer_transaction_commit (unit->timers[i].ptimer); } }
@@ -266,8 +278,10 @@ static void grlib_gptimer_write(void *opaque, hwaddr addr,switch (timer_addr) {case COUNTER_OFFSET :trace_grlib_gptimer_writel (id, addr, value); +grlib_gptimer_tx_begin (&unit->timers[id]); unit->timers[id].counter = value;grlib_gptimer_enable (&unit->timers[id]); +grlib_gptimer_tx_commit (&unit->timers[id]);return ;case COUNTER_RELOAD_OFFSET :
@@ -291,6 +305,7 @@ static void grlib_gptimer_write(void *opaque, hwaddr addr,/* gptimer_restart calls gptimer_enable, so if "enable" and "load" bits are present, we just have to call restart. */ +grlib_gptimer_tx_begin (&unit->timers[id]);if (value &GPTIMER_LOAD ) {grlib_gptimer_restart (&unit->timers[id]); }else if (value &GPTIMER_ENABLE ) {
@@ -301,6 +316,7 @@ static void grlib_gptimer_write(void *opaque, hwaddr addr, value &= ~(GPTIMER_LOAD &GPTIMER_DEBUG_HALT ); unit->timers[id].config = value; +grlib_gptimer_tx_commit (&unit->timers[id]);return ;default :
@@ -344,9 +360,11 @@ static void grlib_gptimer_reset(DeviceState *d) timer->counter =0 ; timer->reload =0 ; timer->config =0 ; +ptimer_transaction_begin (timer->ptimer);ptimer_stop (timer->ptimer);ptimer_set_count (timer->ptimer,0 );ptimer_set_freq (timer->ptimer, unit->freq_hz); +ptimer_transaction_commit (timer->ptimer); } }
@@ -365,14 +383,16 @@ static void grlib_gptimer_realize(DeviceState *dev, Error **errp)GPTimer *timer = &unit->timers[i]; timer->unit = unit; - timer->bh =qemu_bh_new (grlib_gptimer_hit, timer); - timer->ptimer =ptimer_init_with_bh (timer->bh,PTIMER_POLICY_DEFAULT ); + timer->ptimer =ptimer_init (grlib_gptimer_hit, timer, +PTIMER_POLICY_DEFAULT ); timer->id = i;/* One IRQ line for each timer */ sysbus_init_irq (sbd, &timer->irq); +ptimer_transaction_begin (timer->ptimer);ptimer_set_freq (timer->ptimer, unit->freq_hz); +ptimer_transaction_commit (timer->ptimer); } memory_region_init_io(&unit->iomem, OBJECT(unit), &grlib_gptimer_ops,
Signature · 1 line
2.20.1
[PULL 14/51] target/arm: Add arm_rebuild_hflags
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
This function assumes nothing about the current state of the cpu, and writes the computed value to env->hflags.
Message-id: [email protected]
--- target/arm/cpu.h | 6 ++++++ target/arm/helper.c | 30 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-)
target/arm/cpu.h +6 -0
@@ -3297,6 +3297,12 @@ void arm_register_pre_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,void arm_register_el_change_hook (ARMCPU *cpu,ARMELChangeHookFn *hook,void *opaque); +/** +* arm_rebuild_hflags: +* Rebuild the cached TBFLAGS for arbitrary changed processor state. +*/ +void arm_rebuild_hflags (CPUARMState *env); +/** * aa32_vfp_dreg: * Return a pointer to the Dn register within env in 32-bit mode.
target/arm/helper.c +22 -8
@@ -11198,17 +11198,35 @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,return rebuild_hflags_common (env, fp_el, mmu_idx, flags); } +static uint32_t rebuild_hflags_internal (CPUARMState *env) +{ +int el =arm_current_el (env); +int fp_el =fp_exception_el (env, el); +ARMMMUIdx mmu_idx =arm_mmu_idx (env); + +if (is_a64 (env)) { +return rebuild_hflags_a64 (env, el, fp_el, mmu_idx); + }else if (arm_feature (env,ARM_FEATURE_M )) { +return rebuild_hflags_m32 (env, fp_el, mmu_idx); + }else { +return rebuild_hflags_a32 (env, fp_el, mmu_idx); + } +} + +void arm_rebuild_hflags (CPUARMState *env) +{ + env->hflags =rebuild_hflags_internal (env); +} +void cpu_get_tb_cpu_state (CPUARMState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) { -ARMMMUIdx mmu_idx =arm_mmu_idx (env); -int current_el =arm_current_el (env); -int fp_el =fp_exception_el (env, current_el);uint32_t flags, pstate_for_ss; + flags =rebuild_hflags_internal (env); +if (is_a64 (env)) { *pc = env->pc; - flags =rebuild_hflags_a64 (env, current_el, fp_el, mmu_idx);if (cpu_isar_feature (aa64_bti,env_archcpu (env))) { flags =FIELD_DP32 (flags,TBFLAG_A64 ,BTYPE , env->btype); }
@@ -11217,8 +11235,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, *pc = env->regs[15 ];if (arm_feature (env,ARM_FEATURE_M )) { - flags =rebuild_hflags_m32 (env, fp_el, mmu_idx); -if (arm_feature (env,ARM_FEATURE_M_SECURITY ) &&FIELD_EX32 (env->v7m.fpccr[M_REG_S ],V7M_FPCCR ,S ) != env->v7m.secure) {
@@ -11242,8 +11258,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags =FIELD_DP32 (flags,TBFLAG_A32 ,LSPACT ,1 ); } }else { - flags =rebuild_hflags_a32 (env, fp_el, mmu_idx); -/* * Note that XSCALE_CPAR shares bits with VECSTRIDE. * Note that VECLEN+VECSTRIDE are RES0 for M-profile.
Signature · 1 line
2.20.1
[PULL 34/51] hw/watchdog/milkymist-sysctl.c: Switch to transaction-based ptimer API
In reply to Peter MaydellSwitch the milkymist-sysctl code away from bottom-half based ptimers to the new transaction-based ptimer API. This just requires adding begin/commit calls around the various places that modify the ptimer state, and using the new ptimer_init() function to create the timer.
Message-id: [email protected]
--- hw/timer/milkymist-sysctl.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
hw/timer/milkymist-sysctl.c +18 -7
@@ -31,7 +31,6 @@#include "hw/ptimer.h" #include "hw/qdev-properties.h" #include "qemu/error-report.h" -#include "qemu/main-loop.h" #include "qemu/module.h" enum {
@@ -71,8 +70,6 @@ struct MilkymistSysctlState {MemoryRegion regs_region; -QEMUBH *bh0; -QEMUBH *bh1;ptimer_state *ptimer0;ptimer_state *ptimer1;
@@ -161,14 +158,19 @@ static void sysctl_write(void *opaque, hwaddr addr, uint64_t value, s->regs[addr] = value;break ;case R_TIMER0_COMPARE : +ptimer_transaction_begin (s->ptimer0);ptimer_set_limit (s->ptimer0, value,0 ); s->regs[addr] = value; +ptimer_transaction_commit (s->ptimer0);break ;case R_TIMER1_COMPARE : +ptimer_transaction_begin (s->ptimer1);ptimer_set_limit (s->ptimer1, value,0 ); s->regs[addr] = value; +ptimer_transaction_commit (s->ptimer1);break ;case R_TIMER0_CONTROL : +ptimer_transaction_begin (s->ptimer0); s->regs[addr] = value;if (s->regs[R_TIMER0_CONTROL ] &CTRL_ENABLE ) {trace_milkymist_sysctl_start_timer0 ();
@@ -179,8 +181,10 @@ static void sysctl_write(void *opaque, hwaddr addr, uint64_t value,trace_milkymist_sysctl_stop_timer0 ();ptimer_stop (s->ptimer0); } +ptimer_transaction_commit (s->ptimer0);break ;case R_TIMER1_CONTROL : +ptimer_transaction_begin (s->ptimer1); s->regs[addr] = value;if (s->regs[R_TIMER1_CONTROL ] &CTRL_ENABLE ) {trace_milkymist_sysctl_start_timer1 ();
@@ -191,6 +195,7 @@ static void sysctl_write(void *opaque, hwaddr addr, uint64_t value,trace_milkymist_sysctl_stop_timer1 ();ptimer_stop (s->ptimer1); } +ptimer_transaction_commit (s->ptimer1);break ;case R_ICAP :sysctl_icap_write (s, value);
@@ -263,8 +268,12 @@ static void milkymist_sysctl_reset(DeviceState *d) s->regs[i] =0 ; } +ptimer_transaction_begin (s->ptimer0);ptimer_stop (s->ptimer0); +ptimer_transaction_commit (s->ptimer0); +ptimer_transaction_begin (s->ptimer1);ptimer_stop (s->ptimer1); +ptimer_transaction_commit (s->ptimer1);/* defaults */ s->regs[R_ICAP ] =ICAP_READY ;
@@ -292,13 +301,15 @@ static void milkymist_sysctl_realize(DeviceState *dev, Error **errp) {MilkymistSysctlState *s =MILKYMIST_SYSCTL (dev); - s->bh0 =qemu_bh_new (timer0_hit, s); - s->bh1 =qemu_bh_new (timer1_hit, s); - s->ptimer0 =ptimer_init_with_bh (s->bh0,PTIMER_POLICY_DEFAULT ); - s->ptimer1 =ptimer_init_with_bh (s->bh1,PTIMER_POLICY_DEFAULT ); + s->ptimer0 =ptimer_init (timer0_hit, s,PTIMER_POLICY_DEFAULT ); + s->ptimer1 =ptimer_init (timer1_hit, s,PTIMER_POLICY_DEFAULT ); +ptimer_transaction_begin (s->ptimer0);ptimer_set_freq (s->ptimer0, s->freq_hz); +ptimer_transaction_commit (s->ptimer0); +ptimer_transaction_begin (s->ptimer1);ptimer_set_freq (s->ptimer1, s->freq_hz); +ptimer_transaction_commit (s->ptimer1); }static const VMStateDescription vmstate_milkymist_sysctl = {
Signature · 1 line
2.20.1
[PULL 33/51] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API
In reply to Peter MaydellSwitch the mcf5206 code away from bottom-half based ptimers to the new transaction-based ptimer API. This just requires adding begin/commit calls around the various places that modify the ptimer state, and using the new ptimer_init() function to create the timer.
Message-id: [email protected]
--- hw/m68k/mcf5206.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
hw/m68k/mcf5206.c +9 -6
@@ -8,7 +8,6 @@#include "qemu/osdep.h" #include "qemu/error-report.h" -#include "qemu/main-loop.h" #include "cpu.h" #include "hw/hw.h" #include "hw/irq.h"
@@ -57,10 +56,12 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)int prescale;int mode; +ptimer_transaction_begin (s->timer);ptimer_stop (s->timer); -if ((s->tmr &TMR_RST ) ==0 ) -return ; +if ((s->tmr &TMR_RST ) ==0 ) { + goto exit; + } prescale = (s->tmr >>8 ) +1 ; mode = (s->tmr >>1 ) &3 ;
@@ -78,6 +79,8 @@ static void m5206_timer_recalibrate(m5206_timer_state *s)ptimer_set_limit (s->timer, s->trr,0 );ptimer_run (s->timer,0 ); +exit: +ptimer_transaction_commit (s->timer); }static void m5206_timer_trigger (void *opaque)
@@ -123,7 +126,9 @@ static void m5206_timer_write(m5206_timer_state *s, uint32_t addr, uint32_t val) s->tcr = val;break ;case 0xc : +ptimer_transaction_begin (s->timer);ptimer_set_count (s->timer, val); +ptimer_transaction_commit (s->timer);break ;case 0x11 : s->ter &= ~val;
@@ -137,11 +142,9 @@ static void m5206_timer_write(m5206_timer_state *s, uint32_t addr, uint32_t val)static m5206_timer_state *m5206_timer_init (qemu_irq irq) {m5206_timer_state *s; -QEMUBH *bh; s =g_new0 (m5206_timer_state,1 ); - bh =qemu_bh_new (m5206_timer_trigger, s); - s->timer =ptimer_init_with_bh (bh,PTIMER_POLICY_DEFAULT ); + s->timer =ptimer_init (m5206_timer_trigger, s,PTIMER_POLICY_DEFAULT ); s->irq = irq;m5206_timer_reset (s);return s;
Signature · 1 line
2.20.1
[PULL 39/51] target/arm/kvm64: Add kvm_arch_get/put_sve
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
These are the SVE equivalents to kvm_arch_get/put_fpsimd. Note, the swabbing is different than it is for fpsmid because the vector format is a little-endian stream of words.
Message-id: [email protected]
--- target/arm/kvm64.c | 185 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 156 insertions(+), 29 deletions(-)
target/arm/kvm64.c +156 -29
@@ -671,11 +671,12 @@ int kvm_arch_destroy_vcpu(CPUState *cs)bool kvm_arm_reg_syncs_via_cpreg_list (uint64_t regidx) {/* Return true if the regidx is a register we should synchronize -* via the cpreg_tuples array (ie is not a core reg we sync by -* hand in kvm_arch_get/put_registers()) +* via the cpreg_tuples array (ie is not a core or sve reg that +* we sync by hand in kvm_arch_get/put_registers()) */ switch (regidx &KVM_REG_ARM_COPROC_MASK ) {case KVM_REG_ARM_CORE : +case KVM_REG_ARM64_SVE :return false;default :return true;
@@ -721,10 +722,8 @@ int kvm_arm_cpreg_level(uint64_t regidx)static int kvm_arch_put_fpsimd (CPUState *cs) { -ARMCPU *cpu =ARM_CPU (cs); -CPUARMState *env = &cpu->env; +CPUARMState *env = &ARM_CPU (cs)->env;struct kvm_one_reg reg; -uint32_t fpr;int i, ret;for (i =0 ; i <32 ; i++) {
@@ -742,17 +741,73 @@ static int kvm_arch_put_fpsimd(CPUState *cs) } } - reg.addr = (uintptr_t )(&fpr); - fpr =vfp_get_fpsr (env); - reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpsr); - ret =kvm_vcpu_ioctl (cs,KVM_SET_ONE_REG , ®); -if (ret) { -return ret; +return 0 ; +} + +/* +* SVE registers are encoded in KVM's memory in an endianness-invariant format. +* The byte at offset i from the start of the in-memory representation contains +* the bits [(7 + 8 * i) : (8 * i)] of the register value. As this means the +* lowest offsets are stored in the lowest memory addresses, then that nearly +* matches QEMU's representation, which is to use an array of host-endian +* uint64_t's, where the lower offsets are at the lower indices. To complete +* the translation we just need to byte swap the uint64_t's on big-endian hosts. +*/ +static uint64_t *sve_bswap64 (uint64_t *dst,uint64_t *src,int nr) +{ +#ifdef HOST_WORDS_BIGENDIAN +int i; + +for (i =0 ; i < nr; ++i) { + dst[i] =bswap64 (src[i]); } - reg.addr = (uintptr_t )(&fpr); - fpr =vfp_get_fpcr (env); - reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpcr); +return dst; +#else +return src; +#endif +} + +/* +* KVM SVE registers come in slices where ZREGs have a slice size of 2048 bits +* and PREGS and the FFR have a slice size of 256 bits. However we simply hard +* code the slice index to zero for now as it's unlikely we'll need more than +* one slice for quite some time. +*/ +static int kvm_arch_put_sve (CPUState *cs) +{ +ARMCPU *cpu =ARM_CPU (cs); +CPUARMState *env = &cpu->env; +uint64_t tmp[ARM_MAX_VQ *2 ]; +uint64_t *r; +struct kvm_one_reg reg; +int n, ret; + +for (n =0 ; n <KVM_ARM64_SVE_NUM_ZREGS ; ++n) { + r =sve_bswap64 (tmp, &env->vfp.zregs[n].d[0 ], cpu->sve_max_vq *2 ); + reg.addr = (uintptr_t )r; + reg.id =KVM_REG_ARM64_SVE_ZREG (n,0 ); + ret =kvm_vcpu_ioctl (cs,KVM_SET_ONE_REG , ®); +if (ret) { +return ret; + } + } + +for (n =0 ; n <KVM_ARM64_SVE_NUM_PREGS ; ++n) { + r =sve_bswap64 (tmp, r = &env->vfp.pregs[n].p[0 ], +DIV_ROUND_UP (cpu->sve_max_vq *2 ,8 )); + reg.addr = (uintptr_t )r; + reg.id =KVM_REG_ARM64_SVE_PREG (n,0 ); + ret =kvm_vcpu_ioctl (cs,KVM_SET_ONE_REG , ®); +if (ret) { +return ret; + } + } + + r =sve_bswap64 (tmp, &env->vfp.pregs[FFR_PRED_NUM ].p[0 ], +DIV_ROUND_UP (cpu->sve_max_vq *2 ,8 )); + reg.addr = (uintptr_t )r; + reg.id =KVM_REG_ARM64_SVE_FFR (0 ); ret =kvm_vcpu_ioctl (cs,KVM_SET_ONE_REG , ®);if (ret) {return ret;
@@ -765,6 +820,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) {struct kvm_one_reg reg;uint64_t val; +uint32_t fpr;int i, ret;unsigned int el;
@@ -855,7 +911,27 @@ int kvm_arch_put_registers(CPUState *cs, int level) } } - ret =kvm_arch_put_fpsimd (cs); +if (cpu_isar_feature (aa64_sve, cpu)) { + ret =kvm_arch_put_sve (cs); + }else { + ret =kvm_arch_put_fpsimd (cs); + } +if (ret) { +return ret; + } + + reg.addr = (uintptr_t )(&fpr); + fpr =vfp_get_fpsr (env); + reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpsr); + ret =kvm_vcpu_ioctl (cs,KVM_SET_ONE_REG , ®); +if (ret) { +return ret; + } + + reg.addr = (uintptr_t )(&fpr); + fpr =vfp_get_fpcr (env); + reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpcr); + ret =kvm_vcpu_ioctl (cs,KVM_SET_ONE_REG , ®);if (ret) {return ret; }
@@ -878,10 +954,8 @@ int kvm_arch_put_registers(CPUState *cs, int level)static int kvm_arch_get_fpsimd (CPUState *cs) { -ARMCPU *cpu =ARM_CPU (cs); -CPUARMState *env = &cpu->env; +CPUARMState *env = &ARM_CPU (cs)->env;struct kvm_one_reg reg; -uint32_t fpr;int i, ret;for (i =0 ; i <32 ; i++) {
@@ -899,21 +973,53 @@ static int kvm_arch_get_fpsimd(CPUState *cs) } } - reg.addr = (uintptr_t )(&fpr); - reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpsr); - ret =kvm_vcpu_ioctl (cs,KVM_GET_ONE_REG , ®); -if (ret) { -return ret; - } -vfp_set_fpsr (env, fpr); +return 0 ; +} - reg.addr = (uintptr_t )(&fpr); - reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpcr); +/* +* KVM SVE registers come in slices where ZREGs have a slice size of 2048 bits +* and PREGS and the FFR have a slice size of 256 bits. However we simply hard +* code the slice index to zero for now as it's unlikely we'll need more than +* one slice for quite some time. +*/ +static int kvm_arch_get_sve (CPUState *cs) +{ +ARMCPU *cpu =ARM_CPU (cs); +CPUARMState *env = &cpu->env; +struct kvm_one_reg reg; +uint64_t *r; +int n, ret; + +for (n =0 ; n <KVM_ARM64_SVE_NUM_ZREGS ; ++n) { + r = &env->vfp.zregs[n].d[0 ]; + reg.addr = (uintptr_t )r; + reg.id =KVM_REG_ARM64_SVE_ZREG (n,0 ); + ret =kvm_vcpu_ioctl (cs,KVM_GET_ONE_REG , ®); +if (ret) { +return ret; + } +sve_bswap64 (r, r, cpu->sve_max_vq *2 ); + } + +for (n =0 ; n <KVM_ARM64_SVE_NUM_PREGS ; ++n) { + r = &env->vfp.pregs[n].p[0 ]; + reg.addr = (uintptr_t )r; + reg.id =KVM_REG_ARM64_SVE_PREG (n,0 ); + ret =kvm_vcpu_ioctl (cs,KVM_GET_ONE_REG , ®); +if (ret) { +return ret; + } +sve_bswap64 (r, r,DIV_ROUND_UP (cpu->sve_max_vq *2 ,8 )); + } + + r = &env->vfp.pregs[FFR_PRED_NUM ].p[0 ]; + reg.addr = (uintptr_t )r; + reg.id =KVM_REG_ARM64_SVE_FFR (0 ); ret =kvm_vcpu_ioctl (cs,KVM_GET_ONE_REG , ®);if (ret) {return ret; } -vfp_set_fpcr (env, fpr); +sve_bswap64 (r, r,DIV_ROUND_UP (cpu->sve_max_vq *2 ,8 ));return 0 ; }
@@ -923,6 +1029,7 @@ int kvm_arch_get_registers(CPUState *cs)struct kvm_one_reg reg;uint64_t val;unsigned int el; +uint32_t fpr;int i, ret;ARMCPU *cpu =ARM_CPU (cs);
@@ -1012,11 +1119,31 @@ int kvm_arch_get_registers(CPUState *cs) env->spsr = env->banked_spsr[i]; } - ret =kvm_arch_get_fpsimd (cs); +if (cpu_isar_feature (aa64_sve, cpu)) { + ret =kvm_arch_get_sve (cs); + }else { + ret =kvm_arch_get_fpsimd (cs); + }if (ret) {return ret; } + reg.addr = (uintptr_t )(&fpr); + reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpsr); + ret =kvm_vcpu_ioctl (cs,KVM_GET_ONE_REG , ®); +if (ret) { +return ret; + } +vfp_set_fpsr (env, fpr); + + reg.addr = (uintptr_t )(&fpr); + reg.id =AARCH64_SIMD_CTRL_REG (fp_regs.fpcr); + ret =kvm_vcpu_ioctl (cs,KVM_GET_ONE_REG , ®); +if (ret) { +return ret; + } +vfp_set_fpcr (env, fpr); + ret =kvm_get_vcpu_events (cpu);if (ret) {return ret;
Signature · 1 line
2.20.1
[PULL 25/51] linux-user/arm: Rebuild hflags for TARGET_WORDS_BIGENDIAN
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Continue setting, but not relying upon, env->hflags.
Message-id: [email protected]
--- linux-user/arm/cpu_loop.c | 1 + 1 file changed, 1 insertion(+)
linux-user/arm/cpu_loop.c +1 -0
@@ -440,6 +440,7 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) } else { env->cp15.sctlr_el[1 ] |=SCTLR_B ; } +arm_rebuild_hflags (env);#endif ts->stack_base = info->start_stack;
Signature · 1 line
2.20.1
[PULL 37/51] target/arm: Allow SVE to be disabled via a CPU property
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Since 97a28b0eeac14 ("target/arm: Allow VFP and Neon to be disabled via a CPU property") we can disable the 'max' cpu model's VFP and neon features, but there's no way to disable SVE. Add the 'sve=on|off' property to give it that flexibility. We also rename cpu_max_get/set_sve_vq to cpu_max_get/set_sve_max_vq in order for them to follow the typical *_get/set_<property-name> pattern.
Message-id: [email protected]
--- target/arm/cpu.c | 3 ++- target/arm/cpu64.c | 52 ++++++++++++++++++++++++++++++++++------ target/arm/monitor.c | 2 +- tests/arm-cpu-features.c | 1 + 4 files changed, 49 insertions(+), 9 deletions(-)
target/arm/cpu.c +2 -1
@@ -200,7 +200,8 @@ static void arm_cpu_reset(CPUState *s) env->cp15.cpacr_el1 =deposit64 (env->cp15.cpacr_el1,16 ,2 ,3 ); env->cp15.cptr_el[3 ] |=CPTR_EZ ;/* with maximum vector length */ - env->vfp.zcr_el[1 ] = cpu->sve_max_vq -1 ; + env->vfp.zcr_el[1 ] =cpu_isar_feature (aa64_sve, cpu) ? + cpu->sve_max_vq -1 :0 ; env->vfp.zcr_el[2 ] = env->vfp.zcr_el[1 ]; env->vfp.zcr_el[3 ] = env->vfp.zcr_el[1 ];/*
target/arm/cpu64.c +45 -7
74 lines not on this page · raw message
target/arm/monitor.c +1 -1
@@ -97,7 +97,7 @@ GICCapabilityList *qmp_query_gic_capabilities(Error **errp)* then the order that considers those dependencies must be used. */ static const char *cpu_model_advertised_features[] = { -"aarch64" ,"pmu" , +"aarch64" ,"pmu" ,"sve" ,NULL };
tests/arm-cpu-features.c +1 -0
@@ -179,6 +179,7 @@ static void test_query_cpu_model_expansion(const void *data)if (g_str_equal (qtest_get_arch (),"aarch64" )) {assert_has_feature (qts,"max" ,"aarch64" ); +assert_has_feature (qts,"max" ,"sve" );assert_has_feature (qts,"cortex-a57" ,"pmu" );assert_has_feature (qts,"cortex-a57" ,"aarch64" );
Signature · 1 line
2.20.1
[PULL 35/51] target/arm/monitor: Introduce qmp_query_cpu_model_expansion
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Add support for the query-cpu-model-expansion QMP command to Arm. We do this selectively, only exposing CPU properties which represent optional CPU features which the user may want to enable/disable. Additionally we restrict the list of queryable cpu models to 'max', 'host', or the current type when KVM is in use. And, finally, we only implement expansion type 'full', as Arm does not yet have a "base" CPU type. More details and example queries are described in a new document (docs/arm-cpu-features.rst).
Note, certainly more features may be added to the list of advertised features, e.g. 'vfp' and 'neon'. The only requirement is that we can detect invalid configurations and emit failures at QMP query time. For 'vfp' and 'neon' this will require some refactoring to share a validation function between the QMP query and the CPU realize functions.
Message-id: [email protected]
--- qapi/machine-target.json | 6 +- target/arm/monitor.c | 146 ++++++++++++++++++++++++++++++++++++++ docs/arm-cpu-features.rst | 137 +++++++++++++++++++++++++++++++++++ 3 files changed, 286 insertions(+), 3 deletions(-) create mode 100644 docs/arm-cpu-features.rst
qapi/machine-target.json +3 -3
@@ -212,7 +212,7 @@ ## { 'struct': 'CpuModelExpansionInfo', 'data': { 'model': 'CpuModelInfo' }, - 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' } + 'if': 'defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM)' } ## # @query-cpu-model-expansion:
@@ -237,7 +237,7 @@ # query-cpu-model-expansion while using these is not advised. # # Some architectures may not support all expansion types. s390x supports -# "full" and "static". +# "full" and "static". Arm only supports "full". # # Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU models is # not supported, if the model cannot be expanded, if the model contains
@@ -251,7 +251,7 @@ 'data': { 'type': 'CpuModelExpansionType', 'model': 'CpuModelInfo' }, 'returns': 'CpuModelExpansionInfo', - 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' } + 'if': 'defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM)' } ## # @CpuDefinitionInfo:
target/arm/monitor.c +146 -0
157 lines not on this page · raw message
docs/arm-cpu-features.rst new file +137 -0
137 lines not on this page · raw message
Signature · 1 line
2.20.1
[PULL 45/51] hw/arm/bcm2835_peripherals: Use the thermal sensor block
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Map the thermal sensor in the BCM2835 block.
Message-id: [email protected]
--- include/hw/arm/bcm2835_peripherals.h | 2 ++ include/hw/arm/raspi_platform.h | 1 + hw/arm/bcm2835_peripherals.c | 13 +++++++++++++ 3 files changed, 16 insertions(+)
include/hw/arm/bcm2835_peripherals.h +2 -0
@@ -20,6 +20,7 @@#include "hw/misc/bcm2835_property.h" #include "hw/misc/bcm2835_rng.h" #include "hw/misc/bcm2835_mbox.h" +#include "hw/misc/bcm2835_thermal.h" #include "hw/sd/sdhci.h" #include "hw/sd/bcm2835_sdhost.h" #include "hw/gpio/bcm2835_gpio.h"
@@ -53,6 +54,7 @@ typedef struct BCM2835PeripheralState {SDHCIState sdhci;BCM2835SDHostState sdhost;BCM2835GpioState gpio; +Bcm2835ThermalState thermal;UnimplementedDeviceState i2s;UnimplementedDeviceState spi[1 ];UnimplementedDeviceState i2c[3 ];
include/hw/arm/raspi_platform.h +1 -0
@@ -48,6 +48,7 @@#define SPI0_OFFSET 0x204000#define BSC0_OFFSET 0x205000/* BSC0 I2C/TWI */ #define OTP_OFFSET 0x20f000 +#define THERMAL_OFFSET 0x212000#define BSC_SL_OFFSET 0x214000/* SPI slave */ #define AUX_OFFSET 0x215000/* AUX: UART1/SPI1/SPI2 */ #define EMMC1_OFFSET 0x300000
hw/arm/bcm2835_peripherals.c +13 -0
@@ -111,6 +111,10 @@ static void bcm2835_peripherals_init(Object *obj)object_property_add_const_link (OBJECT (&s->dma),"dma-mr" ,OBJECT (&s->gpu_bus_mr), &error_abort); +/* Thermal */ +sysbus_init_child_obj (obj,"thermal" , &s->thermal,sizeof (s->thermal), +TYPE_BCM2835_THERMAL ); +/* GPIO */ sysbus_init_child_obj (obj,"gpio" , &s->gpio,sizeof (s->gpio),TYPE_BCM2835_GPIO );
@@ -321,6 +325,15 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) INTERRUPT_DMA0 + n)); } +/* THERMAL */ +object_property_set_bool (OBJECT (&s->thermal), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +memory_region_add_subregion (&s->peri_mr,THERMAL_OFFSET , +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->thermal),0 )); +/* GPIO */ object_property_set_bool (OBJECT (&s->gpio), true,"realized" , &err);if (err) {
Signature · 1 line
2.20.1
[PULL 28/51] hw/timer/xilinx_timer.c: Switch to transaction-based ptimer API
In reply to Peter MaydellSwitch the xilinx_timer code away from bottom-half based ptimers to the new transaction-based ptimer API. This just requires adding begin/commit calls around the various places that modify the ptimer state, and using the new ptimer_init() function to create the timer.
Message-id: [email protected]
--- hw/timer/xilinx_timer.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
hw/timer/xilinx_timer.c +8 -5
@@ -28,7 +28,6 @@#include "hw/ptimer.h" #include "hw/qdev-properties.h" #include "qemu/log.h" -#include "qemu/main-loop.h" #include "qemu/module.h" #define D (x)
@@ -52,7 +51,6 @@struct xlx_timer { -QEMUBH *bh;ptimer_state *ptimer;void *parent;int nr;/* for debug. */
@@ -134,6 +132,7 @@ timer_read(void *opaque, hwaddr addr, unsigned int size)return r; } +/* Must be called inside ptimer transaction block */ static void timer_enable (struct xlx_timer *xt) {uint64_t count;
@@ -174,8 +173,11 @@ timer_write(void *opaque, hwaddr addr, value &= ~TCSR_TINT ; xt->regs[addr] = value &0x7ff ; -if (value &TCSR_ENT ) +if (value &TCSR_ENT ) { +ptimer_transaction_begin (xt->ptimer);timer_enable (xt); +ptimer_transaction_commit (xt->ptimer); + }break ;default :
@@ -220,9 +222,10 @@ static void xilinx_timer_realize(DeviceState *dev, Error **errp) xt->parent = t; xt->nr = i; - xt->bh =qemu_bh_new (timer_hit, xt); - xt->ptimer =ptimer_init_with_bh (xt->bh,PTIMER_POLICY_DEFAULT ); + xt->ptimer =ptimer_init (timer_hit, xt,PTIMER_POLICY_DEFAULT ); +ptimer_transaction_begin (xt->ptimer);ptimer_set_freq (xt->ptimer, t->freq_hz); +ptimer_transaction_commit (xt->ptimer); } memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, "xlnx.xps-timer",
Signature · 1 line
2.20.1
[PULL 40/51] target/arm/kvm64: max cpu: Enable SVE when available
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Enable SVE in the KVM guest when the 'max' cpu type is configured and KVM supports it. KVM SVE requires use of the new finalize vcpu ioctl, so we add that now too. For starters SVE can only be turned on or off, getting all vector lengths the host CPU supports when on. We'll add the other SVE CPU properties in later patches.
Message-id: [email protected]
--- target/arm/kvm_arm.h | 27 +++++++++++++++++++++++++++ target/arm/cpu64.c | 17 ++++++++++++++--- target/arm/kvm.c | 5 +++++ target/arm/kvm64.c | 20 +++++++++++++++++++- tests/arm-cpu-features.c | 4 ++++ 5 files changed, 69 insertions(+), 4 deletions(-)
target/arm/kvm_arm.h +27 -0
@@ -27,6 +27,20 @@*/ int kvm_arm_vcpu_init (CPUState *cs); +/** +* kvm_arm_vcpu_finalize +* @cs: CPUState +* @feature: int +* +* Finalizes the configuration of the specified VCPU feature by +* invoking the KVM_ARM_VCPU_FINALIZE ioctl. Features requiring +* this are documented in the "KVM_ARM_VCPU_FINALIZE" section of +* KVM's API documentation. +* +* Returns: 0 if success else < 0 error code +*/ +int kvm_arm_vcpu_finalize (CPUState *cs,int feature); +/** * kvm_arm_register_device: * @mr: memory region for this device
@@ -225,6 +239,14 @@ bool kvm_arm_aarch32_supported(CPUState *cs);*/ bool kvm_arm_pmu_supported (CPUState *cs); +/** +* bool kvm_arm_sve_supported: +* @cs: CPUState +* +* Returns true if the KVM VCPU can enable SVE and false otherwise. +*/ +bool kvm_arm_sve_supported (CPUState *cs); +/** * kvm_arm_get_max_vm_ipa_size - Returns the number of bits in the * IPA address space supported by KVM
@@ -276,6 +298,11 @@ static inline bool kvm_arm_pmu_supported(CPUState *cs)return false; } +static inline bool kvm_arm_sve_supported (CPUState *cs) +{ +return false; +} +static inline int kvm_arm_get_max_vm_ipa_size (MachineState *ms) {return -ENOENT ;
target/arm/cpu64.c +14 -3
@@ -493,6 +493,11 @@ static void cpu_arm_set_sve(Object *obj, Visitor *v, const char *name,return ; } +if (value &&kvm_enabled () && !kvm_arm_sve_supported (CPU (cpu))) { +error_setg (errp,"'sve' feature not supported by KVM on this host" ); +return ; + } + t = cpu->isar.id_aa64pfr0; t =FIELD_DP64 (t,ID_AA64PFR0 ,SVE , value); cpu->isar.id_aa64pfr0 = t;
@@ -507,11 +512,16 @@ static void aarch64_max_initfn(Object *obj) {ARMCPU *cpu =ARM_CPU (obj);uint32_t vq; +uint64_t t;if (kvm_enabled ()) {kvm_arm_set_cpu_features_from_host (cpu); +if (kvm_arm_sve_supported (CPU (cpu))) { + t = cpu->isar.id_aa64pfr0; + t =FIELD_DP64 (t,ID_AA64PFR0 ,SVE ,1 ); + cpu->isar.id_aa64pfr0 = t; + } }else { -uint64_t t;uint32_t u;aarch64_a57_initfn (obj);
@@ -612,8 +622,6 @@ static void aarch64_max_initfn(Object *obj)object_property_add (obj,"sve-max-vq" ,"uint32" , cpu_max_get_sve_max_vq, cpu_max_set_sve_max_vq,NULL ,NULL , &error_fatal); -object_property_add (obj,"sve" ,"bool" , cpu_arm_get_sve, - cpu_arm_set_sve,NULL ,NULL , &error_fatal);for (vq =1 ; vq <=ARM_MAX_VQ ; ++vq) {char name[8 ];
@@ -622,6 +630,9 @@ static void aarch64_max_initfn(Object *obj) cpu_arm_set_sve_vq, NULL, NULL, &error_fatal); } } + +object_property_add (obj,"sve" ,"bool" , cpu_arm_get_sve, + cpu_arm_set_sve,NULL ,NULL , &error_fatal); }struct ARMCPUInfo {
target/arm/kvm.c +5 -0
@@ -51,6 +51,11 @@ int kvm_arm_vcpu_init(CPUState *cs)return kvm_vcpu_ioctl (cs,KVM_ARM_VCPU_INIT , &init); } +int kvm_arm_vcpu_finalize (CPUState *cs,int feature) +{ +return kvm_vcpu_ioctl (cs,KVM_ARM_VCPU_FINALIZE , &feature); +} +void kvm_arm_init_serror_injection (CPUState *cs) { cap_has_inject_serror_esr = kvm_check_extension(cs->kvm_state,
target/arm/kvm64.c +19 -1
@@ -602,6 +602,13 @@ bool kvm_arm_aarch32_supported(CPUState *cpu)return kvm_check_extension (s,KVM_CAP_ARM_EL1_32BIT ); } +bool kvm_arm_sve_supported (CPUState *cpu) +{ +KVMState *s =KVM_STATE (current_machine->accelerator); + +return kvm_check_extension (s,KVM_CAP_ARM_SVE ); +} +#define ARM_CPU_ID_MPIDR 3, 0, 0, 0, 5int kvm_arch_init_vcpu (CPUState *cs)
@@ -630,13 +637,17 @@ int kvm_arch_init_vcpu(CPUState *cs) cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_EL1_32BIT ; }if (!kvm_check_extension (cs->kvm_state,KVM_CAP_ARM_PMU_V3 )) { - cpu->has_pmu = false; + cpu->has_pmu = false; }if (cpu->has_pmu) { cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_PMU_V3 ; }else {unset_feature (&env->features,ARM_FEATURE_PMU ); } +if (cpu_isar_feature (aa64_sve, cpu)) { +assert (kvm_arm_sve_supported (cs)); + cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_SVE ; + }/* Do KVM_ARM_VCPU_INIT ioctl */ ret =kvm_arm_vcpu_init (cs);
@@ -644,6 +655,13 @@ int kvm_arch_init_vcpu(CPUState *cs)return ret; } +if (cpu_isar_feature (aa64_sve, cpu)) { + ret =kvm_arm_vcpu_finalize (cs,KVM_ARM_VCPU_SVE ); +if (ret) { +return ret; + } + } +/* * When KVM is in use, PSCI is emulated in-kernel and not by qemu. * Currently KVM has its own idea about MPIDR assignment, so we
tests/arm-cpu-features.c +4 -0
@@ -391,12 +391,16 @@ static void test_query_cpu_model_expansion_kvm(const void *data)assert_has_feature (qts,"host" ,"aarch64" );assert_has_feature (qts,"host" ,"pmu" ); +assert_has_feature (qts,"max" ,"sve" ); +assert_error (qts,"cortex-a15" ,"We cannot guarantee the CPU type 'cortex-a15' works " "with KVM on this host" ,NULL ); }else {assert_has_not_feature (qts,"host" ,"aarch64" );assert_has_not_feature (qts,"host" ,"pmu" ); + +assert_has_not_feature (qts,"max" ,"sve" ); }qtest_quit (qts);
Signature · 1 line
2.20.1
[PULL 43/51] target/arm/kvm: host cpu: Add support for sve<N> properties
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Allow cpu 'host' to enable SVE when it's available, unless the user chooses to disable it with the added 'sve=off' cpu property. Also give the user the ability to select vector lengths with the sve<N> properties. We don't adopt 'max' cpu's other sve property, sve-max-vq, because that property is difficult to use with KVM. That property assumes all vector lengths in the range from 1 up to and including the specified maximum length are supported, but there may be optional lengths not supported by the host in that range. With KVM one must be more specific when enabling vector lengths.
Message-id: [email protected]
--- target/arm/cpu.h | 2 ++ target/arm/cpu.c | 3 +++ target/arm/cpu64.c | 33 +++++++++++++++++---------------- target/arm/kvm64.c | 14 +++++++++++++- tests/arm-cpu-features.c | 23 +++++++++++------------ docs/arm-cpu-features.rst | 19 ++++++++++++------- 6 files changed, 58 insertions(+), 36 deletions(-)
target/arm/cpu.h +2 -0
@@ -977,11 +977,13 @@ int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);void aarch64_sve_narrow_vq (CPUARMState *env,unsigned vq);void aarch64_sve_change_el (CPUARMState *env,int old_el,int new_el,bool el0_a64); +void aarch64_add_sve_properties (Object *obj);#else static inline void aarch64_sve_narrow_vq (CPUARMState *env,unsigned vq) { }static inline void aarch64_sve_change_el (CPUARMState *env,int o,int n,bool a) { } +static inline void aarch64_add_sve_properties (Object *obj) { }#endif #if !defined(CONFIG_TCG )
target/arm/cpu.c +3 -0
@@ -2670,6 +2670,9 @@ static void arm_host_initfn(Object *obj)ARMCPU *cpu =ARM_CPU (obj);kvm_arm_set_cpu_features_from_host (cpu); +if (arm_feature (&cpu->env,ARM_FEATURE_AARCH64 )) { +aarch64_add_sve_properties (obj); + }arm_cpu_post_init (obj); }
target/arm/cpu64.c +17 -16
@@ -594,6 +594,21 @@ static void cpu_arm_set_sve(Object *obj, Visitor *v, const char *name, cpu->isar.id_aa64pfr0 = t; } +void aarch64_add_sve_properties (Object *obj) +{ +uint32_t vq; + +object_property_add (obj,"sve" ,"bool" , cpu_arm_get_sve, + cpu_arm_set_sve,NULL ,NULL , &error_fatal); + +for (vq =1 ; vq <=ARM_MAX_VQ ; ++vq) { +char name[8 ]; +sprintf (name,"sve%d" , vq *128 ); +object_property_add (obj, name,"bool" , cpu_arm_get_sve_vq, + cpu_arm_set_sve_vq,NULL ,NULL , &error_fatal); + } +} +/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); * otherwise, a CPU with as many features enabled as our emulation supports. * The version of '-cpu max' for qemu-system-arm is defined in cpu.c;
@@ -602,17 +617,11 @@ static void cpu_arm_set_sve(Object *obj, Visitor *v, const char *name,static void aarch64_max_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj); -uint32_t vq; -uint64_t t;if (kvm_enabled ()) {kvm_arm_set_cpu_features_from_host (cpu); -if (kvm_arm_sve_supported (CPU (cpu))) { - t = cpu->isar.id_aa64pfr0; - t =FIELD_DP64 (t,ID_AA64PFR0 ,SVE ,1 ); - cpu->isar.id_aa64pfr0 = t; - } }else { +uint64_t t;uint32_t u;aarch64_a57_initfn (obj);
@@ -712,17 +721,9 @@ static void aarch64_max_initfn(Object *obj)#endif } -object_property_add (obj,"sve" ,"bool" , cpu_arm_get_sve, - cpu_arm_set_sve,NULL ,NULL , &error_fatal); +aarch64_add_sve_properties (obj);object_property_add (obj,"sve-max-vq" ,"uint32" , cpu_max_get_sve_max_vq, cpu_max_set_sve_max_vq,NULL ,NULL , &error_fatal); - -for (vq =1 ; vq <=ARM_MAX_VQ ; ++vq) { -char name[8 ]; -sprintf (name,"sve%d" , vq *128 ); -object_property_add (obj, name,"bool" , cpu_arm_get_sve_vq, - cpu_arm_set_sve_vq,NULL ,NULL , &error_fatal); - } }struct ARMCPUInfo {
target/arm/kvm64.c +13 -1
@@ -488,7 +488,9 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)* and then query that CPU for the relevant ID registers. */ int fdarray[3 ]; +bool sve_supported;uint64_t features =0 ; +uint64_t t;int err;/* Old kernels may not know about the PREFERRED_TARGET ioctl: however
@@ -578,13 +580,23 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) ARM64_SYS_REG(3, 0, 0, 3, 2)); } + sve_supported =ioctl (fdarray[0 ],KVM_CHECK_EXTENSION ,KVM_CAP_ARM_SVE ) >0 ; +kvm_arm_destroy_scratch_host_vcpu (fdarray);if (err <0 ) {return false; } -/* We can assume any KVM supporting CPU is at least a v8 +/* Add feature bits that can't appear until after VCPU init. */ +if (sve_supported) { + t = ahcf->isar.id_aa64pfr0; + t =FIELD_DP64 (t,ID_AA64PFR0 ,SVE ,1 ); + ahcf->isar.id_aa64pfr0 = t; + } + +/* +* We can assume any KVM supporting CPU is at least a v8 * with VFPv4+Neon; this in turn implies most of the other * feature bits. */
tests/arm-cpu-features.c +11 -12
@@ -356,7 +356,7 @@ static void sve_tests_sve_off_kvm(const void *data) {QTestState *qts; - qts =qtest_init (MACHINE "-accel kvm -cpu max,sve=off" ); + qts =qtest_init (MACHINE "-accel kvm -cpu host,sve=off" );/* * We don't know if this host supports SVE so we don't
@@ -365,8 +365,8 @@ static void sve_tests_sve_off_kvm(const void *data)* and that using sve<N>=off to explicitly disable vector * lengths is OK too. */ -assert_sve_vls (qts,"max" ,0 ,NULL ); -assert_sve_vls (qts,"max" ,0 ,"{ 'sve128': false }" ); +assert_sve_vls (qts,"host" ,0 ,NULL ); +assert_sve_vls (qts,"host" ,0 ,"{ 'sve128': false }" );qtest_quit (qts); }
@@ -432,8 +432,8 @@ static void test_query_cpu_model_expansion_kvm(const void *data)"We cannot guarantee the CPU type 'cortex-a15' works " "with KVM on this host", NULL); -assert_has_feature (qts,"max" ,"sve" ); - resp =do_query_no_props (qts,"max" ); +assert_has_feature (qts,"host" ,"sve" ); + resp =do_query_no_props (qts,"host" ); kvm_supports_sve =resp_get_feature (resp,"sve" ); vls =resp_get_sve_vls (resp);qobject_unref (resp);
@@ -444,7 +444,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)sprintf (max_name,"sve%d" , max_vq *128 );/* Enabling a supported length is of course fine. */ -assert_sve_vls (qts,"max" , vls,"{ %s: true }" , max_name); +assert_sve_vls (qts,"host" , vls,"{ %s: true }" , max_name);/* Get the next supported length smaller than max-vq. */ vq =64 -__builtin_clzll (vls & ~BIT_ULL (max_vq -1 ));
@@ -453,7 +453,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)* We have at least one length smaller than max-vq, * so we can disable max-vq. */ -assert_sve_vls (qts,"max" , (vls & ~BIT_ULL (max_vq -1 )), +assert_sve_vls (qts,"host" , (vls & ~BIT_ULL (max_vq -1 )),"{ %s: false }" , max_name);/*
@@ -463,7 +463,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)*/ sprintf (name,"sve%d" , vq *128 ); error =g_strdup_printf ("cannot disable %s" , name); -assert_error (qts,"max" , error, +assert_error (qts,"host" , error,"{ %s: true, %s: false }" , max_name, name);g_free (error);
@@ -476,7 +476,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data) vq =__builtin_ffsll (vls);sprintf (name,"sve%d" , vq *128 ); error =g_strdup_printf ("cannot disable %s" , name); -assert_error (qts,"max" , error,"{ %s: false }" , name); +assert_error (qts,"host" , error,"{ %s: false }" , name);g_free (error);/* Get an unsupported length. */
@@ -488,7 +488,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)if (vq <=SVE_MAX_VQ ) {sprintf (name,"sve%d" , vq *128 ); error =g_strdup_printf ("cannot enable %s" , name); -assert_error (qts,"max" , error,"{ %s: true }" , name); +assert_error (qts,"host" , error,"{ %s: true }" , name);g_free (error); } }else {
@@ -497,8 +497,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data) }else {assert_has_not_feature (qts,"host" ,"aarch64" );assert_has_not_feature (qts,"host" ,"pmu" ); - -assert_has_not_feature (qts,"max" ,"sve" ); +assert_has_not_feature (qts,"host" ,"sve" ); }qtest_quit (qts);
docs/arm-cpu-features.rst +12 -7
@@ -272,31 +272,36 @@ SVE CPU Property Examples $ qemu-system-aarch64 -M virt -cpu max - 3) Only enable the 128-bit vector length:: + 3) When KVM is enabled, implicitly enable all host CPU supported vector + lengths with the `host` CPU type:: + + $ qemu-system-aarch64 -M virt,accel=kvm -cpu host + + 4) Only enable the 128-bit vector length:: $ qemu-system-aarch64 -M virt -cpu max,sve128=on - 4) Disable the 512-bit vector length and all larger vector lengths, + 5) Disable the 512-bit vector length and all larger vector lengths, since 512 is a power-of-two. This results in all the smaller, uninitialized lengths (128, 256, and 384) defaulting to enabled:: $ qemu-system-aarch64 -M virt -cpu max,sve512=off - 5) Enable the 128-bit, 256-bit, and 512-bit vector lengths:: + 6) Enable the 128-bit, 256-bit, and 512-bit vector lengths:: $ qemu-system-aarch64 -M virt -cpu max,sve128=on,sve256=on,sve512=on - 6) The same as (5), but since the 128-bit and 256-bit vector + 7) The same as (6), but since the 128-bit and 256-bit vector lengths are required for the 512-bit vector length to be enabled, then allow them to be auto-enabled:: $ qemu-system-aarch64 -M virt -cpu max,sve512=on - 7) Do the same as (6), but by first disabling SVE and then re-enabling it:: + 8) Do the same as (7), but by first disabling SVE and then re-enabling it:: $ qemu-system-aarch64 -M virt -cpu max,sve=off,sve512=on,sve=on - 8) Force errors regarding the last vector length:: + 9) Force errors regarding the last vector length:: $ qemu-system-aarch64 -M virt -cpu max,sve128=off $ qemu-system-aarch64 -M virt -cpu max,sve=off,sve128=off,sve=on
@@ -308,5 +313,5 @@ The examples in "SVE CPU Property Examples" exhibit many ways to select vector lengths which developers may find useful in order to avoid overly verbose command lines. However, the recommended way to select vector lengths is to explicitly enable each desired length. Therefore only -example's (1), (3), and (5) exhibit recommended uses of the properties. +example's (1), (4), and (6) exhibit recommended uses of the properties.
Signature · 1 line
2.20.1
[PULL 30/51] hw/timer/slavio_timer: Remove useless check for NULL t->timer
In reply to Peter MaydellIn the slavio timer devcie, the ptimer TimerContext::timer is always created by slavio_timer_init(), so there's no need to check it for NULL; remove the single unneeded NULL check.
This will be useful to avoid compiler/Coverity errors when a subsequent change adds a use of t->timer before the location we currently do the NULL check.
Message-id: [email protected]
--- hw/timer/slavio_timer.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
hw/timer/slavio_timer.c +5 -7
@@ -227,13 +227,11 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr,// set limit, reset counter qemu_irq_lower (t->irq); t->limit = val &TIMER_MAX_COUNT32 ; -if (t->timer) { -if (t->limit ==0 ) {/* free-run */ -ptimer_set_limit (t->timer, -LIMIT_TO_PERIODS (TIMER_MAX_COUNT32 ),1 ); - }else { -ptimer_set_limit (t->timer,LIMIT_TO_PERIODS (t->limit),1 ); - } +if (t->limit ==0 ) {/* free-run */ +ptimer_set_limit (t->timer, +LIMIT_TO_PERIODS (TIMER_MAX_COUNT32 ),1 ); + }else { +ptimer_set_limit (t->timer,LIMIT_TO_PERIODS (t->limit),1 ); } }break ;
Signature · 1 line
2.20.1
[PULL 41/51] target/arm/kvm: scratch vcpu: Preserve input kvm_vcpu_init features
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
kvm_arm_create_scratch_host_vcpu() takes a struct kvm_vcpu_init parameter. Rather than just using it as an output parameter to pass back the preferred target, use it also as an input parameter, allowing a caller to pass a selected target if they wish and to also pass cpu features. If the caller doesn't want to select a target they can pass -1 for the target which indicates they want to use the preferred target and have it passed back like before.
Message-id: [email protected]
--- target/arm/kvm.c | 20 +++++++++++++++----- target/arm/kvm32.c | 6 +++++- target/arm/kvm64.c | 6 +++++- 3 files changed, 25 insertions(+), 7 deletions(-)
target/arm/kvm.c +15 -5
@@ -66,7 +66,7 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,int *fdarray, struct kvm_vcpu_init *init) { - int ret, kvmfd = -1, vmfd = -1, cpufd = -1; + int ret = 0, kvmfd = -1, vmfd = -1, cpufd = -1; kvmfd =qemu_open ("/dev/kvm" ,O_RDWR );if (kvmfd <0 ) {
@@ -86,7 +86,14 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try, goto finish; } - ret =ioctl (vmfd,KVM_ARM_PREFERRED_TARGET , init); +if (init->target ==-1 ) { +struct kvm_vcpu_init preferred; + + ret =ioctl (vmfd,KVM_ARM_PREFERRED_TARGET , &preferred); +if (!ret) { + init->target = preferred.target; + } + }if (ret >=0 ) { ret =ioctl (cpufd,KVM_ARM_VCPU_INIT , init);if (ret <0 ) {
@@ -98,10 +105,12 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,* creating one kind of guest CPU which is its preferred * CPU type. */ +struct kvm_vcpu_init try; +while (*cpus_to_try !=QEMU_KVM_ARM_TARGET_NONE ) { - init->target = *cpus_to_try++; -memset (init->features,0 ,sizeof (init->features)); - ret =ioctl (cpufd,KVM_ARM_VCPU_INIT , init); + try.target = *cpus_to_try++; +memcpy (try.features, init->features,sizeof (init->features)); + ret =ioctl (cpufd,KVM_ARM_VCPU_INIT , &try);if (ret >=0 ) {break ; }
@@ -109,6 +118,7 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,if (ret <0 ) { goto err; } + init->target = try.target; }else {/* Treat a NULL cpus_to_try argument the same as an empty * list, which means we will fail the call since this must
target/arm/kvm32.c +5 -1
@@ -53,7 +53,11 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)QEMU_KVM_ARM_TARGET_CORTEX_A15 , QEMU_KVM_ARM_TARGET_NONE }; -struct kvm_vcpu_init init; +/* +* target = -1 informs kvm_arm_create_scratch_host_vcpu() +* to use the preferred target +*/ +struct kvm_vcpu_init init = { .target =-1 , };if (!kvm_arm_create_scratch_host_vcpu (cpus_to_try, fdarray, &init)) {return false;
target/arm/kvm64.c +5 -1
@@ -502,7 +502,11 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)KVM_ARM_TARGET_CORTEX_A57 , QEMU_KVM_ARM_TARGET_NONE }; -struct kvm_vcpu_init init; +/* +* target = -1 informs kvm_arm_create_scratch_host_vcpu() +* to use the preferred target +*/ +struct kvm_vcpu_init init = { .target =-1 , };if (!kvm_arm_create_scratch_host_vcpu (cpus_to_try, fdarray, &init)) {return false;
Signature · 1 line
2.20.1
[PULL 47/51] hw/arm/bcm2835_peripherals: Use the SYS_timer
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Connect the recently added SYS_timer.
Now U-Boot does not hang anymore polling a free running counter stuck at 0.
This timer is also used by the Linux kernel thermal subsystem.
Message-id: [email protected]
--- include/hw/arm/bcm2835_peripherals.h | 3 ++- hw/arm/bcm2835_peripherals.c | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-)
include/hw/arm/bcm2835_peripherals.h +2 -1
@@ -24,6 +24,7 @@#include "hw/sd/sdhci.h" #include "hw/sd/bcm2835_sdhost.h" #include "hw/gpio/bcm2835_gpio.h" +#include "hw/timer/bcm2835_systmr.h" #include "hw/misc/unimp.h" #define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals"
@@ -39,7 +40,7 @@ typedef struct BCM2835PeripheralState {MemoryRegion ram_alias[4 ];qemu_irq irq, fiq; -UnimplementedDeviceState systmr; +BCM2835SystemTimerState systmr;UnimplementedDeviceState armtmr;UnimplementedDeviceState cprman;UnimplementedDeviceState a2w;
hw/arm/bcm2835_peripherals.c +16 -1
@@ -58,6 +58,10 @@ static void bcm2835_peripherals_init(Object *obj)/* Interrupt Controller */ sysbus_init_child_obj (obj,"ic" , &s->ic,sizeof (s->ic),TYPE_BCM2835_IC ); +/* SYS Timer */ +sysbus_init_child_obj (obj,"systimer" , &s->systmr,sizeof (s->systmr), +TYPE_BCM2835_SYSTIMER ); +/* UART0 */ sysbus_init_child_obj (obj,"uart0" , &s->uart0,sizeof (s->uart0),TYPE_PL011 );
@@ -171,6 +175,18 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ic), 0));sysbus_pass_irq (SYS_BUS_DEVICE (s),SYS_BUS_DEVICE (&s->ic)); +/* Sys Timer */ +object_property_set_bool (OBJECT (&s->systmr), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +memory_region_add_subregion (&s->peri_mr,ST_OFFSET , +sysbus_mmio_get_region (SYS_BUS_DEVICE (&s->systmr),0 )); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->systmr),0 , +qdev_get_gpio_in_named (DEVICE (&s->ic),BCM2835_IC_ARM_IRQ , +INTERRUPT_ARM_TIMER )); +/* UART0 */ qdev_prop_set_chr (DEVICE (&s->uart0),"chardev" ,serial_hd (0 ));object_property_set_bool (OBJECT (&s->uart0), true,"realized" , &err);
@@ -352,7 +368,6 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) }create_unimp (s, &s->armtmr,"bcm2835-sp804" ,ARMCTRL_TIMER0_1_OFFSET ,0x40 ); -create_unimp (s, &s->systmr,"bcm2835-systimer" ,ST_OFFSET ,0x20 );create_unimp (s, &s->cprman,"bcm2835-cprman" ,CPRMAN_OFFSET ,0x1000 );create_unimp (s, &s->a2w,"bcm2835-a2w" ,A2W_OFFSET ,0x1000 );create_unimp (s, &s->i2s,"bcm2835-i2s" ,I2S_OFFSET ,0x100 );
Signature · 1 line
2.20.1
[PULL 36/51] tests: arm: Introduce cpu feature tests
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Now that Arm CPUs have advertised features lets add tests to ensure we maintain their expected availability with and without KVM.
Message-id: [email protected]
--- tests/Makefile.include | 5 +- tests/arm-cpu-features.c | 240 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 tests/arm-cpu-features.c
tests/Makefile.include +4 -1
@@ -262,6 +262,7 @@ check-qtest-sparc64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF) check-qtest-sparc64-y += tests/prom-env-test$(EXESUF) check-qtest-sparc64-y += tests/boot-serial-test$(EXESUF) +check-qtest-arm-y += tests/arm-cpu-features$(EXESUF) check-qtest-arm-y += tests/microbit-test$(EXESUF) check-qtest-arm-y += tests/m25p80-test$(EXESUF) check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
@@ -269,7 +270,8 @@ check-qtest-arm-y += tests/boot-serial-test$(EXESUF) check-qtest-arm-y += tests/hexloader-test$(EXESUF) check-qtest-arm-$(CONFIG_PFLASH_CFI02) += tests/pflash-cfi02-test$(EXESUF) -check-qtest-aarch64-y = tests/numa-test$(EXESUF) +check-qtest-aarch64-y += tests/arm-cpu-features$(EXESUF) +check-qtest-aarch64-y += tests/numa-test$(EXESUF) check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF) check-qtest-aarch64-y += tests/migration-test$(EXESUF) # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make test unconditional
@@ -835,6 +837,7 @@ tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y) tests/numa-test$(EXESUF): tests/numa-test.o tests/vmgenid-test$(EXESUF): tests/vmgenid-test.o tests/boot-sector.o tests/acpi-utils.o tests/cdrom-test$(EXESUF): tests/cdrom-test.o tests/boot-sector.o $(libqos-obj-y) +tests/arm-cpu-features$(EXESUF): tests/arm-cpu-features.o tests/migration/stress$(EXESUF): tests/migration/stress.o $(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
tests/arm-cpu-features.c new file +240 -0
240 lines not on this page · raw message
Signature · 1 line
2.20.1
[PULL 42/51] target/arm/cpu64: max cpu: Support sve properties with KVM
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Extend the SVE vq map initialization and validation with KVM's supported vector lengths when KVM is enabled. In order to determine and select supported lengths we add two new KVM functions for getting and setting the KVM_REG_ARM64_SVE_VLS pseudo-register.
This patch has been co-authored with Richard Henderson, who reworked the target/arm/cpu64.c changes in order to push all the validation and auto-enabling/disabling steps into the finalizer, resulting in a nice LOC reduction.
Message-id: [email protected]
--- target/arm/kvm_arm.h | 12 +++ target/arm/cpu64.c | 176 ++++++++++++++++++++++++++++---------- target/arm/kvm64.c | 100 +++++++++++++++++++++- tests/arm-cpu-features.c | 106 ++++++++++++++++++++++- docs/arm-cpu-features.rst | 45 +++++++--- 5 files changed, 381 insertions(+), 58 deletions(-)
target/arm/kvm_arm.h +12 -0
@@ -212,6 +212,17 @@ typedef struct ARMHostCPUFeatures {*/ bool kvm_arm_get_host_cpu_features (ARMHostCPUFeatures *ahcf); +/** +* kvm_arm_sve_get_vls: +* @cs: CPUState +* @map: bitmap to fill in +* +* Get all the SVE vector lengths supported by the KVM host, setting +* the bits corresponding to their length in quadwords minus one +* (vq - 1) in @map up to ARM_MAX_VQ. +*/ +void kvm_arm_sve_get_vls (CPUState *cs,unsigned long *map); +/** * kvm_arm_set_cpu_features_from_host: * @cpu: ARMCPU to set the features for
@@ -316,6 +327,7 @@ static inline int kvm_arm_vgic_probe(void)static inline void kvm_arm_pmu_set_irq (CPUState *cs,int irq) {}static inline void kvm_arm_pmu_init (CPUState *cs) {} +static inline void kvm_arm_sve_get_vls (CPUState *cs,unsigned long *map) {}#endif static inline const char *gic_class_name (void )
target/arm/cpu64.c +133 -43
232 lines not on this page · raw message
target/arm/kvm64.c +99 -1
118 lines not on this page · raw message
tests/arm-cpu-features.c +104 -2
136 lines not on this page · raw message
docs/arm-cpu-features.rst +33 -12
71 lines not on this page · raw message
Signature · 1 line
2.20.1
[PULL 46/51] hw/timer/bcm2835: Add the BCM2835 SYS_timer
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Add the 64-bit free running timer. Do not model the COMPARE register (no IRQ generated).
This timer is used by Linux kernel and recently U-Boot:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clocksource/bcm2835_timer.c?h=v3.7
https://github.com/u-boot/u-boot/blob/v2019.07/include/configs/rpi.h#L19
Datasheet used:
https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
Message-id: [email protected]
--- hw/timer/Makefile.objs | 1 + include/hw/timer/bcm2835_systmr.h | 33 ++++++ hw/timer/bcm2835_systmr.c | 163 ++++++++++++++++++++++++++++++ hw/timer/trace-events | 5 + 4 files changed, 202 insertions(+) create mode 100644 include/hw/timer/bcm2835_systmr.h create mode 100644 hw/timer/bcm2835_systmr.c
hw/timer/Makefile.objs +1 -0
@@ -47,3 +47,4 @@ common-obj-$(CONFIG_SUN4V_RTC) += sun4v-rtc.o common-obj-$(CONFIG_CMSDK_APB_TIMER) += cmsdk-apb-timer.o common-obj-$(CONFIG_CMSDK_APB_DUALTIMER) += cmsdk-apb-dualtimer.o common-obj-$(CONFIG_MSF2) += mss-timer.o +common-obj-$(CONFIG_RASPI) += bcm2835_systmr.o
include/hw/timer/bcm2835_systmr.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* BCM2835 SYS timer emulation +* +* Copyright (c) 2019 Philippe Mathieu-Daudé <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef BCM2835_SYSTIMER_H +#define BCM2835_SYSTIMER_H + +#include "hw/sysbus.h" +#include "hw/irq.h" + +#define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer" +#define BCM2835_SYSTIMER (obj) \ + OBJECT_CHECK(BCM2835SystemTimerState, (obj), TYPE_BCM2835_SYSTIMER) + +typedef struct { +/*< private >*/ +SysBusDevice parent_obj; + +/*< public >*/ +MemoryRegion iomem; +qemu_irq irq; + +struct { +uint32_t status; +uint32_t compare[4 ]; + } reg; +}BCM2835SystemTimerState ; + +#endif
hw/timer/bcm2835_systmr.c new file +163 -0
163 lines not on this page · raw message
hw/timer/trace-events +5 -0
@@ -87,3 +87,8 @@ pl031_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x" pl031_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x" pl031_alarm_raised(void) "alarm raised" pl031_set_alarm(uint32_t ticks) "alarm set for %u ticks" + +# bcm2835_systmr.c +bcm2835_systmr_irq(bool enable) "timer irq state %u" +bcm2835_systmr_read(uint64_t offset, uint64_t data) "timer read: offset 0x%" PRIx64 " data 0x%" PRIx64 +bcm2835_systmr_write(uint64_t offset, uint64_t data) "timer write: offset 0x%" PRIx64 " data 0x%" PRIx64
Signature · 1 line
2.20.1
[PULL 48/51] hw/arm/bcm2836: Make the SoC code modular
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
This file creates the BCM2836/BCM2837 blocks.
The biggest differences with the BCM2838 we are going to add, are the base addresses of the interrupt controller and the peripherals. Add these addresses in the BCM283XInfo structure to make this block more modular. Remove the MCORE_OFFSET offset as it is not useful and rather confusing.
Message-id: [email protected]
--- hw/arm/bcm2836.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
hw/arm/bcm2836.c +9 -9
@@ -16,15 +16,11 @@#include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" -/* Peripheral base address seen by the CPU */ -#define BCM2836_PERI_BASE 0x3F000000 - -/* "QA7" (Pi2) interrupt controller and mailboxes etc. */ -#define BCM2836_CONTROL_BASE 0x40000000 -struct BCM283XInfo {const char *name;const char *cpu_type; +hwaddr peri_base;/* Peripheral base address seen by the CPU */ +hwaddr ctrl_base;/* Interrupt controller and mailboxes etc. */ int clusterid; };
@@ -32,12 +28,16 @@ static const BCM283XInfo bcm283x_socs[] = { { .name = TYPE_BCM2836, .cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"), + .peri_base = 0x3f000000, + .ctrl_base = 0x40000000, .clusterid = 0xf, }, #ifdef TARGET_AARCH64 { .name = TYPE_BCM2837, .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"), + .peri_base = 0x3f000000, + .ctrl_base = 0x40000000, .clusterid = 0x0, }, #endif
@@ -104,7 +104,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) }sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->peripherals),0 , -BCM2836_PERI_BASE ,1 ); + info->peri_base,1 );/* bcm2836 interrupt controller (and mailboxes, etc.) */ object_property_set_bool (OBJECT (&s->control), true,"realized" , &err);
@@ -113,7 +113,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)return ; } -sysbus_mmio_map (SYS_BUS_DEVICE (&s->control),0 ,BCM2836_CONTROL_BASE ); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->control),0 , info->ctrl_base);sysbus_connect_irq (SYS_BUS_DEVICE (&s->peripherals),0 ,qdev_get_gpio_in_named (DEVICE (&s->control),"gpu-irq" ,0 ));
@@ -126,7 +126,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)/* set periphbase/CBAR value for CPU-local registers */ object_property_set_int (OBJECT (&s->cpus[n]), -BCM2836_PERI_BASE +MSYNC_OFFSET , + info->peri_base,"reset-cbar" , &err);if (err) {error_propagate (errp, err);
Signature · 1 line
2.20.1
[PULL 38/51] target/arm/cpu64: max cpu: Introduce sve<N> properties
In reply to Peter MaydellFrom: Andrew Jones <[email protected]>
Introduce cpu properties to give fine control over SVE vector lengths. We introduce a property for each valid length up to the current maximum supported, which is 2048-bits. The properties are named, e.g. sve128, sve256, sve384, sve512, ..., where the number is the number of bits. See the updates to docs/arm-cpu-features.rst for a description of the semantics and for example uses.
Note, as sve-max-vq is still present and we'd like to be able to support qmp_query_cpu_model_expansion with guests launched with e.g. -cpu max,sve-max-vq=8 on their command lines, then we do allow sve-max-vq and sve<N> properties to be provided at the same time, but this is not recommended, and is why sve-max-vq is not mentioned in the document. If sve-max-vq is provided then it enables all lengths smaller than and including the max and disables all lengths larger. It also has the side-effect that no larger lengths may be enabled and that the max itself cannot be disabled. Smaller non-power-of-two lengths may, however, be disabled, e.g. -cpu max,sve-max-vq=4,sve384=off provides a guest the vector lengths 128, 256, and 512 bits.
This patch has been co-authored with Richard Henderson, who reworked the target/arm/cpu64.c changes in order to push all the validation and auto-enabling/disabling steps into the finalizer, resulting in a nice LOC reduction.
Message-id: [email protected]
--- include/qemu/bitops.h | 1 + target/arm/cpu.h | 19 ++++ target/arm/cpu.c | 19 ++++ target/arm/cpu64.c | 192 ++++++++++++++++++++++++++++++++++++- target/arm/helper.c | 10 +- target/arm/monitor.c | 12 +++ tests/arm-cpu-features.c | 194 ++++++++++++++++++++++++++++++++++++++ docs/arm-cpu-features.rst | 168 +++++++++++++++++++++++++++++++-- 8 files changed, 606 insertions(+), 9 deletions(-)
include/qemu/bitops.h +1 -0
@@ -20,6 +20,7 @@#define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE)#define BIT (nr) (1UL << (nr)) +#define BIT_ULL (nr) (1ULL << (nr))#define BIT_MASK (nr) (1UL << ((nr) % BITS_PER_LONG))#define BIT_WORD (nr) ((nr) / BITS_PER_LONG)#define BITS_TO_LONGS (nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
target/arm/cpu.h +19 -0
@@ -184,8 +184,13 @@ typedef struct {#ifdef TARGET_AARCH64 # define ARM_MAX_VQ 16 +void arm_cpu_sve_finalize (ARMCPU *cpu,Error **errp); +uint32_t arm_cpu_vq_map_next_smaller (ARMCPU *cpu,uint32_t vq);#else # define ARM_MAX_VQ 1 +static inline void arm_cpu_sve_finalize (ARMCPU *cpu,Error **errp) { } +static inline uint32_t arm_cpu_vq_map_next_smaller (ARMCPU *cpu,uint32_t vq) +{return 0 ; }#endif typedef struct ARMVectorReg {
@@ -918,6 +923,18 @@ struct ARMCPU {/* Used to set the maximum vector length the cpu will support. */ uint32_t sve_max_vq; + +/* +* In sve_vq_map each set bit is a supported vector length of +* (bit-number + 1) * 16 bytes, i.e. each bit number + 1 is the vector +* length in quadwords. +* +* While processing properties during initialization, corresponding +* sve_vq_init bits are set for bits in sve_vq_map that have been +* set by properties. +*/ +DECLARE_BITMAP (sve_vq_map,ARM_MAX_VQ ); +DECLARE_BITMAP (sve_vq_init,ARM_MAX_VQ ); };void arm_cpu_post_init (Object *obj);
@@ -1837,6 +1854,8 @@ static inline int arm_feature(CPUARMState *env, int feature)return (env->features & (1ULL << feature)) !=0 ; } +void arm_cpu_finalize_features (ARMCPU *cpu,Error **errp); +#if !defined(CONFIG_USER_ONLY )/* Return true if exception levels below EL3 are in secure state, * or would be following an exception return to that level.
target/arm/cpu.c +19 -0
@@ -1198,6 +1198,19 @@ static void arm_cpu_finalizefn(Object *obj)#endif } +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); +if (local_err !=NULL ) { +error_propagate (errp, local_err); +return ; + } + } +} +static void arm_cpu_realizefn (DeviceState *dev,Error **errp) {CPUState *cs =CPU (dev);
@@ -1254,6 +1267,12 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)return ; } +arm_cpu_finalize_features (cpu, &local_err); +if (local_err !=NULL ) { +error_propagate (errp, local_err); +return ; + } +if (arm_feature (env,ARM_FEATURE_AARCH64 ) && cpu->has_vfp != cpu->has_neon) {/*
target/arm/cpu64.c +191 -1
220 lines not on this page · raw message
target/arm/helper.c +9 -1
@@ -5361,6 +5361,13 @@ int sve_exception_el(CPUARMState *env, int el)return 0 ; } +static uint32_t sve_zcr_get_valid_len (ARMCPU *cpu,uint32_t start_len) +{ +uint32_t start_vq = (start_len &0xf ) +1 ; + +return arm_cpu_vq_map_next_smaller (cpu, start_vq +1 ) -1 ; +} +/* * Given that SVE is enabled, return the vector length for EL. */
@@ -5378,7 +5385,8 @@ uint32_t sve_zcr_len_for_el(CPUARMState *env, int el)if (arm_feature (env,ARM_FEATURE_EL3 )) { zcr_len =MIN (zcr_len,0xf & (uint32_t )env->vfp.zcr_el[3 ]); } -return zcr_len; + +return sve_zcr_get_valid_len (cpu, zcr_len); } static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
target/arm/monitor.c +12 -0
@@ -90,6 +90,8 @@ GICCapabilityList *qmp_query_gic_capabilities(Error **errp)return head; } +QEMU_BUILD_BUG_ON (ARM_MAX_VQ >16 ); +/* * These are cpu model features we want to advertise. The order here * matters as this is the order in which qmp_query_cpu_model_expansion
@@ -98,6 +100,9 @@ GICCapabilityList *qmp_query_gic_capabilities(Error **errp)*/ static const char *cpu_model_advertised_features[] = {"aarch64" ,"pmu" ,"sve" , +"sve128" ,"sve256" ,"sve384" ,"sve512" , +"sve640" ,"sve768" ,"sve896" ,"sve1024" ,"sve1152" ,"sve1280" , +"sve1408" ,"sve1536" ,"sve1664" ,"sve1792" ,"sve1920" ,"sve2048" ,NULL };
@@ -186,6 +191,9 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,if (!err) {visit_check_struct (visitor, &err); } +if (!err) { +arm_cpu_finalize_features (ARM_CPU (obj), &err); + }visit_end_struct (visitor,NULL );visit_free (visitor);if (err) {
@@ -193,6 +201,10 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,error_propagate (errp, err);return NULL ; } + }else { +Error *err =NULL ; +arm_cpu_finalize_features (ARM_CPU (obj), &err); +assert (err ==NULL ); } expansion_info =g_new0 (CpuModelExpansionInfo,1 );
tests/arm-cpu-features.c +194 -0
225 lines not on this page · raw message
docs/arm-cpu-features.rst +161 -7
193 lines not on this page · raw message
Signature · 1 line
2.20.1
[PULL 51/51] hw/arm/highbank: Use AddressSpace when using write_secondary_boot()
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
write_secondary_boot() is used in SMP configurations where the CPU address space might not be the main System Bus.
The rom_add_blob_fixed_as() function allow us to specify an address space. Use it to write each boot blob in the corresponding CPU address space.
Message-id: [email protected]
--- hw/arm/highbank.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/highbank.c +2 -1
@@ -78,7 +78,8 @@ static void hb_write_secondary(ARMCPU *cpu, const struct arm_boot_info *info)for (n =0 ; n <ARRAY_SIZE (smpboot); n++) { smpboot[n] =tswap32 (smpboot[n]); } -rom_add_blob_fixed ("smpboot" , smpboot,sizeof (smpboot),SMP_BOOT_ADDR ); +rom_add_blob_fixed_as ("smpboot" , smpboot,sizeof (smpboot),SMP_BOOT_ADDR , +arm_boot_address_space (cpu, info)); }static void hb_reset_secondary (ARMCPU *cpu,const struct arm_boot_info *info)
Signature · 1 line
2.20.1
[PULL 49/51] hw/arm/bcm2836: Rename cpus[] as cpu[].core
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
As we are going to add more core-specific fields, add a 'cpu' structure and move the ARMCPU field there as 'core'.
Message-id: [email protected]
--- include/hw/arm/bcm2836.h | 4 +++- hw/arm/bcm2836.c | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-)
include/hw/arm/bcm2836.h +3 -1
@@ -35,7 +35,9 @@ typedef struct BCM283XState {char *cpu_type;uint32_t enabled_cpus; -ARMCPU cpus[BCM283X_NCPUS ]; +struct { +ARMCPU core; + } cpu[BCM283X_NCPUS ];BCM2836ControlState control;BCM2835PeripheralState peripherals; } BCM283XState;
hw/arm/bcm2836.c +14 -12
@@ -51,8 +51,9 @@ static void bcm2836_init(Object *obj)int n;for (n =0 ; n <BCM283X_NCPUS ; n++) { -object_initialize_child (obj,"cpu[*]" , &s->cpus[n],sizeof (s->cpus[n]), - info->cpu_type, &error_abort,NULL ); +object_initialize_child (obj,"cpu[*]" , &s->cpu[n].core, +sizeof (s->cpu[n].core), info->cpu_type, + &error_abort,NULL ); } sysbus_init_child_obj(obj, "control", &s->control, sizeof(s->control),
@@ -122,10 +123,10 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)for (n =0 ; n <BCM283X_NCPUS ; n++) {/* TODO: this should be converted to a property of ARM_CPU */ - s->cpus[n].mp_affinity = (info->clusterid <<8 ) | n; + s->cpu[n].core.mp_affinity = (info->clusterid <<8 ) | n;/* set periphbase/CBAR value for CPU-local registers */ -object_property_set_int (OBJECT (&s->cpus[n]), +object_property_set_int (OBJECT (&s->cpu[n].core), info->peri_base,"reset-cbar" , &err);if (err) {
@@ -134,14 +135,15 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) }/* start powered off if not enabled */ -object_property_set_bool (OBJECT (&s->cpus[n]), n >= s->enabled_cpus, +object_property_set_bool (OBJECT (&s->cpu[n].core), n >= s->enabled_cpus,"start-powered-off" , &err);if (err) {error_propagate (errp, err);return ; } -object_property_set_bool (OBJECT (&s->cpus[n]), true,"realized" , &err); +object_property_set_bool (OBJECT (&s->cpu[n].core), true, +"realized" , &err);if (err) {error_propagate (errp, err);return ;
@@ -149,18 +151,18 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)/* Connect irq/fiq outputs from the interrupt controller. */ qdev_connect_gpio_out_named (DEVICE (&s->control),"irq" , n, -qdev_get_gpio_in (DEVICE (&s->cpus[n]),ARM_CPU_IRQ )); +qdev_get_gpio_in (DEVICE (&s->cpu[n].core),ARM_CPU_IRQ ));qdev_connect_gpio_out_named (DEVICE (&s->control),"fiq" , n, -qdev_get_gpio_in (DEVICE (&s->cpus[n]),ARM_CPU_FIQ )); +qdev_get_gpio_in (DEVICE (&s->cpu[n].core),ARM_CPU_FIQ ));/* Connect timers from the CPU to the interrupt controller */ -qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_PHYS , +qdev_connect_gpio_out (DEVICE (&s->cpu[n].core),GTIMER_PHYS ,qdev_get_gpio_in_named (DEVICE (&s->control),"cntpnsirq" , n)); -qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_VIRT , +qdev_connect_gpio_out (DEVICE (&s->cpu[n].core),GTIMER_VIRT ,qdev_get_gpio_in_named (DEVICE (&s->control),"cntvirq" , n)); -qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_HYP , +qdev_connect_gpio_out (DEVICE (&s->cpu[n].core),GTIMER_HYP ,qdev_get_gpio_in_named (DEVICE (&s->control),"cnthpirq" , n)); -qdev_connect_gpio_out (DEVICE (&s->cpus[n]),GTIMER_SEC , +qdev_connect_gpio_out (DEVICE (&s->cpu[n].core),GTIMER_SEC ,qdev_get_gpio_in_named (DEVICE (&s->control),"cntpsirq" , n)); } }
Signature · 1 line
2.20.1
[PULL 44/51] hw/misc/bcm2835_thermal: Add a dummy BCM2835 thermal sensor
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
We will soon implement the SYS_timer. This timer is used by Linux in the thermal subsystem, so once available, the subsystem will be enabled and poll the temperature sensors. We need to provide the minimum required to keep Linux booting.
Add a dummy thermal sensor returning ~25°C based on:
https://github.com/raspberrypi/linux/blob/rpi-5.3.y/drivers/thermal/broadcom/bcm2835_thermal.c
Message-id: [email protected]
--- hw/misc/Makefile.objs | 1 + include/hw/misc/bcm2835_thermal.h | 27 ++++++ hw/misc/bcm2835_thermal.c | 135 ++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 include/hw/misc/bcm2835_thermal.h create mode 100644 hw/misc/bcm2835_thermal.c
hw/misc/Makefile.objs +1 -0
@@ -53,6 +53,7 @@ common-obj-$(CONFIG_OMAP) += omap_tap.o common-obj-$(CONFIG_RASPI) += bcm2835_mbox.o common-obj-$(CONFIG_RASPI) += bcm2835_property.o common-obj-$(CONFIG_RASPI) += bcm2835_rng.o +common-obj-$(CONFIG_RASPI) += bcm2835_thermal.o common-obj-$(CONFIG_SLAVIO) += slavio_misc.o common-obj-$(CONFIG_ZYNQ) += zynq_slcr.o common-obj-$(CONFIG_ZYNQ) += zynq-xadc.o
include/hw/misc/bcm2835_thermal.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* BCM2835 dummy thermal sensor +* +* Copyright (C) 2019 Philippe Mathieu-Daudé <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_MISC_BCM2835_THERMAL_H +#define HW_MISC_BCM2835_THERMAL_H + +#include "hw/sysbus.h" + +#define TYPE_BCM2835_THERMAL "bcm2835-thermal" + +#define BCM2835_THERMAL (obj) \ + OBJECT_CHECK(Bcm2835ThermalState, (obj), TYPE_BCM2835_THERMAL) + +typedef struct { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ +MemoryRegion iomem; +uint32_t ctl; +}Bcm2835ThermalState ; + +#endif
hw/misc/bcm2835_thermal.c new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.20.1
[PULL 50/51] hw/arm/raspi: Use AddressSpace when using arm_boot::write_secondary_boot
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
write_secondary_boot() is used in SMP configurations where the CPU address space might not be the main System Bus.
The rom_add_blob_fixed_as() function allow us to specify an address space. Use it to write each boot blob in the corresponding CPU address space.
Message-id: [email protected]
--- hw/arm/raspi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
hw/arm/raspi.c +8 -6
@@ -60,12 +60,14 @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)QEMU_BUILD_BUG_ON ((BOARDSETUP_ADDR &0xf ) !=0 || (BOARDSETUP_ADDR >>4 ) >=0x100 ); -rom_add_blob_fixed ("raspi_smpboot" , smpboot,sizeof (smpboot), - info->smp_loader_start); +rom_add_blob_fixed_as ("raspi_smpboot" , smpboot,sizeof (smpboot), + info->smp_loader_start, +arm_boot_address_space (cpu, info)); }static void write_smpboot64 (ARMCPU *cpu,const struct arm_boot_info *info) { +AddressSpace *as =arm_boot_address_space (cpu, info);/* Unlike the AArch32 version we don't need to call the board setup hook. * The mechanism for doing the spin-table is also entirely different. * We must have four 64-bit fields at absolute addresses
@@ -92,10 +94,10 @@ static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info) 0, 0, 0, 0 }; -rom_add_blob_fixed ("raspi_smpboot" , smpboot,sizeof (smpboot), - info->smp_loader_start); -rom_add_blob_fixed ("raspi_spintables" , spintables,sizeof (spintables), -SPINTABLE_ADDR ); +rom_add_blob_fixed_as ("raspi_smpboot" , smpboot,sizeof (smpboot), + info->smp_loader_start, as); +rom_add_blob_fixed_as ("raspi_spintables" , spintables,sizeof (spintables), +SPINTABLE_ADDR , as); }static void write_board_setup (ARMCPU *cpu,const struct arm_boot_info *info)
Signature · 1 line
2.20.1
Quoted 138 lines · Peter Maydell
Probably the last arm pullreq before softfreeze...
The following changes since commit
58560ad254fbda71d4daa6622d71683190070ee2:Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191024' into staging (2019-10-24 16:22:58 +0100)are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191024for you to fetch changes up to
a01a4a3e85ae8f6fe21adbedc80f7013faabdcf4:hw/arm/highbank: Use AddressSpace when using write_secondary_boot() (2019-10-24 17:16:30 +0100)----------------------------------------------------------------
target-arm queue:
* raspi boards: some cleanup
* raspi: implement the bcm2835 system timer device
* raspi: implement a dummy thermal sensor
* KVM: support providing SVE to the guest
* misc devices: switch to ptimer transaction API
* cache TB flag state to improve performance ofcpu_get_tb_cpu_state
* aspeed: Add an AST2600 eval board----------------------------------------------------------------
Andrew Jones (9):
target/arm/monitor: Introduceqmp_query_cpu_model_expansion
tests: arm: Introduce cpu feature tests
target/arm: Allow SVE to be disabled via a CPU property target/arm/cpu64: max cpu: Introduce sve<N> properties target/arm/kvm64: Add kvm_arch_get/put_sve target/arm/kvm64: max cpu: Enable SVE when available target/arm/kvm: scratch vcpu: Preserve inputkvm_vcpu_initfeatures target/arm/cpu64: max cpu: Support sve properties with KVM target/arm/kvm: host cpu: Add support for sve<N> propertiesCédric Le Goater (2):
hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
aspeed: Add an AST2600 eval boardPeter Maydell (8):
hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer APIhw/timer/xilinx_timer.c: Switch to transaction-based ptimer APIhw/dma/xilinx_axidma.c: Switch to transaction-based ptimer API hw/timer/slavio_timer: Remove useless check for NULLt->timerhw/timer/slavio_timer.c: Switch to transaction-based ptimer APIhw/timer/grlib_gptimer.c: Switch to transaction-based ptimer APIhw/m68k/mcf5206.c: Switch to transaction-based ptimer APIhw/watchdog/milkymist-sysctl.c: Switch to transaction-based ptimer APIPhilippe Mathieu-Daudé (8):
hw/misc/bcm2835_thermal: Add a dummy BCM2835 thermal sensor hw/arm/bcm2835_peripherals: Use the thermal sensor block hw/timer/bcm2835: Add the BCM2835SYS_timerhw/arm/bcm2835_peripherals: Use theSYS_timerhw/arm/bcm2836: Make the SoC code modular
hw/arm/bcm2836: Rename cpus[] as cpu[].core
hw/arm/raspi: Use AddressSpace when usingarm_boot::write_secondary_boothw/arm/highbank: Use AddressSpace when usingwrite_secondary_boot()Richard Henderson (24):
target/arm: Split outrebuild_hflags_common
target/arm: Split outrebuild_hflags_a64
target/arm: Split outrebuild_hflags_common_32
target/arm: Splitarm_cpu_data_is_big_endian
target/arm: Split outrebuild_hflags_m32
target/arm: Reduce tests vs M-profile incpu_get_tb_cpu_statetarget/arm: Split outrebuild_hflags_a32
target/arm: Split outrebuild_hflags_aprofile
target/arm: HoistXSCALE_CPAR, VECLEN, VECSTRIDE incpu_get_tb_cpu_statetarget/arm: Simplify set ofPSTATE_SSincpu_get_tb_cpu_statetarget/arm: Hoist computation of TBFLAG_A32.VFPEN target/arm: Addarm_rebuild_hflags
target/arm: Split outarm_mmu_idx_el
target/arm: Hoist store tocs_baseincpu_get_tb_cpu_statetarget/arm: AddHELPER(rebuild_hflags_{a32, a64, m32})target/arm: Rebuild hflags at EL changes
target/arm: Rebuild hflags at MSR writes
target/arm: Rebuild hflags at CPSR writes
target/arm: Rebuild hflags at Xscale SCTLR writes target/arm: Rebuild hflags for M-profile
target/arm: Rebuild hflags for M-profile NVIC linux-user/aarch64: Rebuild hflags forTARGET_WORDS_BIGENDIANlinux-user/arm: Rebuild hflags forTARGET_WORDS_BIGENDIANtarget/arm: Rely on hflags correct incpu_get_tb_cpu_statehw/misc/Makefile.objs | 1 + hw/timer/Makefile.objs | 1 + tests/Makefile.include | 5 +- qapi/machine-target.json | 6 +- hw/net/fsl_etsec/etsec.h | 1 - include/hw/arm/aspeed.h | 1 + include/hw/arm/bcm2835_peripherals.h | 5 +- include/hw/arm/bcm2836.h | 4 +- include/hw/arm/raspi_platform.h | 1 + include/hw/misc/bcm2835_thermal.h | 27 ++ include/hw/timer/bcm2835_systmr.h | 33 +++ include/qemu/bitops.h | 1 + target/arm/cpu.h | 105 +++++-- target/arm/helper.h | 4 + target/arm/internals.h | 9 + target/arm/kvm_arm.h | 39 +++ hw/arm/aspeed.c | 23 ++ hw/arm/bcm2835_peripherals.c | 30 +- hw/arm/bcm2836.c | 44 +-- hw/arm/highbank.c | 3 +- hw/arm/raspi.c | 14 +- hw/dma/xilinx_axidma.c | 9 +- hw/gpio/aspeed_gpio.c | 8 +- hw/intc/armv7m_nvic.c | 22 +- hw/m68k/mcf5206.c | 15 +- hw/misc/bcm2835_thermal.c | 135 +++++++++ hw/net/fsl_etsec/etsec.c | 9 +- hw/timer/bcm2835_systmr.c | 163 +++++++++++ hw/timer/grlib_gptimer.c | 28 +- hw/timer/milkymist-sysctl.c | 25 +- hw/timer/slavio_timer.c | 32 ++- hw/timer/xilinx_timer.c | 13 +- linux-user/aarch64/cpu_loop.c | 1 + linux-user/arm/cpu_loop.c | 1 + linux-user/syscall.c | 1 + target/arm/cpu.c | 26 +- target/arm/cpu64.c | 364 +++++++++++++++++++++-- target/arm/helper-a64.c | 3 + target/arm/helper.c | 403 +++++++++++++++++--------- target/arm/kvm.c | 25 +- target/arm/kvm32.c | 6 +- target/arm/kvm64.c | 325 ++++++++++++++++++--- target/arm/m_helper.c | 6 + target/arm/machine.c | 1 + target/arm/monitor.c | 158 ++++++++++ target/arm/op_helper.c | 4 + target/arm/translate-a64.c | 13 +- target/arm/translate.c | 33 ++- tests/arm-cpu-features.c | 540 +++++++++++++++++++++++++++++++++++ docs/arm-cpu-features.rst | 317 ++++++++++++++++++++ hw/timer/trace-events | 5 + 51 files changed, 2725 insertions(+), 323 deletions(-)
Quoted 7 lines
create mode 100644
include/hw/misc/bcm2835_thermal.hcreate mode 100644include/hw/timer/bcm2835_systmr.hcreate mode 100644hw/misc/bcm2835_thermal.ccreate mode 100644hw/timer/bcm2835_systmr.ccreate mode 100644tests/arm-cpu-features.ccreate mode 100644docs/arm-cpu-features.rst
If this pull ever fails, please consider fixing:
typo "device":
https://www.mail-archive.com/[email protected]/msg654117.html
Tested-by: Mark Cave-Ayland
https://www.mail-archive.com/[email protected]/msg653861.html
Quoted 149 lines · Philippe Mathieu-Daudé
Quoted 139 lines · Peter Maydell
Probably the last arm pullreq before softfreeze...
The following changes since commit
58560ad254fbda71d4daa6622d71683190070ee2:Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191024' into staging (2019-10-24 16:22:58 +0100)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191024
for you to fetch changes up to
a01a4a3e85ae8f6fe21adbedc80f7013faabdcf4:hw/arm/highbank: Use AddressSpace when using
write_secondary_boot()(2019-10-24 17:16:30 +0100)----------------------------------------------------------------
target-arm queue:
* raspi boards: some cleanup
* raspi: implement the bcm2835 system timer device
* raspi: implement a dummy thermal sensor
* KVM: support providing SVE to the guest
* misc devices: switch to ptimer transaction API
* cache TB flag state to improve performance ofcpu_get_tb_cpu_state
* aspeed: Add an AST2600 eval board----------------------------------------------------------------
Andrew Jones (9):
target/arm/monitor: Introduceqmp_query_cpu_model_expansion
tests: arm: Introduce cpu feature tests
target/arm: Allow SVE to be disabled via a CPU property target/arm/cpu64: max cpu: Introduce sve<N> properties target/arm/kvm64: Add kvm_arch_get/put_sve target/arm/kvm64: max cpu: Enable SVE when available target/arm/kvm: scratch vcpu: Preserve inputkvm_vcpu_initfeatures target/arm/cpu64: max cpu: Support sve properties with KVM target/arm/kvm: host cpu: Add support for sve<N> propertiesCédric Le Goater (2):
hw/gpio: Fix property accessors of the AST2600 GPIO 1.8V model
aspeed: Add an AST2600 eval boardPeter Maydell (8):
hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer APIhw/timer/xilinx_timer.c: Switch to transaction-based ptimer APIhw/dma/xilinx_axidma.c: Switch to transaction-based ptimer API hw/timer/slavio_timer: Remove useless check for NULLt->timerhw/timer/slavio_timer.c: Switch to transaction-based ptimer APIhw/timer/grlib_gptimer.c: Switch to transaction-based ptimer APIhw/m68k/mcf5206.c: Switch to transaction-based ptimer APIhw/watchdog/milkymist-sysctl.c: Switch to transaction-based ptimer APIPhilippe Mathieu-Daudé (8):
hw/misc/bcm2835_thermal: Add a dummy BCM2835 thermal sensor hw/arm/bcm2835_peripherals: Use the thermal sensor block hw/timer/bcm2835: Add the BCM2835SYS_timerhw/arm/bcm2835_peripherals: Use theSYS_timerhw/arm/bcm2836: Make the SoC code modular
hw/arm/bcm2836: Rename cpus[] as cpu[].core
hw/arm/raspi: Use AddressSpace when usingarm_boot::write_secondary_boothw/arm/highbank: Use AddressSpace when usingwrite_secondary_boot()Richard Henderson (24):
target/arm: Split outrebuild_hflags_common
target/arm: Split outrebuild_hflags_a64
target/arm: Split outrebuild_hflags_common_32
target/arm: Splitarm_cpu_data_is_big_endian
target/arm: Split outrebuild_hflags_m32
target/arm: Reduce tests vs M-profile incpu_get_tb_cpu_statetarget/arm: Split outrebuild_hflags_a32
target/arm: Split outrebuild_hflags_aprofile
target/arm: HoistXSCALE_CPAR, VECLEN, VECSTRIDE incpu_get_tb_cpu_statetarget/arm: Simplify set ofPSTATE_SSincpu_get_tb_cpu_statetarget/arm: Hoist computation of TBFLAG_A32.VFPEN target/arm: Addarm_rebuild_hflags
target/arm: Split outarm_mmu_idx_el
target/arm: Hoist store tocs_baseincpu_get_tb_cpu_statetarget/arm: AddHELPER(rebuild_hflags_{a32, a64, m32})target/arm: Rebuild hflags at EL changes
target/arm: Rebuild hflags at MSR writes
target/arm: Rebuild hflags at CPSR writes
target/arm: Rebuild hflags at Xscale SCTLR writes target/arm: Rebuild hflags for M-profile
target/arm: Rebuild hflags for M-profile NVIC linux-user/aarch64: Rebuild hflags forTARGET_WORDS_BIGENDIANlinux-user/arm: Rebuild hflags forTARGET_WORDS_BIGENDIANtarget/arm: Rely on hflags correct incpu_get_tb_cpu_statehw/misc/Makefile.objs | 1 + hw/timer/Makefile.objs | 1 + tests/Makefile.include | 5 +- qapi/machine-target.json | 6 +- hw/net/fsl_etsec/etsec.h | 1 - include/hw/arm/aspeed.h | 1 +
include/hw/arm/bcm2835_peripherals.h| 5 +- include/hw/arm/bcm2836.h | 4 +- include/hw/arm/raspi_platform.h | 1 + include/hw/misc/bcm2835_thermal.h | 27 ++ include/hw/timer/bcm2835_systmr.h | 33 +++ include/qemu/bitops.h | 1 +
target/arm/cpu.h | 105 +++++-- target/arm/helper.h | 4 + target/arm/internals.h | 9 +
target/arm/kvm_arm.h | 39 +++
hw/arm/aspeed.c | 23 ++ hw/arm/bcm2835_peripherals.c | 30 +-
hw/arm/bcm2836.c | 44 +--
hw/arm/highbank.c | 3 +-
hw/arm/raspi.c | 14 +- hw/dma/xilinx_axidma.c | 9 +- hw/gpio/aspeed_gpio.c | 8 +- hw/intc/armv7m_nvic.c | 22 +-
hw/m68k/mcf5206.c | 15 +- hw/misc/bcm2835_thermal.c | 135 +++++++++ hw/net/fsl_etsec/etsec.c | 9 +- hw/timer/bcm2835_systmr.c | 163 +++++++++++ hw/timer/grlib_gptimer.c | 28 +- hw/timer/milkymist-sysctl.c | 25 +- hw/timer/slavio_timer.c | 32 ++- hw/timer/xilinx_timer.c | 13 +- linux-user/aarch64/cpu_loop.c | 1 + linux-user/arm/cpu_loop.c | 1 +
linux-user/syscall.c | 1 +
target/arm/cpu.c | 26 +-
target/arm/cpu64.c | 364 +++++++++++++++++++++-- target/arm/helper-a64.c | 3 +
target/arm/helper.c | 403 +++++++++++++++++--------- target/arm/kvm.c | 25 +-
target/arm/kvm32.c | 6 +-
target/arm/kvm64.c | 325 ++++++++++++++++++--- target/arm/m_helper.c | 6 +
target/arm/machine.c | 1 +
target/arm/monitor.c | 158 ++++++++++ target/arm/op_helper.c | 4 + target/arm/translate-a64.c | 13 +- target/arm/translate.c | 33 ++- tests/arm-cpu-features.c | 540 +++++++++++++++++++++++++++++++++++ docs/arm-cpu-features.rst | 317 ++++++++++++++++++++ hw/timer/trace-events | 5 +Quoted 8 lines
51 files changed, 2725 insertions(+), 323 deletions(-)create mode 100644
include/hw/misc/bcm2835_thermal.hcreate mode 100644include/hw/timer/bcm2835_systmr.hcreate mode 100644hw/misc/bcm2835_thermal.ccreate mode 100644hw/timer/bcm2835_systmr.ccreate mode 100644tests/arm-cpu-features.ccreate mode 100644docs/arm-cpu-features.rst
Quoted 7 lines
If this pull ever fails, please consider fixing:
typo "device":
https://www.mail-archive.com/[email protected]/msg654117.htmlTested-by: Mark Cave-Ayland
https://www.mail-archive.com/[email protected]/msg653861.html
Certainly it's not worth a re-spin just on account of a missing tag, I really just wanted to confirm that the changes are good here :)
ATB,
Mark.