diff mbox series

[v3,5/7] tools/init-dom0less: Only seed legacy xenstore grants

Message ID 20250403214608.152954-6-jason.andryuk@amd.com (mailing list archive)
State Superseded
Headers show
Series ARM split hardware and control domains | expand

Commit Message

Jason Andryuk April 3, 2025, 9:46 p.m. UTC
The hardware domain is unable to seed a control domain, but we want the
control domain to use xenstore.  Rely on the hypervisor to seed dom0less
grant table entries for Xenstore, so this seeding is unnecessary.

However, that only works for the new xenstore late init.  The legacy
protocol which uses init-dom0less to populate the page still needs to
seed the grant.

Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/helpers/init-dom0less.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Stefano Stabellini April 4, 2025, 1:22 a.m. UTC | #1
On Thu, 3 Apr 2025, Jason Andryuk wrote:
> The hardware domain is unable to seed a control domain, but we want the
> control domain to use xenstore.  Rely on the hypervisor to seed dom0less
> grant table entries for Xenstore, so this seeding is unnecessary.
> 
> However, that only works for the new xenstore late init.  The legacy
> protocol which uses init-dom0less to populate the page still needs to
> seed the grant.
> 
> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>

I was thinking whether it is an issue that we change behavior of
init-dom0less for the new protocol. I convinced myself it is not an
issue because init-dom0less is supposed to be a matched set with the Xen
hypervisor version. I also thought whether we could check if the call to
xc_dom_gnttab_seed is needed and only do it if it is, so that
init-dom0less.c could be less depedent on the specific Xen behavior.

Overall I thought it is not worth it, so:

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

> ---
>  tools/helpers/init-dom0less.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
> index 17579fe2e8..91edf17b6c 100644
> --- a/tools/helpers/init-dom0less.c
> +++ b/tools/helpers/init-dom0less.c
> @@ -286,12 +286,12 @@ static int init_domain(struct xs_handle *xsh,
>                  xenstore_pfn);
>          if (rc < 0)
>              return rc;
> -    }
>  
> -    rc = xc_dom_gnttab_seed(xch, info->domid, true,
> -                            (xen_pfn_t)-1, xenstore_pfn, 0, 0);
> -    if (rc)
> -        err(1, "xc_dom_gnttab_seed");
> +        rc = xc_dom_gnttab_seed(xch, info->domid, true,
> +                                (xen_pfn_t)-1, xenstore_pfn, 0, 0);
> +        if (rc)
> +               err(1, "xc_dom_gnttab_seed");
> +    }
>  
>      libxl_uuid_generate(&uuid);
>      xc_domain_sethandle(xch, info->domid, libxl_uuid_bytearray(&uuid));
> -- 
> 2.49.0
> 
>
diff mbox series

Patch

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index 17579fe2e8..91edf17b6c 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -286,12 +286,12 @@  static int init_domain(struct xs_handle *xsh,
                 xenstore_pfn);
         if (rc < 0)
             return rc;
-    }
 
-    rc = xc_dom_gnttab_seed(xch, info->domid, true,
-                            (xen_pfn_t)-1, xenstore_pfn, 0, 0);
-    if (rc)
-        err(1, "xc_dom_gnttab_seed");
+        rc = xc_dom_gnttab_seed(xch, info->domid, true,
+                                (xen_pfn_t)-1, xenstore_pfn, 0, 0);
+        if (rc)
+               err(1, "xc_dom_gnttab_seed");
+    }
 
     libxl_uuid_generate(&uuid);
     xc_domain_sethandle(xch, info->domid, libxl_uuid_bytearray(&uuid));