From patchwork Mon Oct 21 17:24:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 837321 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c9:0:b0:37d:45d0:187 with SMTP id f9csp2133726wrt; Mon, 21 Oct 2024 10:24:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/y2cVz7V0Wz1J41obqQw9x3kRFPr9Gq2W+HI1WKH0ifFeYDoM2CUDQSABhCiDYCq5xQuA6g==@linaro.org X-Google-Smtp-Source: AGHT+IHAsMVyeLUkioycQelYxUT1huDcZOfsAaj2iJcoEEsbgCURT2DhBMcw0dTelp/af8CpURgn X-Received: by 2002:a05:6e02:1a27:b0:3a3:3a5e:a337 with SMTP id e9e14a558f8ab-3a4cb4f2111mr10694905ab.16.1729531488972; Mon, 21 Oct 2024 10:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729531488; cv=none; d=google.com; s=arc-20240605; b=iot4RI0YXz+WTuOpNeLn0qhcv3SqrM3S+PwemU1qyrQERaluEO0LI31/vSpQvi0gto smBIMU7SMJNDNvulGec6dEgiziehXsiGg0on/xO/Q3fEn8B+9PVumKibAVfzv0HZqiM+ 99qeUWjPjnsSyzZvRrE+f4BNmWPpkC32s5Yrp+B+yU+TIaJKihlbCyNM/zlwXd+TG3QS w0YXNsUsI7vw9KrNWIA9XQe30ta/mJ145qxe3g+i6bAOo7a3yu2NKr+uksOTlqQ/TWsl 9zjMWR4c7Z2ssPiV7RViWzxSyOiTLlS1QtDbBhAeCzWSFoFpqAlCF2amz9kAxjAsWn3q hj6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=pZSMepnNcHsypERpYZWCzzxh8KCPgoXMSlAQ/HXygvA=; fh=1k2W7XvnwFdwRZvAMpXhw9RaMBjQ62ifoU0cZj4x92w=; b=WiKyYnrYSlVD7RKVbD+HdItJw8QLNYGAG2eR1oSaIYVeG3sc+m0t8CAqkgr0F7cTfc 2niJNUJ2odOjGwOS6YauJzHTFrvAJwyLJwF6fw3XddqBmbSpIMVUy+VVGef+6JTgYDpw 9gusMmJmCFnogkwl+L5UMjNTqDBOEDvg5rdOEuqq4C6r9sFeXmNIMYk3+5JtJbku6K4J MFjXIufKvPPILSs6lMsgO5UvqIoOUeAlDtynfj+xK4qDRT+vMW3CsJwltDw3OypxwKNt 5FHY4l9oJzYJh22+EBz0ORoHXGPWZW4+tC6dD8gvGiTunHvJsUQe1kJ71ZY1yt4YhOfa XwwQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a400b8f230si17302645ab.178.2024.10.21.10.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 10:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0C30D88F01; Mon, 21 Oct 2024 19:24:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 7AB7388E94; Mon, 21 Oct 2024 19:24:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 61D3A88E94 for ; Mon, 21 Oct 2024 19:24:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F501DA7; Mon, 21 Oct 2024 10:25:12 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 41AF13F528; Mon, 21 Oct 2024 10:24:41 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Tom Rini , Vaishnav Achath , Sughosh Ganu Subject: [PATCH] fdt: lmb: add reserved regions as no-overwrite Date: Mon, 21 Oct 2024 22:54:33 +0530 Message-Id: <20241021172433.637950-1-sughosh.ganu@linaro.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The boot_fdt_add_mem_rsv_regions() function reserves the memreserve and reserved-memory regions. These regions are being set with the LMB_NONE flag which allows overwriting and re-using the regions. This was fine earlier when the LMB memory map was local and not enforced globally. But that is no longer the case. Mark these regions as LMB_NOOVERWRITE so that they cannot be used. Signed-off-by: Sughosh Ganu Reported-by: Vaishnav Achath --- boot/image-fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/image-fdt.c b/boot/image-fdt.c index 8eda521693d..9a1fa8840d7 100644 --- a/boot/image-fdt.c +++ b/boot/image-fdt.c @@ -110,7 +110,7 @@ void boot_fdt_add_mem_rsv_regions(void *fdt_blob) for (i = 0; i < total; i++) { if (fdt_get_mem_rsv(fdt_blob, i, &addr, &size) != 0) continue; - boot_fdt_reserve_region(addr, size, LMB_NONE); + boot_fdt_reserve_region(addr, size, LMB_NOOVERWRITE); } /* process reserved-memory */ @@ -122,7 +122,7 @@ void boot_fdt_add_mem_rsv_regions(void *fdt_blob) ret = fdt_get_resource(fdt_blob, subnode, "reg", 0, &res); if (!ret && fdtdec_get_is_enabled(fdt_blob, subnode)) { - flags = LMB_NONE; + flags = LMB_NOOVERWRITE; if (fdtdec_get_bool(fdt_blob, subnode, "no-map")) flags = LMB_NOMAP;