[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090531161842.GB30640@linux-mips.org>
Date: Sun, 31 May 2009 17:18:42 +0100
From: Ralf Baechle <ralf@...ux-mips.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Atsushi Nemoto <anemo@....ocn.ne.jp>, linux-mips@...ux-mips.org,
linux-kernel@...r.kernel.org,
Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH] hwrng: Add TX4939 RNG driver
On Fri, May 29, 2009 at 04:29:07PM -0700, Andrew Morton wrote:
> > +static u64 read_rng(void __iomem *base, unsigned int offset)
> > +{
> > + /* Caller must disable interrupts */
> > + return ____raw_readq(base + offset);
> > +}
>
> What is the reasoning behind the local_irq_disable() requirement?
>
> Because I'm wondering whether this is safe on SMP?
The problem are interrupts, not SMP. readq is reading a 64-bit register
using a 64-bit load. On a 32-bit kernel however interrupts or any
other processor exception would clobber the upper 32-bit of the processor
register so interrupts need to be disabled. The "normal" readq
functions disable interrupts as necessary on a platform. This code does
multiple read accesses so for efficiency sake it relies on the caller
handling interrupts explicitly.
Also this platform does not do SMP.
Ralf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists