> -----Original Message----- > From: Vitaly Kuznetsov [mailto:vkuznets@xxxxxxxxxx] > Sent: Friday, April 7, 2017 04:27 > To: devel@xxxxxxxxxxxxxxxxxxxxxx; x86@xxxxxxxxxx > Cc: linux-kernel@xxxxxxxxxxxxxxx; KY Srinivasan <kys@xxxxxxxxxxxxx>; > Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>; Stephen Hemminger > <sthemmin@xxxxxxxxxxxxx>; Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Ingo > Molnar <mingo@xxxxxxxxxx>; H. Peter Anvin <hpa@xxxxxxxxx>; Steven > Rostedt <rostedt@xxxxxxxxxxx>; Jork Loeser <Jork.Loeser@xxxxxxxxxxxxx> > Subject: [PATCH 1/7] x86/hyperv: make hv_do_hypercall() inline > diff --git a/arch/x86/include/asm/mshyperv.h > b/arch/x86/include/asm/mshyperv.h index 7c9c895..331e834 100644 > --- a/arch/x86/include/asm/mshyperv.h > +++ b/arch/x86/include/asm/mshyperv.h > @@ -170,6 +170,51 @@ void hv_remove_crash_handler(void); > > #if IS_ENABLED(CONFIG_HYPERV) > extern struct clocksource *hyperv_cs; > +extern void *hv_hypercall_pg; > + > +static inline u64 hv_do_hypercall(u64 control, void *input, void > +*output) { > + u64 input_address = (input) ? virt_to_phys(input) : 0; > + u64 output_address = (output) ? virt_to_phys(output) : 0; #ifdef > +CONFIG_X86_64 > + u64 hv_status; > + > + if (!hv_hypercall_pg) > + return (u64)ULLONG_MAX; > + > + __asm__ __volatile__("mov %3, %%r8\n" > + "call *%4" > + : "=a" (hv_status) > + : "c" (control), "d" (input_address), > + "r" (output_address), "m" (hv_hypercall_pg) > + : "cc", "r8", "%r9", "%r10", "%r11"); Is clobbering memory required here? > + > + return hv_status; > + > +#else > + u32 control_hi = control >> 32; > + u32 control_lo = control & 0xFFFFFFFF; > + u32 hv_status_hi; > + u32 hv_status_lo; > + u32 input_address_hi = input_address >> 32; > + u32 input_address_lo = input_address & 0xFFFFFFFF; > + u32 output_address_hi = output_address >> 32; > + u32 output_address_lo = output_address & 0xFFFFFFFF; > + > + if (!hv_hypercall_pg) > + return (u64)ULLONG_MAX; > + > + __asm__ __volatile__ ("call *%8" > + : "=d"(hv_status_hi), "=a"(hv_status_lo) > + : "d" (control_hi), "a" (control_lo), > + "b" (input_address_hi), "c" > (input_address_lo), > + "D"(output_address_hi), > "S"(output_address_lo), > + "m" (hv_hypercall_pg) > + : "cc"); Please clobber ecx register for x86 path as well, e.g. by passing as output w/ "+". Please also clobber memory. _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel