From patchwork Thu Feb 12 00:13:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1824 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=1770855269; bh=b5WzA283SatbGnWvWadt1Ae/D1uOiGaOl6Wl4Q9/pgg=; 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=PVgOk8+FM/ho4ctTpBWEhS6HNk4/ToJrqeCL6ryAU1ymMRMM0yyOxzTCVAFE6zrhx mZmC9E7crVXAy6Qb+nx+buboNGXE7j2eZyoHsKsMFLsG2s/0yrbzQcmOUB/DXF8514 rlU4/uSuxzCm+1pJxxlMXQ5XIzMDxFrWD63RXDAV+vfzeiKaJFYW5IM/tQVt6DH5NQ he7t7fvAnfq9ce9zlThjHuK/2QigNaDEBEia8+6Z/3hdcoUqZewg4Xs6TYJSPx//on gWJCjutKDxHkQ1dVqE6YsptLf1bHcW/rYxJKaI8v9CUVegXEGLe1Wvvsj5Kf/58Qin Whp5rLEyCE3Vg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 790BB69A99 for ; Wed, 11 Feb 2026 17:14:29 -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 JHF0RoTVULhV for ; Wed, 11 Feb 2026 17:14:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855269; bh=b5WzA283SatbGnWvWadt1Ae/D1uOiGaOl6Wl4Q9/pgg=; 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=PVgOk8+FM/ho4ctTpBWEhS6HNk4/ToJrqeCL6ryAU1ymMRMM0yyOxzTCVAFE6zrhx mZmC9E7crVXAy6Qb+nx+buboNGXE7j2eZyoHsKsMFLsG2s/0yrbzQcmOUB/DXF8514 rlU4/uSuxzCm+1pJxxlMXQ5XIzMDxFrWD63RXDAV+vfzeiKaJFYW5IM/tQVt6DH5NQ he7t7fvAnfq9ce9zlThjHuK/2QigNaDEBEia8+6Z/3hdcoUqZewg4Xs6TYJSPx//on gWJCjutKDxHkQ1dVqE6YsptLf1bHcW/rYxJKaI8v9CUVegXEGLe1Wvvsj5Kf/58Qin Whp5rLEyCE3Vg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68B6D69A90 for ; Wed, 11 Feb 2026 17:14:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855267; bh=gy1M/+oC4X19z/dER4b567zbcvNEemHGAmQC3nwI0+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ua1d373exz2h/76n3LHz+ZuLU8vL+u5FyZwqyLm6/1t/RnuFAIgrp76HxTjkNuxad Z9MhBXTg+yOVihD37zGoVbnW74kSNtKZ23VLKyxadsKxJnfcJc2MQZkWNU5neEcWHV PKA6eBDpOutHAZGhYglOxnx+9jVXIpRltavw2eR56uNXo5g2eWwGFMSfb6rWXi1s8e zWHJgp6OxL32rPX47JAC3XqAphscRminZg/prf6RKIr18dWSi8A11q10B5QrGB1uFG Wg7LmNHb47rLMlvh6YDMcFWUmzTBBtzzmZoSxL98DWYlses6xFSP1mXiSEplyr57+z 1qfbPgmvswG7g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68F1069A90; Wed, 11 Feb 2026 17:14:27 -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 nTmLMcB2Ke3k; Wed, 11 Feb 2026 17:14:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1770855264; bh=fZFX3/OUbFz5MZgELnE5ObtL9xIYu9e9ojZfbIZ/CjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CVkPC0gpzg8PVe8QE1iKSiVRNMyGmyWV7XH7mbm7Mk8u5u09iDyGoosi13B0NPIzW OK6HJf8Qt5d8wW9+qr0xznlGtfehp63GuTc3mXG5AzjLtySe5IvPUZ81XfjfnDhYE9 W+fhP7m0qNlzAMgK7jkaUksL3k57gdAASOmfUEydCxUMmHwT6J5c7AwAiI9Dpzm1qM OHZf5cWuBQBqPt3NHMV3tPSFYOzAPTH6v+cxvHZV/EKylcRNVR+kN1+Rb0hdC8yBG/ PC0vnLwfv+sID4cr2V8h3SDfptMKV0zY6d4XqNiAsUP775s/QchKqOUYbaC2YeCnma ky/ofrSpDPAYg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 87513699C6; Wed, 11 Feb 2026 17:14:24 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 11 Feb 2026 17:13:52 -0700 Message-ID: <20260212001410.1919749-2-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: JVLRX2QEUAESOMOS3BISOIFDWPVCLV7M X-Message-ID-Hash: JVLRX2QEUAESOMOS3BISOIFDWPVCLV7M 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 01/15] board_f: Skip the FDT relocation when not relocating 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 When GD_FLG_SKIP_RELOC is set (e.g. for EFI applications), U-Boot does not relocate itself, so the reserved FDT destination address is not valid. Attempting to memcpy the FDT to this address causes a page fault on RISC-V EFI apps. Add a GD_FLG_SKIP_RELOC check before the FDT copy in reloc_and_fix_fdt() so the FDT blob pointer is left unchanged when relocation is skipped. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- common/board_f.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/board_f.c b/common/board_f.c index ec0bdee7321..448cf2e319a 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -665,7 +665,8 @@ static int init_post(void) static int reloc_and_fix_fdt(void) { if (!IS_ENABLED(CONFIG_OF_EMBED)) { - if (gd->boardf->new_fdt) { + if (!(gd->flags & GD_FLG_SKIP_RELOC) && + gd->boardf->new_fdt) { memcpy(gd->boardf->new_fdt, gd->fdt_blob, fdt_totalsize(gd->fdt_blob)); gd->fdt_blob = gd->boardf->new_fdt;