git: c7368ccb6801 - main - xen: remove xen_domain_type enum/variable
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 Nov 2023 13:38:41 UTC
The branch main has been updated by royger:
URL: https://cgit.FreeBSD.org/src/commit/?id=c7368ccb68018c318f2320de2ff3c2b15127c8d6
commit c7368ccb68018c318f2320de2ff3c2b15127c8d6
Author: Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2022-08-06 16:02:03 +0000
Commit: Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2023-11-28 12:40:19 +0000
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
---
sys/x86/xen/hvm.c | 6 ++----
sys/x86/xen/pv.c | 1 -
sys/xen/xen-os.h | 20 ++++++--------------
sys/xen/xen_common.c | 2 --
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.