From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753434AbdHJQmv (ORCPT ); Thu, 10 Aug 2017 12:42:51 -0400 Received: from terminus.zytor.com ([65.50.211.136]:36227 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbdHJQmf (ORCPT ); Thu, 10 Aug 2017 12:42:35 -0400 Date: Thu, 10 Aug 2017 09:37:56 -0700 From: tip-bot for Vitaly Kuznetsov Message-ID: Cc: peterz@infradead.org, andy.shevchenko@gmail.com, Jork.Loeser@microsoft.com, sixiao@microsoft.com, haiyangz@microsoft.com, vkuznets@redhat.com, kys@microsoft.com, mingo@kernel.org, sthemmin@microsoft.com, rostedt@goodmis.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, luto@kernel.org, torvalds@linux-foundation.org, hpa@zytor.com Reply-To: haiyangz@microsoft.com, sixiao@microsoft.com, Jork.Loeser@microsoft.com, andy.shevchenko@gmail.com, peterz@infradead.org, sthemmin@microsoft.com, mingo@kernel.org, vkuznets@redhat.com, kys@microsoft.com, rostedt@goodmis.org, hpa@zytor.com, torvalds@linux-foundation.org, luto@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org In-Reply-To: <20170802160921.21791-4-vkuznets@redhat.com> References: <20170802160921.21791-4-vkuznets@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/platform] x86/hyper-v: Introduce fast hypercall implementation Git-Commit-ID: 6a8edbd0c54ae266b12f4f63e406313481c9d4bc X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 6a8edbd0c54ae266b12f4f63e406313481c9d4bc Gitweb: http://git.kernel.org/tip/6a8edbd0c54ae266b12f4f63e406313481c9d4bc Author: Vitaly Kuznetsov AuthorDate: Wed, 2 Aug 2017 18:09:15 +0200 Committer: Ingo Molnar CommitDate: Thu, 10 Aug 2017 16:50:22 +0200 x86/hyper-v: Introduce fast hypercall implementation Hyper-V supports 'fast' hypercalls when all parameters are passed through registers. Implement an inline version of a simpliest of these calls: hypercall with one 8-byte input and no output. Signed-off-by: Vitaly Kuznetsov Reviewed-by: Andy Shevchenko Reviewed-by: Stephen Hemminger Cc: Andy Lutomirski Cc: Haiyang Zhang Cc: Jork Loeser Cc: K. Y. Srinivasan Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Simon Xiao Cc: Steven Rostedt Cc: Thomas Gleixner Cc: devel@linuxdriverproject.org Link: http://lkml.kernel.org/r/20170802160921.21791-4-vkuznets@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/mshyperv.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 6fa5e34..e484255 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -209,6 +209,40 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output) return hv_status; } +#define HV_HYPERCALL_FAST_BIT BIT(16) + +/* Fast hypercall with 8 bytes of input and no output */ +static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1) +{ + u64 hv_status, control = (u64)code | HV_HYPERCALL_FAST_BIT; + register void *__sp asm(_ASM_SP); + +#ifdef CONFIG_X86_64 + { + __asm__ __volatile__("call *%4" + : "=a" (hv_status), "+r" (__sp), + "+c" (control), "+d" (input1) + : "m" (hv_hypercall_pg) + : "cc", "r8", "r9", "r10", "r11"); + } +#else + { + u32 input1_hi = upper_32_bits(input1); + u32 input1_lo = lower_32_bits(input1); + + __asm__ __volatile__ ("call *%5" + : "=A"(hv_status), + "+c"(input1_lo), + "+r"(__sp) + : "A" (control), + "b" (input1_hi), + "m" (hv_hypercall_pg) + : "cc", "edi", "esi"); + } +#endif + return hv_status; +} + void hyperv_init(void); void hyperv_report_panic(struct pt_regs *regs); bool hv_is_hypercall_page_setup(void);