target/arm: Decode TBID from TCR

Use TBID in aa64_va_parameters depending on the data parameter.
This automatically updates all existing users of the function.

Backports commit 8220af7e4d34c858898fbfe55943aeea8f4e875f from qemu
This commit is contained in:
Richard Henderson 2019-01-22 16:27:34 -05:00 committed by Lioncash
parent b99e2f920b
commit 028aef155a
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 12 additions and 3 deletions

View file

@ -8953,7 +8953,7 @@ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va,
{
uint64_t tcr = regime_tcr(env, mmu_idx)->raw_tcr;
uint32_t el = regime_el(env, mmu_idx);
bool tbi, epd, hpd, using16k, using64k;
bool tbi, tbid, epd, hpd, using16k, using64k;
int select, tsz;
ARMVAParameters result = {0};
@ -8969,10 +8969,11 @@ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va,
using16k = extract32(tcr, 15, 1);
if (mmu_idx == ARMMMUIdx_S2NS) {
/* VTCR_EL2 */
tbi = hpd = false;
tbi = tbid = hpd = false;
} else {
tbi = extract32(tcr, 20, 1);
hpd = extract32(tcr, 24, 1);
tbid = extract32(tcr, 29, 1);
}
epd = false;
} else if (!select) {
@ -8982,6 +8983,7 @@ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va,
using16k = extract32(tcr, 15, 1);
tbi = extract64(tcr, 37, 1);
hpd = extract64(tcr, 41, 1);
tbid = extract64(tcr, 51, 1);
} else {
int tg = extract32(tcr, 30, 2);
using16k = tg == 1;
@ -8990,6 +8992,7 @@ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va,
epd = extract32(tcr, 23, 1);
tbi = extract64(tcr, 38, 1);
hpd = extract64(tcr, 42, 1);
tbid = extract64(tcr, 52, 1);
}
tsz = MIN(tsz, 39); /* TODO: ARMv8.4-TTST */
tsz = MAX(tsz, 16); /* TODO: ARMv8.2-LVA */
@ -8997,6 +9000,7 @@ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va,
result.tsz = tsz;
result.select = select;
result.tbi = tbi;
result.tbid = tbid;
result.epd = epd;
result.hpd = hpd;
result.using16k = using16k;
@ -9007,7 +9011,11 @@ ARMVAParameters aa64_va_parameters_both(CPUARMState *env, uint64_t va,
ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
ARMMMUIdx mmu_idx, bool data)
{
return aa64_va_parameters_both(env, va, mmu_idx);
ARMVAParameters ret = aa64_va_parameters_both(env, va, mmu_idx);
/* Present TBI as a composite with TBID. */
ret.tbi &= (data || !ret.tbid);
return ret;
}
static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va,

View file

@ -952,6 +952,7 @@ typedef struct ARMVAParameters {
unsigned tsz : 8;
unsigned select : 1;
bool tbi : 1;
bool tbid : 1;
bool epd : 1;
bool hpd : 1;
bool using16k : 1;