lkml.org 
[lkml]   [2017]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 06/10] x86/hyper-v: implement rep hypercalls
Date
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>
---
Changes since v1:
- add variable header size
---
arch/x86/include/asm/mshyperv.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 7b9b404..3a0b3f8 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/clocksource.h>
+#include <linux/nmi.h>
#include <asm/hyperv.h>

/*
@@ -255,6 +256,31 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
#endif
}

+/*
+ * Rep hypercalls. Callers of this functions are supposed to ensure that
+ * rep_count and vahead_size comply with union hv_hypercall_input definition.
+ */
+static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
+ void *input, void *output)
+{
+ union hv_hypercall_input hc_input = { .code = code,
+ .varhead_size = varhead_size,
+ .rep_count = rep_count};
+ u64 status;
+
+ do {
+ status = hv_do_hypercall(hc_input.as_uint64, input, output);
+ if ((status & 0xffff) != HV_STATUS_SUCCESS)
+ return status;
+
+ hc_input.rep_start = (status >> 32) & 0xfff;
+
+ touch_nmi_watchdog();
+ } while (hc_input.rep_start < hc_input.rep_count);
+
+ return status;
+}
+
void hyperv_init(void);
void hyperv_report_panic(struct pt_regs *regs);
bool hv_is_hypercall_page_setup(void);
--
2.9.3
\
 
 \ /
  Last update: 2017-04-12 12:46    [W:0.077 / U:24.548 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site