aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Mitchell <ehem+freebsd@m5p.com>2022-08-06 16:02:03 +0000
committerRoger Pau Monné <royger@FreeBSD.org>2023-11-28 12:40:19 +0000
commitc7368ccb68018c318f2320de2ff3c2b15127c8d6 (patch)
treeb5ef4948a5ca4b8bc377d6b73c4f5a652afb3179
parentd48760ffe9eaac809f8d31fb1b4e6b13ae52d59a (diff)
downloadsrc-c7368ccb68018c318f2320de2ff3c2b15127c8d6.tar.gz
src-c7368ccb68018c318f2320de2ff3c2b15127c8d6.zip
xen: remove xen_domain_type enum/variable
The vm_guest variable readily covers all uses of xen_domain_type, so merge them together. Since support for PV domains has been removed hard-core xen_pv_domain() to return false. Reviewed by: royger
-rw-r--r--sys/x86/xen/hvm.c6
-rw-r--r--sys/x86/xen/pv.c1
-rw-r--r--sys/xen/xen-os.h20
-rw-r--r--sys/xen/xen_common.c2
4 files changed, 8 insertions, 21 deletions
diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c
index 602e5396b620..e096559711a3 100644
--- a/sys/x86/xen/hvm.c
+++ b/sys/x86/xen/hvm.c
@@ -345,15 +345,13 @@ xen_hvm_init(enum xen_hvm_init_type init_type)
return;
/*
- * If xen_domain_type is not set at this point
+ * If the Xen domain type is not set at this point
* it means we are inside a (PV)HVM guest, because
* for PVH the guest type is set much earlier
* (see hammer_time_xen).
*/
- if (!xen_domain()) {
- xen_domain_type = XEN_HVM_DOMAIN;
+ if (!xen_domain())
vm_guest = VM_GUEST_XEN;
- }
setup_xen_features();
#ifdef SMP
diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c
index c9537d153820..9ea276caee81 100644
--- a/sys/x86/xen/pv.c
+++ b/sys/x86/xen/pv.c
@@ -165,7 +165,6 @@ hammer_time_xen(vm_paddr_t start_info_paddr)
int rc;
if (isxen()) {
- xen_domain_type = XEN_HVM_DOMAIN;
vm_guest = VM_GUEST_XEN;
rc = xen_hvm_init_hypercall_stubs(XEN_HVM_INIT_EARLY);
if (rc) {
diff --git a/sys/xen/xen-os.h b/sys/xen/xen-os.h
index 2cb45d5d438b..d009b1af11fa 100644
--- a/sys/xen/xen-os.h
+++ b/sys/xen/xen-os.h
@@ -79,30 +79,22 @@ extern shared_info_t *HYPERVISOR_shared_info;
extern bool xen_suspend_cancelled;
-enum xen_domain_type {
- XEN_NATIVE, /* running on bare hardware */
- XEN_PV_DOMAIN, /* running in a PV domain */
- XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
-};
-
-extern enum xen_domain_type xen_domain_type;
-
-static inline int
+static inline bool
xen_domain(void)
{
- return (xen_domain_type != XEN_NATIVE);
+ return (vm_guest == VM_GUEST_XEN);
}
-static inline int
+static inline bool
xen_pv_domain(void)
{
- return (xen_domain_type == XEN_PV_DOMAIN);
+ return (false);
}
-static inline int
+static inline bool
xen_hvm_domain(void)
{
- return (xen_domain_type == XEN_HVM_DOMAIN);
+ return (vm_guest == VM_GUEST_XEN);
}
static inline bool
diff --git a/sys/xen/xen_common.c b/sys/xen/xen_common.c
index ae70a721477a..025f52cceee6 100644
--- a/sys/xen/xen_common.c
+++ b/sys/xen/xen_common.c
@@ -41,8 +41,6 @@
#include <contrib/xen/vcpu.h>
/*-------------------------------- Global Data -------------------------------*/
-enum xen_domain_type xen_domain_type = XEN_NATIVE;
-
/**
* Start info flags. ATM this only used to store the initial domain flag for
* PVHv2, and it's always empty for HVM guests.