Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2283471iof; Wed, 8 Jun 2022 01:22:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEvBdBQVuDp70CscDgdDiYNHMiuCuG2lE+L8iv4LeSfJH4G7nYEL57bxIN49m/8FiDh7GB X-Received: by 2002:a05:6a00:807:b0:51b:f4b5:db82 with SMTP id m7-20020a056a00080700b0051bf4b5db82mr21451235pfk.57.1654676579353; Wed, 08 Jun 2022 01:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654676579; cv=none; d=google.com; s=arc-20160816; b=xsQlvQQesb9kOiGXTinQKbieUtlv5LQ6eKNAmj3WbaxXHTwXC+fcYzFysoaJUMGZ/S iD0MzSrje/PR4oTioKIjEfFqFFnilcCZ4+KeTl3aX5dxXaRsWYy/4ycuHS6Dl6ZiiFYj qPLcf8MH1lOjnM6LxVf/btV4JbCWtdTYimeqfZHOD9H8DAaIHiJ0cLRELDQrGSKx4EIY lHzNtmtZyVUsfvmyRVVLIMPOc1wYkk1LzKH/INzRe2C76cJE9xnSE3JCwwLnYgkh8hC4 JWvdk6OC6Zq52IQYdqtEwwbObJFpEtNDEEWbvHpGVzfKkOND1jChBSAoTaAvq8Tt2E+v Y83w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=UkQJjvZ5xCdBwiht+8tu2AP0BLnypsD3C8jDx5YCgmc=; b=gO+oj9YD6OhaYOBTBc/PnH1IvGh3mQuW2Vx6rDjGKP9y2MQBQMmIQ6zTcEMLxmgCIp Whi5b/kLmzdmlsDLR0hb9lJ2pGWCkgQGCaG8aF1iDgGzQWKEevVqEHCJwP04u4cBsfk7 KFpje9yMhidzpGoQy/TlKvjAyQJ/jG0c9NGqYH035YseKTkysXLjgm0J6XIs/j5TarM2 tQ0TmCd+jvttzoGDZRME2IifuEcYOv8zVNmkjj0F2mbf7UXjGsqNgNiWK4J00QVIS13A L45J7pJfKNuBkk0xdtQ+M3oXyFqzeyIa9+/iGLNabZZHr1BCTz1EHYGxCEdq1BGEAOv3 KEYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=P3yIR3c3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d1-20020a056a0024c100b0050fbf917944si31548169pfv.51.2022.06.08.01.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:22:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=P3yIR3c3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3BDD53BB2BE; Wed, 8 Jun 2022 00:53:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380414AbiFHAR2 (ORCPT + 99 others); Tue, 7 Jun 2022 20:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391411AbiFGW40 (ORCPT ); Tue, 7 Jun 2022 18:56:26 -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 C33B030C9FA for ; Tue, 7 Jun 2022 12:58:05 -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 B3ED0616A8 for ; Tue, 7 Jun 2022 19:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44582C385A2; Tue, 7 Jun 2022 19:58:00 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="P3yIR3c3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1654631878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UkQJjvZ5xCdBwiht+8tu2AP0BLnypsD3C8jDx5YCgmc=; b=P3yIR3c3DtR/RhcoMlwU4sIlFUoCPUUImnF0ckmOipgBY1DMO0Mr7snbuEmvcVropUQvY+ 1+phCFG5vWnyOj2zdcr06D8eVgM1LzYv7wfljGWl2x/n8RrmYu9w+z90FdjamBIDjW/kyK /93Sjs9SFfqRUWrygIZrwCI5ylBXVf8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 5d384389 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 7 Jun 2022 19:57:57 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "Jason A. Donenfeld" , Stephen Boyd , Phil Elwell , Ard Biesheuvel , Russel King , Catalin Marinas , Paul Walmsley , Palmer Dabbelt Subject: [PATCH] riscv: initialize jump labels before early_init_dt_scan() Date: Tue, 7 Jun 2022 21:57:52 +0200 Message-Id: <20220607195752.1146431-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Stephen reported that a static key warning splat appears during early boot on arm64 systems that credit randomness from device trees that contain an "rng-seed" property, because the dtb is parsed is called before jump_label_init() during setup_arch(), which was fixed by 73e2d827a501 ("arm64: Initialize jump labels before setup_machine_fdt()"). The same basic issue applies to RISC-V as well. So this commit moves the call to jump_label_init() just before early_init_dt_scan(). jump_label_init() actually requires sbi_init() to be called first for proper functioning, so it also moves that to the right place. Reported-by: Stephen Boyd Reported-by: Phil Elwell Cc: Ard Biesheuvel Cc: Russel King Cc: Catalin Marinas Cc: Paul Walmsley Cc: Palmer Dabbelt Fixes: f5bda35fba61 ("random: use static branch for crng_ready()") Signed-off-by: Jason A. Donenfeld --- arch/riscv/kernel/setup.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index f0f36a4a0e9b..c44c81b1cfb3 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -263,13 +263,15 @@ static void __init parse_dtb(void) void __init setup_arch(char **cmdline_p) { + early_ioremap_setup(); + sbi_init(); + jump_label_init(); + parse_dtb(); setup_initial_init_mm(_stext, _etext, _edata, _end); *cmdline_p = boot_command_line; - early_ioremap_setup(); - jump_label_init(); parse_early_param(); efi_init(); @@ -285,7 +287,6 @@ void __init setup_arch(char **cmdline_p) misc_mem_init(); init_resources(); - sbi_init(); #ifdef CONFIG_KASAN kasan_init(); -- 2.35.1