Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp741006pxb; Fri, 16 Apr 2021 17:44:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp7U3HW9Ao02uH9OtaOrAgKXB9Zq1sZrFggAXwpAOtoh5fohOAjPfsPFL7B3bJR0m4FSgt X-Received: by 2002:a17:906:a19a:: with SMTP id s26mr10858063ejy.51.1618620284104; Fri, 16 Apr 2021 17:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618620284; cv=none; d=google.com; s=arc-20160816; b=vq7tmHGjB0pk9/qYWNv9z+gZ1pnxdFgP0xQeji1ZqFPPb5PSh80S0Owt8iQrbJ+bGT T6m8gNTHReBBPlYonhBdqzdqfFwKbMHKufFXP+fan5PbNzw+EQGto4faPAPzcaPfoW2V g4BJS0qcQiFXyaNWeky7z78YQ1A6EDeSOiViABXptg6OU3RewauT6rElXxNwG+0MmOWA Qbmu2zSHTdZ3+4tfGtNVgtotZgTsymi9gt5FV4zbKw1GVSIEtcrlWRAC4UVpVpP+wpYi mtvp79AmALPZpSgyiWSL31wdAYau9HyjnknH2i60tHyP17+gWiV99BYf36s9L69ABuAf cMnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=lDwr9oolzxrISbVZdtLhlzKS8cfB+ST2jdq14dk3uqQ=; b=VCytTz1uY5rRPRJ3/FvE7WjnxCEsy9M4uSOAfqk260K6Ki+hps8CByfF2gJZJ2/65u Yd/pJHi050TzneeiH1fdNk+Y7UfGL6BuOk6YsdT8wjZcG8bpvIY+KgMnWuptdP/zDuTN iQS2KJ/wXCKh8GzwZjFoj7ZWcP+6eOWRDfEqXL/bahr9PJEiYGgTN9AZOz7ntJBc+DBa H08smLaNBfQ+mr+rW9ZFCrOJk5qGTqsN/zjXuvBYnt+W05y5k52fxvyhZC7iI0NAEUGE NoSTsaP9rF8m4KyJ1xA25n39ukXVyh6FEmE4ftTo1lyaGH5C+52yU+2vAB1SFrHYMUdE VgCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=VooojyDf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si5986729eja.14.2021.04.16.17.44.21; Fri, 16 Apr 2021 17:44:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=VooojyDf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235188AbhDQAni (ORCPT + 99 others); Fri, 16 Apr 2021 20:43:38 -0400 Received: from linux.microsoft.com ([13.77.154.182]:55694 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbhDQAng (ORCPT ); Fri, 16 Apr 2021 20:43:36 -0400 Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id D4D7120B8001; Fri, 16 Apr 2021 17:43:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D4D7120B8001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1618620190; bh=lDwr9oolzxrISbVZdtLhlzKS8cfB+ST2jdq14dk3uqQ=; h=From:To:Cc:Subject:Date:Reply-To:From; b=VooojyDfneJQ6sQr2+vSaN7EWg27hEY4WqKW1jlNPFa/orSDBYiGd/ONw4ZkeW98m qNBMnoUv07NNq/6uiDZYX+74AhPrZ/yikvf/O95ufUF8V79k/cf6OyNU+c3/7eLiZZ crHwj4kxTJA3ksdelE5Lf1bGnFveBIO7RFn4cDyg= From: Joseph Salisbury To: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, mikelley@microsoft.com Cc: x86@kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, joseph.salisbury@microsoft.com Subject: [PATCH 1/2] x86/hyperv: Move hv_do_rep_hypercall to asm-generic Date: Fri, 16 Apr 2021 17:43:02 -0700 Message-Id: <1618620183-9967-1-git-send-email-joseph.salisbury@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 Reply-To: joseph.salisbury@microsoft.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joseph Salisbury This patch makes no functional changes. It simply moves hv_do_rep_hypercall() out of arch/x86/include/asm/mshyperv.h and into asm-generic/mshyperv.h hv_do_rep_hypercall() is architecture independent, so it makes sense that it should be in the architecture independent mshyperv.h, not in the x86-specific mshyperv.h. This is done in preperation for a follow up patch which creates a consistent pattern for checking Hyper-V hypercall status. Signed-off-by: Joseph Salisbury --- arch/x86/include/asm/mshyperv.h | 32 -------------------------------- include/asm-generic/mshyperv.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index ccf60a809a17..bfc98b490f07 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -189,38 +189,6 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2) 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; -} - extern struct hv_vp_assist_page **hv_vp_assist_page; static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu) diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index dff58a3db5d5..a5246a6ea02d 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -41,6 +41,37 @@ extern struct ms_hyperv_info ms_hyperv; extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr); extern u64 hv_do_fast_hypercall8(u16 control, u64 input8); +/* + * 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; +} /* Generate the guest OS identifier as described in the Hyper-V TLFS */ static inline __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version, -- 2.17.1