Re: [PATCH 3/3] fpga: stratix10-soc: floor config_complete_timeout_us
From: Xu Yilun
Date: Mon Sep 28 2026 - 08:27:40 EST
On Wed, Sep 23, 2026 at 12:02:43AM +0800, Adrian Ng Ho Yin wrote:
> Keep info->config_complete_timeout_us configurable. of-fpga-region
> leaves it at 0 when the DT property is absent, and usecs_to_jiffies(0)
> makes the wait return immediately. Reconfiguration also takes ~600ms in
> practice, so enforce S10_RECONFIG_TIMEOUT as a minimum floor while still
> honouring any larger caller-supplied value. Note this prevents a DT
> property from lowering the timeout below that floor.
>
> Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@xxxxxxxxxx>
> ---
> drivers/fpga/stratix10-soc.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
> index c16ed571630b..83590e6b405f 100644
> --- a/drivers/fpga/stratix10-soc.c
> +++ b/drivers/fpga/stratix10-soc.c
> @@ -7,6 +7,7 @@
> #include <linux/completion.h>
> #include <linux/fpga/fpga-mgr.h>
> #include <linux/firmware/intel/stratix10-svc-client.h>
> +#include <linux/minmax.h>
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> @@ -360,7 +361,15 @@ static int s10_ops_write_complete(struct fpga_manager *mgr,
> unsigned long timeout;
> int ret;
>
> - timeout = usecs_to_jiffies(info->config_complete_timeout_us);
> + /*
> + * Keep config_complete_timeout_us configurable. of-fpga-region leaves
> + * it at 0 when the DT property is absent, and usecs_to_jiffies(0)
> + * makes the wait return immediately. Reconfiguration also takes
> + * ~600ms in practice, so enforce S10_RECONFIG_TIMEOUT as a minimum
> + * floor while still honouring any larger caller-supplied value.
> + */
> + timeout = max(usecs_to_jiffies(info->config_complete_timeout_us),
> + S10_RECONFIG_TIMEOUT);
Basically I think config_complete_timeout_us is used in a wrong way. You
can refer to other vendor fpga driver for reference.
>
> do {
> reinit_completion(&priv->status_return_completion);
> --
> 2.49.GIT
>
>