From d8f2490561eb8879f415c8eb4c7993a92bd33850 Mon Sep 17 00:00:00 2001 From: Paul Durrant Date: Tue, 30 Jul 2019 11:59:01 +0200 Subject: [PATCH] domain: stash xen_domctl_createdomain flags in struct domain MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These are canonical source of data used to set various other flags. If they are available directly in struct domain then the other flags are no longer needed. This patch simply copies the flags into a new 'options' field in struct domain. Subsequent patches will do the related clean-up work. Signed-off-by: Paul Durrant Acked-by: George Dunlap Reviewed-by: Roger Pau Monné --- xen/common/domain.c | 6 ++++-- xen/include/xen/sched.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index e8e850796e..9aefc2a680 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -331,6 +331,8 @@ struct domain *domain_create(domid_t domid, if ( (d = alloc_domain_struct()) == NULL ) return ERR_PTR(-ENOMEM); + d->options = config ? config->flags : 0; + /* Sort out our idea of is_system_domain(). */ d->domain_id = domid; @@ -352,7 +354,7 @@ struct domain *domain_create(domid_t domid, } /* Sort out our idea of is_{pv,hvm}_domain(). All system domains are PV. */ - d->guest_type = ((config && (config->flags & XEN_DOMCTL_CDF_hvm_guest)) + d->guest_type = ((d->options & XEN_DOMCTL_CDF_hvm_guest) ? guest_type_hvm : guest_type_pv); TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id); @@ -429,7 +431,7 @@ struct domain *domain_create(domid_t domid, watchdog_domain_init(d); init_status |= INIT_watchdog; - if ( config->flags & XEN_DOMCTL_CDF_xs_domain ) + if ( d->options & XEN_DOMCTL_CDF_xs_domain ) { d->is_xenstore = 1; d->disable_migrate = 1; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 9578628c6a..7f4747e154 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -357,6 +357,7 @@ struct domain unsigned int nr_pirqs; enum guest_type guest_type; + unsigned int options; /* copy of createdomain flags */ /* Is this guest dying (i.e., a zombie)? */ enum { DOMDYING_alive, DOMDYING_dying, DOMDYING_dead } is_dying; -- 2.30.2