Skip to content

Commit 36c46e6

Browse files
NunoDasNevesliuw
authored andcommitted
Drivers: hv: Use nested hypercall for post message and signal event
When running nested, these hypercalls must be sent to the L0 hypervisor or VMBus will fail. Remove hv_do_nested_hypercall() and hv_do_fast_nested_hypercall8() altogether and open-code these cases, since there are only 2 and all they do is add the nested bit. Signed-off-by: Nuno Das Neves <[email protected]> Reviewed-by: Roman Kisel <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Link: https://lore.kernel.org/r/1752261532-7225-2-git-send-email-nunodasneves@linux.microsoft.com Signed-off-by: Wei Liu <[email protected]> Message-ID: <1752261532-7225-2-git-send-email-nunodasneves@linux.microsoft.com>
1 parent faab52b commit 36c46e6

File tree

3 files changed

+8
-23
lines changed

3 files changed

+8
-23
lines changed

arch/x86/include/asm/mshyperv.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
112112
return hv_status;
113113
}
114114

115-
/* Hypercall to the L0 hypervisor */
116-
static inline u64 hv_do_nested_hypercall(u64 control, void *input, void *output)
117-
{
118-
return hv_do_hypercall(control | HV_HYPERCALL_NESTED, input, output);
119-
}
120-
121115
/* Fast hypercall with 8 bytes of input and no output */
122116
static inline u64 _hv_do_fast_hypercall8(u64 control, u64 input1)
123117
{
@@ -165,13 +159,6 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
165159
return _hv_do_fast_hypercall8(control, input1);
166160
}
167161

168-
static inline u64 hv_do_fast_nested_hypercall8(u16 code, u64 input1)
169-
{
170-
u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
171-
172-
return _hv_do_fast_hypercall8(control, input1);
173-
}
174-
175162
/* Fast hypercall with 16 bytes of input */
176163
static inline u64 _hv_do_fast_hypercall16(u64 control, u64 input1, u64 input2)
177164
{
@@ -223,13 +210,6 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
223210
return _hv_do_fast_hypercall16(control, input1, input2);
224211
}
225212

226-
static inline u64 hv_do_fast_nested_hypercall16(u16 code, u64 input1, u64 input2)
227-
{
228-
u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
229-
230-
return _hv_do_fast_hypercall16(control, input1, input2);
231-
}
232-
233213
extern struct hv_vp_assist_page **hv_vp_assist_page;
234214

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

drivers/hv/connection.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,10 @@ void vmbus_set_event(struct vmbus_channel *channel)
519519
else
520520
WARN_ON_ONCE(1);
521521
} else {
522-
hv_do_fast_hypercall8(HVCALL_SIGNAL_EVENT, channel->sig_event);
522+
u64 control = HVCALL_SIGNAL_EVENT;
523+
524+
control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
525+
hv_do_fast_hypercall8(control, channel->sig_event);
523526
}
524527
}
525528
EXPORT_SYMBOL_GPL(vmbus_set_event);

drivers/hv/hv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ int hv_post_message(union hv_connection_id connection_id,
8585
else
8686
status = HV_STATUS_INVALID_PARAMETER;
8787
} else {
88-
status = hv_do_hypercall(HVCALL_POST_MESSAGE,
89-
aligned_msg, NULL);
88+
u64 control = HVCALL_POST_MESSAGE;
89+
90+
control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
91+
status = hv_do_hypercall(control, aligned_msg, NULL);
9092
}
9193

9294
local_irq_restore(flags);

0 commit comments

Comments
 (0)