Skip to contentSkip to conversation

fpga: stratix10-soc: remove the pre-set reconfiguration condition

PATCH In review [email protected] 3 participants 5 messages May 15, 2020 – Jun 1, 2020 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fpga: stratix10-soc: remove the pre-set reconfiguration condition

From: Richard Gong <[email protected]>

The reconfiguration mode is pre-set by driver as the full reconfiguration. As a result, user have to change code and recompile the drivers if he or she wants to perform a partial reconfiguration. Removing the pre-set reconfiguration condition so that user can select full or partial reconfiguration via overlay device tree without recompiling the drivers.

Also add an error message if the configuration request is failure.

---
v2: define and use constant values

---
 drivers/fpga/stratix10-soc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/fpga/stratix10-soc.c +7 -2
index 44b7c56..4d52a80 100644
@@ -14,9 +14,13 @@
 /*
  * FPGA programming requires a higher level of privilege (EL3), per the SoC
  * design.
+ * SoC firmware supports full and partial reconfiguration.
  */
 #define NUM_SVC_BUFS	4
 #define SVC_BUF_SIZE	SZ_512K
+#define FULL_RECONFIG_FLAG	0
+#define PARTIAL_RECONFIG_FLAG	1
+
 
 /* Indicates buffer is in use if set */
 #define SVC_BUF_LOCK	0
@@ -182,12 +186,12 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
 	uint i;
 	int ret;
 
-	ctype.flags = 0;
 	if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
 		dev_dbg(dev, "Requesting partial reconfiguration.\n");
-		ctype.flags |= BIT(COMMAND_RECONFIG_FLAG_PARTIAL);
+		ctype.flags = PARTIAL_RECONFIG_FLAG;
 	} else {
 		dev_dbg(dev, "Requesting full reconfiguration.\n");
+		ctype.flags = FULL_RECONFIG_FLAG;
 	}
 
 	reinit_completion(&priv->status_return_completion);
@@ -210,6 +214,7 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
 
 	ret = 0;
 	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
+		dev_err(dev, "RECONFIG_REQUEST failed\n");
 		ret = -ETIMEDOUT;
 		goto init_done;
 	}
Signature · 1 line
2.7.4
#1 lore raw

Hi Moritz,

Sorry for asking.

When you get chance, can you review my version 2 patch submitted on 05/15/20?

Regards,
Richard

Quoted 59 lines · On 5/15/20 9:35 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

The reconfiguration mode is pre-set by driver as the full reconfiguration. As a result, user have to change code and recompile the drivers if he or she wants to perform a partial reconfiguration. Removing the pre-set reconfiguration condition so that user can select full or partial reconfiguration via overlay device tree without recompiling the drivers.

Also add an error message if the configuration request is failure.

---
v2: define and use constant values

---
  drivers/fpga/stratix10-soc.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/fpga/stratix10-soc.c +7 -2
index 44b7c56..4d52a80 100644
@@ -14,9 +14,13 @@
  /*
   * FPGA programming requires a higher level of privilege (EL3), per the SoC
   * design.
+ * SoC firmware supports full and partial reconfiguration.
   */
  #define NUM_SVC_BUFS	4
  #define SVC_BUF_SIZE	SZ_512K
+#define FULL_RECONFIG_FLAG	0
+#define PARTIAL_RECONFIG_FLAG	1
+
 
  /* Indicates buffer is in use if set */
  #define SVC_BUF_LOCK	0
@@ -182,12 +186,12 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
  	uint i;
  	int ret;
 
-	ctype.flags = 0;
  	if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
  		dev_dbg(dev, "Requesting partial reconfiguration.\n");
-		ctype.flags |= BIT(COMMAND_RECONFIG_FLAG_PARTIAL);
+		ctype.flags = PARTIAL_RECONFIG_FLAG;
  	} else {
  		dev_dbg(dev, "Requesting full reconfiguration.\n");
+		ctype.flags = FULL_RECONFIG_FLAG;
  	}
 
  	reinit_completion(&priv->status_return_completion);
@@ -210,6 +214,7 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
 
  	ret = 0;
  	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
+		dev_err(dev, "RECONFIG_REQUEST failed\n");
  		ret = -ETIMEDOUT;
  		goto init_done;
  	}
#2 lore raw

Minor comment below.

- Russ

Quoted 19 lines · Richard Gong

Hi Moritz,

Sorry for asking.

When you get chance, can you review my version 2 patch submitted on 05/15/20?

Regards,
Richard

Quoted 9 lines · On 5/15/20 9:35 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

The reconfiguration mode is pre-set by driver as the full reconfiguration. As a result, user have to change code and recompile the drivers if he or she wants to perform a partial reconfiguration. Removing the pre-set reconfiguration condition so that user can select full or partial reconfiguration via overlay device tree without recompiling the drivers.

Also add an error message if the configuration request is failure.

