Re: [patch V4 part 5 05/31] x86/entry: Switch XEN/PV hypercall entry to IDTENTRY

From: Boris Ostrovsky
Date: Wed May 06 2020 - 22:15:16 EST



On 5/5/20 9:53 AM, Thomas Gleixner wrote:
> --- a/arch/x86/xen/setup.c
> +++ b/arch/x86/xen/setup.c
> @@ -20,6 +20,7 @@
> #include <asm/setup.h>
> #include <asm/acpi.h>
> #include <asm/numa.h>
> +#include <asm/idtentry.h>
> #include <asm/xen/hypervisor.h>
> #include <asm/xen/hypercall.h>
>
> @@ -993,7 +994,8 @@ static void __init xen_pvmmu_arch_setup(
> HYPERVISOR_vm_assist(VMASST_CMD_enable,
> VMASST_TYPE_pae_extended_cr3);
>
> - if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) ||
> + if (register_callback(CALLBACKTYPE_event,
> + asm_exc_xen_hypervisor_callback) ||


This ...


> register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback))
> BUG();
>
> --- a/arch/x86/xen/smp_pv.c
> +++ b/arch/x86/xen/smp_pv.c
> @@ -27,6 +27,7 @@
> #include <asm/paravirt.h>
> #include <asm/desc.h>
> #include <asm/pgtable.h>
> +#include <asm/idtentry.h>
> #include <asm/cpu.h>
>
> #include <xen/interface/xen.h>
> @@ -347,7 +348,7 @@ cpu_initialize_context(unsigned int cpu,
> ctxt->gs_base_kernel = per_cpu_offset(cpu);
> #endif
> ctxt->event_callback_eip =
> - (unsigned long)xen_hypervisor_callback;
> + (unsigned long)asm_exc_xen_hypervisor_callback;


... and this should be xen_asm_exc_xen_hypervisor_callback (we need to
pop %rcx and %r11).


And then Xen PV guest boots.


-boris


> ctxt->failsafe_callback_eip =
> (unsigned long)xen_failsafe_callback;
> per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir);