Skip to content

Commit bf0e5bf

Browse files
rgongatintelgregkh
authored andcommitted
firmware: stratix10-svc: extend svc to support new RSU features
Extend Intel Stratix10 service layer driver to support new RSU DCMF versions and max retry parameter. DCMF = Decision Configuration Management Firmware. The max retry parameter is the maximum times the images is allowed to reload itself before giving up and starting RSU failover flow. Signed-off-by: Richard Gong <richard.gong@intel.com> Link: https://lore.kernel.org/r/1592231348-31334-3-git-send-email-richard.gong@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 36847f9 commit bf0e5bf

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

‎drivers/firmware/stratix10-svc.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,15 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data,
305305
cb_data->status = BIT(SVC_STATUS_COMPLETED);
306306
break;
307307
case COMMAND_RSU_RETRY:
308+
case COMMAND_RSU_MAX_RETRY:
308309
cb_data->status = BIT(SVC_STATUS_OK);
309310
cb_data->kaddr1 = &res.a1;
310311
break;
312+
case COMMAND_RSU_DCMF_VERSION:
313+
cb_data->status = BIT(SVC_STATUS_OK);
314+
cb_data->kaddr1 = &res.a1;
315+
cb_data->kaddr2 = &res.a2;
316+
break;
311317
default:
312318
pr_warn("it shouldn't happen\n");
313319
break;
@@ -406,6 +412,16 @@ static int svc_normal_to_secure_thread(void *data)
406412
a1 = 0;
407413
a2 = 0;
408414
break;
415+
case COMMAND_RSU_MAX_RETRY:
416+
a0 = INTEL_SIP_SMC_RSU_MAX_RETRY;
417+
a1 = 0;
418+
a2 = 0;
419+
break;
420+
case COMMAND_RSU_DCMF_VERSION:
421+
a0 = INTEL_SIP_SMC_RSU_DCMF_VERSION;
422+
a1 = 0;
423+
a2 = 0;
424+
break;
409425
default:
410426
pr_warn("it shouldn't happen\n");
411427
break;
@@ -474,6 +490,7 @@ static int svc_normal_to_secure_thread(void *data)
474490
* doesn't support RSU notify or retry
475491
*/
476492
if ((pdata->command == COMMAND_RSU_RETRY) ||
493+
(pdata->command == COMMAND_RSU_MAX_RETRY) ||
477494
(pdata->command == COMMAND_RSU_NOTIFY)) {
478495
cbdata->status =
479496
BIT(SVC_STATUS_NO_SUPPORT);

‎include/linux/firmware/intel/stratix10-smc.h‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,46 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
361361
#define INTEL_SIP_SMC_FUNCID_RSU_RETRY_COUNTER 15
362362
#define INTEL_SIP_SMC_RSU_RETRY_COUNTER \
363363
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_RSU_RETRY_COUNTER)
364+
365+
/**
366+
* Request INTEL_SIP_SMC_RSU_DCMF_VERSION
367+
*
368+
* Sync call used by service driver at EL1 to query DCMF (Decision
369+
* Configuration Management Firmware) version from FW
370+
*
371+
* Call register usage:
372+
* a0 INTEL_SIP_SMC_RSU_DCMF_VERSION
373+
* a1-7 not used
374+
*
375+
* Return status
376+
* a0 INTEL_SIP_SMC_STATUS_OK
377+
* a1 dcmf1 | dcmf0
378+
* a2 dcmf3 | dcmf2
379+
*
380+
* Or
381+
*
382+
* a0 INTEL_SIP_SMC_RSU_ERROR
383+
*/
384+
#define INTEL_SIP_SMC_FUNCID_RSU_DCMF_VERSION 16
385+
#define INTEL_SIP_SMC_RSU_DCMF_VERSION \
386+
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_RSU_DCMF_VERSION)
387+
388+
/**
389+
* Request INTEL_SIP_SMC_RSU_MAX_RETRY
390+
*
391+
* Sync call used by service driver at EL1 to query max retry value from FW
392+
*
393+
* Call register usage:
394+
* a0 INTEL_SIP_SMC_RSU_MAX_RETRY
395+
* a1-7 not used
396+
*
397+
* Return status
398+
* a0 INTEL_SIP_SMC_STATUS_OK
399+
* a1 max retry value
400+
*
401+
* Or
402+
* a0 INTEL_SIP_SMC_RSU_ERROR
403+
*/
404+
#define INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY 18
405+
#define INTEL_SIP_SMC_RSU_MAX_RETRY \
406+
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY)

‎include/linux/firmware/intel/stratix10-svc-client.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ struct stratix10_svc_chan;
9898
*
9999
* @COMMAND_RSU_RETRY: query firmware for the current image's retry counter,
100100
* return status is SVC_STATUS_OK or SVC_STATUS_ERROR
101+
*
102+
* @COMMAND_RSU_MAX_RETRY: query firmware for the max retry value,
103+
* return status is SVC_STATUS_OK or SVC_STATUS_ERROR
104+
*
105+
* @COMMAND_RSU_DCMF_VERSION: query firmware for the DCMF version, return status
106+
* is SVC_STATUS_OK or SVC_STATUS_ERROR
101107
*/
102108
enum stratix10_svc_command_code {
103109
COMMAND_NOOP = 0,
@@ -109,6 +115,8 @@ enum stratix10_svc_command_code {
109115
COMMAND_RSU_UPDATE,
110116
COMMAND_RSU_NOTIFY,
111117
COMMAND_RSU_RETRY,
118+
COMMAND_RSU_MAX_RETRY,
119+
COMMAND_RSU_DCMF_VERSION,
112120
};
113121

114122
/**

0 commit comments

Comments
 (0)