linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Gabriel Paubert <paubert@iram.es>
Cc: linux-s390@vger.kernel.org,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Harald Freudenberger <freude@linux.ibm.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Borislav Petkov <bp@suse.de>,
	linuxppc-dev@lists.ozlabs.org,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] random: handle archrandom in plural words
Date: Wed, 20 Jul 2022 13:03:19 +1000	[thread overview]
Message-ID: <87y1wocwp4.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <YtUB3Iola9R0OwN6@lt-gp.iram.es>

Gabriel Paubert <paubert@iram.es> writes:
> On Mon, Jul 18, 2022 at 04:31:11PM +1000, Michael Ellerman wrote:
>> "Jason A. Donenfeld" <Jason@zx2c4.com> writes:
>> > The archrandom interface was originally designed for x86, which supplies
>> > RDRAND/RDSEED for receiving random words into registers, resulting in
>> > one function to generate an int and another to generate a long. However,
>> > other architectures don't follow this.
>> >
>> > On arm64, the SMCCC TRNG interface can return between 1 and 3 words. On
>> > s390, the CPACF TRNG interface can return between 1 and 32 words for the
>> > same cost as for one word. On UML, the os_getrandom() interface can return
>> > arbitrary amounts.
>> >
>> > So change the api signature to take a "words" parameter designating the
>> > maximum number of words requested, and then return the number of words
>> > generated.
>> 
>> On powerpc a word is 32-bits and a doubleword is 64-bits (at least
>> according to the ISA). I think that's also true on other 64-bit
>> architectures.
>
> IIRC, this is (or was) not the case on Alpha, where word was defined as
> 16 bits. All assembly mnemonics had w for 16 bits, l for 32 bits, and q
> for 64 bits.

Yeah I should have said on *some* other 64-bit arches.

Seems to be a common feature/hack on arches that have evolved over time,
or been inspired by earlier arches.

The latest Power ISA has octwords :)

cheers

  reply	other threads:[~2022-07-20  3:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <YtP1+MJ1tNdJA60l@zx2c4.com>
2022-07-17 20:03 ` [PATCH v2] random: handle archrandom in plural words Jason A. Donenfeld
2022-07-18  6:31   ` Michael Ellerman
2022-07-18  6:46     ` Gabriel Paubert
2022-07-20  3:03       ` Michael Ellerman [this message]
2022-07-19 12:42   ` Mark Rutland
2022-07-19 12:46     ` Jason A. Donenfeld
2022-07-19 13:02       ` [PATCH v3] random: handle archrandom with multiple longs Jason A. Donenfeld
2022-07-19 13:17         ` Mark Rutland
2022-07-19 13:48         ` Catalin Marinas
2022-07-22 12:06         ` Heiko Carstens
2022-07-25  9:19         ` Borislav Petkov
2022-07-25  9:26           ` Jason A. Donenfeld
2022-07-25  9:36             ` David Laight
2022-07-25  9:37               ` Jason A. Donenfeld
2022-07-25 11:25         ` Borislav Petkov
2022-08-01 14:46         ` Harald Freudenberger
2022-08-01 14:50           ` Jason A. Donenfeld
2022-07-22  8:08   ` [PATCH v2] random: handle archrandom in plural words Holger Dengler
2022-07-22 11:22     ` Jason A. Donenfeld
2022-08-03 12:01       ` Holger Dengler

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=87y1wocwp4.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=Jason@zx2c4.com \
    --cc=agordeev@linux.ibm.com \
    --cc=bp@suse.de \
    --cc=catalin.marinas@arm.com \
    --cc=freude@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paubert@iram.es \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).