diff mbox series

[v2,7/9] xen/arm: set up shared memory foreign mapping for borrower domain

Message ID 20220506072502.2177828-8-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
This commit sets up shared memory foreign mapping for borrower domain.

If owner domain is the default dom_io, all shared domain are treated as
borrower domain.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
v2 change:
- remove guest_physmap_add_shm, since for borrower domain, we only
do P2M foreign memory mapping now.
---
 xen/arch/arm/domain_build.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Stefano Stabellini May 7, 2022, 1:09 a.m. UTC | #1
On Fri, 6 May 2022, Penny Zheng wrote:
> This commit sets up shared memory foreign mapping for borrower domain.
> 
> If owner domain is the default dom_io, all shared domain are treated as
> borrower domain.
> 
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>

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


> ---
> v2 change:
> - remove guest_physmap_add_shm, since for borrower domain, we only
> do P2M foreign memory mapping now.
> ---
>  xen/arch/arm/domain_build.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 089b9e99fc..8d299a3616 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -965,6 +965,16 @@ static int __init process_shm(struct domain *d,
>              if ( ret )
>                  return ret;
>          }
> +
> +        if ( owner_dom_io || (strcmp(role_str, "borrower") == 0) )
> +        {
> +            /* Set up P2M foreign mapping for borrower domain. */
> +            ret = guest_physmap_add_pages(d, _gfn(PFN_UP(gbase)),
> +                                          _mfn(PFN_UP(pbase)), PFN_DOWN(psize),
> +                                          p2m_map_foreign_rw);
> +            if ( ret )
> +                return ret;
> +        }
>      }
>  
>      return 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 089b9e99fc..8d299a3616 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -965,6 +965,16 @@  static int __init process_shm(struct domain *d,
             if ( ret )
                 return ret;
         }
+
+        if ( owner_dom_io || (strcmp(role_str, "borrower") == 0) )
+        {
+            /* Set up P2M foreign mapping for borrower domain. */
+            ret = guest_physmap_add_pages(d, _gfn(PFN_UP(gbase)),
+                                          _mfn(PFN_UP(pbase)), PFN_DOWN(psize),
+                                          p2m_map_foreign_rw);
+            if ( ret )
+                return ret;
+        }
     }
 
     return 0;