All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Durrant <paul.durrant@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.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>,
	Paul Durrant <paul.durrant@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [Xen-devel] [PATCH 2/6] domain: remove 'guest_type' field (and enum guest_type)
Date: Tue, 23 Jul 2019 17:06:05 +0100	[thread overview]
Message-ID: <20190723160609.2177-3-paul.durrant@citrix.com> (raw)
In-Reply-To: <20190723160609.2177-1-paul.durrant@citrix.com>

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 'createflags' field.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: 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: Julien Grall <julien.grall@arm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wl@xen.org>
---
 xen/common/domain.c     |  4 ----
 xen/common/domctl.c     | 10 +---------
 xen/common/kernel.c     |  9 ++-------
 xen/include/xen/sched.h | 14 ++++----------
 4 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index d559c8898e..6f405d2541 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -355,10 +355,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->createflags & XEN_DOMCTL_CDF_hvm_guest)
-                     ? guest_type_hvm : guest_type_pv);
-
     TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id);
 
     /*
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 72a44953d0..ef6714c0aa 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -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;
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 612575430f..f7628d73ce 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -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:
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index edae372c2b..9a98857237 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -302,10 +302,6 @@ struct vm_event_domain
 
 struct evtchn_port_ops;
 
-enum guest_type {
-    guest_type_pv, guest_type_hvm
-};
-
 struct domain
 {
     unsigned int     createflags;
@@ -357,8 +353,6 @@ struct domain
     struct radix_tree_root pirq_tree;
     unsigned int     nr_pirqs;
 
-    enum guest_type guest_type;
-
     /* Is this guest dying (i.e., a zombie)? */
     enum { DOMDYING_alive, DOMDYING_dying, DOMDYING_dead } is_dying;
 
@@ -918,8 +912,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->createflags & XEN_DOMCTL_CDF_hvm_guest);
 }
 
 static inline bool is_pv_vcpu(const struct vcpu *v)
@@ -950,8 +944,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->createflags & XEN_DOMCTL_CDF_hvm_guest);
 }
 
 static inline bool is_hvm_vcpu(const struct vcpu *v)
-- 
2.20.1.2.gb21ebb671


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

  parent reply	other threads:[~2019-07-23 16:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 16:06 [Xen-devel] [PATCH 0/6] stash domain create flags and then use them Paul Durrant
2019-07-23 16:06 ` [Xen-devel] [PATCH 1/6] domain: stash xen_domctl_createdomain flags in struct domain Paul Durrant
2019-07-25  9:22   ` Roger Pau Monné
2019-07-25 10:11     ` Paul Durrant
2019-07-25 10:24       ` Jan Beulich
2019-07-25 11:24         ` Paul Durrant
2019-07-23 16:06 ` Paul Durrant [this message]
2019-07-25  9:30   ` [Xen-devel] [PATCH 2/6] domain: remove 'guest_type' field (and enum guest_type) Roger Pau Monné
2019-07-23 16:06 ` [Xen-devel] [PATCH 3/6] x86/hvm/domain: remove the 'hap_enabled' flag Paul Durrant
2019-07-25  9:44   ` Roger Pau Monné
2019-07-25 10:07     ` Paul Durrant
2019-07-25 12:48       ` Paul Durrant
2019-07-23 16:06 ` [Xen-devel] [PATCH 4/6] x86/domain: remove the 'oos_off' flag Paul Durrant
2019-07-24 17:44   ` Tim Deegan
2019-07-25 10:16     ` Paul Durrant
2019-07-23 16:06 ` [Xen-devel] [PATCH 5/6] domain: remove the 'is_xenstore' flag Paul Durrant
2019-07-25  9:47   ` Roger Pau Monné
2019-07-25 10:08     ` Paul Durrant
2019-07-23 16:06 ` [Xen-devel] [PATCH 6/6] x86/domain: remove the 's3_integrity' flag Paul Durrant
2019-07-25  9:48   ` Roger Pau Monné

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=20190723160609.2177-3-paul.durrant@citrix.com \
    --to=paul.durrant@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.