From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] powerpc/pseries: wire up rng during setup_arch
Date: Sat, 11 Jun 2022 14:45:17 +0000 [thread overview]
Message-ID: <80cca718-d637-b48a-ddb3-e6931cd08c24@csgroup.eu> (raw)
In-Reply-To: <20220611100447.5066-4-Jason@zx2c4.com>
Le 11/06/2022 à 12:04, 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.
>
> Cc: stable@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Fixes: a489043f4626 ("powerpc/pseries: Implement arch_get_random_long() based on H_RANDOM")
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
> arch/powerpc/platforms/pseries/rng.c | 11 ++---------
> arch/powerpc/platforms/pseries/setup.c | 3 +++
> 2 files changed, 5 insertions(+), 9 deletions(-)
>
> 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;
> -
There must be a empty line between declarations and code.
> 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);
> +
Prototype has to go in a header file, and should be pSeries maybe
allthough camelCase in throw up on.
> 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)
next prev parent reply other threads:[~2022-06-11 14:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-11 10:04 [PATCH v2 0/3] powerpc: wire up rng during setup_arch Jason A. Donenfeld
2022-06-11 10:04 ` [PATCH v2 1/3] powerpc/microwatt: " Jason A. Donenfeld
2022-06-11 14:40 ` Christophe Leroy
2022-06-11 14:41 ` Jason A. Donenfeld
2022-06-11 14:46 ` Jason A. Donenfeld
2022-06-11 14:48 ` Christophe Leroy
2022-06-11 14:53 ` Jason A. Donenfeld
2022-06-11 10:04 ` [PATCH v2 2/3] powerpc/powernv: " Jason A. Donenfeld
2022-06-11 14:42 ` Christophe Leroy
2022-06-11 14:47 ` Jason A. Donenfeld
2022-06-11 10:04 ` [PATCH v2 3/3] powerpc/pseries: " Jason A. Donenfeld
2022-06-11 14:45 ` Christophe Leroy [this message]
2022-06-11 14:53 ` Jason A. Donenfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80cca718-d637-b48a-ddb3-e6931cd08c24@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=Jason@zx2c4.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).