Skip to content

Commit 25059d5

Browse files
romank-msftliuw
authored andcommitted
Drivers: hv: Post messages through the confidential VMBus if available
When the confidential VMBus is available, the guest should post messages to the paravisor. Update hv_post_message() to post messages to the paravisor rather than through GHCB or TD calls. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Tianyu Lan <tiala@microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent 226494e commit 25059d5

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/hv/hv.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ int hv_post_message(union hv_connection_id connection_id,
7474
aligned_msg->payload_size = payload_size;
7575
memcpy((void *)aligned_msg->payload, payload, payload_size);
7676

77-
if (ms_hyperv.paravisor_present) {
77+
if (ms_hyperv.paravisor_present && !vmbus_is_confidential()) {
78+
/*
79+
* If the VMBus isn't confidential, use the CoCo-specific
80+
* mechanism to communicate with the hypervisor.
81+
*/
7882
if (hv_isolation_type_tdx())
7983
status = hv_tdx_hypercall(HVCALL_POST_MESSAGE,
8084
virt_to_phys(aligned_msg), 0);
@@ -88,6 +92,11 @@ int hv_post_message(union hv_connection_id connection_id,
8892
u64 control = HVCALL_POST_MESSAGE;
8993

9094
control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
95+
/*
96+
* If there is no paravisor, this will go to the hypervisor.
97+
* In the Confidential VMBus case, there is the paravisor
98+
* to which this will trap.
99+
*/
91100
status = hv_do_hypercall(control, aligned_msg, NULL);
92101
}
93102

0 commit comments

Comments
 (0)