From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00DE4C001DE for ; Tue, 1 Aug 2023 02:37:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3482086BAD; Tue, 1 Aug 2023 04:37:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="K2x5mrEM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0410586BAD; Tue, 1 Aug 2023 04:37:31 +0200 (CEST) Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5540586BA8 for ; Tue, 1 Aug 2023 04:37:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-ccc462deca6so5338654276.0 for ; Mon, 31 Jul 2023 19:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1690857447; x=1691462247; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=aTQcCzXU2L0sKJKNRW+ECWr/VTeyw8uwi2671ZK0XlI=; b=K2x5mrEMWXH6QkMuUc5AWEeVC1qgO816ou60o9RPEz1VCshiysT3MiyuzN/rlSOtSL 6ZG4BWscEUWdFtlkqVjutUjECVF9CfKkZe5zpHH6ABIbnXoWlpN6E8ogFOT0hqCPB7WS 0PnOxVUTi9KsQ7JsMcu5psSniCMm7HvyTcmqY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690857447; x=1691462247; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aTQcCzXU2L0sKJKNRW+ECWr/VTeyw8uwi2671ZK0XlI=; b=lGPtOd33M9IDna+N2lUiPFOX1H4C86+n15gifBrTraIqYwNj8+xkYyFc0YXC06JQyN DjH5Yrqrj8YCZDGL7La3ux5cJmuptjIJILI8rJ0UPq05c5Tr0vuGPYbl5FvfmIfQlEMP YFq/gwgkiUchCwXX9wb/n2S326+L5itK9JbUVdeEtUZM3iBazJ8siSAP+rQRTduwMPV2 PFU7S9r69UsCKrK87qXVnN5W7VOfFRulRGkzqCMn6Jzitu9ttwACSo/DGKBvRRgY67vQ if++JQpdxSpAQs6FUXS2EZwER46CkwYwPyvVL831SoCWLah9rlg3U1fRMmCvRp8DLMlp P55Q== X-Gm-Message-State: ABy/qLbUmAcP4gIdCZCpvZ/aHYH9PXt6foJtSJGLTLIUiQ2z+IMMf2YS hyCRpJcLYWmYnLtD0OeyQJoH1w== X-Google-Smtp-Source: APBJJlHcfC7CYlbApm9oBZpDHQUSkm3/MNLSp8unEt6kLn6FPF4sAQ5w4+9mYprPvRY5d6vDsesLJQ== X-Received: by 2002:a25:ab87:0:b0:c85:a84:d87e with SMTP id v7-20020a25ab87000000b00c850a84d87emr13313054ybi.10.1690857446934; Mon, 31 Jul 2023 19:37:26 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-383c-c9ce-d23d-78ae.res6.spectrum.com. [2603:6081:7b00:6400:383c:c9ce:d23d:78ae]) by smtp.gmail.com with ESMTPSA id v30-20020a25aba1000000b00bcd91bb300esm2788797ybi.54.2023.07.31.19.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 19:37:26 -0700 (PDT) Date: Mon, 31 Jul 2023 22:37:24 -0400 From: Tom Rini To: Shiji Yang Cc: festevam@denx.de, marex@denx.de, michael@amarulasolutions.com, okamura.dai@socionext.com, rogerq@kernel.org, sjg@chromium.org, u-boot@lists.denx.de Subject: Re: [PATCH] spl: spl_legacy: Fix spl_end address for non ARM target Message-ID: <20230801023724.GL3630934@bill-the-cat> References: <20230731191227.GB3630934@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WSEwuAnozd6eLaPL" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean --WSEwuAnozd6eLaPL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 01, 2023 at 10:35:19AM +0800, Shiji Yang wrote: > On Mon, 31 Jul 2023 15:12:27 -0400, Tom Rini wrote: > > On Tue, Aug 01, 2023 at 12:10:52AM +0800, Shiji Yang wrote: > > > On Mon, 31 Jul 2023 16:17:39 +0200, Marek Vasut wrote: > > > >On 7/31/23 13:57, Shiji Yang wrote: > > > >> Only ARM target defines _image_binary_end symbol as char*, All oth= er > > > >> targets define it as an ulong type in include/asm-generic/sections= =2Eh. > > > >> > > > >> This patch fixes the boot failure on MIPS target. Error log: > > > >> SPL: Image overlaps SPL > > > >> > > > >> Fixes: 1b8a1be1a1f1 ("spl: spl_legacy: Fix spl_end address") > > > >> Signed-off-by: Shiji Yang > > > >> --- > > > >> common/spl/spl_legacy.c | 6 +++++- > > > >> 1 file changed, 5 insertions(+), 1 deletion(-) > > > >> > > > >> diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c > > > >> index 095443c63d..0fef890384 100644 > > > >> --- a/common/spl/spl_legacy.c > > > >> +++ b/common/spl/spl_legacy.c > > > >> @@ -18,9 +18,13 @@ > > > >> =20 > > > >> static void spl_parse_legacy_validate(uintptr_t start, uintptr_t= size) > > > >> { > > > >> + uintptr_t end =3D start + size; > > > >> uintptr_t spl_start =3D (uintptr_t)_start; > > > >> +#ifdef CONFIG_ARM > > > >> uintptr_t spl_end =3D (uintptr_t)_image_binary_end; > > > >> - uintptr_t end =3D start + size; > > > >> +#else > > > >> + uintptr_t spl_end =3D (uintptr_t)&_image_binary_end; > > > > > > > >I _think_ only this extra & should be enough and that should also wo= rk > > > >on ARM, right ? > > > > > > > >[...] > > > > > > Hi! Thanks for your review. For ARM target, My understanding is that > > > '&_image_binary_end' is a random value. '&_image_binary_end' is a > > > pointer which points to the spl image end address. I think it's not > > > okay for ARM target. > > > > > > I do not have any relevant ARM devices, so I can't test it. > >=20 > > OK, but why isn't the answer that _image_binary_end should be char for > > everyone, and that it was simply mis-placed in the header to start with > > (which is why it was then later added to the header for non-ARM)? Given > > how everyone not-ARM treats it exactly like ARM does in linker scripts, > > that seems the most likely case. > > > > --=20 > > Tom >=20 > Importing variables from linker scripts is a littile magic to me. > Based on my test, yes you are right. I can make MIPS target work > again by converting '_image_binary_end' from ulong to char[] type. > I'll try to cook some patches to convert all symbols in 'sections.h' > to char[]. I believe this is the right way to fix some potential > issues. >=20 > If you want to do this work, please let me know. I am a newbie for > u-boot. It seems that you are more familiar with the u-boot framework. The only symbol I see for sure that needs to be changed is '_image_binary_end' so if you'd like to have a go at converting that and making a patch and running CI: https://u-boot.readthedocs.io/en/latest/develop/ci_testing.html I'd appreciate it, thanks! --=20 Tom --WSEwuAnozd6eLaPL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmTIb+EACgkQFHw5/5Y0 tyxK+wv9ErcrO1qX4ZcZpUNKgMD2HIXiVcBDC/xicgZYLlDfoHoKAMuBi7s0jU9n BwrDEmSCC3jFXsh5N0CId4L4bSyInmdo4hUelDMRUA3MjY8fRlZka9F8hrGHs9Ql l8UTK5GB1YlYA0fLcVPCwAasjs4WQVNKQ87Ru44reFxmc4vBHo/x6RXpjIonajTd R5XFSupsbDvTeSxdc2KtZ9iMN2cWZztCHLp8M0v/aHePUgPJl/FAxLumg2FgxXqG mFfa+7JmVEXVKGOZET9tzUcYRvuO8jy/g7pyCuQrGbvzok1qyQB936AUBsXMzYGb y0irMQ6Uk4YtIcrgeUyCllnUDZZxVmqia9IgsR80hWcS9BoGrBlbagUIBhij9Ehb M8N+onKe/JkcApwJTu/dX2iHOCJbb0mEk6HRwlbzpOHkbNNZmcqg9t4oH3SLYuxc T4LJeVclBPZTVmM9PKD45v9OKSHCfJzPqk0lc6KnCYt3qOzKYnrlUjfgPQxgHtTK bne5kSE1 =kBW0 -----END PGP SIGNATURE----- --WSEwuAnozd6eLaPL--