From: Wei Liu Date: Thu, 4 Oct 2018 15:43:23 +0000 (+0100) Subject: x86: introduce is_pv_64bit_{vcpu,domain} X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~3132 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e386c47882ecc23c14aa895d2702f10bde878b55;p=xen.git 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 Acked-by: Jan Beulich --- 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;