mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-10-19 21:58:23 +02:00
target/arm: Implement the ARMv8.1-HPD extension
Since the TCR_*.HPD bits were RES0 in ARMv8.0, we can simply interpret the bits as if ARMv8.1-HPD is present without checking. We will need a slightly different check for hpd for aarch32. Backports commit 037c13c5904f5fc67bb0ab7dd91ae07347aedee9 from qemu
This commit is contained in:
parent
0e08c37773
commit
3cfd660814
@ -269,6 +269,10 @@ static void aarch64_max_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
|||||||
t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1);
|
t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1);
|
||||||
cpu->isar.id_aa64pfr0 = t;
|
cpu->isar.id_aa64pfr0 = t;
|
||||||
|
|
||||||
|
t = cpu->isar.id_aa64mmfr1;
|
||||||
|
t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */
|
||||||
|
cpu->isar.id_aa64mmfr1 = t;
|
||||||
|
|
||||||
/* Replicate the same data to the 32-bit id registers. */
|
/* Replicate the same data to the 32-bit id registers. */
|
||||||
u = cpu->isar.id_isar5;
|
u = cpu->isar.id_isar5;
|
||||||
u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
|
u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
|
||||||
|
@ -8840,6 +8840,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
|||||||
bool ttbr1_valid = true;
|
bool ttbr1_valid = true;
|
||||||
uint64_t descaddrmask;
|
uint64_t descaddrmask;
|
||||||
bool aarch64 = arm_el_is_aa64(env, el);
|
bool aarch64 = arm_el_is_aa64(env, el);
|
||||||
|
bool hpd = false;
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
* This code does not handle the different format TCR for VTCR_EL2.
|
* This code does not handle the different format TCR for VTCR_EL2.
|
||||||
@ -8954,6 +8955,13 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
|||||||
if (tg == 2) { /* 16KB pages */
|
if (tg == 2) { /* 16KB pages */
|
||||||
stride = 11;
|
stride = 11;
|
||||||
}
|
}
|
||||||
|
if (aarch64) {
|
||||||
|
if (el > 1) {
|
||||||
|
hpd = extract64(tcr->raw_tcr, 24, 1);
|
||||||
|
} else {
|
||||||
|
hpd = extract64(tcr->raw_tcr, 41, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* We should only be here if TTBR1 is valid */
|
/* We should only be here if TTBR1 is valid */
|
||||||
assert(ttbr1_valid);
|
assert(ttbr1_valid);
|
||||||
@ -8969,6 +8977,9 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
|||||||
if (tg == 1) { /* 16KB pages */
|
if (tg == 1) { /* 16KB pages */
|
||||||
stride = 11;
|
stride = 11;
|
||||||
}
|
}
|
||||||
|
if (aarch64) {
|
||||||
|
hpd = extract64(tcr->raw_tcr, 42, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Here we should have set up all the parameters for the translation:
|
/* Here we should have set up all the parameters for the translation:
|
||||||
@ -9062,7 +9073,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
|||||||
descaddr = descriptor & descaddrmask;
|
descaddr = descriptor & descaddrmask;
|
||||||
|
|
||||||
if ((descriptor & 2) && (level < 3)) {
|
if ((descriptor & 2) && (level < 3)) {
|
||||||
/* Table entry. The top five bits are attributes which may
|
/* Table entry. The top five bits are attributes which may
|
||||||
* propagate down through lower levels of the table (and
|
* propagate down through lower levels of the table (and
|
||||||
* which are all arranged so that 0 means "no effect", so
|
* which are all arranged so that 0 means "no effect", so
|
||||||
* we can gather them up by ORing in the bits at each level).
|
* we can gather them up by ORing in the bits at each level).
|
||||||
@ -9087,15 +9098,17 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Merge in attributes from table descriptors */
|
/* Merge in attributes from table descriptors */
|
||||||
attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */
|
attrs |= nstable << 3; /* NS */
|
||||||
attrs |= extract32(tableattrs, 3, 1) << 5; /* APTable[1] => AP[2] */
|
if (hpd) {
|
||||||
|
/* HPD disables all the table attributes except NSTable. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */
|
||||||
/* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
|
/* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
|
||||||
* means "force PL1 access only", which means forcing AP[1] to 0.
|
* means "force PL1 access only", which means forcing AP[1] to 0.
|
||||||
*/
|
*/
|
||||||
if (extract32(tableattrs, 2, 1)) {
|
attrs &= ~(extract32(tableattrs, 2, 1) << 4); /* !APT[0] => AP[1] */
|
||||||
attrs &= ~(1 << 4);
|
attrs |= extract32(tableattrs, 3, 1) << 5; /* APT[1] => AP[2] */
|
||||||
}
|
|
||||||
attrs |= nstable << 3; /* NS */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Here descaddr is the final physical address, and attributes
|
/* Here descaddr is the final physical address, and attributes
|
||||||
|
Loading…
Reference in New Issue
Block a user