Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2907757iog; Mon, 27 Jun 2022 05:32:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uE8LSIdaHGwFEn7LmKQSWozeudBNNOp4My+H5ZsdOU/lr+tvql/ARUSQuGhXx7iFeWi2ti X-Received: by 2002:a17:902:8ec9:b0:168:c341:847e with SMTP id x9-20020a1709028ec900b00168c341847emr14481326plo.170.1656333150997; Mon, 27 Jun 2022 05:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333150; cv=none; d=google.com; s=arc-20160816; b=LMNWWWCnGSWNg9ggCPBiKo3s4L/klI/z37JY8ch605ZHF02VtLEGjCgYHeDCvjNJtz VgYJviENnRNUhoxzCBtFVFbv+kmXkAxU73IAGn0DfwHcWlyu+YQRnH8i77qPZPbZBTH2 DjQlj1ZByeG5YIuJsUiLHPkEszTpk88LKcj453euWKxhDPPWzmVrMcS3hlcPMdkjVAjS jSMok4dWZCzTzDUbtWe/008ntY8rPkgzmqcRuyeesQqnrETlNV66KHDyYqDlbWnutkA2 9Kgfe0txlK56xka25OOBp0VciWvKHnuGc1Bj95cOStCEgjbMvC9qAWBRljaUP1I1cFDK GCCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KA6PDI5Bqv0PW4Lb1lwM2CjYJtCePh8Fn1hx/m4fXrs=; b=D53jxBvJGFN/G40GKT3GILuEM5BFEG51KadWHP80z0mWJFLI25uhLzKKF0bczlSd43 uatAZBOj8Y8ZbGmJ9RMorsvwMH+CpKpJXJuQUs2nwnAtab0yqyfwMmrKEXycUFsVijwv rhDBsB/f28cDU8BtCJkiEvloS7C9ypLbb4+EKznTj1mzdBizxg1T0k19mtTk1KYYb616 mFZ21G3Y3nTp8GY1xfQVuZIyvrJe7Ld/2wzsKHJ+8QPD1eiPBqRq0ySH7wh/VFP6WlYS t95GJfU1IoyRFkXzjhzTTqEMaWKsJJPgyj3s++3jmikAEavjcPMV8EijcbZntV/7Dh6T 6TnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bCSgGpZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e28-20020a631e1c000000b0040cd5d37ca3si14522291pge.364.2022.06.27.05.32.17; Mon, 27 Jun 2022 05:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bCSgGpZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239739AbiF0MBB (ORCPT + 99 others); Mon, 27 Jun 2022 08:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238973AbiF0Lwz (ORCPT ); Mon, 27 Jun 2022 07:52:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2B9DF77; Mon, 27 Jun 2022 04:46:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 359766130A; Mon, 27 Jun 2022 11:46:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D465C3411D; Mon, 27 Jun 2022 11:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330408; bh=Be+DyQ926OIAEU/MJvu9N0bh+BAig/+8qehWjTeo39w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bCSgGpZvvYDJ0m/aU1nw2VhgY+eTG9qwAnIZmI2A0ZRSZwVh23hf6DfDR1FCcTqY4 ySOXlFQC6JaPuueCsoW8w5HFB1rEq4F2BjFIzH9rWREI5us7LIjUq99RW3AYy/ohZt cY7XoTv+yY/XyHqiqgk6V2VgkZBh8LoTsBephcio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Christophe Leroy , Michael Ellerman Subject: [PATCH 5.18 181/181] powerpc/pseries: wire up rng during setup_arch() Date: Mon, 27 Jun 2022 13:22:34 +0200 Message-Id: <20220627111949.929558427@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason A. Donenfeld commit e561e472a3d441753bd012333b057f48fef1045b upstream. 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. This commit also removes some noisy log messages that don't add much. Fixes: a489043f4626 ("powerpc/pseries: Implement arch_get_random_long() based on H_RANDOM") Cc: stable@vger.kernel.org # v3.13+ Signed-off-by: Jason A. Donenfeld Reviewed-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220611151015.548325-4-Jason@zx2c4.com Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/pseries.h | 2 ++ arch/powerpc/platforms/pseries/rng.c | 11 +++-------- arch/powerpc/platforms/pseries/setup.c | 2 ++ 3 files changed, 7 insertions(+), 8 deletions(-) --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h @@ -121,4 +121,6 @@ void pseries_lpar_read_hblkrm_characteri static inline void pseries_lpar_read_hblkrm_characteristics(void) { } #endif +void pseries_rng_init(void); + #endif /* _PSERIES_PSERIES_H */ --- a/arch/powerpc/platforms/pseries/rng.c +++ b/arch/powerpc/platforms/pseries/rng.c @@ -10,6 +10,7 @@ #include #include #include +#include "pseries.h" static int pseries_get_random_long(unsigned long *v) @@ -24,19 +25,13 @@ static int pseries_get_random_long(unsig return 0; } -static __init int rng_init(void) +void __init 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); --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -852,6 +852,8 @@ static void __init pSeries_setup_arch(vo if (swiotlb_force == SWIOTLB_FORCE) ppc_swiotlb_enable = 1; + + pseries_rng_init(); } static void pseries_panic(char *str)