Hi Heinrich, On Sun, 5 Nov 2023 at 14:54, Heinrich Schuchardt <heinrich.schucha...@canonical.com> wrote: > > On 11/5/23 18:25, Simon Glass wrote: > > Hi Heinrich, > > > > On Sun, 5 Nov 2023 at 03:47, Heinrich Schuchardt > > <heinrich.schucha...@canonical.com> wrote: > >> > >> On 11/4/23 21:42, Simon Glass wrote: > >>> Hi Heinrich, > >>> > >>> On Sat, 4 Nov 2023 at 06:51, Heinrich Schuchardt > >>> <heinrich.schucha...@canonical.com> wrote: > >>>> > >>>> The existence of devices should be checked in the bind method and not in > >>>> the probe method. Adjust the RISC-V Zkr RNG driver accordingly. > >>>> > >>>> Use ENOENT (and not ENODEV) to signal that the device is not available. > >>>> > >>>> Fixes: ceec977ba1a9 ("rng: Provide a RNG based on the RISC-V Zkr ISA > >>>> extension") > >>>> Reported-by: Andre Przywara <andre.przyw...@arm.com> > >>>> Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com> > >>>> --- > >>>> drivers/rng/riscv_zkr_rng.c | 34 ++++++++++++++++++++++++++-------- > >>>> 1 file changed, 26 insertions(+), 8 deletions(-) > >>> > >>> This device should be in the DT, so you have some control over which > >>> RNG is used. > >> > >> The device-tree provided by QEMU does not contain such a device as Zkr > >> is an ISA extension and not a device. This device-tree is not under the > >> control of the U-Boot project. > > > > Why do you bring up QEMU? I would expect that it follows the norma dt > > bindings, so it should not be any different from real hardware? > > Yes Simon, QEMU follows the normal bindings. If you want to change > these, please, contribute to the RISC-V working groups or to the Linux > kernel project.
Rick, can you help with this? I am thinking of something like this as a top-level node: rng { compatible = "riscv,zkr"; }; > > > > > Anyway, you could add it. It is just a binding. I believe RISC-V has > > all sorts of isa options which result in different machine features. > > > > What are you going to do when you want to choose between the ISA RNG > > and a TPM one? > > First of all there are different configurations switches for both > drivers. But of course you can enable both. They will be different > U-Boot devices. The rng command has a parameter to choose a RNG device > by device number. This is not different to having two USB drives. Did you see the other discussion about this? Without a propert driver, there is no way to choose which RNG device is used. Also the comment is very clear: /** * struct driver_info - Information required to instantiate a device * * NOTE: Avoid using this except in extreme circumstances, where device tree * is not feasible (e.g. serial driver in SPL where <8KB of SRAM is * available). U-Boot's driver model uses device tree for configuration. Do we need a build-time warning so people don't forget this? Regards, Simon