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 <nunodasneves@linux.microsoft.com>
Reviewed-by: Roman Kisel <romank@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Link: https://lore.kernel.org/r/1752261532-7225-2-git-send-email-nunodasneves@linux.microsoft.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <1752261532-7225-2-git-send-email-nunodasneves@linux.microsoft.com>
This commit is contained in:
Nuno Das Neves 2025-07-11 12:18:50 -07:00 committed by Wei Liu
parent faab52b59b
commit 36c46e64c5
3 changed files with 8 additions and 23 deletions

View File

@ -112,12 +112,6 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
return hv_status; return hv_status;
} }
/* Hypercall to the L0 hypervisor */
static inline u64 hv_do_nested_hypercall(u64 control, void *input, void *output)
{
return hv_do_hypercall(control | HV_HYPERCALL_NESTED, input, output);
}
/* Fast hypercall with 8 bytes of input and no output */ /* Fast hypercall with 8 bytes of input and no output */
static inline u64 _hv_do_fast_hypercall8(u64 control, u64 input1) static inline u64 _hv_do_fast_hypercall8(u64 control, u64 input1)
{ {
@ -165,13 +159,6 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
return _hv_do_fast_hypercall8(control, input1); return _hv_do_fast_hypercall8(control, input1);
} }
static inline u64 hv_do_fast_nested_hypercall8(u16 code, u64 input1)
{
u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
return _hv_do_fast_hypercall8(control, input1);
}
/* Fast hypercall with 16 bytes of input */ /* Fast hypercall with 16 bytes of input */
static inline u64 _hv_do_fast_hypercall16(u64 control, u64 input1, u64 input2) static inline u64 _hv_do_fast_hypercall16(u64 control, u64 input1, u64 input2)
{ {
@ -223,13 +210,6 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
return _hv_do_fast_hypercall16(control, input1, input2); return _hv_do_fast_hypercall16(control, input1, input2);
} }
static inline u64 hv_do_fast_nested_hypercall16(u16 code, u64 input1, u64 input2)
{
u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
return _hv_do_fast_hypercall16(control, input1, input2);
}
extern struct hv_vp_assist_page **hv_vp_assist_page; 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) static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu)

View File

@ -519,7 +519,10 @@ void vmbus_set_event(struct vmbus_channel *channel)
else else
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
} else { } else {
hv_do_fast_hypercall8(HVCALL_SIGNAL_EVENT, channel->sig_event); u64 control = HVCALL_SIGNAL_EVENT;
control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
hv_do_fast_hypercall8(control, channel->sig_event);
} }
} }
EXPORT_SYMBOL_GPL(vmbus_set_event); EXPORT_SYMBOL_GPL(vmbus_set_event);

View File

@ -85,8 +85,10 @@ int hv_post_message(union hv_connection_id connection_id,
else else
status = HV_STATUS_INVALID_PARAMETER; status = HV_STATUS_INVALID_PARAMETER;
} else { } else {
status = hv_do_hypercall(HVCALL_POST_MESSAGE, u64 control = HVCALL_POST_MESSAGE;
aligned_msg, NULL);
control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
status = hv_do_hypercall(control, aligned_msg, NULL);
} }
local_irq_restore(flags); local_irq_restore(flags);