Subject: Re: [PATCH v2] powerpc/powernv: Use darn instr for random_seed on p9

From: Segher Boessenkool <[email-masked]>
Date: Tue, 1 Aug 2017 07:57:36 -0500

On Mon, Jul 31, 2017 at 07:10:15PM +1000, Michael Ellerman wrote:
> And ___PPC_RA() is not quite right. The L field is only 2 bits wide, not
> the 5 that ___PPC_RA() allows.
> 
> We don't have a __PPC_L() macro, because L fields vary in size and
> location. So I think you're best of open coding it, eg:
> 
> +#define PPC_DARN(t, l)		stringify_in_c(.long PPC_INST_DARN |  \
> +						__PPC_RT(t)	   |  \
> +						(((l) & 0x3) << 16))

It would be better if you could do a compile-time error if the L value
is out of range.  Hrm, nothing else does such checking either?

Segher