mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
To: mdf@kernel.org, yilun.xu@intel.com, yilun.xu@linux.intel.com,
	trix@redhat.com, linux-fpga@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
Subject: [PATCH v3 0/3] fpga: stratix10-soc: harden wait, ERROR order, and timeout
Date: Tue, 20 Oct 2026 15:49:29 +0800	[thread overview]
Message-ID: <cover.1792480395.git.adrian.ho.yin.ng@altera.com> (raw)
In-Reply-To: <cover.1790090287.git.adrian.ho.yin.ng@altera.com>

Stratix10 FPGA reconfiguration can fail or hang for three related
reasons in the FPGA manager. This series hardens s10_ops_write_init(),
s10_ops_write() and s10_ops_write_complete(). No dependency on the
stratix10-svc accumulate changes.

  1) always wait for svc buffer completion

     s10_ops_write() skips wait_for_completion_timeout() when
     priv->status is already set. Always call the wait; if complete()
     already ran, the done counter is raised and the wait returns
     immediately.

  2) use config_complete_timeout_us as a deadline

     config_complete_timeout_us was passed as the timeout of every wait
     for a service layer reply, so the value 0 that of-fpga-region
     leaves when the DT property is absent fails write_complete at once.
     Wait for each RECONFIG_STATUS reply with a driver timeout that
     covers the service layer's own polling window, and use
     config_complete_timeout_us only as the deadline for re-polling
     after a BUSY reply, as xilinx-core, efinix-spi and
     altera-pr-ip-core do. Because one reply can take up to the
     service layer polling window, the deadline is coarse.

  3) SVC wait helper; prefer ERROR over success bits

     Add s10_svc_wait() / s10_svc_send_and_wait(). write_init becomes
     one s10_svc_send_and_wait() call, write_complete uses it for each
     status request, and write() uses s10_svc_wait() after sending a
     data buffer or claim request. ERROR takes precedence over
     BUFFER_DONE, BUFFER_SUBMITTED, COMPLETED and OK in the accumulated
     status word.

Changes in v3:
  - Patch 2 replaces "floor config_complete_timeout_us": drop the max()
    floor, use config_complete_timeout_us as a re-poll deadline instead
    of the per-reply wait (Xu Yilun)
  - Patch 3 replaces "prefer ERROR over BUFFER_DONE": add the wait
    helpers and convert all three ops to them (Xu Yilun)
  - ERROR also wins over COMPLETED and OK (Xu Yilun)
  - Timeout patch moved before the helper patch so no intermediate
    commit can re-poll without a bound
  - write_complete ignores a stray wake-up from the last claim callback
    instead of counting it against the deadline
  - v2 was posted without a version tag as "[PATCH n/3]"

Adrian Ng Ho Yin (3):
  fpga: stratix10-soc: always wait for svc buffer completion
  fpga: stratix10-soc: use config_complete_timeout_us as a deadline
  fpga: stratix10-soc: add SVC wait helper and prefer ERROR

 drivers/fpga/stratix10-soc.c | 178 +++++++++++++++++++++--------------
 1 file changed, 106 insertions(+), 72 deletions(-)

-- 
2.49.GIT


  parent reply	other threads:[~2026-10-20  7:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 16:02 [PATCH " Adrian Ng Ho Yin
2026-09-22 16:02 ` [PATCH 1/3] fpga: stratix10-soc: always wait for svc buffer completion Adrian Ng Ho Yin
2026-09-22 16:02 ` [PATCH 2/3] fpga: stratix10-soc: prefer ERROR over BUFFER_DONE Adrian Ng Ho Yin
2026-09-28 11:59   ` Xu Yilun
2026-09-22 16:02 ` [PATCH 3/3] fpga: stratix10-soc: floor config_complete_timeout_us Adrian Ng Ho Yin
2026-09-28 12:14   ` Xu Yilun
2026-10-20  7:49 ` Adrian Ng Ho Yin [this message]
2026-10-20  7:49   ` [PATCH v3 1/3] fpga: stratix10-soc: always wait for svc buffer completion Adrian Ng Ho Yin
2026-10-20  7:49   ` [PATCH v3 2/3] fpga: stratix10-soc: use config_complete_timeout_us as a deadline Adrian Ng Ho Yin
2026-10-20  7:49   ` [PATCH v3 3/3] fpga: stratix10-soc: add SVC wait helper and prefer ERROR Adrian Ng Ho Yin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1792480395.git.adrian.ho.yin.ng@altera.com \
    --to=adrian.ho.yin.ng@altera.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    --cc=yilun.xu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®