Re: [PATCH 4/8] of: add flag to not create resmem DT entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20.04.21 09:56, Rouven Czerwinski wrote:
> If we are parsing entries from the /reserved-memory device tree path we
> don't want to add them again as resmem blocks at the beginning of the
> device tree. Therefore add another flag to indicate this.

This has the assumption that the /reserved-memory device tree node is
identical between barebox and kernel. Prior to your next commit, this
assumption wasn't there because barebox just copied over fix ups it
knows about into the kernel device tree.

I think what you rather do here is to mark device tree reserved entries
by origin. You have a bit that says whether it's a /memreserve/
or /reserved-memory and fix it up the same way into the kernel device
tree.

> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@xxxxxxxxxxxxxx>
> ---
>  drivers/of/fdt.c | 10 +++++++---
>  include/of.h     |  2 ++
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 6aade13fa0..da36739713 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -552,6 +552,9 @@ int of_add_reserve_entry(resource_size_t start, resource_size_t end,
>  	if (flags & OF_RESERVE_ENTRY_FLAG_XN)
>  		of_reserve_map.xn |= BIT(e);
>  
> +	if (flags & OF_RESERVE_ENTRY_FLAG_NO_RESERVE)
> +		of_reserve_map.noentry |= BIT(e);
> +
>  	return 0;
>  }
>  
> @@ -594,9 +597,10 @@ void fdt_add_reserve_map(void *__fdt)
>  	fdt_res += n;
>  
>  	for (i = 0; i < res->num_entries; i++) {
> -		of_write_number(&fdt_res->address, res->start[i], 2);
> -		of_write_number(&fdt_res->size, res->end[i] - res->start[i] + 1,
> -				2);
> +		if (!(res->noentry & BIT(i))) {
> +			of_write_number(&fdt_res->address, res->start[i], 2);
> +			of_write_number(&fdt_res->size, res->end[i] - res->start[i] + 1, 2);
> +		}
>  		fdt_res++;
>  	}
>  
> diff --git a/include/of.h b/include/of.h
> index 088b088223..c6d3836db1 100644
> --- a/include/of.h
> +++ b/include/of.h
> @@ -55,9 +55,11 @@ struct of_reserve_map {
>  	uint64_t end[OF_MAX_RESERVE_MAP];
>  	int num_entries;
>  	u32 xn;
> +	u32 noentry;

u16 : OF_MAX_RESERVE_MAP would fit nicely in here. See comment on first patch. 

>  };
>  
>  #define OF_RESERVE_ENTRY_FLAG_XN		BIT(0)
> +#define OF_RESERVE_ENTRY_FLAG_NO_RESERVE	BIT(1)

Sorry for bikeshedding. But OF_RESERVE.*_NO_RESERVE needs a rename
even if the commit stays mostly as it is..

>  
>  int of_add_reserve_entry(resource_size_t start, resource_size_t end,
>  		 int flags);
> 

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

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux