Skip to contentSkip to conversation

powerpc/rng: wire up during setup_arch

PATCH Superseded Jason A. Donenfeld 2 participants 10 messages Jun 11, 2022

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/rng: wire up during setup_arch

The platform's RNG must be available before random_init() in order to be useful for initial seeding, which in turn means that it needs to be called from setup_arch(), rather than from an init call. Fortunately, each platform already has a setup_arch function pointer, which means it's easy to wire this up for each of the three platforms that have an RNG. This commit also removes some noisy log messages that don't add much.

---
 arch/powerpc/platforms/microwatt/rng.c   |  9 ++-------
 arch/powerpc/platforms/microwatt/setup.c |  8 ++++++++
 arch/powerpc/platforms/powernv/rng.c     | 17 ++++-------------
 arch/powerpc/platforms/powernv/setup.c   |  4 ++++
 arch/powerpc/platforms/pseries/rng.c     | 11 ++---------
 arch/powerpc/platforms/pseries/setup.c   |  3 +++
 6 files changed, 23 insertions(+), 29 deletions(-)
arch/powerpc/platforms/microwatt/rng.c +2 -7
index 7bc4d1cbfaf0..d13f656910ad 100644
@@ -29,7 +29,7 @@ static int microwatt_get_random_darn(unsigned long *v)
 	return 1;
 }
 
-static __init int rng_init(void)
+__init void microwatt_rng_init(void)
 {
 	unsigned long val;
 	int i;
@@ -37,12 +37,7 @@ static __init int rng_init(void)
 	for (i = 0; i < 10; i++) {
 		if (microwatt_get_random_darn(&val)) {
 			ppc_md.get_random_seed = microwatt_get_random_darn;
-			return 0;
+			return;
 		}
 	}
-
-	pr_warn("Unable to use DARN for get_random_seed()\n");
-
-	return -EIO;
 }
-machine_subsys_initcall(, rng_init);
arch/powerpc/platforms/microwatt/setup.c +8 -0
index 0b02603bdb74..23c996dcc870 100644
@@ -32,10 +32,18 @@ static int __init microwatt_populate(void)
 }
 machine_arch_initcall(microwatt, microwatt_populate);
 
+__init void microwatt_rng_init(void);
+
+static void __init microwatt_setup_arch(void)
+{
+	microwatt_rng_init();
+}
+
 define_machine(microwatt) {
 	.name			= "microwatt",
 	.probe			= microwatt_probe,
 	.init_IRQ		= microwatt_init_IRQ,
+	.setup_arch		= microwatt_setup_arch,
 	.progress		= udbg_progress,
 	.calibrate_decr		= generic_calibrate_decr,
 };
arch/powerpc/platforms/powernv/rng.c +4 -13
index e3d44b36ae98..ef24e72a1b69 100644
@@ -84,24 +84,20 @@ static int powernv_get_random_darn(unsigned long *v)
 	return 1;
 }
 
-static int __init initialise_darn(void)
+static void __init initialise_darn(void)
 {
 	unsigned long val;
 	int i;
 
 	if (!cpu_has_feature(CPU_FTR_ARCH_300))
-		return -ENODEV;
+		return;
 
 	for (i = 0; i < 10; i++) {
 		if (powernv_get_random_darn(&val)) {
 			ppc_md.get_random_seed = powernv_get_random_darn;
-			return 0;
+			return;
 		}
 	}
-
-	pr_warn("Unable to use DARN for get_random_seed()\n");
-
-	return -EIO;
 }
 
 int powernv_get_random_long(unsigned long *v)
@@ -163,14 +159,12 @@ static __init int rng_create(struct device_node *dn)
 
 	rng_init_per_cpu(rng, dn);
 
-	pr_info_once("Registering arch random hook.\n");
-
 	ppc_md.get_random_seed = powernv_get_random_long;
 
 	return 0;
 }
 
-static __init int rng_init(void)
+__init void powernv_rng_init(void)
 {
 	struct device_node *dn;
 	int rc;
@@ -188,7 +182,4 @@ static __init int rng_init(void)
 	}
 
 	initialise_darn();
-
-	return 0;
 }
-machine_subsys_initcall(powernv, rng_init);
arch/powerpc/platforms/powernv/setup.c +4 -0
index 824c3ad7a0fa..a0c5217bc5c0 100644
@@ -184,6 +184,8 @@ static void __init pnv_check_guarded_cores(void)
 	}
 }
 
+__init void powernv_rng_init(void);
+
 static void __init pnv_setup_arch(void)
 {
 	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -203,6 +205,8 @@ static void __init pnv_setup_arch(void)
 	pnv_check_guarded_cores();
 
 	/* XXX PMCS */
+
+	powernv_rng_init();
 }
 
 static void __init pnv_init(void)
arch/powerpc/platforms/pseries/rng.c +2 -9
index 6268545947b8..d39bfce39aa1 100644
@@ -24,19 +24,12 @@ static int pseries_get_random_long(unsigned long *v)
 	return 0;
 }
 
-static __init int rng_init(void)
+__init void pseries_rng_init(void)
 {
 	struct device_node *dn;
-
 	dn = of_find_compatible_node(NULL, NULL, "ibm,random");
 	if (!dn)
-		return -ENODEV;
-
-	pr_info("Registering arch random hook.\n");
-
+		return;
 	ppc_md.get_random_seed = pseries_get_random_long;
-
 	of_node_put(dn);
-	return 0;
 }
-machine_subsys_initcall(pseries, rng_init);
arch/powerpc/platforms/pseries/setup.c +3 -0
index afb074269b42..7f3ee2658163 100644
@@ -779,6 +779,8 @@ static resource_size_t pseries_pci_iov_resource_alignment(struct pci_dev *pdev,
 }
 #endif
 
+__init void pseries_rng_init(void);
+
 static void __init pSeries_setup_arch(void)
 {
 	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -839,6 +841,7 @@ static void __init pSeries_setup_arch(void)
 	}
 
 	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	pseries_rng_init();
 }
 
 static void pseries_panic(char *str)
Signature · 1 line
2.35.1
#1 lore raw

Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :

Quoted 7 lines

The platform's RNG must be available before random_init() in order to be useful for initial seeding, which in turn means that it needs to be called from setup_arch(), rather than from an init call. Fortunately, each platform already has a setup_arch function pointer, which means it's easy to wire this up for each of the three platforms that have an RNG. This commit also removes some noisy log messages that don't add much.

Can't we use one of the machine initcalls for that ? Like machine_early_initcall() or machine_arch_initcall() ?

Today it is using machine_subsys_initcall() and you didn't remove it. It means rng_init() will be called twice. Is that ok ?

Quoted 188 lines
---
  arch/powerpc/platforms/microwatt/rng.c   |  9 ++-------
  arch/powerpc/platforms/microwatt/setup.c |  8 ++++++++
  arch/powerpc/platforms/powernv/rng.c     | 17 ++++-------------
  arch/powerpc/platforms/powernv/setup.c   |  4 ++++
  arch/powerpc/platforms/pseries/rng.c     | 11 ++---------
  arch/powerpc/platforms/pseries/setup.c   |  3 +++
  6 files changed, 23 insertions(+), 29 deletions(-)
arch/powerpc/platforms/microwatt/rng.c +2 -7
index 7bc4d1cbfaf0..d13f656910ad 100644
@@ -29,7 +29,7 @@ static int microwatt_get_random_darn(unsigned long *v)
  	return 1;
  }
 
-static __init int rng_init(void)
+__init void microwatt_rng_init(void)
  {
  	unsigned long val;
  	int i;
@@ -37,12 +37,7 @@ static __init int rng_init(void)
  	for (i = 0; i < 10; i++) {
  		if (microwatt_get_random_darn(&val)) {
  			ppc_md.get_random_seed = microwatt_get_random_darn;
-			return 0;
+			return;
  		}
  	}
-
-	pr_warn("Unable to use DARN for get_random_seed()\n");
-
-	return -EIO;
  }
-machine_subsys_initcall(, rng_init);
arch/powerpc/platforms/microwatt/setup.c +8 -0
index 0b02603bdb74..23c996dcc870 100644
@@ -32,10 +32,18 @@ static int __init microwatt_populate(void)
  }
  machine_arch_initcall(microwatt, microwatt_populate);
 
+__init void microwatt_rng_init(void);
+
+static void __init microwatt_setup_arch(void)
+{
+	microwatt_rng_init();
+}
+
  define_machine(microwatt) {
  	.name			= "microwatt",
  	.probe			= microwatt_probe,
  	.init_IRQ		= microwatt_init_IRQ,
+	.setup_arch		= microwatt_setup_arch,
  	.progress		= udbg_progress,
  	.calibrate_decr		= generic_calibrate_decr,
  };
arch/powerpc/platforms/powernv/rng.c +4 -13
index e3d44b36ae98..ef24e72a1b69 100644
@@ -84,24 +84,20 @@ static int powernv_get_random_darn(unsigned long *v)
  	return 1;
  }
 
-static int __init initialise_darn(void)
+static void __init initialise_darn(void)
  {
  	unsigned long val;
  	int i;
 
  	if (!cpu_has_feature(CPU_FTR_ARCH_300))
-		return -ENODEV;
+		return;
 
  	for (i = 0; i < 10; i++) {
  		if (powernv_get_random_darn(&val)) {
  			ppc_md.get_random_seed = powernv_get_random_darn;
-			return 0;
+			return;
  		}
  	}
-
-	pr_warn("Unable to use DARN for get_random_seed()\n");
-
-	return -EIO;
  }
 
  int powernv_get_random_long(unsigned long *v)
@@ -163,14 +159,12 @@ static __init int rng_create(struct device_node *dn)
 
  	rng_init_per_cpu(rng, dn);
 
-	pr_info_once("Registering arch random hook.\n");
-
  	ppc_md.get_random_seed = powernv_get_random_long;
 
  	return 0;
  }
 
-static __init int rng_init(void)
+__init void powernv_rng_init(void)
  {
  	struct device_node *dn;
  	int rc;
@@ -188,7 +182,4 @@ static __init int rng_init(void)
  	}
 
  	initialise_darn();
-
-	return 0;
  }
-machine_subsys_initcall(powernv, rng_init);
arch/powerpc/platforms/powernv/setup.c +4 -0
index 824c3ad7a0fa..a0c5217bc5c0 100644
@@ -184,6 +184,8 @@ static void __init pnv_check_guarded_cores(void)
  	}
  }
 
+__init void powernv_rng_init(void);
+
  static void __init pnv_setup_arch(void)
  {
  	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -203,6 +205,8 @@ static void __init pnv_setup_arch(void)
  	pnv_check_guarded_cores();
 
  	/* XXX PMCS */
+
+	powernv_rng_init();
  }
 
  static void __init pnv_init(void)
arch/powerpc/platforms/pseries/rng.c +2 -9
index 6268545947b8..d39bfce39aa1 100644
@@ -24,19 +24,12 @@ static int pseries_get_random_long(unsigned long *v)
  	return 0;
  }
 
-static __init int rng_init(void)
+__init void pseries_rng_init(void)
  {
  	struct device_node *dn;
-
  	dn = of_find_compatible_node(NULL, NULL, "ibm,random");
  	if (!dn)
-		return -ENODEV;
-
-	pr_info("Registering arch random hook.\n");
-
+		return;
  	ppc_md.get_random_seed = pseries_get_random_long;
-
  	of_node_put(dn);
-	return 0;
  }
-machine_subsys_initcall(pseries, rng_init);
arch/powerpc/platforms/pseries/setup.c +3 -0
index afb074269b42..7f3ee2658163 100644
@@ -779,6 +779,8 @@ static resource_size_t pseries_pci_iov_resource_alignment(struct pci_dev *pdev,
  }
  #endif
 
+__init void pseries_rng_init(void);
+
  static void __init pSeries_setup_arch(void)
  {
  	set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -839,6 +841,7 @@ static void __init pSeries_setup_arch(void)
  	}
 
  	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+	pseries_rng_init();
  }
 
  static void pseries_panic(char *str)
#2 lore raw

Le 11/06/2022 à 11:16, Christophe Leroy a écrit :

Quoted 11 lines

Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :

Quoted 7 lines

The platform's RNG must be available before random_init() in order to be useful for initial seeding, which in turn means that it needs to be called from setup_arch(), rather than from an init call. Fortunately, each platform already has a setup_arch function pointer, which means it's easy to wire this up for each of the three platforms that have an RNG. This commit also removes some noisy log messages that don't add much.

Quoted 5 lines

Can't we use one of the machine initcalls for that ? Like machine_early_initcall() or machine_arch_initcall() ?

Today it is using  machine_subsys_initcall() and you didn't remove it. It means rng_init() will be called twice. Is that ok ?

Also, you copied stable. Should you add a Fixes: tag so that we know what it fixes ?

Quoted 174 lines
Quoted 174 lines

---
  arch/powerpc/platforms/microwatt/rng.c   |  9 ++------- arch/powerpc/platforms/microwatt/setup.c |  8 ++++++++ arch/powerpc/platforms/powernv/rng.c     | 17 ++++------------- arch/powerpc/platforms/powernv/setup.c   |  4 ++++ arch/powerpc/platforms/pseries/rng.c     | 11 ++--------- arch/powerpc/platforms/pseries/setup.c   |  3 +++

  6 files changed, 23 insertions(+), 29 deletions(-)
arch/powerpc/platforms/microwatt/rng.c +2 -7
index 7bc4d1cbfaf0..d13f656910ad 100644
@@ -29,7 +29,7 @@ static int microwatt_get_random_darn(unsigned long *v)
       return 1;
   }
-static __init int rng_init(void)
+__init void microwatt_rng_init(void)
   {
       unsigned long val;
       int i;
@@ -37,12 +37,7 @@ static __init int rng_init(void)
       for (i = 0; i < 10; i++) {
           if (microwatt_get_random_darn(&val)) {
               ppc_md.get_random_seed = microwatt_get_random_darn;
-            return 0;
+            return;
           }
       }
-
-    pr_warn("Unable to use DARN for get_random_seed()\n");
-
-    return -EIO;
   }
-machine_subsys_initcall(, rng_init);
arch/powerpc/platforms/microwatt/setup.c +8 -0
index 0b02603bdb74..23c996dcc870 100644
@@ -32,10 +32,18 @@ static int __init microwatt_populate(void)
   }
   machine_arch_initcall(microwatt, microwatt_populate);
+__init void microwatt_rng_init(void);
+
+static void __init microwatt_setup_arch(void)
+{
+    microwatt_rng_init();
+}
+
   define_machine(microwatt) {
       .name            = "microwatt",
       .probe            = microwatt_probe,
       .init_IRQ        = microwatt_init_IRQ,
+    .setup_arch        = microwatt_setup_arch,
       .progress        = udbg_progress,
       .calibrate_decr        = generic_calibrate_decr,
   };
arch/powerpc/platforms/powernv/rng.c +4 -13
index e3d44b36ae98..ef24e72a1b69 100644
@@ -84,24 +84,20 @@ static int powernv_get_random_darn(unsigned long *v)
       return 1;
   }
-static int __init initialise_darn(void)
+static void __init initialise_darn(void)
   {
       unsigned long val;
       int i;
       if (!cpu_has_feature(CPU_FTR_ARCH_300))
-        return -ENODEV;
+        return;
       for (i = 0; i < 10; i++) {
           if (powernv_get_random_darn(&val)) {
               ppc_md.get_random_seed = powernv_get_random_darn;
-            return 0;
+            return;
           }
       }
-
-    pr_warn("Unable to use DARN for get_random_seed()\n");
-
-    return -EIO;
   }
   int powernv_get_random_long(unsigned long *v)
@@ -163,14 +159,12 @@ static __init int rng_create(struct device_node 
 *dn)
       rng_init_per_cpu(rng, dn);
-    pr_info_once("Registering arch random hook.\n");
-
       ppc_md.get_random_seed = powernv_get_random_long;
       return 0;
   }
-static __init int rng_init(void)
+__init void powernv_rng_init(void)
   {
       struct device_node *dn;
       int rc;
@@ -188,7 +182,4 @@ static __init int rng_init(void)
       }
       initialise_darn();
-
-    return 0;
   }
-machine_subsys_initcall(powernv, rng_init);
arch/powerpc/platforms/powernv/setup.c +4 -0
index 824c3ad7a0fa..a0c5217bc5c0 100644
@@ -184,6 +184,8 @@ static void __init pnv_check_guarded_cores(void)
       }
   }
+__init void powernv_rng_init(void);
+
   static void __init pnv_setup_arch(void)
   {
       set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -203,6 +205,8 @@ static void __init pnv_setup_arch(void)
       pnv_check_guarded_cores();
       /* XXX PMCS */
+
+    powernv_rng_init();
   }
   static void __init pnv_init(void)
arch/powerpc/platforms/pseries/rng.c +2 -9
index 6268545947b8..d39bfce39aa1 100644
@@ -24,19 +24,12 @@ static int pseries_get_random_long(unsigned long *v)
       return 0;
   }
-static __init int rng_init(void)
+__init void pseries_rng_init(void)
   {
       struct device_node *dn;
-
       dn = of_find_compatible_node(NULL, NULL, "ibm,random");
       if (!dn)
-        return -ENODEV;
-
-    pr_info("Registering arch random hook.\n");
-
+        return;
       ppc_md.get_random_seed = pseries_get_random_long;
-
       of_node_put(dn);
-    return 0;
   }
-machine_subsys_initcall(pseries, rng_init);
arch/powerpc/platforms/pseries/setup.c +3 -0
index afb074269b42..7f3ee2658163 100644
@@ -779,6 +779,8 @@ static resource_size_t 
 pseries_pci_iov_resource_alignment(struct pci_dev *pdev,
   }
   #endif
+__init void pseries_rng_init(void);
+
   static void __init pSeries_setup_arch(void)
   {
       set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
@@ -839,6 +841,7 @@ static void __init pSeries_setup_arch(void)
       }
       ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+    pseries_rng_init();
   }
   static void pseries_panic(char *str)
#3 lore raw

Hi Christophe,

Quoted 2 lines · Christophe Leroy

Also, you copied stable. Should you add a Fixes: tag so that we know what it fixes ?

I suppose the fixes tag would be whatever introduced those files in the first place, so not all together useful. But if you want something, feel free to append these when applying the commit:

Fixes a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
Fixes a489043f4626 ("powerpc/pseries: Implement arch_get_random_long() based on H_RANDOM")
Fixes c25769fddaec ("powerpc/microwatt: Add support for hardware random number generator")

Jason

#4 lore raw

Le 11/06/2022 à 11:22, Jason A. Donenfeld a écrit :

Quoted 6 lines

Hi Christophe,

Quoted 2 lines · Christophe Leroy

Also, you copied stable. Should you add a Fixes: tag so that we know what it fixes ?

Quoted 8 lines

I suppose the fixes tag would be whatever introduced those files in the first place, so not all together useful. But if you want something, feel free to append these when applying the commit:

Fixes a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
Fixes a489043f4626 ("powerpc/pseries: Implement arch_get_random_long() based on H_RANDOM")
Fixes c25769fddaec ("powerpc/microwatt: Add support for hardware random number generator")

Well it helps knowing on which stable version it applies.

Maybe it would be cleaner to send three patches ? After all they look like 3 independant changes with nothing in common at all.

Christophe

#5 lore raw

Hi Christophe,

Quoted 11 lines · Christophe Leroy

Le 11/06/2022 à 11:22, Jason A. Donenfeld a écrit :

Quoted 10 lines

Hi Christophe,

Quoted 2 lines · Christophe Leroy

Also, you copied stable. Should you add a Fixes: tag so that we know what it fixes ?

I suppose the fixes tag would be whatever introduced those files in the first place, so not all together useful. But if you want something, feel free to append these when applying the commit:

Quoted 8 lines
Quoted 4 lines
Fixes a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
Fixes a489043f4626 ("powerpc/pseries: Implement arch_get_random_long() based on H_RANDOM")
Fixes c25769fddaec ("powerpc/microwatt: Add support for hardware random number generator")

Well it helps knowing on which stable version it applies.

Maybe it would be cleaner to send three patches ? After all they look

Sounds like irritating paperwork to me.

Quoted 1 line

like 3 independant changes with nothing in common at all.

"Nothing in common"? I don't know about that.

Anyway, sure, I'll do that and send a v2 series.

Jason

#7 lore raw
In reply to Jason A. Donenfeld

Le 11/06/2022 à 11:58, Jason A. Donenfeld a écrit :

Quoted 19 lines

Hi Christophe,

Quoted 16 lines · Christophe Leroy

Le 11/06/2022 à 11:22, Jason A. Donenfeld a écrit :

Quoted 14 lines

Hi Christophe,

Quoted 2 lines · Christophe Leroy

Also, you copied stable. Should you add a Fixes: tag so that we know what it fixes ?

I suppose the fixes tag would be whatever introduced those files in the first place, so not all together useful. But if you want something, feel free to append these when applying the commit:

Fixes a4da0d50b2a0 ("powerpc: Implement arch_get_random_long/int() for powernv")
Fixes a489043f4626 ("powerpc/pseries: Implement arch_get_random_long() based on H_RANDOM")
Fixes c25769fddaec ("powerpc/microwatt: Add support for hardware random number generator")
Quoted 5 lines
Quoted 3 lines

Well it helps knowing on which stable version it applies.

Maybe it would be cleaner to send three patches ? After all they look

Sounds like irritating paperwork to me.

It helps with application to stable.

Two of the above commits are in v3.12, the other one appears in v5.13

So having the microwatt in a separate patch should ease.

Quoted 4 lines
Quoted 2 lines

like 3 independant changes with nothing in common at all.

"Nothing in common"? I don't know about that.

I mean no common file that needs to be changed for the three platforms, so it makes it easy.

Quoted 3 lines

Anyway, sure, I'll do that and send a v2 series.

As they are independant it doesn't need to be a series at all. But that's fine if it is a series as well.

Christophe

#8 lore raw
In reply to Christophe Leroy

Hi Christophe,

Quoted 11 lines · Christophe Leroy

Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :

Quoted 7 lines

The platform's RNG must be available before random_init() in order to be useful for initial seeding, which in turn means that it needs to be called from setup_arch(), rather than from an init call. Fortunately, each platform already has a setup_arch function pointer, which means it's easy to wire this up for each of the three platforms that have an RNG. This commit also removes some noisy log messages that don't add much.

Can't we use one of the machine initcalls for that ? Like machine_early_initcall() or machine_arch_initcall() ?

No, unfortunately. I tried this, and it's still too late. This must be done in setup_arch().

Quoted 2 lines

Today it is using machine_subsys_initcall() and you didn't remove it. It means rng_init() will be called twice. Is that ok ?

I did remove the calls to machine_subsys_initcall(). I just double checked:

zx2c4@thinkpad ~/Projects/random-linux/arch/powerpc $ rg machine_subsys_initcall platforms/*/rng.c zx2c4@thinkpad ~/Projects/random-linux/arch/powerpc $

Jason

#9 lore raw

Le 11/06/2022 à 11:20, Jason A. Donenfeld a écrit :

Quoted 12 lines

Hi Christophe,

Quoted 9 lines · Christophe Leroy

Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :

Quoted 7 lines

The platform's RNG must be available before random_init() in order to be useful for initial seeding, which in turn means that it needs to be called from setup_arch(), rather than from an init call. Fortunately, each platform already has a setup_arch function pointer, which means it's easy to wire this up for each of the three platforms that have an RNG. This commit also removes some noisy log messages that don't add much.

Quoted 5 lines
Quoted 2 lines

Can't we use one of the machine initcalls for that ? Like machine_early_initcall() or machine_arch_initcall() ?

No, unfortunately. I tried this, and it's still too late. This must be done in setup_arch().

Ok

Quoted 9 lines
Quoted 3 lines

Today it is using machine_subsys_initcall() and you didn't remove it. It means rng_init() will be called twice. Is that ok ?

I did remove the calls to machine_subsys_initcall(). I just double checked:

zx2c4@thinkpad ~/Projects/random-linux/arch/powerpc $ rg machine_subsys_initcall platforms/*/rng.c zx2c4@thinkpad ~/Projects/random-linux/arch/powerpc $

Oops, I overlooked it, sorry.

Christophe