From patchwork Thu Feb 12 00:13:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1825 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855274; bh=wi6qD+lo20ip8HhxD2FKFzsO8IW9Z9xDvMn+7aNQhsE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=JFYyVeXxYeZ4EyLlwdZGQhn9QKF9Eebq69Pa92wv1/qICk9JMZIk4HIqmILqXAHTj 5m+X/IX8MY97Uope8I5fib3h93ihHiYbpOeyne+5le6jNhcZiRU4bl31+YPqE01lK2 /7+Bwzz717TeAtSHA2L9nCYbj/LoQdWyYRD1r/zZsXBL8Lov07SnIkAdePCCT3NdVR wexpl2cMf9U5zmUPxJM2q0dw5ZOSVt2P5UCu8W1PeuRASBpSEQHqMfkC7Cd52ykmCo +jgqHaB3yIO5sTQ875U1aj0h7uWjgcXSJzP8kNPbaZEyzOzuuyA9augUQSNA0IYQST axKwkXlPIq3Zg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6FDBD69A99 for ; Wed, 11 Feb 2026 17:14:34 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id JdNPGFTb76yT for ; Wed, 11 Feb 2026 17:14:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855274; bh=wi6qD+lo20ip8HhxD2FKFzsO8IW9Z9xDvMn+7aNQhsE=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=JFYyVeXxYeZ4EyLlwdZGQhn9QKF9Eebq69Pa92wv1/qICk9JMZIk4HIqmILqXAHTj 5m+X/IX8MY97Uope8I5fib3h93ihHiYbpOeyne+5le6jNhcZiRU4bl31+YPqE01lK2 /7+Bwzz717TeAtSHA2L9nCYbj/LoQdWyYRD1r/zZsXBL8Lov07SnIkAdePCCT3NdVR wexpl2cMf9U5zmUPxJM2q0dw5ZOSVt2P5UCu8W1PeuRASBpSEQHqMfkC7Cd52ykmCo +jgqHaB3yIO5sTQ875U1aj0h7uWjgcXSJzP8kNPbaZEyzOzuuyA9augUQSNA0IYQST axKwkXlPIq3Zg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5DDFF69A88 for ; Wed, 11 Feb 2026 17:14:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855271; bh=79rO/3DgEQtSuqdxyr8i6H5g1ra7n7RzwxSftj9h8is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2QXI2S+jdXseIeXdQ5LwH4rX2bO99MINV9WvkoK4m679LkC/AqTvmLk3P+F+ixgn sVH4GrPmF0J8P/+zi+Xi+vE8rGkE699ToMBQvpei9KPPchI7M+Dp/0HQFqYAJI5frf ySLZwxz6tzlz9Biq4I0xft/xyHF6Wk5AyLlLGbi5g5lcZGuZZvqX6foH+rGOJ78gPv fOcEAZxOCCsqqw3E8If/wokjy7s9zWmJOPPCebrbR5Hoi+lfqurDTSEOVd0qzCuh9t pUCm1UcaHxiiXR5ft4kXBKR2KV9vgAonBDBz6t1lEzCsABPT+OH6ZjNQhcwmkMUI80 8Rv/V49LxA0jA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC9C169A9E; Wed, 11 Feb 2026 17:14:31 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id BNFwRG3jUFsJ; Wed, 11 Feb 2026 17:14:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855266; bh=ZMnqkLRBlpsug5tmpEX/gQwUaf5o8hpS6xD/CIuaBjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOMFMg4SrNHcpb3M5YV/LSy7BAP8zprakLPHXedAcHyx2WRVfCaXtNIWwI/hbnUfv QP44PhZxmTJ92Mmvc4pPauwFgh5rTgy7kx4ktZ+nf1rcDsg6HGHZRwPcKsB/hMEd6l t59/FZUUaJkCTsetzOJues6K9d9gd0vFxFZq1eiTEHxLM1StHMXX86ZL3uY890BiWN 1BFWiCnYAQAUeR5KnmpKPSiHCkCbNcblRNWKXx0bkd9jyI7KE04wGjRBsxsHhOBspw dx82ClOJ2kW2MLIv+2HkCRsqXjAguk11X/fJ5u1ik5KWu0WQ73jpUmm8Na8kyWZwtL f9vwHMCo2nPzQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9FAD369A88; Wed, 11 Feb 2026 17:14:25 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:53 -0700 Message-ID: <20260212001410.1919749-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212001410.1919749-1-sjg@u-boot.org> References: <20260212001410.1919749-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XJYU2VOKFCHH4XCWREK4T2Y7GKEMTO3K X-Message-ID-Hash: XJYU2VOKFCHH4XCWREK4T2Y7GKEMTO3K X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/15] board_r: Skip set_gd() for RISC-V EFI applications List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass board_init_r() unconditionally calls set_gd(new_gd) for RISC-V, but the EFI application entry point passes NULL as the new_gd parameter. This zeroes the gp register (which holds the global data pointer), causing an immediate page fault when gd is next accessed. For EFI apps the global data pointer is already set correctly by efi_app.c before calling board_init_r(), so skip the set_gd() call. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- common/board_r.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/board_r.c b/common/board_r.c index c0f1ea9f003..18258b4fa0a 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -793,7 +793,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) arch_setup_gd(new_gd); #if defined(CONFIG_RISCV) - set_gd(new_gd); + if (!IS_ENABLED(CONFIG_EFI_APP)) + set_gd(new_gd); #elif !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) gd = new_gd; #endif