From patchwork Wed May 15 06:27:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1935273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=FYwWoREl; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=NHo5q7nZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VfNZB0mwpz1ymf for ; Wed, 15 May 2024 16:27:45 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=uKU7WwtdiUCNSFF7Yi4bsP4ecE2QRA56g8C30B3A4dE=; b=FYwWoREl91jotZ X08CVAwiWlO6xvuVkl7kUF6icxjiXqwV58mqCT5Qeq9L0D4nga+Ou8TxSAG9H1Xw4ahrvluOlbPF1 T/rc3mdwebaZfmgTZnegOM6MNkub6A7z5qMGfKFhltE3n1/SQh5LnuFFuo+OgR8a3SH2zWpq5fG3h texcvO78yz1t3hp3uhmqfHiGG+2d2EWG8E7fIehj+oT62SzczMrFcEodvghyjyWtGEbilQdS5sBl/ GDKB0gXaB6s812+itrGzS/0jJVxeawpScK8rmlI+5H/w2CsfugvDC+NLczD5akSEZgHhBojui/J6k Hgo1bkRUQpJnbXHm7QrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s786z-00000000eB2-42LC; Wed, 15 May 2024 06:27:37 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s786w-00000000eA6-1RSI for opensbi@lists.infradead.org; Wed, 15 May 2024 06:27:36 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1ed0abbf706so47668435ad.2 for ; Tue, 14 May 2024 23:27:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1715754451; x=1716359251; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+L5vGyuDQxoULzKw99VlBnjQSc/uS4Yh0pSY4sgOpsA=; b=NHo5q7nZ4pdmCCRCo2HJutbSkalbi4f789s9ffHHiO6R4G8eb9CxLM5cTFk02NV0qV BizoeDkZh3Mf76je0kSwLCuokxCuquFnMGpKaecAgWa4gB+dimsFJyXWM8uO7e16hLJv ihhstZEQHgT6dlAjbYD9mim6rqxD82Dkq7wH/pP/i6yyQOlh9FgNGHPxFl40jNhsBtir c5dGUHkPJGGNMgd31PFrr7QO3Dz+mS73zFpxMsJDUq0t56fDoNRHDts4S3HBmC9jejzK fuov+/CmWbu7Sl2LQf3yjr6J6nDnlHaax2lYG1KbThdX3QoBE0Uv9XmjneLTGB2k+Y3D Psug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715754451; x=1716359251; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+L5vGyuDQxoULzKw99VlBnjQSc/uS4Yh0pSY4sgOpsA=; b=bAGUlUwAqSJenUrVWlNMLoMGG0UiFDgALI1eclTfNe15+f0duTrlgvtU7EgVPIXMtu 91RT5M7hC+gug8L0j7ok2ziw5jqJzT6Ddays7XIMq96epumsxm37YrGu+xMxNY+yjLVf EGcw/xS/fObemJjbioyeuHywXk+ZERPcnFSHQPIjB2eT41axreta4l865g5lXk00skdp wJpobNaPC7WJgCiF0n21PoWE4zbi/d399W9Uf8arQ4PRZz6PGMK1oRfcGOnYg9uPhA6f UvtO4yFVX8V0YZNJAdokWwT3OFzo7XfCEb/OkWwgTcQw3+kczkkEhGp1cNEAMyPKRdJS defA== X-Forwarded-Encrypted: i=1; AJvYcCWOwZBiXUDA+ZS7TeEYZjoyi229fD6uXkv1Vs++t6Bn4/wENQEo9TpALarjl+kMDftHDE/idPNby9wzb8QYtEX1tpHTFFZT99Nd9ZA= X-Gm-Message-State: AOJu0YyX4jRGAZDQTRW0sah7mGrgSN6VDObb4IGkHsLzPaBS5e4/ndKw bgRwHJn3Brw9DOcRVWBHKZphzqPSPzMGD1u/ch90Rdo2kO5smbfPaECkFyC/A98= X-Google-Smtp-Source: AGHT+IGLP4Vm8xPpRroIYfl9hdnt4PEWy2iFINoy1TRwfwvemQZDgfJUFKzpa4pIb6SK8RNKyr+BGQ== X-Received: by 2002:a17:902:cf10:b0:1e2:ae83:3197 with SMTP id d9443c01a7336-1ef43d155a4mr164373045ad.10.1715754450771; Tue, 14 May 2024 23:27:30 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c136d53sm109863385ad.254.2024.05.14.23.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 23:27:30 -0700 (PDT) From: Anup Patel To: Atish Patra Cc: Andrew Jones , Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH] firmware: Bring back FW_TEXT_START as an optional parameter Date: Wed, 15 May 2024 11:57:22 +0530 Message-Id: <20240515062722.974003-1-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240514_232734_416675_F1D2195C X-CRM114-Status: GOOD ( 12.61 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Bring back FW_TEXT_START as an optional parameter to allow users explicitly specify compile time address for loading debug symbols. When not specified, the FW_TEXT_START is assumed to be 0. Fixes: d4d2582eef7a ("firmware: remove FW_TEXT_START") Signed-off-by: Anup Patel --- docs/firmware/fw.md | 3 +++ firmware/fw_base.S | 4 +++- firmware/fw_base.ldS | 3 ++- firm [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:62f listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Bring back FW_TEXT_START as an optional parameter to allow users explicitly specify compile time address for loading debug symbols. When not specified, the FW_TEXT_START is assumed to be 0. Fixes: d4d2582eef7a ("firmware: remove FW_TEXT_START") Signed-off-by: Anup Patel Tested-by: Clément Léger --- docs/firmware/fw.md | 3 +++ firmware/fw_base.S | 4 +++- firmware/fw_base.ldS | 3 ++- firmware/fw_payload.elf.ldS | 2 +- firmware/objects.mk | 6 ++++++ firmware/payloads/test.elf.ldS | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/firmware/fw.md b/docs/firmware/fw.md index 3cc0262..d298096 100644 --- a/docs/firmware/fw.md +++ b/docs/firmware/fw.md @@ -61,6 +61,9 @@ Firmware Configuration and Compilation All firmware types support the following common compile time configuration parameters: +* **FW_TEXT_START** - Defines the compile time address of the OpenSBI + firmware. This configuration parameter is optional and assumed to be + `0` if not specified. * **FW_FDT_PATH** - Path to an external flattened device tree binary file to be embedded in the *.rodata* section of the final firmware. If this option is not provided then the firmware will expect the FDT to be passed as an diff --git a/firmware/fw_base.S b/firmware/fw_base.S index 9f995a2..b950c0b 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -53,7 +53,9 @@ _try_lottery: bnez a6, _wait_for_boot_hart /* relocate the global table content */ - lla t2, _fw_start + li t0, FW_TEXT_START /* link start */ + lla t1, _fw_start /* load start */ + sub t2, t1, t0 /* load offset */ lla t0, __rel_dyn_start lla t1, __rel_dyn_end beq t0, t1, _relocate_done diff --git a/firmware/fw_base.ldS b/firmware/fw_base.ldS index 9d11db5..fb47984 100644 --- a/firmware/fw_base.ldS +++ b/firmware/fw_base.ldS @@ -7,7 +7,8 @@ * Anup Patel */ - /* Don't add any section before _fw_start */ + . = FW_TEXT_START; + /* Don't add any section between FW_TEXT_START and _fw_start */ PROVIDE(_fw_start = .); . = ALIGN(0x1000); /* Need this to create proper sections */ diff --git a/firmware/fw_payload.elf.ldS b/firmware/fw_payload.elf.ldS index 94e1ac6..f1a544b 100644 --- a/firmware/fw_payload.elf.ldS +++ b/firmware/fw_payload.elf.ldS @@ -15,7 +15,7 @@ SECTIONS #include "fw_base.ldS" #ifdef FW_PAYLOAD_OFFSET - . = FW_PAYLOAD_OFFSET; + . = FW_TEXT_START + FW_PAYLOAD_OFFSET; #else . = ALIGN(FW_PAYLOAD_ALIGN); #endif diff --git a/firmware/objects.mk b/firmware/objects.mk index a51ff65..a90485d 100644 --- a/firmware/objects.mk +++ b/firmware/objects.mk @@ -13,6 +13,12 @@ firmware-cflags-y += firmware-asflags-y += firmware-ldflags-y += +ifdef FW_TEXT_START +firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) +else +firmware-genflags-y += -DFW_TEXT_START=0x0 +endif + ifdef FW_FDT_PATH firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ifdef FW_FDT_PADDING diff --git a/firmware/payloads/test.elf.ldS b/firmware/payloads/test.elf.ldS index 08e008f..2328a1b 100644 --- a/firmware/payloads/test.elf.ldS +++ b/firmware/payloads/test.elf.ldS @@ -13,7 +13,7 @@ ENTRY(_start) SECTIONS { #ifdef FW_PAYLOAD_OFFSET - . = FW_PAYLOAD_OFFSET; + . = FW_TEXT_START + FW_PAYLOAD_OFFSET; #else . = ALIGN(FW_PAYLOAD_ALIGN); #endif