[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 21/71] target/arm: Implement TPIDR2_EL0
From: |
Peter Maydell |
Subject: |
Re: [PATCH 21/71] target/arm: Implement TPIDR2_EL0 |
Date: |
Mon, 6 Jun 2022 14:18:57 +0100 |
On Thu, 2 Jun 2022 at 23:11, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> This register is part of SME, but isn't closely related to the
> rest of the extension.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/cpu.h | 1 +
> target/arm/helper.c | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index 24c5266f35..245d144fa1 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -474,6 +474,7 @@ typedef struct CPUArchState {
> };
> uint64_t tpidr_el[4];
> };
> + uint64_t tpidr2_el0;
> /* The secure banks of these registers don't map anywhere */
> uint64_t tpidrurw_s;
> uint64_t tpidrprw_s;
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 48534db0bd..204c5cf849 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -6283,6 +6283,35 @@ static const ARMCPRegInfo zcr_reginfo[] = {
> .writefn = zcr_write, .raw_writefn = raw_write },
> };
>
> +#ifdef TARGET_AARCH64
> +static CPAccessResult access_tpidr2(CPUARMState *env, const ARMCPRegInfo *ri,
> + bool isread)
> +{
> + int el = arm_current_el(env);
> +
> + if (el == 0) {
> + uint64_t sctlr = arm_sctlr(env, el);
> + if (!(sctlr & SCTLR_EnTP2)) {
> + uint64_t hcr = arm_hcr_el2_eff(env);
> + return hcr & HCR_TGE ? CP_ACCESS_TRAP_EL2 : CP_ACCESS_TRAP;
Do we really need to do this rather than just returning
CP_ACCESS_TRAP and letting the "take trap to EL2 if TGE
enabled" check in raise_exception() do the TGE routing?
> + }
> + }
> + if (el < 3
> + && arm_feature(env, ARM_FEATURE_EL3)
> + && !(env->cp15.scr_el3 & SCR_ENTP2)) {
> + return CP_ACCESS_TRAP_EL3;
> + }
> + return CP_ACCESS_OK;
> +}
thanks
-- PMM
- [PATCH 22/71] target/arm: Add SMEEXC_EL to TB flags, (continued)
- [PATCH 22/71] target/arm: Add SMEEXC_EL to TB flags, Richard Henderson, 2022/06/02
- [PATCH 28/71] target/arm: Add PSTATE.{SM,ZA} to TB flags, Richard Henderson, 2022/06/02
- [PATCH 18/71] target/arm: Export bfdotadd from vec_helper.c, Richard Henderson, 2022/06/02
- [PATCH 19/71] target/arm: Add isar_feature_aa64_sme, Richard Henderson, 2022/06/02
- [PATCH 14/71] target/arm: Export sve contiguous ldst support functions, Richard Henderson, 2022/06/02
- [PATCH 21/71] target/arm: Implement TPIDR2_EL0, Richard Henderson, 2022/06/02
- Re: [PATCH 21/71] target/arm: Implement TPIDR2_EL0,
Peter Maydell <=
- [PATCH 23/71] target/arm: Add syn_smetrap, Richard Henderson, 2022/06/02
- [PATCH 25/71] target/arm: Add SVCR, Richard Henderson, 2022/06/02
- [PATCH 24/71] target/arm: Add ARM_CP_SME, Richard Henderson, 2022/06/02
- [PATCH 27/71] target/arm: Add SMIDR_EL1, SMPRI_EL1, SMPRIMAP_EL2, Richard Henderson, 2022/06/02