]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86: introduce is_pv_64bit_{vcpu,domain}
authorWei Liu <wei.liu2@citrix.com>
Thu, 4 Oct 2018 15:43:23 +0000 (16:43 +0100)
committerWei Liu <wei.liu2@citrix.com>
Mon, 15 Oct 2018 14:23:44 +0000 (15:23 +0100)
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@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/sched.h

index 4b2380536749acd24459176a4a27a9d48e0f4a8a..3171eabfd692293e8405967780bd7b6a4ad633e9 100644 (file)
@@ -893,8 +893,17 @@ static inline bool is_pv_32bit_vcpu(const struct vcpu *v)
 {
     return is_pv_32bit_domain(v->domain);
 }
-#endif
 
+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);
+}
+#endif
 static inline bool is_hvm_domain(const struct domain *d)
 {
     return IS_ENABLED(CONFIG_HVM) ? d->guest_type == guest_type_hvm : false;