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

2017-08-03 Thread Matt Brown
On Tue, Aug 1, 2017 at 10:57 PM, Segher Boessenkool wrote: > 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

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

2017-08-01 Thread Segher Boessenkool
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,

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

2017-07-31 Thread Michael Ellerman
Hi Matt, A few comments inline ... Matt Brown writes: > Currently ppc_md.get_random_seed uses the powernv_get_random_long function. > A guest calling this function would have to go through the hypervisor. The This is not quite right. The powernv routine is only ever used on bare metal. In a gue

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

2017-07-12 Thread Michael Ellerman
Matt Brown writes: > On Tue, Jul 11, 2017 at 7:34 PM, Daniel Axtens wrote: >>> @@ -67,6 +69,21 @@ int powernv_get_random_real_mode(unsigned long *v) >>> return 1; >>> } >>> >>> +int powernv_get_random_darn(unsigned long *v) >> >> This is only referenced in this file so it should probably b

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

2017-07-12 Thread Matt Brown
On Tue, Jul 11, 2017 at 7:34 PM, Daniel Axtens wrote: > Hi Matt, > >> Currently ppc_md.get_random_seed uses the powernv_get_random_long function. >> A guest calling this function would have to go through the hypervisor. The >> 'darn' instruction, introduced in POWER9, allows us to bypass this by >

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

2017-07-11 Thread Daniel Axtens
Hi Matt, > Currently ppc_md.get_random_seed uses the powernv_get_random_long function. > A guest calling this function would have to go through the hypervisor. The > 'darn' instruction, introduced in POWER9, allows us to bypass this by > directly obtaining a value from the mmio region. > > This pa

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

2017-07-07 Thread Matt Brown
Currently ppc_md.get_random_seed uses the powernv_get_random_long function. A guest calling this function would have to go through the hypervisor. The 'darn' instruction, introduced in POWER9, allows us to bypass this by directly obtaining a value from the mmio region. This patch adds a function f