[RFC PATCH 03/31] lmb: make the lmb reservations persistent

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Jun 10 23:17:08 CEST 2024


Hi Sughosh 

[...]

>  #define LMB_ALLOC_ANYWHERE	0
>  
> +#if !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> +struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS];
> +struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS];
> +#endif
> +
> +struct lmb lmb = {
> +#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> +	.memory.max = CONFIG_LMB_MAX_REGIONS,
> +	.reserved.max = CONFIG_LMB_MAX_REGIONS,
> +#else
> +	.memory.max = CONFIG_LMB_MEMORY_REGIONS,
> +	.reserved.max = CONFIG_LMB_RESERVED_REGIONS,
> +	.memory.region = memory_regions,
> +	.reserved.region = reserved_regions,

This is probably a good opportunity to look into why
CONFIG_LMB_MEMORY_REGIONS was introduced.  Since we are moving towards
static allocations, do we still need it? Or allocating the size dynamically
covers all our cases. 


> +#endif
> +	.memory.cnt = 0,
> +	.reserved.cnt = 0,
> +};
> +
>  static void lmb_dump_region(struct lmb_region *rgn, char *name)
>  {
>  	unsigned long long base, size, end;
> @@ -42,8 +61,8 @@ static void lmb_dump_region(struct lmb_region *rgn, char *name)
>  void lmb_dump_all_force(struct lmb *lmb)
>  {
>  	printf("lmb_dump_all:\n");
> -	lmb_dump_region(&lmb->memory, "memory");
> -	lmb_dump_region(&lmb->reserved, "reserved");
> +	lmb_dump_region(&lmb.memory, "memory");
> +	lmb_dump_region(&lmb.reserved, "reserved");
>  }
>  
 
[...]


Thanks
/Ilias


More information about the U-Boot mailing list