Skip to content

Commit 6523592

Browse files
Joseph Salisburyliuw
authored andcommitted
x86/hyperv: Move hv_do_rep_hypercall to asm-generic
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 <joseph.salisbury@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/1618620183-9967-1-git-send-email-joseph.salisbury@linux.microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent aa5b7d1 commit 6523592

2 files changed

Lines changed: 31 additions & 32 deletions

File tree

‎arch/x86/include/asm/mshyperv.h‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -147,38 +147,6 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
147147
return hv_status;
148148
}
149149

150-
/*
151-
* Rep hypercalls. Callers of this functions are supposed to ensure that
152-
* rep_count and varhead_size comply with Hyper-V hypercall definition.
153-
*/
154-
static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
155-
void *input, void *output)
156-
{
157-
u64 control = code;
158-
u64 status;
159-
u16 rep_comp;
160-
161-
control |= (u64)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET;
162-
control |= (u64)rep_count << HV_HYPERCALL_REP_COMP_OFFSET;
163-
164-
do {
165-
status = hv_do_hypercall(control, input, output);
166-
if ((status & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS)
167-
return status;
168-
169-
/* Bits 32-43 of status have 'Reps completed' data. */
170-
rep_comp = (status & HV_HYPERCALL_REP_COMP_MASK) >>
171-
HV_HYPERCALL_REP_COMP_OFFSET;
172-
173-
control &= ~HV_HYPERCALL_REP_START_MASK;
174-
control |= (u64)rep_comp << HV_HYPERCALL_REP_START_OFFSET;
175-
176-
touch_nmi_watchdog();
177-
} while (rep_comp < rep_count);
178-
179-
return status;
180-
}
181-
182150
extern struct hv_vp_assist_page **hv_vp_assist_page;
183151

184152
static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu)

‎include/asm-generic/mshyperv.h‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,37 @@ extern struct ms_hyperv_info ms_hyperv;
4141
extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr);
4242
extern u64 hv_do_fast_hypercall8(u16 control, u64 input8);
4343

44+
/*
45+
* Rep hypercalls. Callers of this functions are supposed to ensure that
46+
* rep_count and varhead_size comply with Hyper-V hypercall definition.
47+
*/
48+
static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
49+
void *input, void *output)
50+
{
51+
u64 control = code;
52+
u64 status;
53+
u16 rep_comp;
54+
55+
control |= (u64)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET;
56+
control |= (u64)rep_count << HV_HYPERCALL_REP_COMP_OFFSET;
57+
58+
do {
59+
status = hv_do_hypercall(control, input, output);
60+
if ((status & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS)
61+
return status;
62+
63+
/* Bits 32-43 of status have 'Reps completed' data. */
64+
rep_comp = (status & HV_HYPERCALL_REP_COMP_MASK) >>
65+
HV_HYPERCALL_REP_COMP_OFFSET;
66+
67+
control &= ~HV_HYPERCALL_REP_START_MASK;
68+
control |= (u64)rep_comp << HV_HYPERCALL_REP_START_OFFSET;
69+
70+
touch_nmi_watchdog();
71+
} while (rep_comp < rep_count);
72+
73+
return status;
74+
}
4475

4576
/* Generate the guest OS identifier as described in the Hyper-V TLFS */
4677
static inline __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version,

0 commit comments

Comments
 (0)