public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Sjoerd Simons <sjoerd@collabora.com>
Cc: u-boot@lists.denx.de,
	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: Re: [PATCH 3/3] lmb: Treat a region which is a subset as equal
Date: Mon, 6 Feb 2023 13:04:39 -0500	[thread overview]
Message-ID: <Y+FBN7HS5in07FJe@bill-the-cat> (raw)
In-Reply-To: <20230119083820.2656710-4-sjoerd@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

On Thu, Jan 19, 2023 at 09:38:19AM +0100, Sjoerd Simons wrote:

> 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;

This breaks lib_test_lmb_simple, lib_test_lmb_simple_x2 and
lib_test_lmb_alloc_addr.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2023-02-06 18:04 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 ` [PATCH 3/3] lmb: Treat a region which is a subset as equal Sjoerd Simons
2023-02-06 18:04   ` Tom Rini [this message]
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=Y+FBN7HS5in07FJe@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=michal.simek@amd.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=sjoerd@collabora.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