x86/hvm: determine shared info format earlier
PATCH 1/1 x86/hvm: determine shared info format earlier
Latch guest shared info format when hypercall page is being set up rather than during an arbitrarily selected hypercall.
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/hvm/hvm.c +11 -4
@@ -836,6 +836,15 @@ void hvm_update_guest_cr3(struct vcpu *vvoid hvm_hypercall_page_initialise (struct domain *d,void *hypercall_page) { +#ifdef __x86_64__ +/* +* Since this operation is one of the very first executed by PV drivers +* on initialisation or after save/restore, it is a sensible point at +* which to sample the execution mode of the guest and latch 32- or 64- +* bit format for shared state. +*/ + d->arch.has_32bit_shinfo = (hvm_guest_x86_mode (current) !=8 ); +#endif hvm_funcs.init_hypercall_page (d, hypercall_page); }
@@ -1066,10 +1075,8 @@ long do_hvm_op(unsigned long op, XEN_GUEcase HVM_PARAM_CALLBACK_IRQ :hvm_set_callback_via (d, a.value);/* -* Since this operation is one of the very first executed -* by PV drivers on initialisation or after save/restore, it -* is a sensible point at which to sample the execution mode of -* the guest and latch 32- or 64-bit format for shared state. +* For compatibility with older PV drivers, also latch guest +* execution mode here. */ d->arch.has_32bit_shinfo = (hvm_guest_x86_mode (current) !=8 );break ;
Quoted 4 lines · Jan Beulich
Latch guest shared info format when hypercall page is being set up rather than during an arbitrarily selected hypercall.
Signed-off-by Jan Beulich <[email protected]>
I like having the latch at the current place because it will work with (yes, slightly broken) older PV drivers which do not re-init the hypercall page after save/restore, but which *do* re-init the callback-irq value.
I'd be happy to have the latch in *both* places though -- would this appease you?
-- Keir