Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1708858
| From | tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:x86/platform] x86/hyper-v: Implement rep hypercalls |
| Date | 2017-08-10 18:50 +0200 |
| Message-ID | <ucYOJ-8aT-11@gated-at.bofh.it> (permalink) |
| References | <ua4xk-3Io-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: 806c89273bab0c8af0202a6fb6279f36042cb2e6
Gitweb: http://git.kernel.org/tip/806c89273bab0c8af0202a6fb6279f36042cb2e6
Author: Vitaly Kuznetsov <vkuznets@redhat.com>
AuthorDate: Wed, 2 Aug 2017 18:09:17 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 10 Aug 2017 16:50:22 +0200
x86/hyper-v: Implement rep hypercalls
Rep hypercalls are normal hypercalls which perform multiple actions at
once. Hyper-V guarantees to return exectution to the caller in not more
than 50us and the caller needs to use hypercall continuation. Touch NMI
watchdog between hypercall invocations.
This is going to be used for HvFlushVirtualAddressList hypercall for
remote TLB flushing.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Jork Loeser <Jork.Loeser@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Simon Xiao <sixiao@microsoft.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: devel@linuxdriverproject.org
Link: http://lkml.kernel.org/r/20170802160921.21791-6-vkuznets@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/mshyperv.h | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index e484255..efa1860 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -3,6 +3,7 @@
#include <linux/types.h>
#include <linux/atomic.h>
+#include <linux/nmi.h>
#include <asm/io.h>
#include <asm/hyperv.h>
@@ -209,7 +210,13 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
return hv_status;
}
+#define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0)
#define HV_HYPERCALL_FAST_BIT BIT(16)
+#define HV_HYPERCALL_VARHEAD_OFFSET 17
+#define HV_HYPERCALL_REP_COMP_OFFSET 32
+#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32)
+#define HV_HYPERCALL_REP_START_OFFSET 48
+#define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48)
/* Fast hypercall with 8 bytes of input and no output */
static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
@@ -243,6 +250,38 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
return hv_status;
}
+/*
+ * Rep hypercalls. Callers of this functions are supposed to ensure that
+ * rep_count and varhead_size comply with Hyper-V hypercall definition.
+ */
+static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
+ void *input, void *output)
+{
+ u64 control = code;
+ u64 status;
+ u16 rep_comp;
+
+ control |= (u64)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET;
+ control |= (u64)rep_count << HV_HYPERCALL_REP_COMP_OFFSET;
+
+ do {
+ status = hv_do_hypercall(control, input, output);
+ if ((status & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS)
+ return status;
+
+ /* Bits 32-43 of status have 'Reps completed' data. */
+ rep_comp = (status & HV_HYPERCALL_REP_COMP_MASK) >>
+ HV_HYPERCALL_REP_COMP_OFFSET;
+
+ control &= ~HV_HYPERCALL_REP_START_MASK;
+ control |= (u64)rep_comp << HV_HYPERCALL_REP_START_OFFSET;
+
+ touch_nmi_watchdog();
+ } while (rep_comp < rep_count);
+
+ return status;
+}
+
void hyperv_init(void);
void hyperv_report_panic(struct pt_regs *regs);
bool hv_is_hypercall_page_setup(void);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:10 +0200
[PATCH v10 1/9] x86/hyper-v: include hyperv/ only when CONFIG_HYPERV is set Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:10 +0200
[tip:x86/platform] x86/hyper-v: Include hyperv/ only when CONFIG_HYPERV is set tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
[PATCH v10 3/9] x86/hyper-v: fast hypercall implementation Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:10 +0200
[tip:x86/platform] x86/hyper-v: Introduce fast hypercall implementation tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
[PATCH v10 7/9] x86/hyper-v: use hypercall for remote TLB flush Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
[tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
[tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 20:30 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-10 21:00 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-10 21:30 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 11:10 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-08-11 13:30 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-11 18:20 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 18:30 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-11 11:30 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 13:00 +0200
Re: [Xen-devel] [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Andrew Cooper <andrew.cooper3@citrix.com> - 2017-08-11 13:10 +0200
Re: [Xen-devel] [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 14:10 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Juergen Gross <jgross@suse.com> - 2017-08-11 14:30 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 14:40 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Juergen Gross <jgross@suse.com> - 2017-08-11 14:50 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 15:00 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Juergen Gross <jgross@suse.com> - 2017-08-11 15:10 +0200
Re: [tip:x86/platform] x86/hyper-v: Use hypercall for remote TLB flush Peter Zijlstra <peterz@infradead.org> - 2017-08-11 15:50 +0200
[PATCH v10 4/9] hyper-v: use fast hypercall for HVCALL_SIGNAL_EVENT Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
[tip:x86/platform] hyper-v: Use fast hypercall for HVCALL_SIGNAL_EVENT tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
[PATCH v10 5/9] x86/hyper-v: implement rep hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
[tip:x86/platform] x86/hyper-v: Implement rep hypercalls tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
[PATCH v10 8/9] x86/hyper-v: support extended CPU ranges for TLB flush hypercalls Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
[PATCH v10 9/9] tracing/hyper-v: trace hyperv_mmu_flush_tlb_others() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
[PATCH v10 6/9] hyper-v: globalize vp_index Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-02 18:20 +0200
[tip:x86/platform] hyper-v: Globalize vp_index tip-bot for Vitaly Kuznetsov <tipbot@zytor.com> - 2017-08-10 18:50 +0200
Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-10 14:00 +0200
Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Ingo Molnar <mingo@kernel.org> - 2017-08-10 17:20 +0200
Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-10 17:20 +0200
Re: [PATCH v10 0/9] Hyper-V: paravirtualized remote TLB flushing and hypercall improvements Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-08-10 19:10 +0200
csiph-web