Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: "lianfeng.ouyang" <lianfeng.ouyang@starfivetech.com>
Cc: Olivia Mackall <olivia@selenic.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v11 0/6] hwrng: starfive - fixes and JHB100 support
Date: Fri, 13 Nov 2026 21:06:09 +0800	[thread overview]
Message-ID: <avcLQWhT7gpR-Tym@gondor.apana.org.au> (raw)
In-Reply-To: <20261103073252.3028-1-lianfeng.ouyang@starfivetech.com>

On Tue, Nov 03, 2026 at 03:32:46PM +0800, lianfeng.ouyang wrote:
> From: Lianfeng Ouyang <lianfeng.ouyang@starfivetech.com>
> 
> This series adds support for the TRNG on the StarFive JHB100 SoC. The
> JHB100 needs the clocks gated before the reset is asserted, so the
> driver grows per-compatible match data describing the power-down
> ordering.
> 
> Earlier versions of this series carried all of that in the JHB100
> patch, which made it hard to review. Since v10 it is split up:
> 
>   1: dt-bindings for the new compatible (unchanged)
>   2: runtime PM / power teardown fix
>   3: SEU reseed moved out of the interrupt handler, command
>      serialisation, IRQ lifecycle
>   4: include and cleanup tidy-up, no functional change
>   5: match data and the JHB100 compatible
>   6: MAINTAINERS
> 
> Changes in v1:
>  - Remove jh8100-trng and Fix the compatible description in .yaml
>  - add JHB100 and fix clk/reset teardown logic code
> 
> Changes in v2:
>  - Balance the PM via pm_runtime_set_active() in ->probe
>  - Add devm_add_action_or_reset() to register a resource rollback function
> 
> Changes in v3:
>  - Supplement .yaml commit message
>  - Add pm_runtime_get_if_active() to check PM in irq
>  - Balances pm_runtime_get/put calls in init, read, and cleanup paths
>  - Add per-compatible match data for the teardown order
> 
> Changes in v4:
>  - Modify .yaml commit information to non point description
>  - serialise the command sequences with a mutex.
> 
> Changes in v5:
>  - Run the reseed from a workqueue instead of hard IRQ context.
>  - Balance the probe reset_control_deassert() via a ->cleanup flag in the
>    PM suspend/resume callbacks (was skipped when already suspended).
>  - Use devm_pm_runtime_set_active_enabled() instead of manual PM enable.
>  - Register the IRQ after clk/reset/PM setup; reuse
>     starfive_trng_release() on request_irq() failure.
>  - Check reset_control_deassert();
>  - drop of_match_ptr() from the match table.
> 
> Changes in v6:
>  - check lock in starfive_trng_read() using mutex_trylock when wait is 0
> 
> Changes in v7:
>  - using mutex_trylock when wait is 0, otherwise use mutex_lock()
> 
> Changes in v8:
>  - rebase patches against the latest tree
> 
> Changes in v9:
>  - Fixed the PM runtime reference leak in starfive_trng_read()
>  - Drop redundant pm_runtime_get/put calls from the interrupt
>      handler (starfive_trng_irq).
>  - Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() for power
>      management operations.
>  - Split clock/reset control into starfive_trng_power_on/off()
>  - Track power state with clk_on/rst_deassert/initialized/need_reseed
>       instead of open-coded clk control.
>  - IRQ now requested with IRQF_NO_AUTOEN and enabled only after init
>       succeeds.
>  - LFSR_LOCKUP no longer schedules work from hard IRQ: set need_reseed
>       flag and let starfive_trng_reseed_work() handle reseed on a
>       freezable workqueue.
>  - starfive_trng_cmd() takes timeout + wait args; read path checks idle,
>       reseeds on need_reseed, retries once on lockup, returns 0 for
>       non-blocking.
>  - Protect ctrl-cmd sequences with mutex + lockdep_assert_held.
>  - Cleanup/suspend disables IE, clears ISTAT, synchronize_irq() before
>       gating clocks/reset.
> 
> Changes in v10:
>  - Split the driver change into fixes, cleanup and the JHB100 addition.
>  - starfive_trng_init() only enables the interrupt line once and clears
>    trng->initialized on failure; starfive_trng_cleanup() only disables
>    the line if init left it enabled. Fixes the unbalanced enable_irq()
>    when the device is deselected and quickly reselected, and the double
>    disable_irq() after a failed init.
>  - Non-blocking reads re-queue the reseed work instead of assuming it
>    is pending, and starfive_trng_irq_clear() queues it when it clears a
>    lockup. Fixes the stall of non-blocking reads after a lockup seen
>    outside the interrupt handler or a failed reseed.
>  - Do not include <linux/mod_devicetable.h>, <linux/platform_device.h>
>    already provides struct of_device_id.
>  - Describe the header rearrangement in the commit log.
>  - Rebased on top of ace145efdd80.
> 
> Changes in v11:
>  - starfive_trng_cmd() acks RAND_RDY/SEED_DONE in ISTAT and calls
>    synchronize_irq() before re-arming its completion, so that the late
>    completion interrupt of a command that timed out cannot complete
>    the next command. The v10 commit log claimed this case was already
>    covered; it was not.
>  - starfive_trng_irq_clear() only queues the reseed work while the
>    device is initialised, so the suspend run from ->cleanup() and from
>    the runtime PM teardown on unbind can no longer queue the work after
>    it has been cancelled.
> 
> Lianfeng Ouyang (6):
>   dt-bindings: rng: starfive,jh7110-trng: add jhb100, drop jh8100
>   hwrng: starfive - fix runtime PM and power teardown handling
>   hwrng: starfive - move the SEU reseed out of the interrupt handler
>   hwrng: starfive - tidy up includes and drop unused code
>   hwrng: starfive - add JHB100 support
>   MAINTAINERS: update the StarFive TRNG driver maintainer
> 
>  .../bindings/rng/starfive,jh7110-trng.yaml    |  10 +-
>  MAINTAINERS                                   |   2 +-
>  drivers/char/hw_random/jh7110-trng.c          | 587 +++++++++++++-----
>  3 files changed, 434 insertions(+), 165 deletions(-)
> 
> --
> 2.43.0

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      parent reply	other threads:[~2026-11-13 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  7:32 [PATCH v11 0/6] hwrng: starfive - fixes and JHB100 support lianfeng.ouyang
2026-11-03  7:32 ` [PATCH v11 1/6] dt-bindings: rng: starfive,jh7110-trng: add jhb100, drop jh8100 lianfeng.ouyang
2026-11-03  7:32 ` [PATCH v11 2/6] hwrng: starfive - fix runtime PM and power teardown handling lianfeng.ouyang
2026-11-03  7:32 ` [PATCH v11 3/6] hwrng: starfive - move the SEU reseed out of the interrupt handler lianfeng.ouyang
2026-11-03  7:32 ` [PATCH v11 4/6] hwrng: starfive - tidy up includes and drop unused code lianfeng.ouyang
2026-11-03  7:32 ` [PATCH v11 5/6] hwrng: starfive - add JHB100 support lianfeng.ouyang
2026-11-03  7:32 ` [PATCH v11 6/6] MAINTAINERS: update the StarFive TRNG driver maintainer lianfeng.ouyang
2026-11-13 13:06 ` Herbert Xu [this message]

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=avcLQWhT7gpR-Tym@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lianfeng.ouyang@starfivetech.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olivia@selenic.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    /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