MPFS: add hardware RNG support and fix RNG consumers
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest6 patches 5 repliesIn review
- v18 patches 8 repliesSuperseded
Changes in v2 from the cover letter
- Removal of patch 1/8 (cmd: rng: fix error handling for dm_rng_read()) after correcting the MPFS RNG driver to follow existing UCLASS_RNG semantics (0 on success, negative errno on failure).
- Removal of patch 8/8 (boot: fdt: downgrade KASLR RNG failure to warning) after the mailbox sequencing fixes resolved the early-boot RNG failure along with the correct return value fix above.
- Moved DM_RNG selection into the defconfig enablement patch.
- Removed special-casing of -EBUSY in the system controller path.
- Removed informational RNG registration logging.
- Added review/ack tags where applicable.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | misc: mpfs_syscontroller: add mailbox RX helper for service responsesdrivers/ include/ | +28 | 0 replies | |
| 2/6 | misc: mpfs_syscontroller: bind RNG sub-devicedrivers/ | +6 | 0 replies | |
| 3/6 | rng: add Microchip PolarFire SoC hardware RNG driverdrivers/ drivers/ drivers/ | +109 | 3 replies | |
| 4/6 | configs: microchip_mpfs_generic: enable MPFS RNG supportconfigs/ | +3 | 1 reply | |
| 5/6 | mailbox: mpfs-mbox: replace unbounded BUSY polling with bounded waitsdrivers/ | +14 | 0 replies | |
| 6/6 | mailbox: mpfs: add bounded wait for BUSY to clear before sending requestdrivers/ | +5 | 0 replies |
Reviews trailers per patch
All 6 patches have a Reviewed-by or Acked-by.
| Patch | Conor Dooley | Leo Yu-Chi Liang |
|---|---|---|
| 1/6 | A-b | |
| 2/6 | A-b | |
| 3/6 | R-b | |
| 4/6 | R-b | |
| 5/6 | R-b | |
| 6/6 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/6] MPFS: add hardware RNG support and fix RNG consumers
Hi all,
This series adds support for the hardware random number generator (RNG) on the Microchip PolarFire SoC (MPFS) and fixes several related issues uncovered during integration and testing.
The MPFS hardware RNG is accessed indirectly via the MPFS system controller using the mailbox interface. Unlike typical memory-mapped RNGs, the system controller mailbox is shared and non‑reentrant, which introduces integration challenges in U‑Boot’s synchronous, polled execution model during early boot.
While integrating the RNG support, testing revealed that mailbox requests issued during autoboot could fail spuriously due to transient mailbox BUSY states. Investigation showed that the MPFS mailbox BUSY indication reflects multiple phases of the underlying IHC handshake, allowing U-Boot’s polled model to observe intermediate states that Linux’s interrupt-driven model normally hides.
This series addresses those challenges in various ways.
1. Adds missing infrastructure in the MPFS system controller driver to explicitly receive mailbox responses.
2. Binds the MPFS RNG as a sub‑device of the system controller, mirroring Linux behaviour and avoiding the need for a device tree node.
3. Introduces a new MPFS RNG driver implementing UCLASS_RNG.
4. Enables RNG support in the Microchip PolarFire SoC generic defconfig.
5. Replaces unbounded polling loops with regmap_read_poll_timeout().
6. Replaces an immediate -EBUSY return with a bounded wait for BUSY to clear, before issuing requests, avoiding spurious early-boot mailbox failures and allowing KASLR seed generation to complete successfully during autoboot.
The resulting behaviour matches Linux semantics where practical while remaining appropriate for U-Boot’s single-threaded execution model. Interactive RNG usage and boot-time KASLR seed generation both work reliably after the mailbox sequencing fixes.
All changes have been tested on the PolarFire SoC Icicle Kit ES.
Regards,
Jamie.
v1 -> v2:
- Removal of patch 1/8 (cmd: rng: fix error handling for dm_rng_read()) after correcting the MPFS RNG driver to follow existing UCLASS_RNG semantics (0 on success, negative errno on failure).
- Removal of patch 8/8 (boot: fdt: downgrade KASLR RNG failure to warning) after the mailbox sequencing fixes resolved the early-boot RNG failure along with the correct return value fix above.
- Moved DM_RNG selection into the defconfig enablement patch.
- Removed special-casing of -EBUSY in the system controller path.
- Removed informational RNG registration logging.
- Added review/ack tags where applicable.
Jamie Gibbons (6):
misc: mpfs_syscontroller: add mailbox RX helper for service responses
misc: mpfs_syscontroller: bind RNG sub-device
rng: add Microchip PolarFire SoC hardware RNG driver
configs: microchip_mpfs_generic: enable MPFS RNG support
mailbox: mpfs-mbox: replace unbounded BUSY polling with bounded waits
mailbox: mpfs: add bounded wait for BUSY to clear before sending
request
configs/microchip_mpfs_generic_defconfig | 3 + drivers/mailbox/mpfs-mbox.c | 27 ++++-- drivers/misc/mpfs_syscontroller.c | 36 +++++++- drivers/rng/Kconfig | 7 ++ drivers/rng/Makefile | 1 + drivers/rng/mpfs_rng.c | 101 +++++++++++++++++++++++ include/mpfs-mailbox.h | 2 + 7 files changed, 165 insertions(+), 12 deletions(-) create mode 100644 drivers/rng/mpfs_rng.c
Signature · 1 line
2.43.0