Skip to contentSkip to conversation

firmware: stratix10-svc: extend SVC driver to get the firmware version

PATCH In review Dinh Nguyen 3 participants 8 messages Jan 25, 2022 – Feb 16, 2022

Subsystems (2)
lore
Share & tools
lore

Dinh Nguyen

author maintainer
#0 lore raw

PATCH 1/1 firmware: stratix10-svc: extend SVC driver to get the firmware version

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

---
 drivers/firmware/stratix10-svc.c              |  9 +++++++-
 include/linux/firmware/intel/stratix10-smc.h  | 21 +++++++++++++++++--
 .../firmware/intel/stratix10-svc-client.h     |  4 ++++
 3 files changed, 31 insertions(+), 3 deletions(-)
drivers/firmware/stratix10-svc.c +8 -1
index 29c0a616b317..4bd57a908efe 100644
@@ -306,6 +306,7 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data,
 		break;
 	case COMMAND_RSU_RETRY:
 	case COMMAND_RSU_MAX_RETRY:
+	case COMMAND_FIRMWARE_VERSION:
 		cb_data->status = BIT(SVC_STATUS_OK);
 		cb_data->kaddr1 = &res.a1;
 		break;
@@ -422,6 +423,11 @@ static int svc_normal_to_secure_thread(void *data)
 			a1 = 0;
 			a2 = 0;
 			break;
+		case COMMAND_FIRMWARE_VERSION:
+			a0 = INTEL_SIP_SMC_FIRMWARE_VERSION;
+			a1 = 0;
+			a2 = 0;
+			break;
 		default:
 			pr_warn("it shouldn't happen\n");
 			break;
@@ -491,7 +497,8 @@ static int svc_normal_to_secure_thread(void *data)
 			 */
 			if ((pdata->command == COMMAND_RSU_RETRY) ||
 			    (pdata->command == COMMAND_RSU_MAX_RETRY) ||
-				(pdata->command == COMMAND_RSU_NOTIFY)) {
+			    (pdata->command == COMMAND_RSU_NOTIFY) ||
+			    (pdata->command == COMMAND_FIRMWARE_VERSION)) {
 				cbdata->status =
 					BIT(SVC_STATUS_NO_SUPPORT);
 				cbdata->kaddr1 = NULL;
include/linux/firmware/intel/stratix10-smc.h +19 -2
index c3e5ab014caf..aad497a9ad8b 100644
@@ -321,8 +321,6 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_ECC_DBE \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_ECC_DBE)
 
-#endif
-
 /**
  * Request INTEL_SIP_SMC_RSU_NOTIFY
  *
@@ -404,3 +402,22 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY 18
 #define INTEL_SIP_SMC_RSU_MAX_RETRY \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY)
+
+/**
+ * Request INTEL_SIP_SMC_FIRMWARE_VERSION
+ *
+ * Sync call used to query the version of running firmware
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_FIRMWARE_VERSION
+ * a1-a7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_STATUS_ERROR
+ * a1 running firmware version
+ */
+#define INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION 31
+#define INTEL_SIP_SMC_FIRMWARE_VERSION \
+        INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION)
+
+#endif
include/linux/firmware/intel/stratix10-svc-client.h +4 -0
index 19781b0f6429..18c1841fdb1f 100644
@@ -104,6 +104,9 @@ struct stratix10_svc_chan;
  *
  * @COMMAND_RSU_DCMF_VERSION: query firmware for the DCMF version, return status
  * is SVC_STATUS_OK or SVC_STATUS_ERROR
