mirror of https://github.com/xemu-project/xemu.git
target/arm: Store VTCR_EL2, VSTCR_EL2 registers as uint64_t
Change the representation of the VSTCR_EL2 and VTCR_EL2 registers in the CPU state struct from struct TCR to uint64_t. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220714132303.1287193-6-peter.maydell@linaro.org
This commit is contained in:
parent
afbb181c2d
commit
988cc1909f
|
@ -340,8 +340,8 @@ typedef struct CPUArchState {
|
||||||
uint64_t vsttbr_el2; /* Secure Virtualization Translation Table. */
|
uint64_t vsttbr_el2; /* Secure Virtualization Translation Table. */
|
||||||
/* MMU translation table base control. */
|
/* MMU translation table base control. */
|
||||||
TCR tcr_el[4];
|
TCR tcr_el[4];
|
||||||
TCR vtcr_el2; /* Virtualization Translation Control. */
|
uint64_t vtcr_el2; /* Virtualization Translation Control. */
|
||||||
TCR vstcr_el2; /* Secure Virtualization Translation Control. */
|
uint64_t vstcr_el2; /* Secure Virtualization Translation Control. */
|
||||||
uint32_t c2_data; /* MPU data cacheable bits. */
|
uint32_t c2_data; /* MPU data cacheable bits. */
|
||||||
uint32_t c2_insn; /* MPU instruction cacheable bits. */
|
uint32_t c2_insn; /* MPU instruction cacheable bits. */
|
||||||
union { /* MMU domain access control register
|
union { /* MMU domain access control register
|
||||||
|
|
|
@ -5413,9 +5413,7 @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
|
||||||
{ .name = "VTCR_EL2", .state = ARM_CP_STATE_AA64,
|
{ .name = "VTCR_EL2", .state = ARM_CP_STATE_AA64,
|
||||||
.opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2,
|
.opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2,
|
||||||
.access = PL2_RW,
|
.access = PL2_RW,
|
||||||
/* no .writefn needed as this can't cause an ASID change;
|
/* no .writefn needed as this can't cause an ASID change */
|
||||||
* no .raw_writefn or .resetfn needed as we never use mask/base_mask
|
|
||||||
*/
|
|
||||||
.fieldoffset = offsetof(CPUARMState, cp15.vtcr_el2) },
|
.fieldoffset = offsetof(CPUARMState, cp15.vtcr_el2) },
|
||||||
{ .name = "VTTBR", .state = ARM_CP_STATE_AA32,
|
{ .name = "VTTBR", .state = ARM_CP_STATE_AA32,
|
||||||
.cp = 15, .opc1 = 6, .crm = 2,
|
.cp = 15, .opc1 = 6, .crm = 2,
|
||||||
|
|
|
@ -781,14 +781,14 @@ static inline uint64_t regime_sctlr(CPUARMState *env, ARMMMUIdx mmu_idx)
|
||||||
static inline uint64_t regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
|
static inline uint64_t regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
|
||||||
{
|
{
|
||||||
if (mmu_idx == ARMMMUIdx_Stage2) {
|
if (mmu_idx == ARMMMUIdx_Stage2) {
|
||||||
return env->cp15.vtcr_el2.raw_tcr;
|
return env->cp15.vtcr_el2;
|
||||||
}
|
}
|
||||||
if (mmu_idx == ARMMMUIdx_Stage2_S) {
|
if (mmu_idx == ARMMMUIdx_Stage2_S) {
|
||||||
/*
|
/*
|
||||||
* Note: Secure stage 2 nominally shares fields from VTCR_EL2, but
|
* Note: Secure stage 2 nominally shares fields from VTCR_EL2, but
|
||||||
* those are not currently used by QEMU, so just return VSTCR_EL2.
|
* those are not currently used by QEMU, so just return VSTCR_EL2.
|
||||||
*/
|
*/
|
||||||
return env->cp15.vstcr_el2.raw_tcr;
|
return env->cp15.vstcr_el2;
|
||||||
}
|
}
|
||||||
return env->cp15.tcr_el[regime_el(env, mmu_idx)].raw_tcr;
|
return env->cp15.tcr_el[regime_el(env, mmu_idx)].raw_tcr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,9 +241,9 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
|
||||||
if (arm_is_secure_below_el3(env)) {
|
if (arm_is_secure_below_el3(env)) {
|
||||||
/* Check if page table walk is to secure or non-secure PA space. */
|
/* Check if page table walk is to secure or non-secure PA space. */
|
||||||
if (*is_secure) {
|
if (*is_secure) {
|
||||||
*is_secure = !(env->cp15.vstcr_el2.raw_tcr & VSTCR_SW);
|
*is_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
|
||||||
} else {
|
} else {
|
||||||
*is_secure = !(env->cp15.vtcr_el2.raw_tcr & VTCR_NSW);
|
*is_secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(!*is_secure);
|
assert(!*is_secure);
|
||||||
|
@ -2341,9 +2341,9 @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
|
||||||
ipa_secure = attrs->secure;
|
ipa_secure = attrs->secure;
|
||||||
if (arm_is_secure_below_el3(env)) {
|
if (arm_is_secure_below_el3(env)) {
|
||||||
if (ipa_secure) {
|
if (ipa_secure) {
|
||||||
attrs->secure = !(env->cp15.vstcr_el2.raw_tcr & VSTCR_SW);
|
attrs->secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
|
||||||
} else {
|
} else {
|
||||||
attrs->secure = !(env->cp15.vtcr_el2.raw_tcr & VTCR_NSW);
|
attrs->secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(!ipa_secure);
|
assert(!ipa_secure);
|
||||||
|
@ -2385,11 +2385,11 @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
|
||||||
if (arm_is_secure_below_el3(env)) {
|
if (arm_is_secure_below_el3(env)) {
|
||||||
if (ipa_secure) {
|
if (ipa_secure) {
|
||||||
attrs->secure =
|
attrs->secure =
|
||||||
!(env->cp15.vstcr_el2.raw_tcr & (VSTCR_SA | VSTCR_SW));
|
!(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW));
|
||||||
} else {
|
} else {
|
||||||
attrs->secure =
|
attrs->secure =
|
||||||
!((env->cp15.vtcr_el2.raw_tcr & (VTCR_NSA | VTCR_NSW))
|
!((env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))
|
||||||
|| (env->cp15.vstcr_el2.raw_tcr & (VSTCR_SA | VSTCR_SW)));
|
|| (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue