]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
domain: remove 'guest_type' field (and enum guest_type)
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 31 Jul 2019 11:29:31 +0000 (13:29 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 31 Jul 2019 11:29:31 +0000 (13:29 +0200)
The enum guest_type was introduced in commit 6c6492780ea "pvh prep:
introduce pv guest type and has_hvm_container macros" to allow a new guest
type, distinct from either PV or HVM guest types, to be added in commit
8271d6522c6 "pvh: introduce PVH guest type". Subsequently, commit
33e5c32559e "x86: remove PVHv1 code" removed this third guest type.

This patch removes the struct domain field and enumeration as the guest
type can now be trivially determined from the 'options' field.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
Acked-by: George Dunlap <George.Dunlap@eu.citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/domain.c
xen/common/domctl.c
xen/common/kernel.c
xen/include/xen/sched.h

index 9aefc2a68094c98020bddb863b78fd82170dfa88..df523c9ce4803a7db04779f826dd6f7ce38ca41a 100644 (file)
@@ -353,10 +353,6 @@ struct domain *domain_create(domid_t domid,
         hardware_domain = d;
     }
 
-    /* Sort out our idea of is_{pv,hvm}_domain().  All system domains are PV. */
-    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);
 
     /*
index fa260ce5fb419ae2ce16c066873bc3863c3c9270..3d937434af0271a3175af6b4b9eae66389f8f67e 100644 (file)
@@ -187,17 +187,9 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
         (d->controller_pause_count > 0  ? XEN_DOMINF_paused    : 0) |
         (d->debugger_attached           ? XEN_DOMINF_debugged  : 0) |
         (d->is_xenstore                 ? XEN_DOMINF_xs_domain : 0) |
+        (is_hvm_domain(d)               ? XEN_DOMINF_hvm_guest : 0) |
         d->shutdown_code << XEN_DOMINF_shutdownshift;
 
-    switch ( d->guest_type )
-    {
-    case guest_type_hvm:
-        info->flags |= XEN_DOMINF_hvm_guest;
-        break;
-    default:
-        break;
-    }
-
     xsm_security_domaininfo(d, info);
 
     info->tot_pages         = d->tot_pages;
index 612575430f1ce7faf5bd66e7a99f1758c63fb3cb..f7628d73ce69a87c27afba064ae90b3a267a0bf5 100644 (file)
@@ -474,19 +474,14 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             fi.submap |= (1U << XENFEAT_ARM_SMCCC_supported);
 #endif
 #ifdef CONFIG_X86
-            switch ( d->guest_type )
-            {
-            case guest_type_pv:
+            if ( is_pv_domain(d) )
                 fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
                              (1U << XENFEAT_highmem_assist) |
                              (1U << XENFEAT_gnttab_map_avail_bits);
-                break;
-            case guest_type_hvm:
+            else
                 fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
                              (1U << XENFEAT_hvm_callback_vector) |
                              (has_pirq(d) ? (1U << XENFEAT_hvm_pirqs) : 0);
-                break;
-            }
 #endif
             break;
         default:
index 7f4747e15470e07d77fccebe88c1981f91a2aa7c..2e6e0d3488e677dac673dc94b1068a42167d0d26 100644 (file)
@@ -302,10 +302,6 @@ struct vm_event_domain
 
 struct evtchn_port_ops;
 
-enum guest_type {
-    guest_type_pv, guest_type_hvm
-};
-
 struct domain
 {
     domid_t          domain_id;
@@ -356,7 +352,6 @@ struct domain
     struct radix_tree_root pirq_tree;
     unsigned int     nr_pirqs;
 
-    enum guest_type guest_type;
     unsigned int     options;         /* copy of createdomain flags */
 
     /* Is this guest dying (i.e., a zombie)? */
@@ -918,8 +913,8 @@ void watchdog_domain_destroy(struct domain *d);
 
 static inline bool is_pv_domain(const struct domain *d)
 {
-    return IS_ENABLED(CONFIG_PV)
-           ? evaluate_nospec(d->guest_type == guest_type_pv) : false;
+    return IS_ENABLED(CONFIG_PV) &&
+        evaluate_nospec(!(d->options & XEN_DOMCTL_CDF_hvm_guest));
 }
 
 static inline bool is_pv_vcpu(const struct vcpu *v)
@@ -950,8 +945,8 @@ static inline bool is_pv_64bit_vcpu(const struct vcpu *v)
 #endif
 static inline bool is_hvm_domain(const struct domain *d)
 {
-    return IS_ENABLED(CONFIG_HVM)
-           ? evaluate_nospec(d->guest_type == guest_type_hvm) : false;
+    return IS_ENABLED(CONFIG_HVM) &&
+        evaluate_nospec(d->options & XEN_DOMCTL_CDF_hvm_guest);
 }
 
 static inline bool is_hvm_vcpu(const struct vcpu *v)