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

[Xen-devel] [PATCH 2/7] xen/domain: Drop all DOMCRF_* constants



With DOMCRF_dummy removed, all remaining DOMCRF_* idenitcally match their
DOMCTL counterparts.  Avoid having a conversion between two different bit
layouts, and use the DOMCTL_CDF_* constants everywhere.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
CC: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
---
 xen/arch/x86/domain.c           |  4 ++--
 xen/arch/x86/mm/shadow/common.c |  2 +-
 xen/arch/x86/setup.c            |  6 +++---
 xen/common/domain.c             |  4 ++--
 xen/common/domctl.c             | 16 ++--------------
 xen/include/xen/sched.h         | 16 ----------------
 6 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 69679a6..36555ea 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -435,7 +435,7 @@ int arch_domain_create(struct domain *d, unsigned int 
domcr_flags,
     if ( config == NULL && !is_idle_domain(d) )
         return -EINVAL;
 
-    d->arch.s3_integrity = !!(domcr_flags & DOMCRF_s3_integrity);
+    d->arch.s3_integrity = domcr_flags & XEN_DOMCTL_CDF_s3_integrity;
 
     INIT_LIST_HEAD(&d->arch.pdev_list);
 
@@ -497,7 +497,7 @@ int arch_domain_create(struct domain *d, unsigned int 
domcr_flags,
         /* Need to determine if HAP is enabled before initialising paging */
         if ( is_hvm_domain(d) )
             d->arch.hvm_domain.hap_enabled =
-                hvm_funcs.hap_supported && (domcr_flags & DOMCRF_hap);
+                hvm_funcs.hap_supported && (domcr_flags & XEN_DOMCTL_CDF_hap);
 
         if ( (rc = paging_domain_init(d, domcr_flags)) != 0 )
             goto fail;
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 20ded3e..1cf7b28 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -62,7 +62,7 @@ int shadow_domain_init(struct domain *d, unsigned int 
domcr_flags)
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
     d->arch.paging.shadow.oos_active = 0;
-    d->arch.paging.shadow.oos_off = (domcr_flags & DOMCRF_oos_off) ?  1 : 0;
+    d->arch.paging.shadow.oos_off = domcr_flags & XEN_DOMCTL_CDF_oos_off;
 #endif
     d->arch.paging.shadow.pagetable_dying_op = 0;
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ac530ec..a6dc5df 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -660,7 +660,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 {
     char *memmap_type = NULL;
     char *cmdline, *kextra, *loader;
-    unsigned int initrdidx, domcr_flags = DOMCRF_s3_integrity;
+    unsigned int initrdidx, domcr_flags = XEN_DOMCTL_CDF_s3_integrity;
     multiboot_info_t *mbi;
     module_t *mod;
     unsigned long nr_pages, raw_max_page, modules_headroom, *module_map;
@@ -1632,9 +1632,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     if ( dom0_pvh )
     {
-        domcr_flags |= DOMCRF_hvm |
+        domcr_flags |= XEN_DOMCTL_CDF_hvm_guest |
                        ((hvm_funcs.hap_supported && !opt_dom0_shadow) ?
-                         DOMCRF_hap : 0);
+                         XEN_DOMCTL_CDF_hap : 0);
         config.emulation_flags = XEN_X86_EMU_LAPIC|XEN_X86_EMU_IOAPIC;
     }
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index cd39a58..582e3e5 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -304,7 +304,7 @@ struct domain *domain_create(domid_t domid, unsigned int 
domcr_flags,
     if ( !zalloc_cpumask_var(&d->dirty_cpumask) )
         goto fail;
 
-    if ( domcr_flags & DOMCRF_hvm )
+    if ( domcr_flags & XEN_DOMCTL_CDF_hvm_guest )
         d->guest_type = guest_type_hvm;
     else
         d->guest_type = guest_type_pv;
@@ -331,7 +331,7 @@ struct domain *domain_create(domid_t domid, unsigned int 
domcr_flags,
             hardware_domain = d;
         }
 
-        if ( domcr_flags & DOMCRF_xs_domain )
+        if ( domcr_flags & XEN_DOMCTL_CDF_xs_domain )
         {
             d->is_xenstore = 1;
             d->disable_migrate = 1;
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 50f7422..a73e1a4 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -498,7 +498,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
     {
         domid_t        dom;
         static domid_t rover = 0;
-        unsigned int domcr_flags;
 
         ret = -EINVAL;
         if ( (op->u.createdomain.flags &
@@ -533,19 +532,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
             rover = dom;
         }
 
-        domcr_flags = 0;
-        if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hvm_guest )
-            domcr_flags |= DOMCRF_hvm;
-        if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hap )
-            domcr_flags |= DOMCRF_hap;
-        if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_s3_integrity )
-            domcr_flags |= DOMCRF_s3_integrity;
-        if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_oos_off )
-            domcr_flags |= DOMCRF_oos_off;
-        if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_xs_domain )
-            domcr_flags |= DOMCRF_xs_domain;
-
-        d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref,
+        d = domain_create(dom, op->u.createdomain.flags,
+                          op->u.createdomain.ssidref,
                           &op->u.createdomain.config);
         if ( IS_ERR(d) )
         {
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index aa5729b..9af78ac 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -542,22 +542,6 @@ void domain_update_node_affinity(struct domain *d);
 struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
                              uint32_t ssidref,
                              struct xen_arch_domainconfig *config);
- /* DOMCRF_hvm: Create an HVM domain, as opposed to a PV domain. */
-#define _DOMCRF_hvm           0
-#define DOMCRF_hvm            (1U<<_DOMCRF_hvm)
- /* DOMCRF_hap: Create a domain with hardware-assisted paging. */
-#define _DOMCRF_hap           1
-#define DOMCRF_hap            (1U<<_DOMCRF_hap)
- /* DOMCRF_s3_integrity: Create a domain with tboot memory integrity protection
-                        by tboot */
-#define _DOMCRF_s3_integrity  2
-#define DOMCRF_s3_integrity   (1U<<_DOMCRF_s3_integrity)
- /* DOMCRF_oos_off: dont use out-of-sync optimization for shadow page tables */
-#define _DOMCRF_oos_off         4
-#define DOMCRF_oos_off          (1U<<_DOMCRF_oos_off)
- /* DOMCRF_xs_domain: xenstore domain */
-#define _DOMCRF_xs_domain       5
-#define DOMCRF_xs_domain        (1U<<_DOMCRF_xs_domain)
 
 /*
  * rcu_lock_domain_by_id() is more efficient than get_domain_by_id().
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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