From patchwork Thu Jan 20 19:17:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Salveti X-Patchwork-Id: 1582306 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=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=VSmeVGFw; 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 4Jfsj41vB6z9s1l for ; Fri, 21 Jan 2022 06:17:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 755BC837D7; Thu, 20 Jan 2022 20:17:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="VSmeVGFw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A114B838DA; Thu, 20 Jan 2022 20:17:38 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (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 F22D0837FB for ; Thu, 20 Jan 2022 20:17:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ricardo@foundries.io Received: by mail-oi1-x234.google.com with SMTP id e81so10345731oia.6 for ; Thu, 20 Jan 2022 11:17:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qB2gpM6D0p0wRx0nXp5y1ZIvPrGTknEIXER1GjdPWio=; b=VSmeVGFwA2v2d4LSOUS26N418D+oxneBghl0dglhKMj9q0ZC4EsA7CvteEsL/+u2m8 umiothJy5TljgifLRnPbvFBh8K2JzQiqCsDwqv2jwsaq491G4kLUtR2dscGWnFENwfia AjC+986oPf9AjWZOeZ5z0b0O4tRwok1KTIwyijlIwOGHLeT/BVVV4z1pWv7UFg40mrQG wv+H4FC1w3qkm/4HD+ugzuQVlplleh4VRCBeqfPEV2YzdmigqZopRjcE2gsTYsy4X6RL 2Q6cfjznoLf+3GZOz4t28pSIaalC/k/r11B+yMfiaO37xGdd2td/K2TyTRaQ0rNt4/fm wkaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qB2gpM6D0p0wRx0nXp5y1ZIvPrGTknEIXER1GjdPWio=; b=6LyOjE4o8HtdpQCFBPJH8/m9G7CZ6ra77lBX6gs30KIpn3y8eTNWUiBI86jbjG9Qy5 dWstvShjmGwZ3fpBeM5DP69nz3DCx1e9k31miTxk1VVZ7YTNbc+e/SzjzlrQHq26h6+A +P8RdNjZDLuaDXnjibmXiSFMtMJJpdZYKWjX+4iUDb8RC9b0ykqZd88tnq4mn5YX+IFk itvNIVBB+/lec7zKQvJ3CekGXfBQYRX5m82zmCRTGTcZDH/oK5r5fUtmHZLJ5mDnmgNH PpuCcDG/53OpxfRhzHE+PsclYDpGLdSi0CNbOZud3xAfoKANiqJ/cBIpJxbpA/cj2zQD ZqdQ== X-Gm-Message-State: AOAM533O4G1VwEHqueiP8oDe2fEprSJf5MRzBwRAh311+N7zWfdWfLNT lgzcG6hS4nSq931kl+Skrs5tDq3WIUPt X-Google-Smtp-Source: ABdhPJxhSSI1tff+shFmFdW+VMtsBhCoszxhOHbziquwBcKOQQDoozRUueqyhHsHx03iZ3kQsfNUeQ== X-Received: by 2002:a54:469a:: with SMTP id k26mr8811805oic.147.1642706254258; Thu, 20 Jan 2022 11:17:34 -0800 (PST) Received: from localhost.localdomain ([191.251.45.228]) by smtp.gmail.com with ESMTPSA id o12sm36751ooi.18.2022.01.20.11.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 11:17:33 -0800 (PST) From: Ricardo Salveti To: u-boot@lists.denx.de Cc: michal.simek@xilinx.com, igor.opaniuk@foundries.io Subject: [PATCH v2] xilinx: common: change bootm_size to not go beyond ram_top Date: Thu, 20 Jan 2022 16:17:30 -0300 Message-Id: <20220120191730.2009270-1-ricardo@foundries.io> X-Mailer: git-send-email 2.34.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.2 at phobos.denx.de X-Virus-Status: Clean The available ram can be limited by ram_top as that depends on the reserved memory nodes provided by the device-tree (via board_get_usable_ram_top), so make sure to respect ram_top when setting up bootm_size to avoid overlapping reserved memory regions (e.g. memory used by OP-TEE). The same logic is available in env_get_bootm_size when bootm_size is not defined by the default environment. Signed-off-by: Ricardo Salveti --- Change in v2: - Declare bootm_size based on ram top and base board/xilinx/common/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 78a5d0efa86..6fce23197a4 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -377,7 +377,7 @@ int board_late_init_xilinx(void) u32 ret = 0; int i, id, macid = 0; struct xilinx_board_description *desc; - phys_size_t bootm_size = gd->ram_size; + phys_size_t bootm_size = gd->ram_top - gd->ram_base; if (!CONFIG_IS_ENABLED(MICROBLAZE)) { ulong scriptaddr;