mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-27 13:45:07 +00:00
target/arm: Honor the HCR_EL2.TPCP bit
This bit traps EL1 access to cache maintenance insns that operate to the point of coherency or persistence. Backports commit 1bed4d2e55459129c19f5952bcfc65bd0c70db5b from qemu
This commit is contained in:
parent
8ff8ff0c4a
commit
f35a83d5ff
|
@ -4105,6 +4105,28 @@ static CPAccessResult aa64_cacheop_access(CPUARMState *env,
|
|||
return CP_ACCESS_OK;
|
||||
}
|
||||
|
||||
static CPAccessResult aa64_cacheop_poc_access(CPUARMState *env,
|
||||
const ARMCPRegInfo *ri,
|
||||
bool isread)
|
||||
{
|
||||
/* Cache invalidate/clean to Point of Coherency or Persistence... */
|
||||
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.TPCP is set. */
|
||||
if (arm_hcr_el2_eff(env) & HCR_TPCP) {
|
||||
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)
|
||||
*/
|
||||
|
@ -4529,14 +4551,15 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||
.accessfn = aa64_cacheop_access },
|
||||
{ .name = "DC_IVAC", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1,
|
||||
.access = PL1_W, .type = ARM_CP_NOP },
|
||||
.access = PL1_W, .accessfn = aa64_cacheop_poc_access,
|
||||
.type = ARM_CP_NOP },
|
||||
{ .name = "DC_ISW", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2,
|
||||
.access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP },
|
||||
{ .name = "DC_CVAC", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 10, .opc2 = 1,
|
||||
.access = PL0_W, .type = ARM_CP_NOP,
|
||||
.accessfn = aa64_cacheop_access },
|
||||
.accessfn = aa64_cacheop_poc_access },
|
||||
{ .name = "DC_CSW", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 2,
|
||||
.access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP },
|
||||
|
@ -4547,7 +4570,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||
{ .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,
|
||||
.accessfn = aa64_cacheop_access },
|
||||
.accessfn = aa64_cacheop_poc_access },
|
||||
{ .name = "DC_CISW", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2,
|
||||
.access = PL1_W, .accessfn = access_tsw, .type = ARM_CP_NOP },
|
||||
|
@ -4729,17 +4752,17 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
|
|||
{ .name = "BPIMVA", .cp = 15, .opc1 = 0, .crn = 7, .crm = 5, .opc2 = 7,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
{ .name = "DCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access },
|
||||
{ .name = "DCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 2,
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw },
|
||||
{ .name = "DCCMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 10, .opc2 = 1,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access },
|
||||
{ .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 },
|
||||
{ .name = "DCCIMVAC", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 1,
|
||||
.type = ARM_CP_NOP, .access = PL1_W },
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_poc_access },
|
||||
{ .name = "DCCISW", .cp = 15, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 2,
|
||||
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw },
|
||||
/* MMU Domain access control / MPU write buffer control */
|
||||
|
@ -6551,7 +6574,7 @@ static const ARMCPRegInfo dcpop_reg[] = {
|
|||
{ .name = "DC_CVAP", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 1,
|
||||
.access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END,
|
||||
.accessfn = aa64_cacheop_access, .writefn = dccvap_writefn },
|
||||
.accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn },
|
||||
REGINFO_SENTINEL
|
||||
};
|
||||
|
||||
|
@ -6559,7 +6582,7 @@ static const ARMCPRegInfo dcpodp_reg[] = {
|
|||
{ .name = "DC_CVADP", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 1,
|
||||
.access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END,
|
||||
.accessfn = aa64_cacheop_access, .writefn = dccvap_writefn },
|
||||
.accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn },
|
||||
REGINFO_SENTINEL
|
||||
};
|
||||
#endif /*CONFIG_USER_ONLY*/
|
||||
|
|
Loading…
Reference in a new issue