xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 2/7] xen/domain: Drop all DOMCRF_* constants
Date: Fri, 9 Mar 2018 13:18:37 +0000	[thread overview]
Message-ID: <1520601522-2886-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1520601522-2886-1-git-send-email-andrew.cooper3@citrix.com>

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@citrix.com>
---
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Tim Deegan <tim@xen.org>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Julien Grall <julien.grall@arm.com>
---
 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-03-09 13:18 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 13:18 [PATCH 0/7] xen: More assorted improvements to domain creation Andrew Cooper
2018-03-09 13:18 ` [PATCH 1/7] xen/domain: Drop DOMCRF_dummy Andrew Cooper
2018-03-09 14:12   ` Wei Liu
2018-03-09 16:46     ` Jan Beulich
2018-03-11 20:01   ` Julien Grall
2018-03-09 13:18 ` Andrew Cooper [this message]
2018-03-09 14:12   ` [PATCH 2/7] xen/domain: Drop all DOMCRF_* constants Wei Liu
2018-03-09 14:14     ` Andrew Cooper
2018-03-09 14:16       ` Wei Liu
2018-03-09 16:48         ` Jan Beulich
2018-03-11 20:02   ` Julien Grall
2018-03-09 13:18 ` [PATCH 3/7] RFC arm/domain: Reject invalid combinations of domain creation flags Andrew Cooper
2018-03-11 19:59   ` Julien Grall
2018-03-12 16:32     ` Wei Liu
2018-03-13 14:42       ` Julien Grall
2018-03-15 20:02         ` Andrew Cooper
2018-03-09 13:18 ` [PATCH 4/7] x86/domain: Remove unused parameters from {hvm, pv}_domain_initialise() Andrew Cooper
2018-03-09 14:13   ` Wei Liu
2018-03-09 16:49     ` Jan Beulich
2018-03-13 12:05   ` Roger Pau Monné
2018-03-15 20:09     ` Andrew Cooper
2018-03-16 10:58       ` Jan Beulich
2018-03-09 13:18 ` [PATCH 5/7] x86/domain: Optimise the order of actions in arch_domain_create() Andrew Cooper
2018-03-09 14:43   ` Wei Liu
2018-03-09 16:54   ` Jan Beulich
2018-03-15 20:15     ` Andrew Cooper
2018-03-16  7:40       ` Jan Beulich
2018-03-13 12:18   ` Roger Pau Monné
2018-03-09 13:18 ` [PATCH 6/7] xen/domain: Pass the full domctl_createdomain struct to create_domain() Andrew Cooper
2018-03-09 14:50   ` Wei Liu
2018-03-09 17:00   ` Jan Beulich
2018-03-09 17:06     ` Andrew Cooper
2018-03-12 12:57       ` Jan Beulich
2018-03-11 20:08   ` Julien Grall
2018-03-09 13:18 ` [PATCH 7/7] xen/mm: Clean up share_xen_page_with_guest() API Andrew Cooper
2018-03-09 14:53   ` Wei Liu
2018-03-11 20:29   ` Julien Grall
2018-03-13 12:28   ` Roger Pau Monné
2018-03-13 14:39     ` Jan Beulich
2018-03-15 20:25       ` Andrew Cooper
2018-03-16  7:43         ` Jan Beulich
2018-03-16  8:58           ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520601522-2886-3-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).