From patchwork Thu Feb 13 13:11:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 864823 Delivered-To: patch@linaro.org Received: by 2002:a5d:47a6:0:b0:38f:210b:807b with SMTP id 6csp415881wrb; Thu, 13 Feb 2025 05:11:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV31q7QVFp1URqAhuh9pfJE6eisGJqAXvcL5o42npBD1v53+VizXNc0pxlfh1ip5vxu22uedg==@linaro.org X-Google-Smtp-Source: AGHT+IF98J6ez45UZQEOC9opzL51mnOe4h04fMakri+c3XNQbhP4ARv0PXv0I9Le/PNCJTF23ULG X-Received: by 2002:a5d:5887:0:b0:38f:2861:8fa9 with SMTP id ffacd0b85a97d-38f286191d8mr1430975f8f.30.1739452296458; Thu, 13 Feb 2025 05:11:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739452296; cv=none; d=google.com; s=arc-20240605; b=XZ1744B4pQqIULmRgqJmsMJlLJtK6M5QokiorkNcF/6DOBdcCbPBN7Mn3H7HHxyMly CzhuN8ynvmrrdPYpwum6aE0+AU5TMA7AvyVSNj5mGsvTYeJLB7RB7FJi3HRvEJF6FZ7Y 6UwbZ7ebb6444ZIiSNvtc8/XBlihoC41OaafkdNiMgy14+9wcaptXQSA8wqUNn5TeLXX HSGGLxWFe9UxNJEfyWTK58x4CGCvDAlvja2MdRfInHx4HUH3C+vGWHcC1GlNQZnq92nn 2mFYC/cQpXjZoAjgp9izLTMbOnSX2HBI9RMGHqAsW6+QTaW4KQEuoriZih++lK8K/2Bk zKEA== 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=euyd7y09sJxLyLzWLcCXApO0OJZBnKrwPU0Bq02n5ks=; fh=d4XVj+8HdmsbsoM1smqjwzmIkzY0nU/RUGJJUff3t00=; b=elZiMbM0VyFt6fAnjMw/uzOohvdyRwmpeRIla9V0qwsrtrgztAzl31cGqw74PXJjU/ Do5Ct0qMrq1MevVH9LBOjJUreFeAzP+p/ALfVEMhsw9CZASbMjT3BHXOoW2vh2/pVaUK S90xIwKgXtU1EMPkQWBg2e4QIMNm+A7X7CTL7TdqqeX1CQfv5IlU7GXolOU/cdMsjDkE NA2F8r25L8F/anQj8204kvT9F+kHjgahrVCXmUIs+qIqPpwI9VenzpAfRq+hFUbD6bR2 UsKA3x+DHyfBLgUIWTW4avATAj7C8bEgcutfMDv0o2zXG+ojLyThKRvfE/2P30rzfF6j 1j5A==; 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 ffacd0b85a97d-38f258e0f4dsi1400296f8f.10.2025.02.13.05.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2025 05:11:36 -0800 (PST) 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 3E7B280A55; Thu, 13 Feb 2025 14:11:35 +0100 (CET) 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 F2B8880C98; Thu, 13 Feb 2025 14:11:34 +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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_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 C9CC1806FE for ; Thu, 13 Feb 2025 14:11:32 +0100 (CET) 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 C548916F3; Thu, 13 Feb 2025 05:11:52 -0800 (PST) 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 B38ED3F58B; Thu, 13 Feb 2025 05:11:29 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Tom Rini , Quentin Schulz , Udit Kumar , Heinrich Schuchardt Subject: [PATCH 0/4] lmb: miscellaneous fixes and improvements Date: Thu, 13 Feb 2025 18:41:00 +0530 Message-Id: <20250213131104.186663-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 patch series contains some fixes and improvements in the lmb code, along with addition of corresponding test cases for the changes made. The lmb_reserve() function currently does not check if the requested reservation would overlap with existing reserved regions. While some scenarios are being handled, some corner cases still exist. These are being handled by patch 1, along with adding test cases for these scenarios. Patch 2 is handling the case of reserving a new region of memory, but that region overlaps with an existing region. The current code only handles one particular scenario, but prints a message for the other scenario of an encompassing overlap and returns back. The patch handles the encompassing overlap. Patch 3 is an improvement whereby we allow coalescing a newly reserved region with an existing region. The current code exits this check prematurely. Patch 4 is putting an ifdef in the lmb_map_update_notify() so that the function contents are compiled only with EFI_LOADER. Reasoning for the same is provided in the patch commit message. Sughosh Ganu (4): lmb: check if a region can be reserved by lmb_reserve() lmb: handle scenario of of encompassing overlap lmb: check for a region's coalescing with all existing regions lmb: build lmb_map_update_notify() only with EFI_LOADER lib/lmb.c | 40 +++++++++++++++----- test/lib/lmb.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 130 insertions(+), 10 deletions(-)