public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sjoerd Simons <sjoerd@collabora.com>
To: u-boot@lists.denx.de
Cc: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Michal Simek <michal.simek@amd.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>
Subject: [PATCH 3/3] lmb: Treat a region which is a subset as equal
Date: Thu, 19 Jan 2023 09:38:19 +0100	[thread overview]
Message-ID: <20230119083820.2656710-4-sjoerd@collabora.com> (raw)
In-Reply-To: <20230119083820.2656710-1-sjoerd@collabora.com>

In various cases logical memory blocks are coalesced; As a result doing
a strict check whether memory blocks are the same doesn't necessarily
work as a previous addition of a given block might have been merged into
a bigger block.

Fix this by considering a block is already registered if it's a pure
subset of one of the existing blocks.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>

---

 lib/lmb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index f447c639a60..b09a043f4c2 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -248,7 +248,7 @@ static long lmb_add_region_flags(struct lmb_region *rgn, phys_addr_t base,
 		phys_size_t rgnsize = rgn->region[i].size;
 		phys_size_t rgnflags = rgn->region[i].flags;
 
-		if (rgnbase == base && rgnsize == size) {
+		if (rgnbase <= base && rgnbase + rgnsize >= base + size) {
 			if (flags == rgnflags)
 				/* Already have this region, so we're done */
 				return 0;
-- 
2.39.0


  parent reply	other threads:[~2023-01-19  8:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  8:38 [PATCH 0/3] Fix boot regressions on at least TI am62x Sjoerd Simons
2023-01-19  8:38 ` [PATCH 1/3] Bump LMB_MAX_REGIONS default to 16 Sjoerd Simons
2023-01-26 18:28   ` Tom Rini
2023-01-27  7:55     ` Sjoerd Simons
2023-01-27 13:22       ` Tom Rini
2023-02-08 20:00   ` Tom Rini
2023-01-19  8:38 ` [PATCH 2/3] lmb: Set correct lmb flags for EFI memory map entries Sjoerd Simons
2023-02-07 16:49   ` Tom Rini
2023-01-19  8:38 ` Sjoerd Simons [this message]
2023-02-06 18:04   ` [PATCH 3/3] lmb: Treat a region which is a subset as equal Tom Rini
2023-02-08  7:37     ` Sjoerd Simons
2023-02-08 14:55       ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230119083820.2656710-4-sjoerd@collabora.com \
    --to=sjoerd@collabora.com \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=michal.simek@amd.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox