Discussion:
[Xen-changelog] [xen master] x86: turn is_pv_{, 32bit_}{domain, vcpu} into inline functions
p***@xen.org
2018-11-04 04:57:46 UTC
Permalink
commit d87dd1bd6c1099398cdfce18e448088488bf6ca8
Author: Wei Liu <***@citrix.com>
AuthorDate: Thu Oct 4 16:43:22 2018 +0100
Commit: Wei Liu <***@citrix.com>
CommitDate: Mon Oct 15 15:23:36 2018 +0100

x86: turn is_pv_{,32bit_}{domain,vcpu} into inline functions

And make them work with CONFIG_PV.

Signed-off-by: Wei Liu <***@citrix.com>
Reviewed-by: Jan Beulich <***@suse.com>
---
xen/include/asm-x86/domain.h | 2 --
xen/include/xen/sched.h | 23 +++++++++++++++++++++--
2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index cb0721e9d5..e7b82279e7 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -13,8 +13,6 @@
#include <public/hvm/hvm_info_table.h>

#define has_32bit_shinfo(d) ((d)->arch.has_32bit_shinfo)
-#define is_pv_32bit_domain(d) ((d)->arch.is_32bit_pv)
-#define is_pv_32bit_vcpu(v) (is_pv_32bit_domain((v)->domain))

#define is_hvm_pv_evtchn_domain(d) (is_hvm_domain(d) && \
(d)->arch.hvm.irq->callback_via_type == HVMIRQ_callback_vector)
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 0ddff03a30..4b23805367 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -873,8 +873,27 @@ void watchdog_domain_destroy(struct domain *d);

#define VM_ASSIST(d, t) (test_bit(VMASST_TYPE_ ## t, &(d)->vm_assist))

-#define is_pv_domain(d) ((d)->guest_type == guest_type_pv)
-#define is_pv_vcpu(v) (is_pv_domain((v)->domain))
+static inline bool is_pv_domain(const struct domain *d)
+{
+ return IS_ENABLED(CONFIG_PV) ? d->guest_type == guest_type_pv : false;
+}
+
+static inline bool is_pv_vcpu(const struct vcpu *v)
+{
+ return is_pv_domain(v->domain);
+}
+
+#ifdef CONFIG_COMPAT
+static inline bool is_pv_32bit_domain(const struct domain *d)
+{
+ return is_pv_domain(d) && d->arch.is_32bit_pv;
+}
+
+static inline bool is_pv_32bit_vcpu(const struct vcpu *v)
+{
+ return is_pv_32bit_domain(v->domain);
+}
+#endif

static inline bool is_hvm_domain(const struct domain *d)
{
--
generated by git-patchbot for /home/xen/git/xen.git#master

Loading...