From patchwork Thu Mar 17 14:25:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1606595 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=JuqREKAX; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KK8ZT5RgMz9s3q for ; Fri, 18 Mar 2022 01:25:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 14E7783ADC; Thu, 17 Mar 2022 15:25:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="JuqREKAX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 339C783CB4; Thu, 17 Mar 2022 15:25:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (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 D3C1E8005D for ; Thu, 17 Mar 2022 15:25:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x62d.google.com with SMTP id ja24so5689252ejc.11 for ; Thu, 17 Mar 2022 07:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=S0yyBjxmNdZ/qCqGIS3tXDLATE0UfPolfh+q8pUlalY=; b=JuqREKAXZVaQIhIGIxhe12c0VOq26KBkwHX8ZQBe6JXBqaBgIOTGsHUjH7sv0idd4d SgBG4HaV5/cliuizTstF1DEobrUuux/RtFI9pEH6Y6+iTwBwz2u2XWzQbp7rwItI69RD ejh1XWwXPc9+XRIieHmvWlNpA3AOs/EWsQspGXKdHEjcqwSOgXkxTdnU3cjIeSpKVJiC AcSG1yEpF3F/Yl07zTl3X4PL1yVWlngGNI3sZDBMes14qWlSxtv5GkyYdCKmFXdGYgp5 CWWCFr66xx9z1EHSJTuMFhZySlmXl6/bvbbS03UNfAozfWYYujMTZQls9atZvoYQNrVg wQ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version:content-transfer-encoding; bh=S0yyBjxmNdZ/qCqGIS3tXDLATE0UfPolfh+q8pUlalY=; b=VyCdlhPjrXrqxMF1ljE8cORRe3Fe51dPQcA/NhV5HNlx1fo/NVwoLPY2o02HC5ZlRn ZIAUNhtBh1p7Ae1jGxHg2F98EWkBL6CM3GvlZITbzwfVz4j1sXW10JH9mtGMGsXy0bS4 6ZQsSUInhUISc5kcSD2TCrqJqMnKoG/mwtr++ek/vpfpO6106Cac0qWuukFOAiBoxpG8 bOn1kp6oIGrfUbkEj1Www0DE9AsbBuwqziDQDElBDJMqO1JtdJE75jFCNCeFwaOEBh5J qbihKHtG3dxbRWmDyUtuS3fPtIyQO+qii+I3DoZGaFM/U25ZpE1fN4vrqXUCzA6SUF6G pGAw== X-Gm-Message-State: AOAM531XBOBST9uc97Z59GoNl43HVwQmet+WnIF8qoWwOP1tt8Cd5PEO TmVmpD/1c/BJwyFavRFLHvUD++xe0f4Cyw== X-Google-Smtp-Source: ABdhPJxx73reUGTCPrylrLH40cty02wdG8EMug5433OMyJRVYQLdtDnPpjQgSXWRzKdC1ClgoSQ+qw== X-Received: by 2002:a17:907:1c0a:b0:6da:7ac4:5349 with SMTP id nc10-20020a1709071c0a00b006da7ac45349mr4636168ejc.596.1647527136032; Thu, 17 Mar 2022 07:25:36 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id c17-20020a05640227d100b00416bbe8ca69sm2761502ede.89.2022.03.17.07.25.35 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Mar 2022 07:25:35 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Subject: [PATCH] arm64: versal: Do not place u-boot to reserved memory location Date: Thu, 17 Mar 2022 15:25:31 +0100 Message-Id: <15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 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 Versal can also have reserved space in DT which u-boot has to avoid to placing self to that location. The same change was done in ZynqMP by commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location") and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place u-boot to reserved memory location"). The patch was tested by adding reserved-memory node to DT and check via bdinfo back. Signed-off-by: Michal Simek --- board/xilinx/versal/board.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 299e128f7b9d..9940f2aeb337 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -249,6 +250,25 @@ int dram_init(void) return 0; } +ulong board_get_usable_ram_top(ulong total_size) +{ + phys_size_t size; + phys_addr_t reg; + struct lmb lmb; + + /* found enough not-reserved memory to relocated U-Boot */ + lmb_init(&lmb); + lmb_add(&lmb, gd->ram_base, gd->ram_size); + boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob); + size = ALIGN(CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE); + reg = lmb_alloc(&lmb, size, MMU_SECTION_SIZE); + + if (!reg) + reg = gd->ram_top - size; + + return reg + size; +} + void reset_cpu(void) { }