]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Drivers: hv: Post messages through the confidential VMBus if available
authorRoman Kisel <romank@linux.microsoft.com>
Wed, 8 Oct 2025 23:34:10 +0000 (16:34 -0700)
committerWei Liu <wei.liu@kernel.org>
Sat, 15 Nov 2025 06:18:15 +0000 (06:18 +0000)
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>
drivers/hv/hv.c

index d380e0df63f39f2c0216ac92fe902f240ca8c48c..aca3a275bb1f922a45fe4c555e10efa144aae4be 100644 (file)
@@ -74,7 +74,11 @@ int hv_post_message(union hv_connection_id connection_id,
        aligned_msg->payload_size = payload_size;
        memcpy((void *)aligned_msg->payload, payload, payload_size);
 
-       if (ms_hyperv.paravisor_present) {
+       if (ms_hyperv.paravisor_present && !vmbus_is_confidential()) {
+               /*
+                * If the VMBus isn't confidential, use the CoCo-specific
+                * mechanism to communicate with the hypervisor.
+                */
                if (hv_isolation_type_tdx())
                        status = hv_tdx_hypercall(HVCALL_POST_MESSAGE,
                                                  virt_to_phys(aligned_msg), 0);
@@ -88,6 +92,11 @@ int hv_post_message(union hv_connection_id connection_id,
                u64 control = HVCALL_POST_MESSAGE;
 
                control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
+               /*
+                * If there is no paravisor, this will go to the hypervisor.
+                * In the Confidential VMBus case, there is the paravisor
+                * to which this will trap.
+                */
                status = hv_do_hypercall(control, aligned_msg, NULL);
        }