@@ -66,7 +66,7 @@ static void init_fw_feat_flags(struct device_node *np)
66
66
if (fw_feature_is ("enabled" , "fw-bcctrl-serialized" , np ))
67
67
security_ftr_set (SEC_FTR_BCCTRL_SERIALISED );
68
68
69
- if (fw_feature_is ("enabled" , "inst-spec-barrier-ori31,31 ,0" , np ))
69
+ if (fw_feature_is ("enabled" , "inst-l1d-flush-ori30,30 ,0" , np ))
70
70
security_ftr_set (SEC_FTR_L1D_FLUSH_ORI30 );
71
71
72
72
if (fw_feature_is ("enabled" , "inst-l1d-flush-trig2" , np ))
@@ -99,52 +99,31 @@ static void pnv_setup_rfi_flush(void)
99
99
{
100
100
struct device_node * np , * fw_features ;
101
101
enum l1d_flush_type type ;
102
- int enable ;
102
+ bool enable ;
103
103
104
104
/* Default to fallback in case fw-features are not available */
105
105
type = L1D_FLUSH_FALLBACK ;
106
- enable = 1 ;
107
106
108
107
np = of_find_node_by_name (NULL , "ibm,opal" );
109
108
fw_features = of_get_child_by_name (np , "fw-features" );
110
109
of_node_put (np );
111
110
112
111
if (fw_features ) {
113
112
init_fw_feat_flags (fw_features );
113
+ of_node_put (fw_features );
114
114
115
- np = of_get_child_by_name (fw_features , "inst-l1d-flush-trig2" );
116
- if (np && of_property_read_bool (np , "enabled" ))
115
+ if (security_ftr_enabled (SEC_FTR_L1D_FLUSH_TRIG2 ))
117
116
type = L1D_FLUSH_MTTRIG ;
118
117
119
- of_node_put (np );
120
-
121
- np = of_get_child_by_name (fw_features , "inst-l1d-flush-ori30,30,0" );
122
- if (np && of_property_read_bool (np , "enabled" ))
118
+ if (security_ftr_enabled (SEC_FTR_L1D_FLUSH_ORI30 ))
123
119
type = L1D_FLUSH_ORI ;
124
-
125
- of_node_put (np );
126
-
127
- /* Enable unless firmware says NOT to */
128
- enable = 2 ;
129
- np = of_get_child_by_name (fw_features , "needs-l1d-flush-msr-hv-1-to-0" );
130
- if (np && of_property_read_bool (np , "disabled" ))
131
- enable -- ;
132
-
133
- of_node_put (np );
134
-
135
- np = of_get_child_by_name (fw_features , "needs-l1d-flush-msr-pr-0-to-1" );
136
- if (np && of_property_read_bool (np , "disabled" ))
137
- enable -- ;
138
-
139
- np = of_get_child_by_name (fw_features , "speculation-policy-favor-security" );
140
- if (np && of_property_read_bool (np , "disabled" ))
141
- enable = 0 ;
142
-
143
- of_node_put (np );
144
- of_node_put (fw_features );
145
120
}
146
121
147
- setup_rfi_flush (type , enable > 0 );
122
+ enable = security_ftr_enabled (SEC_FTR_FAVOUR_SECURITY ) && \
123
+ (security_ftr_enabled (SEC_FTR_L1D_FLUSH_PR ) || \
124
+ security_ftr_enabled (SEC_FTR_L1D_FLUSH_HV ));
125
+
126
+ setup_rfi_flush (type , enable );
148
127
}
149
128
150
129
static void __init pnv_setup_arch (void )
0 commit comments