Re: [PATCH 1/3] hwrng: imx-rngc - use polling to detect end of self test

From: Martin Kaiser
Date: Wed Aug 23 2023 - 07:07:51 EST


Hi Alexander,

thanks for reviewing the patches.

Alexander Stein (alexander.stein@xxxxxxxxxxxxxxx) wrote:

> Am Dienstag, 22. August 2023, 17:25:51 CEST schrieb Martin Kaiser:
> > Use polling to detect the end of the rngc self test. This is much simpler
> > than using an interrupt and a completion.

> > Active waiting is no disadvantage here. The self test is run during
> > probe, there's nothing we could do in parallel at this time.

> If this driver is built-in you are stalling the boot process while
> polling, no?

According to the manual, "The self test takes approximately 29,000
cycles to complete." On my system, the rngb peripheral clock runs at
66.5MHz, i.e. the self test takes 436us.

A poll interval of 480us and a timeout of 1.5ms are more appropriate
than the current values (1ms poll interval, 3sec timeout). I'll fix this
in v2.

If it is unacceptable for a probe function to run for 1.5ms, we could
probably move the self test to the init function. It's called when the
rng is selected as the active rng.

> Unless probe_type = PROBE_PREFER_ASYNCHRONOUS is set of
> course.

This does not work for drivers that use module_platform_driver_probe.

We could switch to module_platform_driver. I'd prefer fixing the timing
or moving the self test to init, though.

Best regards,
Martin