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

Re: [RFC PATCH 3/4] xen/arm: Move make_resv_memory_node()



On Sun, 22 Jun 2025, Koichiro Den wrote:
> The /reserved-memory node is inherently not specific to static-shmem. In
> the next commit, child nodes will be added under /reserved-memory for
> the stolen time shared memory regions.
> 
> No functional changes intended.
> 
> Signed-off-by: Koichiro Den <den@xxxxxxxxxxxxx>

This causes a build failure when CONFIG_STATIC_SHM is missing.

arch/arm/domain_build.c: In function ‘make_resv_memory_node’:
arch/arm/domain_build.c:1567:34: error: implicit declaration of function 
‘kernel_info_get_shm_mem_const’; did you mean ‘kernel_info_get_mem_const’? 
[-Werror=implicit-function-declaration]
 1567 |     const struct membanks *mem = kernel_info_get_shm_mem_const(kinfo);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                  kernel_info_get_mem_const
arch/arm/domain_build.c:1567:34: error: nested extern declaration of 
‘kernel_info_get_shm_mem_const’ [-Werror=nested-externs]
arch/arm/domain_build.c:1567:34: error: initialization of ‘const struct 
membanks *’ from ‘int’ makes pointer from integer without a cast 
[-Werror=int-conversion]



> ---
>  xen/arch/arm/domain_build.c           | 40 +++++++++++++++++++++++++++
>  xen/common/device-tree/static-shmem.c | 40 ---------------------------
>  xen/include/xen/fdt-domain-build.h    |  2 ++
>  xen/include/xen/static-shmem.h        |  9 ------
>  4 files changed, 42 insertions(+), 49 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 967ca6f375ca..85b6909e2b0e 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1561,6 +1561,46 @@ int __init make_chosen_node(const struct kernel_info 
> *kinfo)
>      return res;
>  }
>  
> +int __init make_resv_memory_node(const struct kernel_info *kinfo, int 
> addrcells,
> +                                 int sizecells)
> +{
> +    const struct membanks *mem = kernel_info_get_shm_mem_const(kinfo);
> +    void *fdt = kinfo->fdt;
> +    int res = 0;
> +    /* Placeholder for reserved-memory\0 */
> +    const char resvbuf[16] = "reserved-memory";
> +
> +    if ( mem->nr_banks == 0 )
> +        /* No shared memory provided. */
> +        return 0;
> +
> +    dt_dprintk("Create reserved-memory node\n");
> +
> +    res = fdt_begin_node(fdt, resvbuf);
> +    if ( res )
> +        return res;
> +
> +    res = fdt_property(fdt, "ranges", NULL, 0);
> +    if ( res )
> +        return res;
> +
> +    res = fdt_property_cell(fdt, "#address-cells", addrcells);
> +    if ( res )
> +        return res;
> +
> +    res = fdt_property_cell(fdt, "#size-cells", sizecells);
> +    if ( res )
> +        return res;
> +
> +    res = make_shm_resv_memory_node(kinfo, addrcells, sizecells);
> +    if ( res )
> +        return res;
> +
> +    res = fdt_end_node(fdt);
> +
> +    return res;
> +}
> +
>  static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
>                                struct dt_device_node *node,
>                                p2m_type_t p2mt)
> diff --git a/xen/common/device-tree/static-shmem.c 
> b/xen/common/device-tree/static-shmem.c
> index 8023c0a484c1..7eede97fa25d 100644
> --- a/xen/common/device-tree/static-shmem.c
> +++ b/xen/common/device-tree/static-shmem.c
> @@ -730,46 +730,6 @@ int __init process_shm_node(const void *fdt, int node, 
> uint32_t address_cells,
>      return 0;
>  }
>  
> -int __init make_resv_memory_node(const struct kernel_info *kinfo, int 
> addrcells,
> -                                 int sizecells)
> -{
> -    const struct membanks *mem = kernel_info_get_shm_mem_const(kinfo);
> -    void *fdt = kinfo->fdt;
> -    int res = 0;
> -    /* Placeholder for reserved-memory\0 */
> -    const char resvbuf[16] = "reserved-memory";
> -
> -    if ( mem->nr_banks == 0 )
> -        /* No shared memory provided. */
> -        return 0;
> -
> -    dt_dprintk("Create reserved-memory node\n");
> -
> -    res = fdt_begin_node(fdt, resvbuf);
> -    if ( res )
> -        return res;
> -
> -    res = fdt_property(fdt, "ranges", NULL, 0);
> -    if ( res )
> -        return res;
> -
> -    res = fdt_property_cell(fdt, "#address-cells", addrcells);
> -    if ( res )
> -        return res;
> -
> -    res = fdt_property_cell(fdt, "#size-cells", sizecells);
> -    if ( res )
> -        return res;
> -
> -    res = make_shm_resv_memory_node(kinfo, addrcells, sizecells);
> -    if ( res )
> -        return res;
> -
> -    res = fdt_end_node(fdt);
> -
> -    return res;
> -}
> -
>  void __init early_print_info_shmem(void)
>  {
>      const struct membanks *shmem = bootinfo_get_shmem();
> diff --git a/xen/include/xen/fdt-domain-build.h 
> b/xen/include/xen/fdt-domain-build.h
> index 45981dbec0b8..e9418857e386 100644
> --- a/xen/include/xen/fdt-domain-build.h
> +++ b/xen/include/xen/fdt-domain-build.h
> @@ -25,6 +25,8 @@ int construct_domain(struct domain *d, struct kernel_info 
> *kinfo);
>  int construct_hwdom(struct kernel_info *kinfo,
>                      const struct dt_device_node *node);
>  int make_chosen_node(const struct kernel_info *kinfo);
> +int make_resv_memory_node(const struct kernel_info *kinfo,
> +                          int addrcells, int sizecells);
>  int make_cpus_node(const struct domain *d, void *fdt);
>  int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo,
>                           int addrcells, int sizecells);
> diff --git a/xen/include/xen/static-shmem.h b/xen/include/xen/static-shmem.h
> index 76a49869126c..4afa9107de5d 100644
> --- a/xen/include/xen/static-shmem.h
> +++ b/xen/include/xen/static-shmem.h
> @@ -11,9 +11,6 @@
>  /* Worst case /memory node reg element: (addrcells + sizecells) */
>  #define DT_MEM_NODE_REG_RANGE_SIZE ((NR_MEM_BANKS + NR_SHMEM_BANKS) * 4)
>  
> -int make_resv_memory_node(const struct kernel_info *kinfo, int addrcells,
> -                          int sizecells);
> -
>  int process_shm(struct domain *d, struct kernel_info *kinfo,
>                  const struct dt_device_node *node);
>  
> @@ -50,12 +47,6 @@ kernel_info_get_shm_mem_const(const struct kernel_info 
> *kinfo)
>  /* Worst case /memory node reg element: (addrcells + sizecells) */
>  #define DT_MEM_NODE_REG_RANGE_SIZE (NR_MEM_BANKS * 4)
>  
> -static inline int make_resv_memory_node(const struct kernel_info *kinfo,
> -                                        int addrcells, int sizecells)
> -{
> -    return 0;
> -}
> -
>  static inline int process_shm(struct domain *d, struct kernel_info *kinfo,
>                                const struct dt_device_node *node)
>  {
> -- 
> 2.48.1
> 

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.