+ *
+ * @COMMAND_FIRMWARE_VERSION: query running firmware version, return status
+ * is SVC_STATUS_OK or SVC_STATUS_ERROR
  */
 enum stratix10_svc_command_code {
 	COMMAND_NOOP = 0,
@@ -117,6 +120,7 @@ enum stratix10_svc_command_code {
 	COMMAND_RSU_RETRY,
 	COMMAND_RSU_MAX_RETRY,
 	COMMAND_RSU_DCMF_VERSION,
+	COMMAND_FIRMWARE_VERSION,
 };
 
 /**
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Dinh Nguyen

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

This is already acked and no more change, is it? So please just ping in the original mail or add the [RESEND PATCH] prefix.

The patch is good to me.

Quoted 102 lines
---
 drivers/firmware/stratix10-svc.c              |  9 +++++++-
 include/linux/firmware/intel/stratix10-smc.h  | 21 +++++++++++++++++--
 .../firmware/intel/stratix10-svc-client.h     |  4 ++++
 3 files changed, 31 insertions(+), 3 deletions(-)
drivers/firmware/stratix10-svc.c +8 -1
index 29c0a616b317..4bd57a908efe 100644
@@ -306,6 +306,7 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data,
 		break;
 	case COMMAND_RSU_RETRY:
 	case COMMAND_RSU_MAX_RETRY:
+	case COMMAND_FIRMWARE_VERSION:
 		cb_data->status = BIT(SVC_STATUS_OK);
 		cb_data->kaddr1 = &res.a1;
 		break;
@@ -422,6 +423,11 @@ static int svc_normal_to_secure_thread(void *data)
 			a1 = 0;
 			a2 = 0;
 			break;
+		case COMMAND_FIRMWARE_VERSION:
+			a0 = INTEL_SIP_SMC_FIRMWARE_VERSION;
+			a1 = 0;
+			a2 = 0;
+			break;
 		default:
 			pr_warn("it shouldn't happen\n");
 			break;
@@ -491,7 +497,8 @@ static int svc_normal_to_secure_thread(void *data)
 			 */
 			if ((pdata->command == COMMAND_RSU_RETRY) ||
 			    (pdata->command == COMMAND_RSU_MAX_RETRY) ||
-				(pdata->command == COMMAND_RSU_NOTIFY)) {
+			    (pdata->command == COMMAND_RSU_NOTIFY) ||
+			    (pdata->command == COMMAND_FIRMWARE_VERSION)) {
 				cbdata->status =
 					BIT(SVC_STATUS_NO_SUPPORT);
 				cbdata->kaddr1 = NULL;
include/linux/firmware/intel/stratix10-smc.h +19 -2
index c3e5ab014caf..aad497a9ad8b 100644
@@ -321,8 +321,6 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_ECC_DBE \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_ECC_DBE)
 
-#endif
-
 /**
  * Request INTEL_SIP_SMC_RSU_NOTIFY
  *
@@ -404,3 +402,22 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
 #define INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY 18
 #define INTEL_SIP_SMC_RSU_MAX_RETRY \
 	INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_RSU_MAX_RETRY)
+
+/**
+ * Request INTEL_SIP_SMC_FIRMWARE_VERSION
+ *
+ * Sync call used to query the version of running firmware
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_FIRMWARE_VERSION
+ * a1-a7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_STATUS_ERROR
+ * a1 running firmware version
+ */
+#define INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION 31
+#define INTEL_SIP_SMC_FIRMWARE_VERSION \
+        INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION)
+
+#endif
include/linux/firmware/intel/stratix10-svc-client.h +4 -0
index 19781b0f6429..18c1841fdb1f 100644
@@ -104,6 +104,9 @@ struct stratix10_svc_chan;
  *
  * @COMMAND_RSU_DCMF_VERSION: query firmware for the DCMF version, return status
  * is SVC_STATUS_OK or SVC_STATUS_ERROR
+ *
+ * @COMMAND_FIRMWARE_VERSION: query running firmware version, return status
+ * is SVC_STATUS_OK or SVC_STATUS_ERROR
  */
 enum stratix10_svc_command_code {
 	COMMAND_NOOP = 0,
@@ -117,6 +120,7 @@ enum stratix10_svc_command_code {
 	COMMAND_RSU_RETRY,
 	COMMAND_RSU_MAX_RETRY,
 	COMMAND_RSU_DCMF_VERSION,
+	COMMAND_FIRMWARE_VERSION,
 };
 
 /**
Signature · 1 line
2.25.1
author maintainer
#2 lore raw
Quoted 8 lines · Xu Yilun
Quoted 7 lines · Dinh Nguyen

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

Quoted 9 lines
Quoted 1 line

This is already acked and no more change, is it? So please just ping in the original mail or add the [RESEND PATCH] prefix.

The patch is good to me.

Thanks, I added Moritz Acked-by: is the only change.

Dinh

maintainer
#3 lore raw

Dinh,

Quoted 16 lines · Dinh Nguyen
Quoted 13 lines · Xu Yilun
Quoted 8 lines · Dinh Nguyen

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

This is already acked and no more change, is it? So please just ping in the original mail or add the [RESEND PATCH] prefix.

Quoted 8 lines
Quoted 4 lines

The patch is good to me.

Thanks, I added Moritz Acked-by: is the only change.

Dinh

Did we traditionally take those through FPGA tree, did Greg pick those up?

Cheers,
Moritz

author maintainer
#4 lore raw

Hi Moritz,

Quoted 24 lines · Moritz Fischer

Dinh,

Quoted 21 lines · Dinh Nguyen
Quoted 17 lines · Xu Yilun
Quoted 8 lines · Dinh Nguyen

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

This is already acked and no more change, is it? So please just ping in the original mail or add the [RESEND PATCH] prefix.

The patch is good to me.

Quoted 7 lines
Quoted 3 lines

Thanks, I added Moritz Acked-by: is the only change.

Dinh

Did we traditionally take those through FPGA tree, did Greg pick those up?

I don't know for sure.

Dinh

maintainer
#5 lore raw
In reply to Moritz Fischer
Quoted 24 lines · Moritz Fischer

Dinh,

Quoted 21 lines · Dinh Nguyen
Quoted 17 lines · Xu Yilun
Quoted 8 lines · Dinh Nguyen

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

This is already acked and no more change, is it? So please just ping in the original mail or add the [RESEND PATCH] prefix.

The patch is good to me.

Quoted 6 lines
Quoted 3 lines

Thanks, I added Moritz Acked-by: is the only change.

Dinh

Did we traditionally take those through FPGA tree, did Greg pick those up?

This patch was the 3rd one of a patchset. It is acked but the patchset is not, so we didn't take the single one in FPGA tree. This is the last conversation.

https://lore.kernel.org/linux-fpga/[email protected]/

Thanks,
Yilun

Quoted 3 lines

Cheers,
Moritz

author maintainer
#6 lore raw
Quoted 29 lines · Xu Yilun
Quoted 28 lines · Moritz Fischer

Dinh,

Quoted 24 lines · Dinh Nguyen
Quoted 8 lines · Xu Yilun
Quoted 7 lines · Dinh Nguyen

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

Quoted 9 lines
Quoted 1 line

This is already acked and no more change, is it? So please just ping in the original mail or add the [RESEND PATCH] prefix.

The patch is good to me.

Thanks, I added Moritz Acked-by: is the only change.

Dinh

Quoted 9 lines
Quoted 2 lines

Did we traditionally take those through FPGA tree, did Greg pick those up?

This patch was the 3rd one of a patchset. It is acked but the patchset is not, so we didn't take the single one in FPGA tree. This is the last conversation.

https://lore.kernel.org/linux-fpga/[email protected]/

Right, Richard has left Intel. So what I've done is gone back and try to re-send patches that have been Acked, like this one, and split out the other patches to a smaller series to restart the process.

Dinh

author maintainer
#7 lore raw
In reply to Moritz Fischer
Quoted 24 lines · Moritz Fischer

Dinh,

Quoted 21 lines · Dinh Nguyen
Quoted 17 lines · Xu Yilun
Quoted 8 lines · Dinh Nguyen

From: Richard Gong <[email protected]>

Extend Intel service layer driver to get the firmware version running at FPGA device. Therefore FPGA manager driver, one of Intel service layer driver's client, can decide whether to handle the newly added bitstream authentication function based on the retrieved firmware version.

This is already acked and no more change, is it? So please just ping in the original mail or add the [RESEND PATCH] prefix.

The patch is good to me.

Quoted 7 lines
Quoted 3 lines

Thanks, I added Moritz Acked-by: is the only change.

Dinh

Did we traditionally take those through FPGA tree, did Greg pick those up?

I'll take these patches through my repo and will send it up to Greg.

Dinh