toggle_guest_mode() is only ever being called for 64-bit PV vCPU-s - replace the 32-bit PV conditional by an ASSERT().
Introduce a local helper without 32-bit PV conditional, to be used by both pre-existing functions. Signed-off-by: Jan Beulich <jbeul...@suse.com> --- a/xen/arch/x86/pv/domain.c +++ b/xen/arch/x86/pv/domain.c @@ -220,28 +220,8 @@ int pv_domain_initialise(struct domain * return rc; } -void toggle_guest_mode(struct vcpu *v) -{ - if ( is_pv_32bit_vcpu(v) ) - return; - - if ( cpu_has_fsgsbase ) - { - if ( v->arch.flags & TF_kernel_mode ) - v->arch.pv_vcpu.gs_base_kernel = __rdgsbase(); - else - v->arch.pv_vcpu.gs_base_user = __rdgsbase(); - } - asm volatile ( "swapgs" ); - - toggle_guest_pt(v); -} - -void toggle_guest_pt(struct vcpu *v) +static void _toggle_guest_pt(struct vcpu *v) { - if ( is_pv_32bit_vcpu(v) ) - return; - v->arch.flags ^= TF_kernel_mode; update_cr3(v); /* Don't flush user global mappings from the TLB. Don't tick TLB clock. */ @@ -260,6 +240,28 @@ void toggle_guest_pt(struct vcpu *v) v->arch.pv_vcpu.pending_system_time.version = 0; } +void toggle_guest_mode(struct vcpu *v) +{ + ASSERT(!is_pv_32bit_vcpu(v)); + + if ( cpu_has_fsgsbase ) + { + if ( v->arch.flags & TF_kernel_mode ) + v->arch.pv_vcpu.gs_base_kernel = __rdgsbase(); + else + v->arch.pv_vcpu.gs_base_user = __rdgsbase(); + } + asm volatile ( "swapgs" ); + + _toggle_guest_pt(v); +} + +void toggle_guest_pt(struct vcpu *v) +{ + if ( !is_pv_32bit_vcpu(v) ) + _toggle_guest_pt(v); +} + /* * Local variables: * mode: C _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel