mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH] hwrng: Add TX4939 RNG driver
Date: Sun, 31 May 2009 17:18:42 +0100	[thread overview]
Message-ID: <20090531161842.GB30640@linux-mips.org> (raw)
In-Reply-To: <20090529162907.9cb1bba2.akpm@linux-foundation.org>

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

  parent reply	other threads:[~2009-05-31 16:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 15:02 Atsushi Nemoto
2009-05-29 23:29 ` Andrew Morton
2009-05-31  1:30   ` Herbert Xu
2009-05-31 16:18   ` Ralf Baechle [this message]
2009-05-31 16:45   ` Atsushi Nemoto
2009-05-31 17:00     ` Matt Mackall
2009-05-31 17:18       ` Atsushi Nemoto
2009-06-02  3:53     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090531161842.GB30640@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=akpm@linux-foundation.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome