lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Sep 2013 22:15:51 -0500
From:	Grant Likely <grant.likely@...aro.org>
To:	Rob Herring <robherring2@...il.com>, linux-kernel@...r.kernel.org,
	devicetree@...r.kernel.org
Cc:	Rob Herring <rob.herring@...xeda.com>
Subject: Re: [PATCH 03/28] of: create unflatten_and_copy_device_tree

On Mon, 16 Sep 2013 18:08:59 -0500, Rob Herring <robherring2@...il.com> wrote:
> From: Rob Herring <rob.herring@...xeda.com>
> 
> Several architectures using DT support built-in dtb's in the init
> section. These platforms need to copy the dtb from init since the
> strings are referenced after unflattening. Every arch has their own
> copying routine which do the same thing. Create a common function,
> unflatten_and_copy_device_tree, to copy the dtb when unflattening the
> dtb.

This set of changes looks fine by me, but it does raise a question:
For the platforms using memblock; would it work to use memblock_reserve
on the region containing the device tree? That would avoid an
unnecessary copy of the data. Can anyone tell me if it is legal to do a
memblock_reserve on an __init section?

Also, I think the patch needs to add documentation for the function that
states when it is appropriate to use the function, and that it shouldn't
be used when DT memory has been reserved.

Acked-by: Grant Likely <grant.likely@...aro.org>

> 
> Signed-off-by: Rob Herring <rob.herring@...xeda.com>
> Cc: Grant Likely <grant.likely@...aro.org>
> ---
>  drivers/of/fdt.c       | 13 +++++++++++++
>  include/linux/of_fdt.h |  2 ++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 229dd9d..eca1810 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -802,6 +802,19 @@ void __init unflatten_device_tree(void)
>  	of_alias_scan(early_init_dt_alloc_memory_arch);
>  }
>  
> +void __init unflatten_and_copy_device_tree(void)
> +{
> +	int size = __be32_to_cpu(initial_boot_params->totalsize);
> +	void *dt = early_init_dt_alloc_memory_arch(size,
> +		__alignof__(struct boot_param_header));
> +
> +	if (dt) {
> +		memcpy(dt, initial_boot_params, size);
> +		initial_boot_params = dt;
> +	}
> +	unflatten_device_tree();
> +}
> +
>  #endif /* CONFIG_OF_EARLY_FLATTREE */
>  
>  /* Feed entire flattened device tree into the random pool */
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index a478c62..58c28a8 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -118,9 +118,11 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
>  
>  /* Other Prototypes */
>  extern void unflatten_device_tree(void);
> +extern void unflatten_and_copy_device_tree(void);
>  extern void early_init_devtree(void *);
>  #else /* CONFIG_OF_FLATTREE */
>  static inline void unflatten_device_tree(void) {}
> +static inline void unflatten_and_copy_device_tree(void) {}
>  #endif /* CONFIG_OF_FLATTREE */
>  
>  #endif /* __ASSEMBLY__ */
> -- 
> 1.8.1.2
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