diff mbox series

[v2,9/9] xen/arm: enable statically shared memory on Dom0

Message ID 20220506072502.2177828-10-Penny.Zheng@arm.com (mailing list archive)
State Superseded
Headers show
Series static shared memory on dom0less system | expand

Commit Message

Penny Zheng May 6, 2022, 7:25 a.m. UTC
From: Penny Zheng <penny.zheng@arm.com>

To add statically shared memory nodes in Dom0, user shall put according
static shared memory configuration under /chosen node.

This commit adds shm-processing function process_shm in construct_dom0
to enable statically shared memory on Dom0.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
v2 change:
- no change
---
 xen/arch/arm/domain_build.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Stefano Stabellini May 7, 2022, 1:09 a.m. UTC | #1
On Fri, 6 May 2022, Penny Zheng wrote:
> From: Penny Zheng <penny.zheng@arm.com>
> 
> To add statically shared memory nodes in Dom0, user shall put according
> static shared memory configuration under /chosen node.
> 
> This commit adds shm-processing function process_shm in construct_dom0
> to enable statically shared memory on Dom0.
> 
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> v2 change:
> - no change
> ---
>  xen/arch/arm/domain_build.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index f08606d2c0..9da0a0c88b 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2628,6 +2628,11 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
>              if ( res )
>                  return res;
>          }
> +
> +        res = make_resv_memory_node(d, kinfo->fdt, addrcells, sizecells,
> +                                    d->arch.shm_mem);
> +        if ( res )
> +            return res;
>      }
>  
>      res = fdt_end_node(kinfo->fdt);
> @@ -3639,6 +3644,9 @@ static int __init construct_dom0(struct domain *d)
>  {
>      struct kernel_info kinfo = {};
>      int rc;
> +#ifdef CONFIG_STATIC_SHM
> +    const struct dt_device_node *chosen = dt_find_node_by_path("/chosen");
> +#endif
>  
>      /* Sanity! */
>      BUG_ON(d->domain_id != 0);
> @@ -3673,6 +3681,12 @@ static int __init construct_dom0(struct domain *d)
>      allocate_memory_11(d, &kinfo);
>      find_gnttab_region(d, &kinfo);
>  
> +#ifdef CONFIG_STATIC_SHM
> +    rc = process_shm(d, chosen);
> +    if ( rc < 0 )
> +        return rc;
> +#endif
> +
>      /* Map extra GIC MMIO, irqs and other hw stuffs to dom0. */
>      rc = gic_map_hwdom_extra_mappings(d);
>      if ( rc < 0 )
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index f08606d2c0..9da0a0c88b 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2628,6 +2628,11 @@  static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
             if ( res )
                 return res;
         }
+
+        res = make_resv_memory_node(d, kinfo->fdt, addrcells, sizecells,
+                                    d->arch.shm_mem);
+        if ( res )
+            return res;
     }
 
     res = fdt_end_node(kinfo->fdt);
@@ -3639,6 +3644,9 @@  static int __init construct_dom0(struct domain *d)
 {
     struct kernel_info kinfo = {};
     int rc;
+#ifdef CONFIG_STATIC_SHM
+    const struct dt_device_node *chosen = dt_find_node_by_path("/chosen");
+#endif
 
     /* Sanity! */
     BUG_ON(d->domain_id != 0);
@@ -3673,6 +3681,12 @@  static int __init construct_dom0(struct domain *d)
     allocate_memory_11(d, &kinfo);
     find_gnttab_region(d, &kinfo);
 
+#ifdef CONFIG_STATIC_SHM
+    rc = process_shm(d, chosen);
+    if ( rc < 0 )
+        return rc;
+#endif
+
     /* Map extra GIC MMIO, irqs and other hw stuffs to dom0. */
     rc = gic_map_hwdom_extra_mappings(d);
     if ( rc < 0 )