@@ -194,6 +194,11 @@ struct erri_config {
194
194
__u16 nrtdp ;
195
195
};
196
196
197
+ struct ieee1667_get_cq_entry {
198
+ __u32 enabled :3 ;
199
+ __u32 rsvd3 :29 ;
200
+ };
201
+
197
202
static const char * sel = "[0-3]: current/default/saved/supported" ;
198
203
static const char * no_uuid = "Skip UUID index search (UUID index not required for OCP 1.0)" ;
199
204
const char * data = "Error injection data structure entries" ;
@@ -4141,3 +4146,67 @@ static int set_error_injection(int argc, char **argv, struct command *cmd, struc
4141
4146
4142
4147
return error_injection_set (dev , & cfg , !argconfig_parse_seen (opts , "no-uuid" ));
4143
4148
}
4149
+
4150
+ static int enable_ieee1667_silo_get (struct nvme_dev * dev , const __u8 sel , bool uuid )
4151
+ {
4152
+ struct ieee1667_get_cq_entry cq_entry ;
4153
+ int err ;
4154
+ const __u8 fid = 0xc4 ;
4155
+
4156
+ struct nvme_get_features_args args = {
4157
+ .result = (__u32 * )& cq_entry ,
4158
+ .args_size = sizeof (args ),
4159
+ .fd = dev_fd (dev ),
4160
+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT ,
4161
+ .sel = sel ,
4162
+ .fid = fid ,
4163
+ };
4164
+
4165
+ if (uuid ) {
4166
+ /* OCP 2.0 requires UUID index support */
4167
+ err = ocp_get_uuid_index (dev , & args .uuidx );
4168
+ if (err || !args .uuidx ) {
4169
+ nvme_show_error ("ERROR: No OCP UUID index found" );
4170
+ return err ;
4171
+ }
4172
+ }
4173
+
4174
+ err = nvme_cli_get_features (dev , & args );
4175
+ if (!err ) {
4176
+ if (sel == NVME_GET_FEATURES_SEL_SUPPORTED )
4177
+ nvme_show_select_result (fid , * args .result );
4178
+ else
4179
+ nvme_show_result ("IEEE1667 Sifo Enabled (feature: 0x%02x): 0x%0x (%s: %s)" ,
4180
+ fid , cq_entry .enabled , nvme_select_to_string (sel ),
4181
+ cq_entry .enabled ? "enabled" : "disabled" );
4182
+ } else {
4183
+ nvme_show_error ("Could not get feature: 0x%02x." , fid );
4184
+ }
4185
+
4186
+ return err ;
4187
+ }
4188
+
4189
+ static int get_enable_ieee1667_silo (int argc , char * * argv , struct command * cmd ,
4190
+ struct plugin * plugin )
4191
+ {
4192
+ const char * desc = "return set of enable IEEE1667 silo" ;
4193
+ int err ;
4194
+ struct config {
4195
+ __u8 sel ;
4196
+ };
4197
+ struct config cfg = { 0 };
4198
+
4199
+ _cleanup_nvme_dev_ struct nvme_dev * dev = NULL ;
4200
+
4201
+ OPT_ARGS (opts ) = {
4202
+ OPT_BYTE ("sel" , 's' , & cfg .sel , sel ),
4203
+ OPT_FLAG ("no-uuid" , 'n' , NULL , no_uuid ),
4204
+ OPT_END ()
4205
+ };
4206
+
4207
+ err = parse_and_open (& dev , argc , argv , desc , opts );
4208
+ if (err )
4209
+ return err ;
4210
+
4211
+ return enable_ieee1667_silo_get (dev , cfg .sel , !argconfig_parse_seen (opts , "no-uuid" ));
4212
+ }
0 commit comments