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 B3D65C433F5 for ; Sat, 12 Mar 2022 05:03:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 49EF783B20; Sat, 12 Mar 2022 06:03:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="YugJTs9U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A79483AFF; Sat, 12 Mar 2022 06:02:57 +0100 (CET) Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) (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 EB57D83A92 for ; Sat, 12 Mar 2022 06:02:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vs1-xe29.google.com with SMTP id h30so11601697vsq.13 for ; Fri, 11 Mar 2022 21:02:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9psCTw+lHotkqTbbiV1apIIXaXqXiEQOPh0AnTF2TJI=; b=YugJTs9UqpYlCi7K5aKfGbkdb0I6LVvlF52DN60U9RacC+ahy1/oN4DSOy4/U0Vxby ZattyONW2tcA7hmCdsgWpM0nuDLDWqLuwHvP0EVFp29tasshVpIAPXtqg9hdj2SLVSEz HieySvBwhwg1iME/6QWuh5sEWVo56nId6EBCU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9psCTw+lHotkqTbbiV1apIIXaXqXiEQOPh0AnTF2TJI=; b=PbLdSBPc1YRojZJ1VCMuIG24KanpDdjclmdGccdzBcNBdxaODqtOscy8vB/XcCb8+2 0/aXAWsZFA4NAp7Kg8Qm2FowLin2L0OG1+Tjn1fRR6R1F8NiqSZzWZtZyY3/7+zwpwWV pdVOKc7L7ZrWBI4TC6MRCLdM0nOW2C4r87vrbT9xS7+HaLYCVRBauuUSO0ttKn6SZz+U PWrHnMuXn7eB09dPagaNw+niUfj6ZRFyRiWrsxxd+kEzYJXh5WrOSacE80zxjYZfeXRt Df7OsGEWoLMChxDVY1GKZHQRcqxqVO85N/NbxPoHnUn8zuhrD/G86xLuXghsZLUEJ5Uw u/BQ== X-Gm-Message-State: AOAM5323RCuEqtaTPUzbFFuJHbe6h9rjQJx8GQx/aoy0ckkeihBLvy+o z6tVuomjpnqaxGCn6U86+LKzeYHPlkEp5MPK7Z3HL8ieQ7hnP9uT X-Google-Smtp-Source: ABdhPJz1+vBZQhRU5eVc2I+s05dgrYxzpbER14KFpoveUIy4+bM9T43vy6sZzruUf2WZ9s1zFF7xyvobnXVIeDZQYEE= X-Received: by 2002:a67:1a02:0:b0:320:a51f:8067 with SMTP id a2-20020a671a02000000b00320a51f8067mr6995309vsa.38.1647061366333; Fri, 11 Mar 2022 21:02:46 -0800 (PST) MIME-Version: 1.0 References: <20210722000502.327622-1-marex@denx.de> <9832fafc-bb88-9c6a-1a72-4b21f7a03877@denx.de> In-Reply-To: <9832fafc-bb88-9c6a-1a72-4b21f7a03877@denx.de> From: Simon Glass Date: Fri, 11 Mar 2022 22:02:33 -0700 Message-ID: Subject: Re: [PATCH][RFC] image: fdt: Fix DT relocation handling with multiple DRAM banks with gap To: Marek Vasut Cc: U-Boot Mailing List , Heinrich Schuchardt , Tom Rini Content-Type: text/plain; charset="UTF-8" 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.5 at phobos.denx.de X-Virus-Status: Clean Hi Marek, On Fri, 11 Mar 2022 at 19:41, Marek Vasut wrote: > > On 3/12/22 03:24, Simon Glass wrote: > > Hi Marek, > > > > On Wed, 21 Jul 2021 at 18:05, Marek Vasut wrote: > >> > >> The current implementation of boot_relocate_fdt() places DT at the > >> highest usable DRAM address, which is calculated as: > >> env_get_bootm_low() + env_get_bootm_mapsize() > >> which by default becomes gd->ram_base + gd->ram_size. > >> > >> Systems like i.MX53 can have multiple DRAM banks with gap between them, > >> e.g. have DRAM at 0x70000000-0x8fffffff and 0xb0000000-0xcfffffff , so > >> for them the calculated highest DRAM address is 0xafffffff, which is > >> exactly in the gap and thus not usable. > >> > >> Fix this by iterating over all DRAM banks and tracking the remaining > >> amount of the total mapping size obtained from env_get_bootm_mapsize(). > >> Limit the maximum LMB area size to each bank, to avoid using nonexistent > >> DRAM. > >> > >> Signed-off-by: Marek Vasut > >> Cc: Heinrich Schuchardt > >> Cc: Simon Glass > >> Cc: Tom Rini > >> --- > >> common/image-fdt.c | 40 ++++++++++++++++++++++++++++++++++++---- > >> 1 file changed, 36 insertions(+), 4 deletions(-) > > > > Reviewed-by: Simon Glass > > > > Should we put this behind a Kconfig option to reduce code size? > > Since this depends on DT content, we cannot predict what kind of DT will > be passed to U-Boot, so no, we cannot put this behind a Kconfig option. Doesn't it only affect boards with disjoint memory? Regards, Simon