Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1687348
| From | Vitaly Kuznetsov <vkuznets@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v9 04/10] x86/hyper-v: fast hypercall implementation |
| Date | 2017-07-14 14:50 +0200 |
| Message-ID | <u38cH-3uL-7@gated-at.bofh.it> (permalink) |
| References | <u38cG-3uL-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 <vkuznets@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
---
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 5f708804b00b..91c404a4c020 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -210,6 +210,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);
--
2.13.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v9 00/10] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 06/10] x86/hyper-v: implement rep hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 04/10] x86/hyper-v: fast hypercall implementation Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 09/10] x86/hyper-v: support extended CPU ranges for TLB flush hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 07/10] hyper-v: globalize vp_index Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 08/10] x86/hyper-v: use hypercall for remote TLB flush Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
Re: [PATCH v9 08/10] x86/hyper-v: use hypercall for remote TLB flush Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-15 00:00 +0200
[PATCH v9 10/10] tracing/hyper-v: trace hyperv_mmu_flush_tlb_others() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 03/10] x86/hyper-v: make hv_do_hypercall() inline Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 05/10] hyper-v: use fast hypercall for HVCALL_SIGNAL_EVENT Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 02/10] x86/hyper-v: stash the max number of virtual/logical processor Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
[PATCH v9 01/10] x86/hyper-v: include hyperv/ only when CONFIG_HYPERV is set Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-07-14 14:50 +0200
csiph-web