Skip to contentSkip to conversation

fpga: stratix10-soc: make FPGA task un-interruptible

PATCH Superseded [email protected] 3 participants 8 messages Jul 7, 2020 – Jul 20, 2020 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fpga: stratix10-soc: make FPGA task un-interruptible

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
 drivers/fpga/stratix10-soc.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +3 -20
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
 	if (ret < 0)
 		goto init_done;
 
-	ret = wait_for_completion_interruptible_timeout(
+	ret = wait_for_completion_timeout(
 		&priv->status_return_completion, S10_RECONFIG_TIMEOUT);
 	if (!ret) {
 		dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
 		ret = -ETIMEDOUT;
 		goto init_done;
 	}
-	if (ret < 0) {
-		dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret);
-		goto init_done;
-	}
 
 	ret = 0;
 	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
 		 */
 		wait_status = 1; /* not timed out */
 		if (!priv->status)
-			wait_status = wait_for_completion_interruptible_timeout(
+			wait_status = wait_for_completion_timeout(
 				&priv->status_return_completion,
 				S10_BUFFER_TIMEOUT);
 
@@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
 			ret = -ETIMEDOUT;
 			break;
 		}
-		if (wait_status < 0) {
-			ret = wait_status;
-			dev_err(dev,
-				"error (%d) waiting for svc layer buffers\n",
-				ret);
-			break;
-		}
 	}
 
 	if (!s10_free_buffers(mgr))
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
 		if (ret < 0)
 			break;
 
-		ret = wait_for_completion_interruptible_timeout(
+		ret = wait_for_completion_timeout(
 			&priv->status_return_completion, timeout);
 		if (!ret) {
 			dev_err(dev,
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
 			ret = -ETIMEDOUT;
 			break;
 		}
-		if (ret < 0) {
-			dev_err(dev,
-				"error (%d) waiting for RECONFIG_COMPLETED\n",
-				ret);
-			break;
-		}
 		/* Not error or timeout, so ret is # of jiffies until timeout */
 		timeout = ret;
 		ret = 0;
Signature · 1 line
2.7.4
#1 lore raw

Hi

Quoted 73 lines · On 7/7/20 11:14 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
 drivers/fpga/stratix10-soc.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +3 -14
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
 	if (ret < 0)
 		goto init_done;
 
-	ret = wait_for_completion_interruptible_timeout(
+	ret = wait_for_completion_timeout(
 		&priv->status_return_completion, S10_RECONFIG_TIMEOUT);
 	if (!ret) {
 		dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
 		ret = -ETIMEDOUT;
 		goto init_done;
 	}
-	if (ret < 0) {
-		dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret);
-		goto init_done;
-	}
 
 	ret = 0;
 	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
 		 */
 		wait_status = 1; /* not timed out */
 		if (!priv->status)
-			wait_status = wait_for_completion_interruptible_timeout(
+			wait_status = wait_for_completion_timeout(
 				&priv->status_return_completion,
 				S10_BUFFER_TIMEOUT);
 
@@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
 			ret = -ETIMEDOUT;
 			break;
 		}
-		if (wait_status < 0) {
-			ret = wait_status;
-			dev_err(dev,
-				"error (%d) waiting for svc layer buffers\n",
-				ret);
-			break;
-		}
 	}
 
 	if (!s10_free_buffers(mgr))
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
 		if (ret < 0)
 			break;
 
-		ret = wait_for_completion_interruptible_timeout(
+		ret = wait_for_completion_timeout(
 			&priv->status_return_completion, timeout);
 		if (!ret) {
 			dev_err(dev,
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
 			ret = -ETIMEDOUT;
 			break;

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

Quoted 10 lines
drivers/fpga/stratix10-soc.c +0 -6
 		}
-		if (ret < 0) {
-			dev_err(dev,
-				"error (%d) waiting for RECONFIG_COMPLETED\n",
-				ret);
-			break;
-		}
 		/* Not error or timeout, so ret is # of jiffies until timeout */
 		timeout = ret;
 		ret = 0;

Do you need the same change in drivers/fpga/socfpga.c? Also, you did not include Moritz Fisher on this. He's the maintainer.

Dinh

#2 lore raw

Hi Dinh,

Quoted 80 lines · Dinh Nguyen

Hi

Quoted 77 lines · On 7/7/20 11:14 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
  drivers/fpga/stratix10-soc.c | 23 +++--------------------
  1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +3 -18
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
  	if (ret < 0)
  		goto init_done;
 
-	ret = wait_for_completion_interruptible_timeout(
+	ret = wait_for_completion_timeout(
  		&priv->status_return_completion, S10_RECONFIG_TIMEOUT);
  	if (!ret) {
  		dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
  		ret = -ETIMEDOUT;
  		goto init_done;
  	}
-	if (ret < 0) {
-		dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret);
-		goto init_done;
-	}
 
  	ret = 0;
  	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
  		 */
  		wait_status = 1; /* not timed out */
  		if (!priv->status)
-			wait_status = wait_for_completion_interruptible_timeout(
+			wait_status = wait_for_completion_timeout(
  				&priv->status_return_completion,
  				S10_BUFFER_TIMEOUT);
 
@@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
  			ret = -ETIMEDOUT;
  			break;
  		}
-		if (wait_status < 0) {
-			ret = wait_status;
-			dev_err(dev,
-				"error (%d) waiting for svc layer buffers\n",
-				ret);
-			break;
-		}
  	}
 
  	if (!s10_free_buffers(mgr))
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
  		if (ret < 0)
  			break;
 
-		ret = wait_for_completion_interruptible_timeout(
+		ret = wait_for_completion_timeout(
  			&priv->status_return_completion, timeout);
  		if (!ret) {
  			dev_err(dev,
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
  			ret = -ETIMEDOUT;
  			break;
  		}
-		if (ret < 0) {
-			dev_err(dev,
-				"error (%d) waiting for RECONFIG_COMPLETED\n",
-				ret);
Quoted 8 lines

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

Quoted 6 lines
drivers/fpga/stratix10-soc.c +0 -2
-			break;
-
  		/* Not error or timeout, so ret is # of jiffies until timeout */
  		timeout = ret;
  		ret = 0;

Do you need the same change in drivers/fpga/socfpga.c?

It is not required.
Also, you did not

Quoted 2 lines

include Moritz Fisher on this. He's the maintainer.

I did include Moritz Fisher <[email protected]> in the submission, is something change recently?

Regards,
Richard

Quoted 2 lines

Dinh

#3 lore raw
Quoted 93 lines · Richard Gong

Hi Dinh,

Quoted 81 lines · Dinh Nguyen

Hi

Quoted 78 lines · On 7/7/20 11:14 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
  drivers/fpga/stratix10-soc.c | 23 +++--------------------

  1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +0 -0
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct
 fpga_manager *mgr,
       if (ret < 0)
           goto init_done;

  -    ret = wait_for_completion_interruptible_timeout(
+    ret = wait_for_completion_timeout( &priv->status_return_completion, S10_RECONFIG_TIMEOUT); if (!ret) {
          dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n"); ret = -ETIMEDOUT;
          goto init_done;
      }
-    if (ret < 0) {
-        dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret); -        goto init_done;
-    }
        ret = 0;
      if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {

drivers/fpga/stratix10-soc.c +0 -0
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager
 *mgr, const char *buf,
            */

          wait_status = 1; /* not timed out */
          if (!priv->status)
-            wait_status = wait_for_completion_interruptible_timeout( +            wait_status = wait_for_completion_timeout( &priv->status_return_completion, S10_BUFFER_TIMEOUT);
  @@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
              ret = -ETIMEDOUT;
              break;
          }
-        if (wait_status < 0) {
-            ret = wait_status;
-            dev_err(dev,
-                "error (%d) waiting for svc layer buffers\n", -                ret);
-            break;
-        }
      }
        if (!s10_free_buffers(mgr))

drivers/fpga/stratix10-soc.c +0 -0
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct
 fpga_manager *mgr,
           if (ret < 0)
               break;

  -        ret = wait_for_completion_interruptible_timeout( +        ret = wait_for_completion_timeout( &priv->status_return_completion, timeout); if (!ret) {
              dev_err(dev,

drivers/fpga/stratix10-soc.c +0 -5
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct
 fpga_manager *mgr,
               ret = -ETIMEDOUT;
               break;
           }
-        if (ret < 0) {
-            dev_err(dev,
-                "error (%d) waiting for RECONFIG_COMPLETED\n",
-                ret);
-            break;
Quoted 8 lines
Quoted 6 lines
drivers/fpga/stratix10-soc.c +0 -1
-
           /* Not error or timeout, so ret is # of jiffies until

timeout */
          timeout = ret;
          ret = 0;

Do you need the same change in drivers/fpga/socfpga.c?

Quoted 1 line

It is not required.

Why not?

Quoted 6 lines

Also, you did not

Quoted 2 lines

include Moritz Fisher on this. He's the maintainer.

I did include Moritz Fisher <[email protected]> in the submission, is something change recently?

My bad, I didn't see his name in the email.

Dinh

#4 lore raw

Hi Dinh,

Quoted 96 lines · Dinh Nguyen
Quoted 93 lines · Richard Gong

Hi Dinh,

Quoted 89 lines · Dinh Nguyen

Hi

Quoted 80 lines · On 7/7/20 11:14 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
   drivers/fpga/stratix10-soc.c | 23 +++--------------------
   1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +2 -5
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct
 fpga_manager *mgr,
       if (ret < 0)
           goto init_done;
   -    ret = wait_for_completion_interruptible_timeout(
+    ret = wait_for_completion_timeout(
           &priv->status_return_completion, S10_RECONFIG_TIMEOUT);
       if (!ret) {
           dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
           ret = -ETIMEDOUT;
           goto init_done;
       }
-    if (ret < 0) {
-        dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret);
-        goto init_done;
-    }
         ret = 0;
       if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager
 *mgr, const char *buf,
            */
           wait_status = 1; /* not timed out */
           if (!priv->status)
-            wait_status = wait_for_completion_interruptible_timeout(
+            wait_status = wait_for_completion_timeout(
                   &priv->status_return_completion,
                   S10_BUFFER_TIMEOUT);

  @@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager
*mgr, const char *buf,
              ret = -ETIMEDOUT;
              break;
          }
-        if (wait_status < 0) {
-            ret = wait_status;
-            dev_err(dev,
-                "error (%d) waiting for svc layer buffers\n", -                ret);
-            break;
-        }
      }
        if (!s10_free_buffers(mgr))

drivers/fpga/stratix10-soc.c +1 -6
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct
 fpga_manager *mgr,
           if (ret < 0)
               break;
   -        ret = wait_for_completion_interruptible_timeout(
+        ret = wait_for_completion_timeout(
               &priv->status_return_completion, timeout);
           if (!ret) {
               dev_err(dev,
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct
 fpga_manager *mgr,
               ret = -ETIMEDOUT;
               break;
           }
-        if (ret < 0) {
-            dev_err(dev,
-                "error (%d) waiting for RECONFIG_COMPLETED\n",
-                ret);
-            break;
-
           /* Not error or timeout, so ret is # of jiffies until
Quoted 4 lines

timeout */
          timeout = ret;
          ret = 0;

Do you need the same change in drivers/fpga/socfpga.c?

Quoted 3 lines
Quoted 1 line

It is not required.

Why not?

The original codes doesn't handle the task completion to be signaled, so here it serves the same function as wait_for_completion_timeout call.

Regards,
Richard

Quoted 12 lines
Quoted 7 lines

Also, you did not

Quoted 2 lines

include Moritz Fisher on this. He's the maintainer.

I did include Moritz Fisher <[email protected]> in the submission, is something change recently?

My bad, I didn't see his name in the email.

Dinh

reviewer Reviewed-by on v1 1/1
#5 lore raw
In reply to [email protected]

Mostly fine, see inline question.

drivers/fpga/stratix10-soc.c static int s10_ops_write_complete(struct fpga_manager *mgr,

Quoted 61 lines · On 7/7/20 9:14 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
 drivers/fpga/stratix10-soc.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +2 -13
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
 	if (ret < 0)
 		goto init_done;
 
-	ret = wait_for_completion_interruptible_timeout(
+	ret = wait_for_completion_timeout(
 		&priv->status_return_completion, S10_RECONFIG_TIMEOUT);
 	if (!ret) {
 		dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
 		ret = -ETIMEDOUT;
 		goto init_done;
 	}
-	if (ret < 0) {
-		dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret);
-		goto init_done;
-	}
 
 	ret = 0;
 	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
 		 */
 		wait_status = 1; /* not timed out */
 		if (!priv->status)
-			wait_status = wait_for_completion_interruptible_timeout(
+			wait_status = wait_for_completion_timeout(
 				&priv->status_return_completion,
 				S10_BUFFER_TIMEOUT);
 
@@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
 			ret = -ETIMEDOUT;
 			break;
 		}
-		if (wait_status < 0) {
-			ret = wait_status;
-			dev_err(dev,
-				"error (%d) waiting for svc layer buffers\n",
-				ret);
-			break;
-		}
 	}
 
 	if (!s10_free_buffers(mgr))
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,

This part is done in an infinite loop, is the loop still needed ?

Quoted 21 lines
drivers/fpga/stratix10-soc.c +1 -7
 		if (ret < 0)
 			break;
 
-		ret = wait_for_completion_interruptible_timeout(
+		ret = wait_for_completion_timeout(
 			&priv->status_return_completion, timeout);
 		if (!ret) {
 			dev_err(dev,
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
 			ret = -ETIMEDOUT;
 			break;
 		}
-		if (ret < 0) {
-			dev_err(dev,
-				"error (%d) waiting for RECONFIG_COMPLETED\n",
-				ret);
-			break;
-		}
 		/* Not error or timeout, so ret is # of jiffies until timeout */
 		timeout = ret;
 		ret = 0;
#6 lore raw

Hi Tom,

Quoted 62 lines · Tom Rix

Mostly fine, see inline question.

Quoted 59 lines · On 7/7/20 9:14 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
  drivers/fpga/stratix10-soc.c | 23 +++--------------------
  1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +2 -13
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
  	if (ret < 0)
  		goto init_done;
 
-	ret = wait_for_completion_interruptible_timeout(
+	ret = wait_for_completion_timeout(
  		&priv->status_return_completion, S10_RECONFIG_TIMEOUT);
  	if (!ret) {
  		dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
  		ret = -ETIMEDOUT;
  		goto init_done;
  	}
-	if (ret < 0) {
-		dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret);
-		goto init_done;
-	}
 
  	ret = 0;
  	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
  		 */
  		wait_status = 1; /* not timed out */
  		if (!priv->status)
-			wait_status = wait_for_completion_interruptible_timeout(
+			wait_status = wait_for_completion_timeout(
  				&priv->status_return_completion,
  				S10_BUFFER_TIMEOUT);
 
@@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
  			ret = -ETIMEDOUT;
  			break;
  		}
-		if (wait_status < 0) {
-			ret = wait_status;
-			dev_err(dev,
-				"error (%d) waiting for svc layer buffers\n",
-				ret);
-			break;
-		}
  	}
 
Quoted 4 lines

drivers/fpga/stratix10-soc.c static int s10_ops_write_complete(struct fpga_manager *mgr,

Quoted 2 lines
drivers/fpga/stratix10-soc.c +0 -0
  	if (!s10_free_buffers(mgr))
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,

This part is done in an infinite loop, is the loop still needed

The loop is still need. FPGA manager driver need polling the completed status from the lower level firmware. The lower level firmware can return FPGA manager driver with busy, completed or error status.

Quoted 2 lines

Thanks for your review!

Regards,
Richard

Quoted 23 lines
Quoted 22 lines
drivers/fpga/stratix10-soc.c +1 -7
  		if (ret < 0)
  			break;
 
-		ret = wait_for_completion_interruptible_timeout(
+		ret = wait_for_completion_timeout(
  			&priv->status_return_completion, timeout);
  		if (!ret) {
  			dev_err(dev,
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
  			ret = -ETIMEDOUT;
  			break;
  		}
-		if (ret < 0) {
-			dev_err(dev,
-				"error (%d) waiting for RECONFIG_COMPLETED\n",
-				ret);
-			break;
-		}
  		/* Not error or timeout, so ret is # of jiffies until timeout */
  		timeout = ret;
  		ret = 0;
#7 lore raw
In reply to [email protected]

Hi Moritz,

Sorry for asking.

When you get chance, can you review this FPGA patch?

Regards,
Richard

Quoted 83 lines · On 7/7/20 11:14 AM, [email protected] wrote:

From: Richard Gong <[email protected]>

When CTRL+C occurs during the process of FPGA reconfiguration, the FPGA reconfiguration process stops and the user can't perform a new FPGA reconfiguration properly.

Set FPGA complete task to be not interruptible so that the user can properly perform FPGA reconfiguration after CTRL+C event.

---
  drivers/fpga/stratix10-soc.c | 23 +++--------------------
  1 file changed, 3 insertions(+), 20 deletions(-)
drivers/fpga/stratix10-soc.c +3 -20
index 44b7c56..657a70c 100644
@@ -196,17 +196,13 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
  	if (ret < 0)
  		goto init_done;
 
-	ret = wait_for_completion_interruptible_timeout(
+	ret = wait_for_completion_timeout(
  		&priv->status_return_completion, S10_RECONFIG_TIMEOUT);
  	if (!ret) {
  		dev_err(dev, "timeout waiting for RECONFIG_REQUEST\n");
  		ret = -ETIMEDOUT;
  		goto init_done;
  	}
-	if (ret < 0) {
-		dev_err(dev, "error (%d) waiting for RECONFIG_REQUEST\n", ret);
-		goto init_done;
-	}
 
  	ret = 0;
  	if (!test_and_clear_bit(SVC_STATUS_OK, &priv->status)) {
@@ -318,7 +314,7 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
  		 */
  		wait_status = 1; /* not timed out */
  		if (!priv->status)
-			wait_status = wait_for_completion_interruptible_timeout(
+			wait_status = wait_for_completion_timeout(
  				&priv->status_return_completion,
  				S10_BUFFER_TIMEOUT);
 
@@ -340,13 +336,6 @@ static int s10_ops_write(struct fpga_manager *mgr, const char *buf,
  			ret = -ETIMEDOUT;
  			break;
  		}
-		if (wait_status < 0) {
-			ret = wait_status;
-			dev_err(dev,
-				"error (%d) waiting for svc layer buffers\n",
-				ret);
-			break;
-		}
  	}
 
  	if (!s10_free_buffers(mgr))
@@ -372,7 +361,7 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
  		if (ret < 0)
  			break;
 
-		ret = wait_for_completion_interruptible_timeout(
+		ret = wait_for_completion_timeout(
  			&priv->status_return_completion, timeout);
  		if (!ret) {
  			dev_err(dev,
@@ -380,12 +369,6 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
  			ret = -ETIMEDOUT;
  			break;
  		}
-		if (ret < 0) {
-			dev_err(dev,
-				"error (%d) waiting for RECONFIG_COMPLETED\n",
-				ret);
-			break;
-		}
  		/* Not error or timeout, so ret is # of jiffies until timeout */
  		timeout = ret;
  		ret = 0;