# Re: \[PATCH v10 2/7\] firmware: hwrng: arm\_smccc\_trng: Register as an SMCCC device

- From: Jason Gunthorpe \<jgg@nvidia.com\>
- Date: 2026-09-04 19:40:07 
- List: linux-coco
- Page: https://ratatoskr.run/linux-coco/2026/09/17516514
- Thread: https://ratatoskr.run/linux-coco/2026/09/17512666/t.md

```text
> The SMCCC TRNG interface is a firmware-provided SMCCC service rather than a
> standalone platform device. Now that the SMCCC core has an SMCCC bus,
> create an arm-smccc-trng device for the discovered TRNG service and convert
> the hwrng driver to an SMCCC driver.
> 
> The SMCCC id table preserves module autoloading for systems where the TRNG
> driver is built as a module.
> 
> The sysfs device path changes from the old smccc_trng platform-device path
> to an arm-smccc device path. No known userspace dependency on the old path
> was found; a Debian Code Search lookup for the existing platform-device
> name/path did not find any users.
> 
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> Tested-by: Andre Przywara <andre.przywara@arm.com>
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
>
> diff --git a/arch/arm/include/asm/archrandom.h b/arch/arm/include/asm/archrandom.h
> index cc4714eb1a7556..ee39a03ddf8abe 100644
> --- a/arch/arm/include/asm/archrandom.h
> +++ b/arch/arm/include/asm/archrandom.h
> @@ -2,7 +2,7 @@
>  #ifndef _ASM_ARCHRANDOM_H
>  #define _ASM_ARCHRANDOM_H
>  
> -static inline bool __init smccc_probe_trng(void)
> +static inline bool smccc_probe_trng(void)
>  {
>  	return false;
>  }

It is preexisting so 

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

But I still think this is weird, and now looks weirder with a nice
proper device driver.

Inline this ARM64 version check code in the driver:

> diff --git a/arch/arm64/include/asm/archrandom.h b/arch/arm64/include/asm/archrandom.h
> index 8babfbe31f9541..7605dd81bd1e1f 100644
> --- a/arch/arm64/include/asm/archrandom.h
> +++ b/arch/arm64/include/asm/archrandom.h
> @@ -12,7 +12,7 @@
>  
>  extern bool smccc_trng_available;
>  
> -static inline bool __init smccc_probe_trng(void)
> +static inline bool smccc_probe_trng(void)
>  {
>  	struct arm_smccc_res res;

And adjust the kconfig to not permit the driver on ARM32
builds. Achieves the same outcome without involving arch code.

Though I have no idea why it doesn't work on ARM32.

> [ ... 108 lines skipped ... ]
> +	if (IS_ENABLED(CONFIG_ARM) && ARM_SMCCC_IS_64(smccc_dev->func_id))
> +		return false;

This test passes for TRNG after all.

-- 
Jason
```
