@@ -79,6 +79,10 @@ enum cgt_group_id {
79
79
CGT_MDCR_E2TB ,
80
80
CGT_MDCR_TDCC ,
81
81
82
+ CGT_CPACR_E0POE ,
83
+ CGT_CPTR_TAM ,
84
+ CGT_CPTR_TCPAC ,
85
+
82
86
/*
83
87
* Anything after this point is a combination of coarse trap
84
88
* controls, which must all be evaluated to decide what to do.
@@ -106,6 +110,8 @@ enum cgt_group_id {
106
110
CGT_CNTHCTL_EL1PCTEN = __COMPLEX_CONDITIONS__ ,
107
111
CGT_CNTHCTL_EL1PTEN ,
108
112
113
+ CGT_CPTR_TTA ,
114
+
109
115
/* Must be last */
110
116
__NR_CGT_GROUP_IDS__
111
117
};
@@ -345,6 +351,24 @@ static const struct trap_bits coarse_trap_bits[] = {
345
351
.mask = MDCR_EL2_TDCC ,
346
352
.behaviour = BEHAVE_FORWARD_ANY ,
347
353
},
354
+ [CGT_CPACR_E0POE ] = {
355
+ .index = CPTR_EL2 ,
356
+ .value = CPACR_ELx_E0POE ,
357
+ .mask = CPACR_ELx_E0POE ,
358
+ .behaviour = BEHAVE_FORWARD_ANY ,
359
+ },
360
+ [CGT_CPTR_TAM ] = {
361
+ .index = CPTR_EL2 ,
362
+ .value = CPTR_EL2_TAM ,
363
+ .mask = CPTR_EL2_TAM ,
364
+ .behaviour = BEHAVE_FORWARD_ANY ,
365
+ },
366
+ [CGT_CPTR_TCPAC ] = {
367
+ .index = CPTR_EL2 ,
368
+ .value = CPTR_EL2_TCPAC ,
369
+ .mask = CPTR_EL2_TCPAC ,
370
+ .behaviour = BEHAVE_FORWARD_ANY ,
371
+ },
348
372
};
349
373
350
374
#define MCB (id , ...) \
@@ -410,12 +434,26 @@ static enum trap_behaviour check_cnthctl_el1pten(struct kvm_vcpu *vcpu)
410
434
return BEHAVE_FORWARD_ANY ;
411
435
}
412
436
437
+ static enum trap_behaviour check_cptr_tta (struct kvm_vcpu * vcpu )
438
+ {
439
+ u64 val = __vcpu_sys_reg (vcpu , CPTR_EL2 );
440
+
441
+ if (!vcpu_el2_e2h_is_set (vcpu ))
442
+ val = translate_cptr_el2_to_cpacr_el1 (val );
443
+
444
+ if (val & CPACR_ELx_TTA )
445
+ return BEHAVE_FORWARD_ANY ;
446
+
447
+ return BEHAVE_HANDLE_LOCALLY ;
448
+ }
449
+
413
450
#define CCC (id , fn ) \
414
451
[id - __COMPLEX_CONDITIONS__] = fn
415
452
416
453
static const complex_condition_check ccc [] = {
417
454
CCC (CGT_CNTHCTL_EL1PCTEN , check_cnthctl_el1pcten ),
418
455
CCC (CGT_CNTHCTL_EL1PTEN , check_cnthctl_el1pten ),
456
+ CCC (CGT_CPTR_TTA , check_cptr_tta ),
419
457
};
420
458
421
459
/*
@@ -1000,6 +1038,59 @@ static const struct encoding_to_trap_config encoding_to_cgt[] __initconst = {
1000
1038
SR_TRAP (SYS_TRBPTR_EL1 , CGT_MDCR_E2TB ),
1001
1039
SR_TRAP (SYS_TRBSR_EL1 , CGT_MDCR_E2TB ),
1002
1040
SR_TRAP (SYS_TRBTRG_EL1 , CGT_MDCR_E2TB ),
1041
+ SR_TRAP (SYS_CPACR_EL1 , CGT_CPTR_TCPAC ),
1042
+ SR_TRAP (SYS_AMUSERENR_EL0 , CGT_CPTR_TAM ),
1043
+ SR_TRAP (SYS_AMCFGR_EL0 , CGT_CPTR_TAM ),
1044
+ SR_TRAP (SYS_AMCGCR_EL0 , CGT_CPTR_TAM ),
1045
+ SR_TRAP (SYS_AMCNTENCLR0_EL0 , CGT_CPTR_TAM ),
1046
+ SR_TRAP (SYS_AMCNTENCLR1_EL0 , CGT_CPTR_TAM ),
1047
+ SR_TRAP (SYS_AMCNTENSET0_EL0 , CGT_CPTR_TAM ),
1048
+ SR_TRAP (SYS_AMCNTENSET1_EL0 , CGT_CPTR_TAM ),
1049
+ SR_TRAP (SYS_AMCR_EL0 , CGT_CPTR_TAM ),
1050
+ SR_TRAP (SYS_AMEVCNTR0_EL0 (0 ), CGT_CPTR_TAM ),
1051
+ SR_TRAP (SYS_AMEVCNTR0_EL0 (1 ), CGT_CPTR_TAM ),
1052
+ SR_TRAP (SYS_AMEVCNTR0_EL0 (2 ), CGT_CPTR_TAM ),
1053
+ SR_TRAP (SYS_AMEVCNTR0_EL0 (3 ), CGT_CPTR_TAM ),
1054
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (0 ), CGT_CPTR_TAM ),
1055
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (1 ), CGT_CPTR_TAM ),
1056
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (2 ), CGT_CPTR_TAM ),
1057
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (3 ), CGT_CPTR_TAM ),
1058
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (4 ), CGT_CPTR_TAM ),
1059
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (5 ), CGT_CPTR_TAM ),
1060
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (6 ), CGT_CPTR_TAM ),
1061
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (7 ), CGT_CPTR_TAM ),
1062
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (8 ), CGT_CPTR_TAM ),
1063
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (9 ), CGT_CPTR_TAM ),
1064
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (10 ), CGT_CPTR_TAM ),
1065
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (11 ), CGT_CPTR_TAM ),
1066
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (12 ), CGT_CPTR_TAM ),
1067
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (13 ), CGT_CPTR_TAM ),
1068
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (14 ), CGT_CPTR_TAM ),
1069
+ SR_TRAP (SYS_AMEVCNTR1_EL0 (15 ), CGT_CPTR_TAM ),
1070
+ SR_TRAP (SYS_AMEVTYPER0_EL0 (0 ), CGT_CPTR_TAM ),
1071
+ SR_TRAP (SYS_AMEVTYPER0_EL0 (1 ), CGT_CPTR_TAM ),
1072
+ SR_TRAP (SYS_AMEVTYPER0_EL0 (2 ), CGT_CPTR_TAM ),
1073
+ SR_TRAP (SYS_AMEVTYPER0_EL0 (3 ), CGT_CPTR_TAM ),
1074
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (0 ), CGT_CPTR_TAM ),
1075
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (1 ), CGT_CPTR_TAM ),
1076
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (2 ), CGT_CPTR_TAM ),
1077
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (3 ), CGT_CPTR_TAM ),
1078
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (4 ), CGT_CPTR_TAM ),
1079
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (5 ), CGT_CPTR_TAM ),
1080
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (6 ), CGT_CPTR_TAM ),
1081
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (7 ), CGT_CPTR_TAM ),
1082
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (8 ), CGT_CPTR_TAM ),
1083
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (9 ), CGT_CPTR_TAM ),
1084
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (10 ), CGT_CPTR_TAM ),
1085
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (11 ), CGT_CPTR_TAM ),
1086
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (12 ), CGT_CPTR_TAM ),
1087
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (13 ), CGT_CPTR_TAM ),
1088
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (14 ), CGT_CPTR_TAM ),
1089
+ SR_TRAP (SYS_AMEVTYPER1_EL0 (15 ), CGT_CPTR_TAM ),
1090
+ SR_TRAP (SYS_POR_EL0 , CGT_CPACR_E0POE ),
1091
+ /* op0=2, op1=1, and CRn<0b1000 */
1092
+ SR_RANGE_TRAP (sys_reg (2 , 1 , 0 , 0 , 0 ),
1093
+ sys_reg (2 , 1 , 7 , 15 , 7 ), CGT_CPTR_TTA ),
1003
1094
SR_TRAP (SYS_CNTP_TVAL_EL0 , CGT_CNTHCTL_EL1PTEN ),
1004
1095
SR_TRAP (SYS_CNTP_CVAL_EL0 , CGT_CNTHCTL_EL1PTEN ),
1005
1096
SR_TRAP (SYS_CNTP_CTL_EL0 , CGT_CNTHCTL_EL1PTEN ),
0 commit comments