Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796353130; b=yJ6mh6oLIU9zq5txIZd2j6SjPzKisxRQ4k9yIjoYOESvvb1F6y4gPtHJ82ZHtuhRQoqa hyGz1auBNrtXBGXaLyzTib89mQT+M9zrg6ocL3iLWB08DUOneU2+6vlBL8XWI1rnVBDMo jkuuTJNmKyXMvTYiQX9RwnvceZkd7ZMfhFHt90PHq8LAtYJHDiyUmEm7VYlO5XAwIjeKb L5jAnUvpehoHRYOEIUVv16Dabjr1FryxanrLBSgsFlsk5oUf1YtX4AmHGQcp4ZMjJwy2a Rvvsg7EIMcHwg22uXfA7J36wKnsOmP07kc6Civ8/xcsBg1aML8HUzVstOesqLwwRxLw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796353130; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=WDVv6io2Fl6hPgW96o2Th/e+SqQJwmmgbDMll8hDvYs=; b=5Wu588tBrB7GUOadkX/h1GN5Fag7xtdx8ficMfRfSCUwCHCBLG/bKSKPdRbp5H2hAwKr XpZDgDqvx2TGX524DrZAmKLgBMAsEE1ysJg8572g1HZf9u0Cne+IHgDjtf8DZEUp7VDjh ynRvl9ABHo/awBuEZYjpzDzb4bklIQrJzlGbHGaF6oyGHNjPMYgHxvCnuEq98biKjd8nD +w3f3fYbRhnC3Mbm4CsfG5nTSsIY6e8GdaX3JZ7uXqpG4r7GmeUjlWwfLiZttHWGL/cjc MQgqwgck+TYPwkRZWWmGgLOHzij7hvTDJSBbdWq/FQtNXURflxTqI8mVvqbT/LqLW5Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=UqtXsPAX; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96940606A685; Fri, 4 Dec 2026 02:58:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 96940606A685 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=UqtXsPAX Received: from mrdev.corp.microsoft.com (192-184-212-33.fiber.dynamic.sonic.net [192.184.212.33]) by linux.microsoft.com (Postfix) with ESMTPSA id D60F520B7167; Thu, 3 Dec 2026 18:58:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D60F520B7167 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1796353128; bh=WDVv6io2Fl6hPgW96o2Th/e+SqQJwmmgbDMll8hDvYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UqtXsPAXWMpYfWCuV3j5gVDmmmOaCXm3EzsLBYuUTscPIMf6XuRqnSaPV9nehsA9Z xv5p6ANAgtcGx1yFldTI1Ov7nHqwDZ0G/N8HFjCuGaIRmqVq9FkEHFm6+S/7CexH6N OOssm9kPRvCxDTDui0NBMiZpGNvZctr5Ux+oL3Fw= From: Mukesh R To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, mhkelley58@gmail.com, kameroncarr@linux.microsoft.com Subject: [PATCH 2/3] Drivers: hv: Create REP_COUNT define Date: Thu, 3 Dec 2026 18:58:35 -0800 Message-ID: <20261204025836.3855312-3-mrathor@linux.microsoft.com> X-Mailer: git-send-email 2.51.2.vfs.0.1 In-Reply-To: <20261204025836.3855312-1-mrathor@linux.microsoft.com> References: <20261204025836.3855312-1-mrathor@linux.microsoft.com> X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When a repeat hypercall completes, it returns completions as part of the status in bits 43-32, and HV_HYPERCALL_REP_COMP_MASK is used to extract and examine it. When issuing a hypercall, the actual repeat count is part of the input struct at same bits. However, the same COMP_MASK is used to set it. This maybe confusing for anyone reading the code. Add HV_HYPERCALL_REP_COUNT_MASK and use it for counts instead of REP_COMP. Signed-off-by: Mukesh R --- arch/x86/kvm/hyperv.c | 2 +- include/asm-generic/mshyperv.h | 2 +- include/hyperv/hvgdk_mini.h | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 5d2e3617c952..ce40bb48016b 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -2579,7 +2579,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) hc.code = hc.param & 0xffff; hc.var_cnt = (hc.param & HV_HYPERCALL_VARHEAD_MASK) >> HV_HYPERCALL_VARHEAD_OFFSET; hc.fast = !!(hc.param & HV_HYPERCALL_FAST_BIT); - hc.rep_cnt = (hc.param >> HV_HYPERCALL_REP_COMP_OFFSET) & 0xfff; + hc.rep_cnt = (hc.param >> HV_HYPERCALL_REP_COUNT_OFFSET) & 0xfff; hc.rep_idx = (hc.param >> HV_HYPERCALL_REP_START_OFFSET) & 0xfff; hc.rep = !!(hc.rep_cnt || hc.rep_idx); diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index b9157ac8731c..9d4b4d1cdac3 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -143,7 +143,7 @@ static inline u64 hv_do_rep_hypercall_ex(u16 code, u16 rep_count, u16 rep_comp; control |= (u64)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET; - control |= (u64)rep_count << HV_HYPERCALL_REP_COMP_OFFSET; + control |= (u64)rep_count << HV_HYPERCALL_REP_COUNT_OFFSET; control |= (u64)rep_start << HV_HYPERCALL_REP_START_OFFSET; do { diff --git a/include/hyperv/hvgdk_mini.h b/include/hyperv/hvgdk_mini.h index bec4e633e381..160d0813e598 100644 --- a/include/hyperv/hvgdk_mini.h +++ b/include/hyperv/hvgdk_mini.h @@ -521,9 +521,9 @@ union hv_vp_assist_msr_contents { /* HV_REGISTER_VP_ASSIST_PAGE */ #define HV_HYPERCALL_VARHEAD_MASK GENMASK_ULL(26, 17) #define HV_HYPERCALL_RSVD0_MASK GENMASK_ULL(31, 27) #define HV_HYPERCALL_NESTED BIT_ULL(31) -#define HV_HYPERCALL_REP_COMP_OFFSET 32 #define HV_HYPERCALL_REP_COMP_1 BIT_ULL(32) -#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32) +#define HV_HYPERCALL_REP_COUNT_OFFSET 32 +#define HV_HYPERCALL_REP_COUNT_MASK GENMASK_ULL(43, 32) #define HV_HYPERCALL_RSVD1_MASK GENMASK_ULL(47, 44) #define HV_HYPERCALL_REP_START_OFFSET 48 #define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48) @@ -532,6 +532,10 @@ union hv_vp_assist_msr_contents { /* HV_REGISTER_VP_ASSIST_PAGE */ HV_HYPERCALL_RSVD1_MASK | \ HV_HYPERCALL_RSVD2_MASK) +/* Hypercall output status */ +#define HV_HYPERCALL_REP_COMP_OFFSET 32 +#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32) + /* HvFlushGuestPhysicalAddressSpace hypercalls */ struct hv_guest_mapping_flush { u64 address_space; -- 2.51.2.vfs.0.1