mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 23:45:35 +00:00
target/arm: Honor the HCR_EL2.TPU bit
This bit traps EL1 access to cache maintenance insns that operate to the point of unification. There are no longer any references to plain aa64_cacheop_access, so remove it. Backports commit 38262d8a732f8bd0e9ca3dc064f6e73d00c08b9a from qemu
This commit is contained in:
parent
8889cc9af8
commit
74d6aa6012
|
@ -4092,19 +4092,6 @@ static const ARMCPRegInfo uao_reginfo = {
|
|||
.readfn = aa64_uao_read, .writefn = aa64_uao_write
|
||||
};
|
||||
|
||||
static CPAccessResult aa64_cacheop_access(CPUARMState *env,
|
||||
const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
/* Cache invalidate/clean: NOP, but EL0 must UNDEF unless
|
||||
* SCTLR_EL1.UCI is set.
|
||||
*/
|
||||
if (arm_current_el(env) == 0 && !(arm_sctlr(env, 0) & SCTLR_UCI)) {
|
||||
return CP_ACCESS_TRAP;
|
||||
}
|
||||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env,
|
||||
const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
|
@ -4127,6 +4114,28 @@ static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env,
|
|||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
static CPAccessResult aa64_cacheop_pou_access(CPUARMState *env,
|
||||
const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
/* Cache invalidate/clean to Point of Unification... */
|
||||
switch (arm_current_el(env)) {
|
||||
case 0:
|
||||
/* ... EL0 must UNDEF unless SCTLR_EL1.UCI is set. */
|
||||
if (!(arm_sctlr(env, 0) & SCTLR_UCI)) {
|
||||
return CP_ACCESS_TRAP;
|
||||
}
|
||||
/* fall through */
|
||||
case 1:
|
||||
/* ... EL1 must trap to EL2 if HCR_EL2.TPU is set. */
|
||||
if (arm_hcr_el2_eff(env) & HCR_TPU) {
|
||||
return CP_ACCESS_TRAP_EL2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
/* See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions
|
||||
* Page D4-1736 (DDI0487A.b)
|
||||
*/
|
||||
|
@ -4541,14 +4550,16 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||
/* Cache ops: all NOPs since we don't emulate caches */
|
||||
{ .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0,
|
||||
.access = PL1_W, .type = ARM_CP_NOP },
|
||||
.access = PL1_W, .type = ARM_CP_NOP,
|
||||
.accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "IC_IALLU", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0,
|
||||
.access = PL1_W, .type = ARM_CP_NOP },
|
||||
.access = PL1_W, .type = ARM_CP_NOP,
|
||||
.accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "IC_IVAU", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1,
|
||||
.access = PL0_W, .type = ARM_CP_NOP,
|
||||
.accessfn = aa64_cacheop_access },
|
||||
.accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "DC_IVAC", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1,
|
||||
.access = PL1_W, .accessfn = aa64_cacheop_poc_access,
|
||||
|
@ -4566,7 +4577,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||
{ .name = "DC_CVAU", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 11, .opc2 = 1,
|
||||
.access = PL0_W, .type = ARM_CP_NOP,
|
||||
.accessfn = aa64_cacheop_access },
|
||||
.accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "DC_CIVAC", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 14, .opc2 = 1,
|
||||
.access = PL0_W, .type = ARM_CP_NOP,
|
||||
|
@ -4740,13 +4751,13 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||
.writefn = tlbiipas2_is_write },
|
||||
/* 32 bit cache operations */
|
||||
{ .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "BPIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 6,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
{ .name = "ICIALLU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 0,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "ICIMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 1,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "BPIALL", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 6,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
{ .name = "BPIMVA", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 7,
|
||||
|
@ -4760,7 +4771,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||
{ .name = "DCCSW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2,
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw },
|
||||
{ .name = "DCCMVAU", .cp = 15, .opc1 = 0, .crn = 7, .crm = 11, .opc2 = 1,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
|
||||
{ .name = "DCCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 1,
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access },
|
||||
{ .name = "DCCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2,
|
||||
|
|
Loading…
Reference in a new issue