Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932598AbdDGL1V (ORCPT ); Fri, 7 Apr 2017 07:27:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41366 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755834AbdDGL1S (ORCPT ); Fri, 7 Apr 2017 07:27:18 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F9E24AEBE Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=vkuznets@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8F9E24AEBE From: Vitaly Kuznetsov To: devel@linuxdriverproject.org, x86@kernel.org Cc: linux-kernel@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Steven Rostedt , Jork Loeser Subject: [PATCH 4/7] x86/hyperv: implement rep hypercalls Date: Fri, 7 Apr 2017 13:26:58 +0200 Message-Id: <20170407112701.17157-5-vkuznets@redhat.com> In-Reply-To: <20170407112701.17157-1-vkuznets@redhat.com> References: <20170407112701.17157-1-vkuznets@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Apr 2017 11:27:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1567 Lines: 54 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 --- arch/x86/include/asm/mshyperv.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 9a5f58b..a2c996b 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -4,6 +4,7 @@ #include #include #include +#include #include /* @@ -253,6 +254,26 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1) #endif } +static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, void *input, + void *output) +{ + union hv_hypercall_input hc_input = { .code = code, + .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