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

Re: [PATCH 04/23] xen/arm: dom0less use domid 0 for hwdom



Hi,

On 06/03/2025 22:03, Jason Andryuk wrote:
Assign domid 0 to the hwdom.  Normally, dom0less does not use domid 0.
A few years ago, we went to great length to avoid making the assumption 
that the hardware domain is domid 0. See all the calls to 
"is_hardware_domain()". So I am reluctant to force the domain ID to 0.
This fixes using the Xen console which assumes domid 0 to use the
hypercall interface.
I had a brief look at drivers/char/console.c and I can't find any place 
assuming "domid 0". Do you have any pointer?
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
  xen/arch/arm/dom0less-build.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index e539bcc762..5a7871939b 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -969,6 +969,7 @@ void __init create_domUs(void)
      dt_for_each_child_node(chosen, node)
      {
          struct domain *d;
+        domid_t domid;
          struct xen_domctl_createdomain d_cfg = {
              .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
              .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
@@ -1121,7 +1122,12 @@ void __init create_domUs(void)
           * very important to use the pre-increment operator to call
           * domain_create() with a domid > 0. (domid == 0 is reserved for Dom0)
           */
-        d = domain_create(++max_init_domid, &d_cfg, flags);
+        if ( flags & CDF_hardware )
+            domid = 0;
+        else
+            domid = ++max_init_domid;
+
+        d = domain_create(domid, &d_cfg, flags);
          if ( IS_ERR(d) )
              panic("Error creating domain %s (rc = %ld)\n",
                    dt_node_name(node), PTR_ERR(d));
Cheers,

--
Julien Grall




 


Rackspace

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