Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2906738iog; Mon, 27 Jun 2022 05:31:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tHdu5hoWCID+D9IDvWgG3JP+fUDcxSHgNCc431z1Gu4xQhgMb4X3KO5zfz34yeUV+KuXQO X-Received: by 2002:a05:6402:d5e:b0:435:dc14:d457 with SMTP id ec30-20020a0564020d5e00b00435dc14d457mr16257870edb.58.1656333082794; Mon, 27 Jun 2022 05:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333082; cv=none; d=google.com; s=arc-20160816; b=E24OKtwQil2bsJSySGSnMTtf80slHTBv1JO4imedEQNdYScXna+/q7Q+0Y0hpACDdE pJZrCV/6YyYDZuIrrKolXDwEYT2dczJg1G9KcK2R5x/TV8vEy/lGTylPcam1fJnVHXZO KhvfrYfskk+pFzqt2OLnDQaOQGY3fnE9ctGaGkKTElWJuaDaegUenPDQVXCogDyYd9sv FoyUQbQf2E11+RSlqcV8JKvlBWco3yj2hq95zJ71/5XZ2CiEdC3JT9Bjm9Y0Remi7otr QjzZTAZFkAxAhJNjI0ohgWXDs4VPOmolDZtzsDVf4fhLzVTzxtZQ+T1Rt464EIid64Ik 5L3Q== 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=ZQZOReJngJk12LOon7v4OBJUGv/mb9qUGdho8nU/oH0=; b=UKtW54KcP8hzg9Yq0tZ2cekMluIFmC23+46+ARbfvtyTo2OQ3jf2pwGQP1jwINpJ1r uhHtpoCJwlFfiYtwkc43cqgIe94aiLeGryi8qM3uUprDMdhQvsP622x8eHMqz1G7Vu4J 24xK8DGFOXiG5jYJF4RJblKvX/KQ/fGdlH+6R/cfr6q3L/pDSd1Q+c4zyZAGTSehFyMN mAdCDHSUTPj+5C8GrGVDVR6t6ynb+O132N+Ww9JJsCJyZZ6KLwlR8G3tDFFAkfnhIbft MoY/qvaPbfejDB6Bcgy7h4GV//wY3iLin0JYeZgImbDj2Qb3b0Qp1AZIN4/h6XP7b9dD TPWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pjNPh7yw; 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 gt12-20020a1709072d8c00b00722df7631c5si13619602ejc.749.2022.06.27.05.30.55; Mon, 27 Jun 2022 05:31:22 -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=pjNPh7yw; 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 S235998AbiF0LfH (ORCPT + 99 others); Mon, 27 Jun 2022 07:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236237AbiF0Lda (ORCPT ); Mon, 27 Jun 2022 07:33:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03B86D10B; Mon, 27 Jun 2022 04:30:41 -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 ams.source.kernel.org (Postfix) with ESMTPS id 63852B8111A; Mon, 27 Jun 2022 11:30:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31D20C3411D; Mon, 27 Jun 2022 11:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329439; bh=10mVpdiw6f+f02y4ZjqUbiBDWe4mSbM1JwVKYUuAddI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pjNPh7ywehEnX163ijqbjjDciUGMRPfSQ4o284Ide2ic+RiY+gTOE/3uwckujuwmF SMof7KCsXPn7W0jxlUlKjkEqDTaOIYkMhwO1P/YjGBk+rnSik7nOJpk/CRyfuejsGe 6XrFCoLVn5Gy9I83aMuItFP6VG2ZIfjKdneWd+2Q= 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.4 60/60] powerpc/pseries: wire up rng during setup_arch() Date: Mon, 27 Jun 2022 13:22:11 +0200 Message-Id: <20220627111929.455633485@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@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 @@ -114,4 +114,6 @@ int dlpar_workqueue_init(void); void pseries_setup_rfi_flush(void); void pseries_lpar_read_hblkrm_characteristics(void); +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 @@ -792,6 +792,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)