[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 04/17] x86: introduce is_pv_64bit_{vcpu, domain}



This is useful to rewrite the following pattern (v is PV vcpu)

   if ( is_pv_32bit_vcpu(v) )
       do_foo;
   else
       do_bar;

to

   if ( is_pv_32bit_vcpu(v) )
       do_foo;
   else if ( is_pv_64bit_vcpu(v) )
       do_bar;
   else
       ASSERT_UNREACHABLE;
.

Previously it is not possible to rely on DCE to eliminate the do_bar
part. It becomes possible with the new code structure.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/include/xen/sched.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index b32ad57..46c22f1 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -897,6 +897,16 @@ static inline bool is_pv_32bit_vcpu(const struct vcpu *v)
     return is_pv_32bit_domain(v->domain);
 }
 
+static inline bool is_pv_64bit_domain(const struct domain *d)
+{
+    return is_pv_domain(d) && !d->arch.is_32bit_pv;
+}
+
+static inline bool is_pv_64bit_vcpu(const struct vcpu *v)
+{
+    return is_pv_64bit_domain(v->domain);
+}
+
 static inline bool is_hvm_domain(const struct domain *d)
 {
     return IS_ENABLED(CONFIG_HVM) ? d->guest_type == guest_type_hvm : false;
-- 
git-series 0.9.1

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.