Re: hwrng on 82801EB/ER (ICH5/ICH5R) fails rngtest checks

From: gmu 2k6
Date: Thu Jul 27 2006 - 11:05:33 EST


On 7/27/06, Michael Buesch <mb@xxxxxxxxx> wrote:
On Thursday 27 July 2006 16:20, gmu 2k6 wrote:
> On 7/27/06, Michael Buesch <mb@xxxxxxxxx> wrote:
> > On Wednesday 26 July 2006 21:44, gmu 2k6 wrote:
> > > > But could you try the following patch on top of latest git?
> > > > It's just a random test, but I think it's worth trying.
> > > > Let's see if it works around the issue.
> > > >
> > > > Index: linux-2.6/drivers/char/hw_random/intel-rng.c
> > > > ===================================================================
> > > > --- linux-2.6.orig/drivers/char/hw_random/intel-rng.c 2006-06-27 17:48:13.000000000 +0200
> > > > +++ linux-2.6/drivers/char/hw_random/intel-rng.c 2006-07-26 17:27:03.000000000 +0200
> > > > @@ -104,9 +104,14 @@
> > > > int err = -EIO;
> > > >
> > > > hw_status = hwstatus_get(mem);
> > > > + hw_status = hwstatus_set(mem, hw_status & ~INTEL_RNG_ENABLED);
> > > > + hw_status = hwstatus_set(mem, hw_status | INTEL_RNG_ENABLED);
> > > > +#if 0
> > > > + hw_status = hwstatus_get(mem);
> > > > /* turn RNG h/w on, if it's off */
> > > > if ((hw_status & INTEL_RNG_ENABLED) == 0)
> > > > hw_status = hwstatus_set(mem, hw_status | INTEL_RNG_ENABLED);
> > > > +#endif
> > > > if ((hw_status & INTEL_RNG_ENABLED) == 0) {
> > > > printk(KERN_ERR PFX "cannot enable RNG, aborting\n");
> > > > goto out;
> > >
> > > well as it didn't work, are you sure it was not intended to be more like this:
> > > @@ -104,9 +104,14 @@
> > > int err = -EIO;
> > >
> > > hw_status = hwstatus_get(mem);
> > > + hw_status = hwstatus_set(mem, hw_status & ~INTEL_RNG_ENABLED);
> > > + hw_status = hwstatus_set(mem, hw_status | INTEL_RNG_ENABLED);
> > > +#if 0
> > > /* turn RNG h/w on, if it's off */
> > > if ((hw_status & INTEL_RNG_ENABLED) == 0)
> > > hw_status = hwstatus_set(mem, hw_status | INTEL_RNG_ENABLED);
> > > +#endif
> > > if ((hw_status & INTEL_RNG_ENABLED) == 0) {
> > > printk(KERN_ERR PFX "cannot enable RNG, aborting\n");
> > > goto out;
> > >
> > > ?
> >
> > I don't think that makes a difference to the generated code, does it?
>
> I will test it now as you seem to be interested in the results.
>
> actually I was just curious what sense it made to do
> hw_status = hwstatus_get(mem);
> twice, though I'm not informed about the semantics there so I could be wrong
> in interpreting the API on that level.

Look at the #if 0. The second hwstatus_get is not going to be compiled, anyway.

yep you're right, originally I caught it as because it won't be
included in the gcc output at all and later on false thought it would
be called twice after a long day of work. maybe I should take more
time when replying to mails :D

But Jan Beulich posted an interresting patch to lkml.
Please test it.
http://marc.theaimsgroup.com/?l=linux-kernel&m=115399953714650&q=raw

I saw that too and was thinking about trying it out, will do so now.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/