Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Nuno Das Neves and committed by
Wei Liu
36c46e64 faab52b5

+8 -23
-20
arch/x86/include/asm/mshyperv.h
··· 112 112 return hv_status; 113 113 } 114 114 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 - 121 115 /* Fast hypercall with 8 bytes of input and no output */ 122 116 static inline u64 _hv_do_fast_hypercall8(u64 control, u64 input1) 123 117 { ··· 155 161 static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1) 156 162 { 157 163 u64 control = (u64)code | HV_HYPERCALL_FAST_BIT; 158 - 159 - return _hv_do_fast_hypercall8(control, input1); 160 - } 161 - 162 - static inline u64 hv_do_fast_nested_hypercall8(u16 code, u64 input1) 163 - { 164 - u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED; 165 164 166 165 return _hv_do_fast_hypercall8(control, input1); 167 166 } ··· 206 219 static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2) 207 220 { 208 221 u64 control = (u64)code | HV_HYPERCALL_FAST_BIT; 209 - 210 - return _hv_do_fast_hypercall16(control, input1, input2); 211 - } 212 - 213 - static inline u64 hv_do_fast_nested_hypercall16(u16 code, u64 input1, u64 input2) 214 - { 215 - u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED; 216 222 217 223 return _hv_do_fast_hypercall16(control, input1, input2); 218 224 }
+4 -1
drivers/hv/connection.c
··· 519 519 else 520 520 WARN_ON_ONCE(1); 521 521 } 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); 523 526 } 524 527 } 525 528 EXPORT_SYMBOL_GPL(vmbus_set_event);
+4 -2
drivers/hv/hv.c
··· 85 85 else 86 86 status = HV_STATUS_INVALID_PARAMETER; 87 87 } 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); 90 92 } 91 93 92 94 local_irq_restore(flags);