s/is failure/fails/

Quoted 48 lines
Quoted 48 lines

---
v2: define and use constant values
---
  drivers/fpga/stratix10-soc.c | 9 +++++++--

  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/fpga/stratix10-soc.c +7 -1
index 44b7c56..4d52a80 100644
@@ -14,9 +14,13 @@
   /*
    * FPGA programming requires a higher level of privilege (EL3), per the SoC
    * design.
+ * SoC firmware supports full and partial reconfiguration.
    */
   #define NUM_SVC_BUFS    4
   #define SVC_BUF_SIZE    SZ_512K
+#define FULL_RECONFIG_FLAG    0
+#define PARTIAL_RECONFIG_FLAG    1
+
     /* Indicates buffer is in use if set */
   #define SVC_BUF_LOCK    0
@@ -182,12 +186,12 @@ static int s10_ops_write_init(struct 
 fpga_manager *mgr,
       uint i;
       int ret;
   -    ctype.flags = 0;
       if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
           dev_dbg(dev, "Requesting partial reconfiguration.\n");
-        ctype.flags |= BIT(COMMAND_RECONFIG_FLAG_PARTIAL);
+        ctype.flags = PARTIAL_RECONFIG_FLAG;
       } else {
           dev_dbg(dev, "Requesting full reconfiguration.\n");
+        ctype.flags = FULL_RECONFIG_FLAG;
       }
 reinit_completion(&priv->status_return_completion);
@@ -210,6 +214,7 @@ static int s10_ops_write_init(struct fpga_manager 
 *mgr,
         ret = 0;
       if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
+        dev_err(dev, "RECONFIG_REQUEST failed\n");
           ret = -ETIMEDOUT;
           goto init_done;
       }
maintainer
#3 lore raw
In reply to Richard Gong
Quoted 4 lines · Richard Gong

Hi Moritz,

Sorry for asking.

Quoted 14 lines

When you get chance, can you review my version 2 patch submitted on 05/15/20?

Regards,
Richard

Quoted 7 lines · On 5/15/20 9:35 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

The reconfiguration mode is pre-set by driver as the full reconfiguration. As a result, user have to change code and recompile the drivers if he or she wants to perform a partial reconfiguration. Removing the pre-set reconfiguration condition so that user can select full or partial reconfiguration via overlay device tree without recompiling the drivers.

Can you help me understand? See comment below, I'm not sure how this change changes the behavior.

Quoted 10 lines
Quoted 10 lines

Also add an error message if the configuration request is failure.

---
v2: define and use constant values

---
  drivers/fpga/stratix10-soc.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
Quoted 9 lines

drivers/fpga/stratix10-soc.c line 17

Quoted 9 lines
drivers/fpga/stratix10-soc.c +1 -0
index 44b7c56..4d52a80 100644
@@ -14,9 +14,13 @@
  /*
   * FPGA programming requires a higher level of privilege (EL3), per the SoC
   * design.
+ * SoC firmware supports full and partial reconfiguration.

Consider:
"The SoC firmware supports full and partial reconfiguration."

Quoted 12 lines
Quoted 12 lines
drivers/fpga/stratix10-soc.c +3 -1
   */
  #define NUM_SVC_BUFS	4
  #define SVC_BUF_SIZE	SZ_512K
+#define FULL_RECONFIG_FLAG	0
+#define PARTIAL_RECONFIG_FLAG	1
+
  /* Indicates buffer is in use if set */
  #define SVC_BUF_LOCK	0
@@ -182,12 +186,12 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
  	uint i;
  	int ret;
-	ctype.flags = 0;
Quoted 8 lines

drivers/fpga/stratix10-soc.c static int s10_ops_write_init(struct fpga_manager *mgr, · line 195

Quoted 8 lines
drivers/fpga/stratix10-soc.c +2 -1
  	if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
  		dev_dbg(dev, "Requesting partial reconfiguration.\n");
-		ctype.flags |= BIT(COMMAND_RECONFIG_FLAG_PARTIAL);
+		ctype.flags = PARTIAL_RECONFIG_FLAG;
  	} else {
  		dev_dbg(dev, "Requesting full reconfiguration.\n");
+		ctype.flags = FULL_RECONFIG_FLAG;
  	}

Am I missing something here: Doesn't this do the same as before?

Before:
If info->flags & FPGA_MGR_PARTIAL_RECONFIG -> ctype.flags = 0 | BIT(COMMAND_RECONFIG_FLAG_PARTIAL) -> 1
and ctype->flags = FULL_RECONFIG -> 0 else.

Now:
If info->flags & FPGA_MGR_PARTIAL_RECONFIG -> ctype.flags = PARTIAL_RECONFIG_FLAG -> 1 ctype->flags = FULL_REECONFIG_FLAG -> 0 else.

Am I missing something here? If I don't set the flag for partial reconfig I'd end up with full reconfiguration in both cases? If I do set the flag, I get partial reconfiguration in both cases?

