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 21F89C4332F for ; Mon, 7 Nov 2022 07:56:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 33F7984198; Mon, 7 Nov 2022 08:56:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="VF1NyT1s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2584B80705; Mon, 7 Nov 2022 08:56:02 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0794D848C2 for ; Mon, 7 Nov 2022 08:56:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org 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 1657E60E2C; Mon, 7 Nov 2022 07:55:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55A70C433D6; Mon, 7 Nov 2022 07:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667807757; bh=q9HPqeLIR2nKYTx22SAtR7aAbT6CxegKwhjMWyq/8mM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VF1NyT1sChlcZN0gTGh/SZ1N0p9rn86praeJJnzmPDz6RGUxJUW82pXcUPWDzlZoe hCGF17JiVH9XhON05vlyHshzoiAZ1eo/LqWsnj4a2CFVPl/bCwciGouVKjU8RySpVH mvKxd4HH4uWsIluIRcOipnYvLIeCoIOSEiOUXCf1mUQUxTQemgvYEV3nrMMv4yWEBL A+IPbvoIrzw36uNinotINrSzJ4ZpWzafJ7eSCFWgGHZUvvW36AWrrPY3yKxTTnhb2F I0mrBjoorq5F2IS5Jo1TVyXSYQnqvofOHK8wkCt9/NDv5x8hLF4TU2K5/wYYYvJO0w xMRrrKeIYu6Uw== Received: by pali.im (Postfix) id 6053889B; Mon, 7 Nov 2022 08:55:54 +0100 (CET) Date: Mon, 7 Nov 2022 08:55:54 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: "Peng Fan (OSS)" Cc: sbabic@denx.de, festevam@gmail.com, "NXP i.MX U-Boot Team" , u-boot@lists.denx.de, Peng Fan Subject: Re: [PATCH 01/11] imx: implement get_effective_memsize Message-ID: <20221107075554.crfgaoubgzalx23g@pali> References: <20221107080016.1304-1-peng.fan@oss.nxp.com> <20221107080016.1304-2-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221107080016.1304-2-peng.fan@oss.nxp.com> User-Agent: NeoMutt/20180716 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.6 at phobos.denx.de X-Virus-Status: Clean On Monday 07 November 2022 16:00:06 Peng Fan (OSS) wrote: > From: Peng Fan > > To i.MX6/7 which has 2GB memory, the upper 4KB cut off, will cause the > top 1MB not mapped as normal memory, because ARMV7-A use section > mapping. So implement i.MX6/7 specific get_effective_memsize to fix the > issue. > > Fixes: 777aaaa706bc("common/memsize.c: Fix get_effective_memsize() to check for overflow") > Signed-off-by: Peng Fan Should not just configuring CONFIG_MAX_MEM_MAPPED properly avoid that issue? > --- > arch/arm/mach-imx/cache.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/arch/arm/mach-imx/cache.c b/arch/arm/mach-imx/cache.c > index ab9b621a2a6..69a085abee7 100644 > --- a/arch/arm/mach-imx/cache.c > +++ b/arch/arm/mach-imx/cache.c > @@ -7,10 +7,24 @@ > #include > #include > #include > +#include > #include > #include > #include > > +DECLARE_GLOBAL_DATA_PTR; > + > +phys_size_t get_effective_memsize(void) > +{ > +#ifndef CONFIG_MAX_MEM_MAPPED > + return gd->ram_size; > +#else > + /* limit stack to what we can reasonable map */ > + return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ? > + CONFIG_MAX_MEM_MAPPED : gd->ram_size); > +#endif > +} > + > void enable_ca7_smp(void) > { > u32 val; > -- > 2.36.0 >