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

[Xen-changelog] [xen staging] x86: introduce is_pv_64bit_{vcpu, domain}



commit e386c47882ecc23c14aa895d2702f10bde878b55
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Thu Oct 4 16:43:23 2018 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Mon Oct 15 15:23:44 2018 +0100

    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>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/xen/sched.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 4b23805367..3171eabfd6 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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