Subject: linux-next: manual merge of the random tree with the s390-fixes tree

From: [email-masked]
Date: Wed, 3 Aug 2022 00:35:59 +0100

Hi all,

Today's linux-next merge of the random tree got a conflict in:

  arch/s390/include/asm/archrandom.h

between commit:

  918e75f77af7d ("s390/archrandom: prevent CPACF trng invocations in interrupt context")

from the s390-fixes tree and commit:

  d349ab99eec7a ("random: handle archrandom with multiple longs")

from the random tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc arch/s390/include/asm/archrandom.h
index 4120c428dc378,cf5e000df0a14..0000000000000
--- a/arch/s390/include/asm/archrandom.h
+++ b/arch/s390/include/asm/archrandom.h
@@@ -11,47 -11,26 +11,28 @@@
  #ifndef _ASM_S390_ARCHRANDOM_H
  #define _ASM_S390_ARCHRANDOM_H
  
- #ifdef CONFIG_ARCH_RANDOM
- 
  #include <linux/static_key.h>
 +#include <linux/preempt.h>
  #include <linux/atomic.h>
  #include <asm/cpacf.h>
  
  DECLARE_STATIC_KEY_FALSE(s390_arch_random_available);
  extern atomic64_t s390_arch_random_counter;
  
- static inline bool __must_check arch_get_random_long(unsigned long *v)
- {
- 	return false;
- }
- 
- static inline bool __must_check arch_get_random_int(unsigned int *v)
- {
- 	return false;
- }
- 
- static inline bool __must_check arch_get_random_seed_long(unsigned long *v)
+ static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)
  {
- 	if (static_branch_likely(&s390_arch_random_available) &&
- 	    in_task()) {
- 		cpacf_trng(NULL, 0, (u8 *)v, sizeof(*v));
- 		atomic64_add(sizeof(*v), &s390_arch_random_counter);
- 		return true;
- 	}
- 	return false;
+ 	return 0;
  }
  
- static inline bool __must_check arch_get_random_seed_int(unsigned int *v)
+ static inline size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)
  {
 -	if (static_branch_likely(&s390_arch_random_available)) {
 +	if (static_branch_likely(&s390_arch_random_available) &&
 +	    in_task()) {
- 		cpacf_trng(NULL, 0, (u8 *)v, sizeof(*v));
- 		atomic64_add(sizeof(*v), &s390_arch_random_counter);
- 		return true;
+ 		cpacf_trng(NULL, 0, (u8 *)v, max_longs * sizeof(*v));
+ 		atomic64_add(max_longs * sizeof(*v), &s390_arch_random_counter);
+ 		return max_longs;
  	}
- 	return false;
+ 	return 0;
  }
  
- #endif /* CONFIG_ARCH_RANDOM */
  #endif /* _ASM_S390_ARCHRANDOM_H */