* [PATCH] powerpc/rng: wire up during setup_arch
@ 2022-06-11 8:11 Jason A. Donenfeld
2022-06-11 9:16 ` Christophe Leroy
0 siblings, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-06-11 8:11 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel; +Cc: Jason A. Donenfeld, stable
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.
Cc: stable@vger.kernel.org
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
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(-)
diff --git a/arch/powerpc/platforms/microwatt/rng.c b/arch/powerpc/platforms/microwatt/rng.c
index 7bc4d1cbfaf0..d13f656910ad 100644
--- a/arch/powerpc/platforms/microwatt/rng.c
+++ b/arch/powerpc/platforms/microwatt/rng.c
@@ -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);
diff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c
index 0b02603bdb74..23c996dcc870 100644
--- a/arch/powerpc/platforms/microwatt/setup.c
+++ b/arch/powerpc/platforms/microwatt/setup.c
@@ -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,
};
diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
index e3d44b36ae98..ef24e72a1b69 100644
--- a/arch/powerpc/platforms/powernv/rng.c
+++ b/arch/powerpc/platforms/powernv/rng.c
@@ -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);
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 824c3ad7a0fa..a0c5217bc5c0 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -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)
diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c
index 6268545947b8..d39bfce39aa1 100644
--- a/arch/powerpc/platforms/pseries/rng.c
+++ b/arch/powerpc/platforms/pseries/rng.c
@@ -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);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index afb074269b42..7f3ee2658163 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -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.35.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 8:11 [PATCH] powerpc/rng: wire up during setup_arch Jason A. Donenfeld
@ 2022-06-11 9:16 ` Christophe Leroy
2022-06-11 9:17 ` Christophe Leroy
2022-06-11 9:20 ` Jason A. Donenfeld
0 siblings, 2 replies; 10+ messages in thread
From: Christophe Leroy @ 2022-06-11 9:16 UTC (permalink / raw)
To: Jason A. Donenfeld, linuxppc-dev, linux-kernel; +Cc: stable
Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :
> 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 ?
>
> Cc: stable@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> 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(-)
>
> diff --git a/arch/powerpc/platforms/microwatt/rng.c b/arch/powerpc/platforms/microwatt/rng.c
> index 7bc4d1cbfaf0..d13f656910ad 100644
> --- a/arch/powerpc/platforms/microwatt/rng.c
> +++ b/arch/powerpc/platforms/microwatt/rng.c
> @@ -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);
> diff --git a/arch/powerpc/platforms/microwatt/setup.c b/arch/powerpc/platforms/microwatt/setup.c
> index 0b02603bdb74..23c996dcc870 100644
> --- a/arch/powerpc/platforms/microwatt/setup.c
> +++ b/arch/powerpc/platforms/microwatt/setup.c
> @@ -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,
> };
> diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
> index e3d44b36ae98..ef24e72a1b69 100644
> --- a/arch/powerpc/platforms/powernv/rng.c
> +++ b/arch/powerpc/platforms/powernv/rng.c
> @@ -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);
> diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
> index 824c3ad7a0fa..a0c5217bc5c0 100644
> --- a/arch/powerpc/platforms/powernv/setup.c
> +++ b/arch/powerpc/platforms/powernv/setup.c
> @@ -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)
> diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c
> index 6268545947b8..d39bfce39aa1 100644
> --- a/arch/powerpc/platforms/pseries/rng.c
> +++ b/arch/powerpc/platforms/pseries/rng.c
> @@ -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);
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index afb074269b42..7f3ee2658163 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -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)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:16 ` Christophe Leroy
@ 2022-06-11 9:17 ` Christophe Leroy
2022-06-11 9:22 ` Jason A. Donenfeld
2022-06-11 9:20 ` Jason A. Donenfeld
1 sibling, 1 reply; 10+ messages in thread
From: Christophe Leroy @ 2022-06-11 9:17 UTC (permalink / raw)
To: Jason A. Donenfeld, linuxppc-dev, linux-kernel; +Cc: stable
Le 11/06/2022 à 11:16, Christophe Leroy a écrit :
>
>
> Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :
>> 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 ?
>
Also, you copied stable. Should you add a Fixes: tag so that we know
what it fixes ?
>
>
>>
>> Cc: stable@vger.kernel.org
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
>> ---
>> 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(-)
>>
>> diff --git a/arch/powerpc/platforms/microwatt/rng.c
>> b/arch/powerpc/platforms/microwatt/rng.c
>> index 7bc4d1cbfaf0..d13f656910ad 100644
>> --- a/arch/powerpc/platforms/microwatt/rng.c
>> +++ b/arch/powerpc/platforms/microwatt/rng.c
>> @@ -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);
>> diff --git a/arch/powerpc/platforms/microwatt/setup.c
>> b/arch/powerpc/platforms/microwatt/setup.c
>> index 0b02603bdb74..23c996dcc870 100644
>> --- a/arch/powerpc/platforms/microwatt/setup.c
>> +++ b/arch/powerpc/platforms/microwatt/setup.c
>> @@ -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,
>> };
>> diff --git a/arch/powerpc/platforms/powernv/rng.c
>> b/arch/powerpc/platforms/powernv/rng.c
>> index e3d44b36ae98..ef24e72a1b69 100644
>> --- a/arch/powerpc/platforms/powernv/rng.c
>> +++ b/arch/powerpc/platforms/powernv/rng.c
>> @@ -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);
>> diff --git a/arch/powerpc/platforms/powernv/setup.c
>> b/arch/powerpc/platforms/powernv/setup.c
>> index 824c3ad7a0fa..a0c5217bc5c0 100644
>> --- a/arch/powerpc/platforms/powernv/setup.c
>> +++ b/arch/powerpc/platforms/powernv/setup.c
>> @@ -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)
>> diff --git a/arch/powerpc/platforms/pseries/rng.c
>> b/arch/powerpc/platforms/pseries/rng.c
>> index 6268545947b8..d39bfce39aa1 100644
>> --- a/arch/powerpc/platforms/pseries/rng.c
>> +++ b/arch/powerpc/platforms/pseries/rng.c
>> @@ -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);
>> diff --git a/arch/powerpc/platforms/pseries/setup.c
>> b/arch/powerpc/platforms/pseries/setup.c
>> index afb074269b42..7f3ee2658163 100644
>> --- a/arch/powerpc/platforms/pseries/setup.c
>> +++ b/arch/powerpc/platforms/pseries/setup.c
>> @@ -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)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:17 ` Christophe Leroy
@ 2022-06-11 9:22 ` Jason A. Donenfeld
2022-06-11 9:27 ` Christophe Leroy
0 siblings, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-06-11 9:22 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, linux-kernel, stable
Hi Christophe,
On Sat, Jun 11, 2022 at 11:17:23AM +0200, Christophe Leroy wrote:
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:22 ` Jason A. Donenfeld
@ 2022-06-11 9:27 ` Christophe Leroy
2022-06-11 9:58 ` Jason A. Donenfeld
0 siblings, 1 reply; 10+ messages in thread
From: Christophe Leroy @ 2022-06-11 9:27 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: linuxppc-dev, linux-kernel, stable
Le 11/06/2022 à 11:22, Jason A. Donenfeld a écrit :
> Hi Christophe,
>
> On Sat, Jun 11, 2022 at 11:17:23AM +0200, Christophe Leroy wrote:
>> 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")
>
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:27 ` Christophe Leroy
@ 2022-06-11 9:58 ` Jason A. Donenfeld
2022-06-11 10:06 ` Jason A. Donenfeld
2022-06-11 10:41 ` Christophe Leroy
0 siblings, 2 replies; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-06-11 9:58 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, linux-kernel, stable
Hi Christophe,
On Sat, Jun 11, 2022 at 09:27:43AM +0000, Christophe Leroy wrote:
> Le 11/06/2022 à 11:22, Jason A. Donenfeld a écrit :
> > Hi Christophe,
> >
> > On Sat, Jun 11, 2022 at 11:17:23AM +0200, Christophe Leroy wrote:
> >> 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")
> >
>
> 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.
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:58 ` Jason A. Donenfeld
@ 2022-06-11 10:06 ` Jason A. Donenfeld
2022-06-11 10:41 ` Christophe Leroy
1 sibling, 0 replies; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-06-11 10:06 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, linux-kernel, stable
Hey again,
On Sat, Jun 11, 2022 at 11:58:23AM +0200, Jason A. Donenfeld wrote:
> Anyway, sure, I'll do that and send a v2 series.
This is now done here:
https://lore.kernel.org/lkml/20220611100447.5066-1-Jason@zx2c4.com/
Jason
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:58 ` Jason A. Donenfeld
2022-06-11 10:06 ` Jason A. Donenfeld
@ 2022-06-11 10:41 ` Christophe Leroy
1 sibling, 0 replies; 10+ messages in thread
From: Christophe Leroy @ 2022-06-11 10:41 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: linuxppc-dev, linux-kernel, stable
Le 11/06/2022 à 11:58, Jason A. Donenfeld a écrit :
> Hi Christophe,
>
> On Sat, Jun 11, 2022 at 09:27:43AM +0000, Christophe Leroy wrote:
>> Le 11/06/2022 à 11:22, Jason A. Donenfeld a écrit :
>>> Hi Christophe,
>>>
>>> On Sat, Jun 11, 2022 at 11:17:23AM +0200, Christophe Leroy wrote:
>>>> 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")
>>>
>>
>> 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.
>
>> 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.
>
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:16 ` Christophe Leroy
2022-06-11 9:17 ` Christophe Leroy
@ 2022-06-11 9:20 ` Jason A. Donenfeld
2022-06-11 9:23 ` Christophe Leroy
1 sibling, 1 reply; 10+ messages in thread
From: Jason A. Donenfeld @ 2022-06-11 9:20 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, linux-kernel, stable
Hi Christophe,
On Sat, Jun 11, 2022 at 09:16:24AM +0000, Christophe Leroy wrote:
> Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :
> > 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().
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] powerpc/rng: wire up during setup_arch
2022-06-11 9:20 ` Jason A. Donenfeld
@ 2022-06-11 9:23 ` Christophe Leroy
0 siblings, 0 replies; 10+ messages in thread
From: Christophe Leroy @ 2022-06-11 9:23 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: linuxppc-dev, linux-kernel, stable
Le 11/06/2022 à 11:20, Jason A. Donenfeld a écrit :
> Hi Christophe,
>
> On Sat, Jun 11, 2022 at 09:16:24AM +0000, Christophe Leroy wrote:
>> Le 11/06/2022 à 10:11, Jason A. Donenfeld a écrit :
>>> 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().
Ok
>
>> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-06-11 10:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11 8:11 [PATCH] powerpc/rng: wire up during setup_arch Jason A. Donenfeld
2022-06-11 9:16 ` Christophe Leroy
2022-06-11 9:17 ` Christophe Leroy
2022-06-11 9:22 ` Jason A. Donenfeld
2022-06-11 9:27 ` Christophe Leroy
2022-06-11 9:58 ` Jason A. Donenfeld
2022-06-11 10:06 ` Jason A. Donenfeld
2022-06-11 10:41 ` Christophe Leroy
2022-06-11 9:20 ` Jason A. Donenfeld
2022-06-11 9:23 ` Christophe Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).