@@ -26,6 +26,7 @@ struct s1_walk_info {
26
26
bool hpd ;
27
27
bool e0poe ;
28
28
bool poe ;
29
+ bool pan ;
29
30
bool be ;
30
31
bool s2 ;
31
32
};
@@ -151,6 +152,8 @@ static int setup_s1_walk(struct kvm_vcpu *vcpu, u32 op, struct s1_walk_info *wi,
151
152
152
153
wi -> regime = compute_translation_regime (vcpu , op );
153
154
as_el0 = (op == OP_AT_S1E0R || op == OP_AT_S1E0W );
155
+ wi -> pan = (op == OP_AT_S1E1RP || op == OP_AT_S1E1WP ) &&
156
+ (* vcpu_cpsr (vcpu ) & PSR_PAN_BIT );
154
157
155
158
va55 = va & BIT (55 );
156
159
@@ -1020,10 +1023,12 @@ static void compute_s1_indirect_permissions(struct kvm_vcpu *vcpu,
1020
1023
}
1021
1024
}
1022
1025
1023
- static void compute_s1_permissions (struct kvm_vcpu * vcpu , u32 op ,
1026
+ static void compute_s1_permissions (struct kvm_vcpu * vcpu ,
1024
1027
struct s1_walk_info * wi ,
1025
1028
struct s1_walk_result * wr )
1026
1029
{
1030
+ bool pan ;
1031
+
1027
1032
if (!s1pie_enabled (vcpu , wi -> regime ))
1028
1033
compute_s1_direct_permissions (vcpu , wi , wr );
1029
1034
else
@@ -1032,14 +1037,10 @@ static void compute_s1_permissions(struct kvm_vcpu *vcpu, u32 op,
1032
1037
if (!wi -> hpd )
1033
1038
compute_s1_hierarchical_permissions (vcpu , wi , wr );
1034
1039
1035
- if (op == OP_AT_S1E1RP || op == OP_AT_S1E1WP ) {
1036
- bool pan ;
1037
-
1038
- pan = * vcpu_cpsr (vcpu ) & PSR_PAN_BIT ;
1039
- pan &= wr -> ur || wr -> uw || (pan3_enabled (vcpu , wi -> regime ) && wr -> ux );
1040
- wr -> pw &= !pan ;
1041
- wr -> pr &= !pan ;
1042
- }
1040
+ pan = wi -> pan && (wr -> ur || wr -> uw ||
1041
+ (pan3_enabled (vcpu , wi -> regime ) && wr -> ux ));
1042
+ wr -> pw &= !pan ;
1043
+ wr -> pr &= !pan ;
1043
1044
}
1044
1045
1045
1046
static u64 handle_at_slow (struct kvm_vcpu * vcpu , u32 op , u64 vaddr )
@@ -1065,7 +1066,7 @@ static u64 handle_at_slow(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
1065
1066
if (ret )
1066
1067
goto compute_par ;
1067
1068
1068
- compute_s1_permissions (vcpu , op , & wi , & wr );
1069
+ compute_s1_permissions (vcpu , & wi , & wr );
1069
1070
1070
1071
switch (op ) {
1071
1072
case OP_AT_S1E1RP :
0 commit comments