Hi Penny,

On 06/12/2023 10:06, Penny Zheng wrote:
> 
> 
> In case there is a /reserved-memory node already present in the host dtb,
> current Xen codes would create yet another /reserved-memory node specially
> for the static shm in Dom0 Device Tree.
Rational missing:
This would result in an incorrect device tree generation and guest would not be 
able
to detect the static shared memory region.

> 
> Xen will use write_properties() to copy the reserved memory nodes from host 
> dtb
> to Dom0 FDT, so we want to insert the shm node along with the copying.
> And avoiding duplication, we add a checking before make_resv_memory_node().
> 
> Signed-off-by: Penny Zheng <penny.zh...@arm.com>
> 
> ---
> v3 -> v4:
> new commit
> ---
> v4 -> v5:
> rebase and no change
> ---
>  xen/arch/arm/domain_build.c             | 27 ++++++++++++++++++++++---
>  xen/arch/arm/include/asm/kernel.h       |  2 ++
>  xen/arch/arm/include/asm/static-shmem.h | 14 +++++++++++++
>  xen/arch/arm/static-shmem.c             |  6 +++---
>  4 files changed, 43 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index e040f8a6d9..f098678ea3 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -752,6 +752,23 @@ static int __init write_properties(struct domain *d, 
> struct kernel_info *kinfo,
>          }
>      }
> 
> +    if ( dt_node_path_is_equal(node, "/reserved-memory") )
> +    {
> +        kinfo->resv_mem = true;
I think I raised this concern last time. kinfo is used to store per-domain 
configuration.
Information whether the reserved memory is present in host dtb or not does not 
fit there.
Therefore, I would move this flag to bootinfo.

> +
> +        /* shared memory provided. */
> +        if ( kinfo->shminfo.nr_banks != 0 )
> +        {
> +            uint32_t addrcells = dt_n_addr_cells(node),
> +                     sizecells = dt_n_size_cells(node);
I find this always a bit odd. Just uint32_t sizecells on the next line, just 
like you did in all the other patches.

~Michal


Reply via email to