linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv1] fpga: stratix10-soc: remove the pre-set reconfiguration condition
@ 2020-05-12 13:27 richard.gong
  2020-05-12 15:35 ` Moritz Fischer
  0 siblings, 1 reply; 3+ messages in thread
From: richard.gong @ 2020-05-12 13:27 UTC (permalink / raw)
  To: mdf; +Cc: linux-fpga, linux-kernel, dinguyen, richard.gong, Richard Gong

From: Richard Gong <richard.gong@intel.com>

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.

Signed-off-by: Richard Gong <richard.gong@intel.com>
---
 drivers/fpga/stratix10-soc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
index 44b7c56..2da8a40 100644
--- a/drivers/fpga/stratix10-soc.c
+++ b/drivers/fpga/stratix10-soc.c
@@ -182,12 +182,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 = 1;
 	} else {
 		dev_dbg(dev, "Requesting full reconfiguration.\n");
+		ctype.flags = 0;
 	}
 
 	reinit_completion(&priv->status_return_completion);
@@ -210,6 +210,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.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv1] fpga: stratix10-soc: remove the pre-set reconfiguration condition
  2020-05-12 13:27 [PATCHv1] fpga: stratix10-soc: remove the pre-set reconfiguration condition richard.gong
@ 2020-05-12 15:35 ` Moritz Fischer
  2020-05-12 21:27   ` Richard Gong
  0 siblings, 1 reply; 3+ messages in thread
From: Moritz Fischer @ 2020-05-12 15:35 UTC (permalink / raw)
  To: richard.gong; +Cc: mdf, linux-fpga, linux-kernel, dinguyen, Richard Gong

Hi Richard,

On Tue, May 12, 2020 at 08:27:31AM -0500, richard.gong@linux.intel.com wrote:
> From: Richard Gong <richard.gong@intel.com>
> 
> 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.
> 
> Signed-off-by: Richard Gong <richard.gong@intel.com>
> ---
>  drivers/fpga/stratix10-soc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
> index 44b7c56..2da8a40 100644
> --- a/drivers/fpga/stratix10-soc.c
> +++ b/drivers/fpga/stratix10-soc.c
> @@ -182,12 +182,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 = 1;
Have you considered:

ctype.flags = BIT(COMMAND_RECONFIG_FLAG_PARTIAL);

instead (assuming 1, lines up with BIT(COMMAND_RECONFIG_FLAG_PARTIAL)?

If not: Can you define a constant?
>  	} else {
>  		dev_dbg(dev, "Requesting full reconfiguration.\n");
> +		ctype.flags = 0;
>  	}
>  
>  	reinit_completion(&priv->status_return_completion);
> @@ -210,6 +210,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.7.4
> 

Cheers,
Moritz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv1] fpga: stratix10-soc: remove the pre-set reconfiguration condition
  2020-05-12 15:35 ` Moritz Fischer
@ 2020-05-12 21:27   ` Richard Gong
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Gong @ 2020-05-12 21:27 UTC (permalink / raw)
  To: Moritz Fischer; +Cc: linux-fpga, linux-kernel, dinguyen, Richard Gong

Hi Moritz,

On 5/12/20 10:35 AM, Moritz Fischer wrote:
> Hi Richard,
> 
> On Tue, May 12, 2020 at 08:27:31AM -0500, richard.gong@linux.intel.com wrote:
>> From: Richard Gong <richard.gong@intel.com>
>>
>> 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.
>>
>> Signed-off-by: Richard Gong <richard.gong@intel.com>
>> ---
>>   drivers/fpga/stratix10-soc.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
>> index 44b7c56..2da8a40 100644
>> --- a/drivers/fpga/stratix10-soc.c
>> +++ b/drivers/fpga/stratix10-soc.c
>> @@ -182,12 +182,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 = 1;
> Have you considered:
> 
> ctype.flags = BIT(COMMAND_RECONFIG_FLAG_PARTIAL);
> 
> instead (assuming 1, lines up with BIT(COMMAND_RECONFIG_FLAG_PARTIAL)?
> 
> If not: Can you define a constant?

How about change below?

+#define RECONFIG_FLAG_FULL             0
+#define RECONFIG_FLAG_PARTIAL          1
+
  /*
   * struct s10_svc_buf
   * buf:  virtual address of buf provided by service layer
@@ -184,10 +187,10 @@ static int s10_ops_write_init(struct fpga_manager 
*mgr,

         if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
                 dev_dbg(dev, "Requesting partial reconfiguration.\n");
-               ctype.flags = 1;
+               ctype.flags = RECONFIG_FLAG_PARTIAL;
         } else {
                 dev_dbg(dev, "Requesting full reconfiguration.\n");
-               ctype.flags = 0;
+               ctype.flags = RECONFIG_FLAG_FULL;
         }

The protocol between kernel driver and the firmware:
The reconfiguration flag for full or partial configuration. 0 is for 
full (default mode) and 1 for partial reconfiguration.

I will submit a new version.

Regards,
Richard

>>   	} else {
>>   		dev_dbg(dev, "Requesting full reconfiguration.\n");
>> +		ctype.flags = 0;
>>   	}
>>   
>>   	reinit_completion(&priv->status_return_completion);
>> @@ -210,6 +210,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.7.4
>>
> 
> Cheers,
> Moritz
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-12 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 13:27 [PATCHv1] fpga: stratix10-soc: remove the pre-set reconfiguration condition richard.gong
2020-05-12 15:35 ` Moritz Fischer
2020-05-12 21:27   ` Richard Gong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).