{"id":2219322,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2219322/?format=json","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.0/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260402205038.4005350-2-rs@ti.com>","date":"2026-04-02T20:50:34","name":"[PATCHv2,1/5] lmb: add LMB_FDT for fdt reserved regions","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c552b456f1b651c0475336f53e83ef81f2cc60f9","submitter":{"id":88727,"url":"http://patchwork.ozlabs.org/api/1.0/people/88727/?format=json","name":"Randolph Sapp","email":"rs@ti.com"},"delegate":{"id":68728,"url":"http://patchwork.ozlabs.org/api/1.0/users/68728/?format=json","username":"xypron","first_name":"Heinrich","last_name":"Schuchardt","email":"xypron.glpk@gmx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260402205038.4005350-2-rs@ti.com/mbox/","series":[{"id":498552,"url":"http://patchwork.ozlabs.org/api/1.0/series/498552/?format=json","date":"2026-04-02T20:50:33","name":"various memory related fixups","version":1,"mbox":"http://patchwork.ozlabs.org/series/498552/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2219322/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256\n header.s=selector1 header.b=KNf+VO0X;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=quarantine dis=none) header.from=ti.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=ti.com header.i=@ti.com header.b=\"KNf+VO0X\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=quarantine dis=none) header.from=ti.com","phobos.denx.de; spf=pass smtp.mailfrom=rs@ti.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmvCk5Wttz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 07:51:30 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 4179D8408D;\n\tThu,  2 Apr 2026 22:51:23 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id C2C8380212; Thu,  2 Apr 2026 22:51:21 +0200 (CEST)","from PH7PR06CU001.outbound.protection.outlook.com\n (mail-westus3azlp170100009.outbound.protection.outlook.com\n [IPv6:2a01:111:f403:c107::9])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 99C1A84056\n for <u-boot@lists.denx.de>; Thu,  2 Apr 2026 22:51:19 +0200 (CEST)","from BY3PR03CA0013.namprd03.prod.outlook.com (2603:10b6:a03:39a::18)\n by PH7PR10MB6105.namprd10.prod.outlook.com (2603:10b6:510:1fb::8)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Thu, 2 Apr\n 2026 20:51:16 +0000","from SJ5PEPF000001D2.namprd05.prod.outlook.com\n (2603:10b6:a03:39a:cafe::2f) by BY3PR03CA0013.outlook.office365.com\n (2603:10b6:a03:39a::18) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.18 via Frontend Transport; Thu,\n 2 Apr 2026 20:51:16 +0000","from flwvzet201.ext.ti.com (198.47.21.195) by\n SJ5PEPF000001D2.mail.protection.outlook.com (10.167.242.54) with Microsoft\n SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.9769.17 via Frontend Transport; Thu, 2 Apr 2026 20:51:14 +0000","from DFLE212.ent.ti.com (10.64.6.70) by flwvzet201.ext.ti.com\n (10.248.192.32) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 2 Apr\n 2026 15:51:00 -0500","from DFLE205.ent.ti.com (10.64.6.63) by DFLE212.ent.ti.com\n (10.64.6.70) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 2 Apr\n 2026 15:51:00 -0500","from lelvem-mr06.itg.ti.com (10.180.75.8) by DFLE205.ent.ti.com\n (10.64.6.63) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend\n Transport; Thu, 2 Apr 2026 15:51:00 -0500","from rs-desk.dhcp.ti.com (rs-desk.dhcp.ti.com [128.247.81.39])\n by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 632Kp0bO2708543;\n Thu, 2 Apr 2026 15:51:00 -0500"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,T_SPF_PERMERROR autolearn=ham\n autolearn_force=no version=3.4.2","ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=PGXEThPuah+4Vp9Zy6V1aNWmL3TEw2u7Vvx+865Fow7JeVdVxaf8mqAXyvEqb1nJRDRL4j9yoHQ4IorOGCCDUziWGso2JylXz735ll3+yfrQ7d7XxHwAl3Kvv/Hhvyxu3B5pG5ymRn1BgCZxR/ku87Owi/FVpsspl8zTTq01PFbus28R/GSxKVYankRbmXKXat2WPeVtByGlZLBfRn27m0y5WXml9jzwLZa0tNvu6IwN7v7LgQFMaT7Ea57eDXF9QhM4xeFXkFY2sJ9sniBQSSCkFfUnZKbsGfMTlsrGZQhARo3HVD/xVfZpF4TkkSEddvQhqSd3z+evGU8NLh3gWw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=2GGKeCnV73W3aTCaY9Gzb+YH7LxviCucmxM588ysRNw=;\n b=Mc0HBHy4Q89a/MPIz/m2Sn6YHpYBwQCl5arm5mWG3yu5xxS6jqppD9BXF6iJzu1QBI/4zj2DNFjAg/JtRt2S8JMwdhU7qkxYtavO/Chk1F0UnVTysZEo3VzclA9uNH265H5Wk8q067JCbOzDXJg/FCJhDYlLKyZZvffpZ3MB+v065Y22Us1Uy0p9pBNVAmqJHS4+oSxlLzkIanpVCDYnh+iieeXMFmvDAKYJpcovULeyUcYeXorqVG0H4FNzj+tQ4s4TQ/chZoLOX2wvCKL7ck8qp2eNvYrMfyr6KEmmiI9HJ5XQMz3YUdobAipdHrmbvy86yZHdsiX26bgvyb1mlQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 198.47.21.195) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=ti.com;\n dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com;\n dkim=none (message not signed); arc=none (0)","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=2GGKeCnV73W3aTCaY9Gzb+YH7LxviCucmxM588ysRNw=;\n b=KNf+VO0Xb3moHK8/xQtaNNSopJDfA01tkHwOmtiovnSQ6Ze2pDRIOw+EfQsKAjJTQRn9njp3qPCrsw+MxkBuRtVXP09A2xBN8gDxs5eLjmTaz4o+n+17PEYARIK9ycRVWvP/uT4zJm0zSiC0fpTjQw8rG1gQYcV5PT2SZ2snHNs=","X-MS-Exchange-Authentication-Results":"spf=pass (sender IP is 198.47.21.195)\n smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;\n dmarc=pass\n action=none header.from=ti.com;","Received-SPF":"Pass (protection.outlook.com: domain of ti.com designates\n 198.47.21.195 as permitted sender) receiver=protection.outlook.com;\n client-ip=198.47.21.195; helo=flwvzet201.ext.ti.com; pr=C","From":"<rs@ti.com>","To":"<robertcnelson@gmail.com>, <ayush@beagleboard.org>,\n <Erik.Welsh@octavosystems.com>, <anshuld@ti.com>, <bb@ti.com>,\n <trini@konsulko.com>, <afd@ti.com>, <xypron.glpk@gmx.de>,\n <ilias.apalodimas@linaro.org>","CC":"<u-boot@lists.denx.de>","Subject":"[PATCHv2 1/5] lmb: add LMB_FDT for fdt reserved regions","Date":"Thu, 2 Apr 2026 15:50:34 -0500","Message-ID":"<20260402205038.4005350-2-rs@ti.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260402205038.4005350-1-rs@ti.com>","References":"<20260402205038.4005350-1-rs@ti.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain","X-C2ProcessedOrg":"333ef613-75bf-4e12-a4b1-8e3623f5dcea","X-EOPAttributedMessage":"0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"SJ5PEPF000001D2:EE_|PH7PR10MB6105:EE_","X-MS-Office365-Filtering-Correlation-Id":"32ee2755-73d1-4931-f928-08de90f99489","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;\n ARA:13230040|36860700016|376014|1800799024|82310400026|22082099003|56012099003|18002099003;","X-Microsoft-Antispam-Message-Info":"\n zwag09mnC7WabxwgRHiQIIIUP7TRgKCW/8pKJwTdRUrT1eLxDsKrPLOi1W5JbQRgRm/zyQjDviq1/YxViz0WwVWpYkTlDyKTKlhAT1o7W6T/v1cR0SJZnGXmCl7pfXKuTho4YIIzGAfWOY7DtDHXSpAC0qVzkSsUQldL9mj08/q3453bfrwA0pcs/vvTg3gq/zPDWRZQBbH6ycyQtXWBDeG1NxOGusHaxHCuROwUY9pJuVgrQUh9+1r/U6V1l+uFv3Gyu1Z/zjg+EOM9CjQB3rsD2GTZBM/ZAswMCPwSyvrPTIItD4KDytG3xYJonHWf7yjhds2/Es9G2ygiC5Q5MkPTuINcV78xPsfrpI6eVqjLD7LGGGD8sag3GjVU/D+lBzqroMDmkDaG0noZPWyyM6MXL49EcwGE24yz1kvLEVw12A6J7Cx3qZ61JpdyQnVgnh/jOgm4+gK0ISDz4Q3bBaM7czzYQ8KmOZ6AIyNCxQv3D2oZcNcGg+i4hQ10LLB6ParMsqwTIugvRKOwci76s6+DGj8PQjFOOGT/M1MEqeF8TVYkoHhTCHY417VgPFPzjugWSs/8Fe0QFBjD6tqn7PVFNvGSibmuAib0vMqUJ5G+2av7xQoT7FRHX6WgyZ9COUE7SzOFT47K47V2KbR290/jV7pfPJUa6Y8Qa0uaKVpbnwXUWwLh3BUyn5ZIiwOqSzD/qMOWInuGgRZjcRowZJW7564sN7B+B41Pyop0Ui0aBKbAVCgq1XT1XxMAJZRrgVOFwdO7OiwbQvRcWUmJJw==","X-Forefront-Antispam-Report":"CIP:198.47.21.195; CTRY:US; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:flwvzet201.ext.ti.com; PTR:ErrorRetry; CAT:NONE;\n SFS:(13230040)(36860700016)(376014)(1800799024)(82310400026)(22082099003)(56012099003)(18002099003);\n DIR:OUT; SFP:1101;","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"\n BaT8O3fsV60jiFG7czEHWT7Mg6HfJFHjeYICxl8VCAnd6xUaXGnOnebcDgteUa1oPjaL5kxVlQ0RsEp94nOYK2QPAGLTUTJotsYg6VmBYq0fk78JdpH+TgDD7FfuG5+WK7RegmXq6G4+Tpm3pFN0buP0+r2haETspGt8FN26/za+0AojKuNBcC0GJSxjlos96ktoEXu7+X7ZjYSRxHhhNzysbDiECQ7vRKVa2FCN8fX3M55b0mK4A92RavZQgoC58SWtHEvj134LddXnx6dsFL9NAqo2bdlAHYm4XPCisAB/cYwp4Mc9o88g66udSh2k1IFhKfttj86nxttYd8jtRDiHuKWOHOXoftbSNB7ptvCzXMG1XaImUDUBmTQDd8AWyqvo7m3pBsWbYal6h1O41xmVzo5zpgL014fbj4hjkJONmezwfl4oxaI4RdgUHc6h","X-OriginatorOrg":"ti.com","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"02 Apr 2026 20:51:14.5138 (UTC)","X-MS-Exchange-CrossTenant-Network-Message-Id":"\n 32ee2755-73d1-4931-f928-08de90f99489","X-MS-Exchange-CrossTenant-Id":"e5b49634-450b-4709-8abb-1e2b19b982b7","X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp":"\n TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7; Ip=[198.47.21.195];\n Helo=[flwvzet201.ext.ti.com]","X-MS-Exchange-CrossTenant-AuthSource":"\n SJ5PEPF000001D2.namprd05.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Anonymous","X-MS-Exchange-CrossTenant-FromEntityHeader":"HybridOnPrem","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"PH7PR10MB6105","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"From: Randolph Sapp <rs@ti.com>\n\nAdd an LMB_FDT bit for fdt reserved regions, so we can reclaim them when\nparsing a new device tree and properly warn people when a reservation\noverlaps with an existing allocation.\n\nIf we don't at least warn the user of these reservation failures,\nthere's a chance that this region could be freed and reallocated for\nsomething important later.\n\nThis useful warning mechanism was broken in:\n5a6aa7d5913 (\"boot: fdt: Handle already reserved memory in boot_fdt_reserve_region()\")\n\nSigned-off-by: Randolph Sapp <rs@ti.com>\n---\n boot/image-fdt.c |  5 ++++-\n include/lmb.h    |  7 +++++++\n lib/lmb.c        | 25 +++++++++++++++++++++++++\n 3 files changed, 36 insertions(+), 1 deletion(-)","diff":"diff --git a/boot/image-fdt.c b/boot/image-fdt.c\nindex a3a4fb8b558..0f5857f24d2 100644\n--- a/boot/image-fdt.c\n+++ b/boot/image-fdt.c\n@@ -73,6 +73,7 @@ static void boot_fdt_reserve_region(u64 addr, u64 size, u32 flags)\n {\n \tlong ret;\n \tphys_addr_t rsv_addr;\n+\tflags |= LMB_FDT;\n \n \trsv_addr = (phys_addr_t)addr;\n \tret = lmb_alloc_mem(LMB_MEM_ALLOC_ADDR, 0, &rsv_addr, size, flags);\n@@ -80,7 +81,7 @@ static void boot_fdt_reserve_region(u64 addr, u64 size, u32 flags)\n \t\tdebug(\"   reserving fdt memory region: addr=%llx size=%llx flags=%x\\n\",\n \t\t      (unsigned long long)addr,\n \t\t      (unsigned long long)size, flags);\n-\t} else if (ret != -EEXIST && ret != -EINVAL) {\n+\t} else if (ret != -EINVAL) {\n \t\tputs(\"ERROR: reserving fdt memory region failed \");\n \t\tprintf(\"(addr=%llx size=%llx flags=%x)\\n\",\n \t\t       (unsigned long long)addr,\n@@ -108,6 +109,8 @@ void boot_fdt_add_mem_rsv_regions(void *fdt_blob)\n \tif (fdt_check_header(fdt_blob) != 0)\n \t\treturn;\n \n+\tlmb_free_fdt_regions();\n+\n \t/* process memreserve sections */\n \ttotal = fdt_num_mem_rsv(fdt_blob);\n \tfor (i = 0; i < total; i++) {\ndiff --git a/include/lmb.h b/include/lmb.h\nindex 5d5f037ccb9..1b59a63f61d 100644\n--- a/include/lmb.h\n+++ b/include/lmb.h\n@@ -25,11 +25,13 @@\n  * %LMB_NOMAP: Don't add to MMU configuration\n  * %LMB_NOOVERWRITE: The memory region cannot be overwritten/re-reserved\n  * %LMB_NONOTIFY: Do not notify other modules of changes to this memory region\n+ * %LMB_FDT: A FDT reserved region that can be reclaimed if the FDT changes\n  */\n #define LMB_NONE 0\n #define LMB_NOMAP BIT(1)\n #define LMB_NOOVERWRITE BIT(2)\n #define LMB_NONOTIFY BIT(3)\n+#define LMB_FDT BIT(4)\n \n /**\n  * enum lmb_mem_type - type of memory allocation request\n@@ -215,6 +217,11 @@ phys_addr_t io_lmb_alloc(struct lmb *io_lmb, phys_size_t size, ulong align);\n  */\n long io_lmb_free(struct lmb *io_lmb, phys_addr_t base, phys_size_t size);\n \n+/**\n+ * lmb_free_fdt_regions() - Reclaim all LMB_FDT tagged reserved regions\n+ */\n+void lmb_free_fdt_regions(void);\n+\n #endif /* __KERNEL__ */\n \n #endif /* _LINUX_LMB_H */\ndiff --git a/lib/lmb.c b/lib/lmb.c\nindex e2d9fe86c14..18703212afb 100644\n--- a/lib/lmb.c\n+++ b/lib/lmb.c\n@@ -669,6 +669,31 @@ long lmb_free(phys_addr_t base, phys_size_t size, u32 flags)\n \treturn lmb_map_update_notify(base, size, LMB_MAP_OP_FREE, flags);\n }\n \n+void lmb_free_fdt_regions(void)\n+{\n+\tstruct alist *lmb_rgn_lst = &lmb.used_mem;\n+\tstruct lmb_region *rgn = lmb_rgn_lst->data;\n+\tlong ret;\n+\tint i = 0;\n+\n+\twhile (i < lmb_rgn_lst->count) {\n+\t\tphys_addr_t base = rgn[i].base;\n+\t\tphys_size_t size = rgn[i].size;\n+\t\tu32 flags = rgn[i].flags;\n+\n+\t\tif (flags & LMB_FDT) {\n+\t\t\tret = lmb_free(base, size, flags);\n+\t\t\tif (ret < 0) {\n+\t\t\t\tprintf(\"Unable to free FDT memory at 0x%08lx\",\n+\t\t\t\t       (ulong)base);\n+\t\t\t\ti++;\n+\t\t\t}\n+\t\t} else {\n+\t\t\ti++;\n+\t\t}\n+\t}\n+}\n+\n static int _lmb_alloc_base(phys_size_t size, ulong align,\n \t\t\t   phys_addr_t *addr, u32 flags)\n {\n","prefixes":["PATCHv2","1/5"]}