> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Friday, April 7, 2017 04:27
> To: de...@linuxdriverproject.org; x...@kernel.org
> Cc: linux-ker...@vger.kernel.org; KY Srinivasan <k...@microsoft.com>;
> Haiyang Zhang <haiya...@microsoft.com>; Stephen Hemminger
> <sthem...@microsoft.com>; Thomas Gleixner <t...@linutronix.de>; Ingo
> Molnar <mi...@redhat.com>; H. Peter Anvin <h...@zytor.com>; Steven
> Rostedt <rost...@goodmis.org>; Jork Loeser <jork.loe...@microsoft.com>
> 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
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to