mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] resource: fix recently broken memory bank fusing
@ 2022-10-17 13:39 Ahmad Fatoum
  2022-10-17 14:47 ` Ian Abbott
  2022-10-18  8:52 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2022-10-17 13:39 UTC (permalink / raw)
  To: barebox; +Cc: Ian Abbott, Ahmad Fatoum

barebox will fuse overlapping memory banks to avoid the common issue of
the device tree being modified upstream to contain a minimum RAM size
that would then conflict with a RAM size barebox determines by
querying the memory controller. This was recently broken, because we
changed memory banks to have IORESOURCE_MEM in their flags field,
but resource_contains() used to compare regions won't return true if
memory type differs. Fix this by settings .flags = IORESOURCE_MEM
for the new resource as well.

Reported-by: Ian Abbott <abbotti@mev.co.uk>
Fixes: d0b5f6bde15b ("of: reserved-mem: reserve regions prior to mmu_initcall()")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/memory.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/memory.c b/common/memory.c
index 7e24ecb2bd03..0ae9e7383cce 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -149,6 +149,7 @@ int barebox_add_memory_bank(const char *name, resource_size_t start,
 	struct resource newres = {
 		.start = start,
 		.end = start + size - 1,
+		.flags = IORESOURCE_MEM,
 	};
 
 	for_each_memory_bank(bank) {
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH master] resource: fix recently broken memory bank fusing
  2022-10-17 13:39 [PATCH master] resource: fix recently broken memory bank fusing Ahmad Fatoum
@ 2022-10-17 14:47 ` Ian Abbott
  2022-10-18  8:52 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2022-10-17 14:47 UTC (permalink / raw)
  To: Ahmad Fatoum, barebox

On 17/10/2022 14:39, Ahmad Fatoum wrote:
> barebox will fuse overlapping memory banks to avoid the common issue of
> the device tree being modified upstream to contain a minimum RAM size
> that would then conflict with a RAM size barebox determines by
> querying the memory controller. This was recently broken, because we
> changed memory banks to have IORESOURCE_MEM in their flags field,
> but resource_contains() used to compare regions won't return true if
> memory type differs. Fix this by settings .flags = IORESOURCE_MEM
> for the new resource as well.
> 
> Reported-by: Ian Abbott <abbotti@mev.co.uk>
> Fixes: d0b5f6bde15b ("of: reserved-mem: reserve regions prior to mmu_initcall()")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>   common/memory.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/common/memory.c b/common/memory.c
> index 7e24ecb2bd03..0ae9e7383cce 100644
> --- a/common/memory.c
> +++ b/common/memory.c
> @@ -149,6 +149,7 @@ int barebox_add_memory_bank(const char *name, resource_size_t start,
>   	struct resource newres = {
>   		.start = start,
>   		.end = start + size - 1,
> +		.flags = IORESOURCE_MEM,
>   	};
>   
>   	for_each_memory_bank(bank) {

Tested-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH master] resource: fix recently broken memory bank fusing
  2022-10-17 13:39 [PATCH master] resource: fix recently broken memory bank fusing Ahmad Fatoum
  2022-10-17 14:47 ` Ian Abbott
@ 2022-10-18  8:52 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-10-18  8:52 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Ian Abbott

On Mon, Oct 17, 2022 at 03:39:00PM +0200, Ahmad Fatoum wrote:
> barebox will fuse overlapping memory banks to avoid the common issue of
> the device tree being modified upstream to contain a minimum RAM size
> that would then conflict with a RAM size barebox determines by
> querying the memory controller. This was recently broken, because we
> changed memory banks to have IORESOURCE_MEM in their flags field,
> but resource_contains() used to compare regions won't return true if
> memory type differs. Fix this by settings .flags = IORESOURCE_MEM
> for the new resource as well.
> 
> Reported-by: Ian Abbott <abbotti@mev.co.uk>
> Fixes: d0b5f6bde15b ("of: reserved-mem: reserve regions prior to mmu_initcall()")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/memory.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

Sascha

> 
> diff --git a/common/memory.c b/common/memory.c
> index 7e24ecb2bd03..0ae9e7383cce 100644
> --- a/common/memory.c
> +++ b/common/memory.c
> @@ -149,6 +149,7 @@ int barebox_add_memory_bank(const char *name, resource_size_t start,
>  	struct resource newres = {
>  		.start = start,
>  		.end = start + size - 1,
> +		.flags = IORESOURCE_MEM,
>  	};
>  
>  	for_each_memory_bank(bank) {
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-18  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 13:39 [PATCH master] resource: fix recently broken memory bank fusing Ahmad Fatoum
2022-10-17 14:47 ` Ian Abbott
2022-10-18  8:52 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox