[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v11 23/55] target/arm: move arm_sctlr away from tcg helpers
From: |
Claudio Fontana |
Subject: |
Re: [RFC v11 23/55] target/arm: move arm_sctlr away from tcg helpers |
Date: |
Thu, 25 Mar 2021 15:26:00 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
On 3/24/21 11:07 PM, Richard Henderson wrote:
> On 3/23/21 9:46 AM, Claudio Fontana wrote:
>> this function is used for kvm too, add it to the
>> cpu-common module.
>>
>> Signed-off-by: Claudio Fontana <cfontana@suse.de>
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
>> /* #endif TARGET_AARCH64 , see matching comment above */
>> +
>> +uint64_t arm_sctlr(CPUARMState *env, int el)
>> +{
>> + /* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */
>> + if (el == 0) {
>> + ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, 0);
>> + el = (mmu_idx == ARMMMUIdx_E20_0 || mmu_idx == ARMMMUIdx_SE20_0)
>> + ? 2 : 1;
>
> I only thought of it because of the comment, but *E20_0 is aarch64 only;
> aarch32 always uses el = 1 here. ;-)
>
>
> r~
In this case, maybe we should do:
uint64_t arm_sctlr(CPUARMState *env, int el)
{
/* Only EL0 needs to be adjusted for EL1&0 or EL2&0. */
if (el == 0) {
#ifdef TARGET_AARCH64
ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, 0);
el = (mmu_idx == ARMMMUIdx_E20_0 || mmu_idx == ARMMMUIdx_SE20_0)
? 2 : 1;
#else
el = 1;
#endif
}
return env->cp15.sctlr_el[el];
}
?
Thanks,
Claudio
- [RFC v11 13/55] target/arm: split cpregs from tcg/helper.c, (continued)
- [RFC v11 13/55] target/arm: split cpregs from tcg/helper.c, Claudio Fontana, 2021/03/23
- [RFC v11 19/55] target/arm: add temporary stub for arm_rebuild_hflags, Claudio Fontana, 2021/03/23
- [RFC v11 20/55] target/arm: split vfp state setting from tcg helpers, Claudio Fontana, 2021/03/23
- [RFC v11 21/55] target/arm: move arm_mmu_idx* to cpu-mmu, Claudio Fontana, 2021/03/23
- [RFC v11 23/55] target/arm: move arm_sctlr away from tcg helpers, Claudio Fontana, 2021/03/23
- [RFC v11 24/55] target/arm: move arm_cpu_list to common_cpu, Claudio Fontana, 2021/03/23
- [RFC v11 22/55] target/arm: move sve_zcr_len_for_el to common_cpu, Claudio Fontana, 2021/03/23
- [RFC v11 25/55] target/arm: move aarch64_sync_32_to_64 (and vv) to cpu code, Claudio Fontana, 2021/03/23
- [RFC v11 26/55] target/arm: split a15 cpu model and 32bit class functions to cpu32.c, Claudio Fontana, 2021/03/23
- [RFC v11 30/55] target/arm: wrap call to aarch64_sve_change_el in tcg_enabled(), Claudio Fontana, 2021/03/23