Skip to contentSkip to conversation

linux-next: manual merge of the bitmap tree with the random tree

PATCH [email protected] 2 participants 2 messages Aug 2, 2022 – Aug 6, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Hi all,

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

arch/powerpc/include/asm/archrandom.h

between commit:

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

from the random tree and commit:

3e731203153de ("powerpc: drop dependency on <asm/machdep.h> in archrandom.h")

from the bitmap 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.

arch/powerpc/include/asm/archrandom.h +0 -0
diff --cc arch/powerpc/include/asm/archrandom.h
index 564859e6a807c,21def59ef1a68..0000000000000
@@@ -2,22 -2,41 +2,17 @@@
  #ifndef _ASM_POWERPC_ARCHRANDOM_H
  #define _ASM_POWERPC_ARCHRANDOM_H
  
 -#ifdef CONFIG_ARCH_RANDOM
 +#include <asm/machdep.h>
  
 -bool __must_check arch_get_random_seed_long(unsigned long *v);
 -
 -static inline bool __must_check arch_get_random_long(unsigned long *v)
 +static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)
  {
 -	return false;
 +	return 0;
  }
  
- static inline size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)
 -static inline bool __must_check arch_get_random_int(unsigned int *v)
--{
- 	if (max_longs && ppc_md.get_random_seed && ppc_md.get_random_seed(v))
- 		return 1;
- 	return 0;
 -	return false;
 -}
 -
 -
 -static inline bool __must_check arch_get_random_seed_int(unsigned int *v)
 -{
 -	unsigned long val;
 -	bool rc;
 -
 -	rc = arch_get_random_seed_long(&val);
 -	if (rc)
 -		*v = val;
 -
 -	return rc;
--}
 -#endif /* CONFIG_ARCH_RANDOM */
++size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs);
  
  #ifdef CONFIG_PPC_POWERNV
 -int powernv_hwrng_present(void);
 -int powernv_get_random_long(unsigned long *v);
 -int powernv_get_random_real_mode(unsigned long *v);
 -#else
 -static inline int powernv_hwrng_present(void) { return 0; }
 -static inline int powernv_get_random_real_mode(unsigned long *v) { return 0; }
 +int pnv_get_random_long(unsigned long *v);
  #endif
  
  #endif /* _ASM_POWERPC_ARCHRANDOM_H */
arch/powerpc/kernel/setup-common.c +4 -4
index 3b1cf9ca4814b..951822145600e 100644
@@ -172,12 +172,12 @@ void (*pm_power_off)(void);
 EXPORT_SYMBOL_GPL(pm_power_off);
 
 #ifdef CONFIG_ARCH_RANDOM
-bool __must_check arch_get_random_seed_long(unsigned long *v)
+size_T __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)
 {
-	if (ppc_md.get_random_seed)
-		return ppc_md.get_random_seed(v);
+	if (max_longs && ppc_md.get_random_seed && ppc_md.get_random_seed(v))
+		return 1;
 
-	return false;
+	return 0;
 }
 EXPORT_SYMBOL(arch_get_random_seed_long);
 
#1 lore raw

Hi Mark,

Thanks for doing linux-next in sfr's absence.

The merge resolution below is not quite right ...

Quoted 28 lines · [email protected] writes:

Hi all,

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

arch/powerpc/include/asm/archrandom.h

between commit:

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

from the random tree and commit:

3e731203153de ("powerpc: drop dependency on <asm/machdep.h> in archrandom.h")

from the bitmap 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.

arch/powerpc/include/asm/archrandom.h +0 -0
diff --cc arch/powerpc/include/asm/archrandom.h
index 564859e6a807c,21def59ef1a68..0000000000000

arch/powerpc/include/asm/archrandom.h

Quoted 5 lines
arch/powerpc/include/asm/archrandom.h +0 -0
@@@ -2,22 -2,41 +2,17 @@@
  #ifndef _ASM_POWERPC_ARCHRANDOM_H
  #define _ASM_POWERPC_ARCHRANDOM_H
 
 -#ifdef CONFIG_ARCH_RANDOM
 +#include <asm/machdep.h>

This include must be dropped.

Quoted 49 lines

-bool __must_check arch_get_random_seed_long(unsigned long *v);
-
-static inline bool __must_check arch_get_random_long(unsigned long *v) +static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)
{
- return false;
+ return 0;
}

- static inline size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs) -static inline bool __must_check arch_get_random_int(unsigned int *v)
--{

arch/powerpc/include/asm/archrandom.h +1 -4
- 	if (max_longs && ppc_md.get_random_seed && ppc_md.get_random_seed(v))
- 		return 1;
- 	return 0;
 -	return false;
 -}
 -
 -
 -static inline bool __must_check arch_get_random_seed_int(unsigned int *v)
 -{
 -	unsigned long val;
 -	bool rc;
 -
 -	rc = arch_get_random_seed_long(&val);
 -	if (rc)
 -		*v = val;
 -
 -	return rc;
--}
 -#endif /* CONFIG_ARCH_RANDOM */
++size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs);
 
  #ifdef CONFIG_PPC_POWERNV
 -int powernv_hwrng_present(void);
 -int powernv_get_random_long(unsigned long *v);
 -int powernv_get_random_real_mode(unsigned long *v);
 -#else
 -static inline int powernv_hwrng_present(void) { return 0; }
 -static inline int powernv_get_random_real_mode(unsigned long *v) { return 0; }
 +int pnv_get_random_long(unsigned long *v);
  #endif
 
  #endif /* _ASM_POWERPC_ARCHRANDOM_H */
arch/powerpc/kernel/setup-common.c +0 -0
index 3b1cf9ca4814b..951822145600e 100644

arch/powerpc/kernel/setup-common.c void (*pm_power_off)(void); · line 174

Quoted 3 lines
arch/powerpc/kernel/setup-common.c +0 -0
@@ -172,12 +172,12 @@ void (*pm_power_off)(void);
 EXPORT_SYMBOL_GPL(pm_power_off);
 
 #ifdef CONFIG_ARCH_RANDOM

This ifdef must be dropped entirely, it was removed in Jason's tree.

arch/powerpc/kernel/setup-common.c void (*pm_power_off)(void); · line 175

Quoted 2 lines
arch/powerpc/kernel/setup-common.c +1 -1
-bool __must_check arch_get_random_seed_long(unsigned long *v)
+size_T __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)

Typo, should be size_t.

arch/powerpc/kernel/setup-common.c void (*pm_power_off)(void); · line 182

Quoted 10 lines
arch/powerpc/kernel/setup-common.c +3 -3
 {
-	if (ppc_md.get_random_seed)
-		return ppc_md.get_random_seed(v);
+	if (max_longs && ppc_md.get_random_seed && ppc_md.get_random_seed(v))
+		return 1;
 
-	return false;
+	return 0;
 }
 EXPORT_SYMBOL(arch_get_random_seed_long);

The export needs to be updated to "arch_get_random_seed_longs".

I've attached the end state of archrandom.h and the hunk in setup-common.c below for reference.

cheers

==== arch/powerpc/kernel/setup-common.c ====
...

size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs)

{
	if (max_longs && ppc_md.get_random_seed && ppc_md.get_random_seed(v))
		return 1;

	return 0;
}

EXPORT_SYMBOL(arch_get_random_seed_longs);

...

==== arch/powerpc/include/asm/archrandom.h ====
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_POWERPC_ARCHRANDOM_H
#define _ASM_POWERPC_ARCHRANDOM_H

static inline size_t __must_check arch_get_random_longs(unsigned long *v, size_t max_longs)

{
	return 0;
}

size_t __must_check arch_get_random_seed_longs(unsigned long *v, size_t max_longs);

#ifdef CONFIG_PPC_POWERNV
int pnv_get_random_long(unsigned long *v);
#endif

#endif /* _ASM_POWERPC_ARCHRANDOM_H */