linux-next: manual merge of the random tree with Linus' tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Theodore,

Today's linux-next merge of the random tree got a conflict in
arch/x86/include/asm/archrandom.h between commit 5bfce5ef55cb ("x86,
kaslr: Provide randomness functions") from Linus' tree and commits
e3be36e60bdc ("x86, random: Enable the RDSEED instruction") and
91a60dc7aa88 ("random: Add arch_has_random[_seed]()") from the random tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@xxxxxxxxxxxxxxxx

diff --cc arch/x86/include/asm/archrandom.h
index e6a92455740e,c7ed4a61e928..000000000000
--- a/arch/x86/include/asm/archrandom.h
+++ b/arch/x86/include/asm/archrandom.h
@@@ -39,20 -42,16 +42,30 @@@
  
  #ifdef CONFIG_ARCH_RANDOM
  
 +/* Instead of arch_get_random_long() when alternatives haven't run. */
 +static inline int rdrand_long(unsigned long *v)
 +{
 +	int ok;
 +	asm volatile("1: " RDRAND_LONG "\n\t"
 +		     "jc 2f\n\t"
 +		     "decl %0\n\t"
 +		     "jnz 1b\n\t"
 +		     "2:"
 +		     : "=r" (ok), "=a" (*v)
 +		     : "0" (RDRAND_RETRY_LOOPS));
 +	return ok;
 +}
 +
+ /* A single attempt at RDSEED */
+ static inline bool rdseed_long(unsigned long *v)
+ {
+ 	unsigned char ok;
+ 	asm volatile(RDSEED_LONG "\n\t"
+ 		     "setc %0"
+ 		     : "=qm" (ok), "=a" (*v));
+ 	return ok;
+ }
+ 
  #define GET_RANDOM(name, type, rdrand, nop)			\
  static inline int name(type *v)					\
  {								\
@@@ -80,15 -95,14 +109,21 @@@ GET_SEED(arch_get_random_seed_int, unsi
  GET_RANDOM(arch_get_random_long, unsigned long, RDRAND_LONG, ASM_NOP3);
  GET_RANDOM(arch_get_random_int, unsigned int, RDRAND_INT, ASM_NOP3);
  
+ GET_SEED(arch_get_random_seed_long, unsigned long, RDSEED_LONG, ASM_NOP4);
+ GET_SEED(arch_get_random_seed_int, unsigned int, RDSEED_INT, ASM_NOP4);
+ 
  #endif /* CONFIG_X86_64 */
  
+ #define arch_has_random()	static_cpu_has(X86_FEATURE_RDRAND)
+ #define arch_has_random_seed()	static_cpu_has(X86_FEATURE_RDSEED)
+ 
 +#else
 +
 +static inline int rdrand_long(unsigned long *v)
 +{
 +	return 0;
 +}
 +
  #endif  /* CONFIG_ARCH_RANDOM */
  
  extern void x86_init_rdrand(struct cpuinfo_x86 *c);

Attachment: pgpnHjkKVOnhh.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux