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

[PATCH v10 3/3] xen/domain: use get_initial_domain_id() instead of open-coded 0



From: Denis Mukhin <dmukhin@xxxxxxxx>

Remove the open-coded domain ID 0 and replace it with a call to
get_initial_domain_id().

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
Changes since v9:
- new patch
---
 xen/arch/arm/domain_build.c | 4 ++--
 xen/common/domain.c         | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b59b56636920..b525d78c608f 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2074,9 +2074,9 @@ void __init create_dom0(void)
     if ( !llc_coloring_enabled )
         flags |= CDF_directmap;
 
-    domid = domid_alloc(0);
+    domid = domid_alloc(get_initial_domain_id());
     if ( domid == DOMID_INVALID )
-        panic("Error allocating domain ID 0\n");
+        panic("Error allocating domain ID %d\n", get_initial_domain_id());
 
     dom0 = domain_create(domid, &dom0_cfg, flags);
     if ( IS_ERR(dom0) )
diff --git a/xen/common/domain.c b/xen/common/domain.c
index be022c720b13..27575b4610e3 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -492,7 +492,7 @@ static int late_hwdom_init(struct domain *d)
     struct domain *dom0;
     int rv;
 
-    if ( d != hardware_domain || d->domain_id == 0 )
+    if ( d != hardware_domain || d->domain_id == get_initial_domain_id() )
         return 0;
 
     rv = xsm_init_hardware_domain(XSM_HOOK, d);
@@ -501,7 +501,7 @@ static int late_hwdom_init(struct domain *d)
 
     printk("Initialising hardware domain %d\n", hardware_domid);
 
-    dom0 = rcu_lock_domain_by_id(0);
+    dom0 = rcu_lock_domain_by_id(get_initial_domain_id());
     ASSERT(dom0 != NULL);
     /*
      * Hardware resource ranges for domain 0 have been set up from
@@ -2479,7 +2479,7 @@ domid_t domid_alloc(domid_t domid)
         if ( domid == DOMID_FIRST_RESERVED )
             domid = find_next_zero_bit(domid_bitmap,
                                        DOMID_FIRST_RESERVED,
-                                       1);
+                                       get_initial_domain_id() + 1);
 #endif
 
         if ( domid < DOMID_FIRST_RESERVED )
-- 
2.34.1





 


Rackspace

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