Skip to contentSkip to conversation

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

PATCH RESEND In review [email protected] 2 participants 3 messages Jul 24, 2020 – Aug 4, 2020 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 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 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
maintainer
#1 lore raw
Quoted 86 lines · On Fri, Jul 24, 2020 at 11:10:09AM -0500, [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 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

Sorry that one slipped through the cracks, will apply to for-next.

Thanks!

#2 lore raw

Hi Moritz,

No problem.

Thanks you very much for applying patch to the next!

Regards,
Richard

Quoted 92 lines · Moritz Fischer
Quoted 86 lines · On Fri, Jul 24, 2020 at 11:10:09AM -0500, [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 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

Sorry that one slipped through the cracks, will apply to for-next.

Thanks!