Quoted 9 lines

drivers/fpga/stratix10-soc.c static int s10_ops_write_init(struct fpga_manager *mgr, · line 220

Quoted 9 lines
drivers/fpga/stratix10-soc.c +1 -0
  	reinit_completion(&priv->status_return_completion);
@@ -210,6 +214,7 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
  	ret = 0;
  	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
+		dev_err(dev, "RECONFIG_REQUEST failed\n");
  		ret = -ETIMEDOUT;
  		goto init_done;
  	}
 

Thanks,
Moritz

#4 lore raw

Hi Moritz,

Quoted 14 lines · Moritz Fischer
Quoted 13 lines · Richard Gong

Hi Moritz,

Sorry for asking.

When you get chance, can you review my version 2 patch submitted on 05/15/20?

Regards,
Richard

Quoted 2 lines · On 5/15/20 9:35 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

The reconfiguration mode is pre-set by driver as the full reconfiguration. As a result, user have to change code and recompile the drivers if he or she wants to perform a partial reconfiguration. Removing the pre-set reconfiguration condition so that user can select full or partial reconfiguration via overlay device tree without recompiling the drivers.

Can you help me understand? See comment below, I'm not sure how this change changes the behavior.

Flag COMMAND_RECONFIG_FLAG_PARTIAL is defined in Intel service layer driver (include/linux/firmware/intel/stratix10-svc-client.h) and the default value is zero. It is obvious that COMMAND_RECONFIG_FLAG_PARTIAL should be set to 1 to support partial reconfiguration.

Please discard this FPGA patch, I will submit a patch on Intel service layer driver.

Regards,
Richard

Quoted 69 lines
Quoted 10 lines
Quoted 10 lines

Also add an error message if the configuration request is failure.

---
v2: define and use constant values

---
   drivers/fpga/stratix10-soc.c | 9 +++++++--
   1 file changed, 7 insertions(+), 2 deletions(-)
Quoted 9 lines

drivers/fpga/stratix10-soc.c line 17

Quoted 9 lines
drivers/fpga/stratix10-soc.c +1 -0
index 44b7c56..4d52a80 100644
@@ -14,9 +14,13 @@
   /*
    * FPGA programming requires a higher level of privilege (EL3), per the SoC
    * design.
+ * SoC firmware supports full and partial reconfiguration.

Consider:
"The SoC firmware supports full and partial reconfiguration."

Quoted 12 lines
Quoted 12 lines
drivers/fpga/stratix10-soc.c +3 -1
    */
   #define NUM_SVC_BUFS	4
   #define SVC_BUF_SIZE	SZ_512K
+#define FULL_RECONFIG_FLAG	0
+#define PARTIAL_RECONFIG_FLAG	1
+
   /* Indicates buffer is in use if set */
   #define SVC_BUF_LOCK	0
@@ -182,12 +186,12 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
   	uint i;
   	int ret;
-	ctype.flags = 0;
Quoted 8 lines

drivers/fpga/stratix10-soc.c static int s10_ops_write_init(struct fpga_manager *mgr, · line 195

Quoted 8 lines
drivers/fpga/stratix10-soc.c +2 -1
   	if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
   		dev_dbg(dev, "Requesting partial reconfiguration.\n");
-		ctype.flags |= BIT(COMMAND_RECONFIG_FLAG_PARTIAL);
+		ctype.flags = PARTIAL_RECONFIG_FLAG;
   	} else {
   		dev_dbg(dev, "Requesting full reconfiguration.\n");
+		ctype.flags = FULL_RECONFIG_FLAG;
   	}

Am I missing something here: Doesn't this do the same as before?

Before:
If info->flags & FPGA_MGR_PARTIAL_RECONFIG -> ctype.flags = 0 | BIT(COMMAND_RECONFIG_FLAG_PARTIAL) -> 1
and ctype->flags = FULL_RECONFIG -> 0 else.

Now:
If info->flags & FPGA_MGR_PARTIAL_RECONFIG -> ctype.flags = PARTIAL_RECONFIG_FLAG -> 1 ctype->flags = FULL_REECONFIG_FLAG -> 0 else.

Am I missing something here? If I don't set the flag for partial reconfig I'd end up with full reconfiguration in both cases? If I do set the flag, I get partial reconfiguration in both cases?

Quoted 9 lines

drivers/fpga/stratix10-soc.c static int s10_ops_write_init(struct fpga_manager *mgr, · line 220

Quoted 9 lines
drivers/fpga/stratix10-soc.c +1 -0
   	reinit_completion(&priv->status_return_completion);
@@ -210,6 +214,7 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
   	ret = 0;
   	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
+		dev_err(dev, "RECONFIG_REQUEST failed\n");
   		ret = -ETIMEDOUT;
   		goto init_done;
   	}
 

Thanks,
Moritz