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

Drivers: hv: Support confidential VMBus channels

To make use of Confidential VMBus channels, initialize the
co_ring_buffers and co_external_memory fields of the channel
structure.

Advertise support upon negotiating the version and compute
values for those fields and initialize them.

Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Roman Kisel and committed by
Wei Liu
bf35d298 51016453

+22
+19
drivers/hv/channel_mgmt.c
··· 1022 1022 struct vmbus_channel_offer_channel *offer; 1023 1023 struct vmbus_channel *oldchannel, *newchannel; 1024 1024 size_t offer_sz; 1025 + bool co_ring_buffer, co_external_memory; 1025 1026 1026 1027 offer = (struct vmbus_channel_offer_channel *)hdr; 1027 1028 ··· 1033 1032 offer->child_relid); 1034 1033 atomic_dec(&vmbus_connection.offer_in_progress); 1035 1034 return; 1035 + } 1036 + 1037 + co_ring_buffer = is_co_ring_buffer(offer); 1038 + co_external_memory = is_co_external_memory(offer); 1039 + if (!co_ring_buffer && co_external_memory) { 1040 + pr_err("Invalid offer relid=%d: the ring buffer isn't encrypted\n", 1041 + offer->child_relid); 1042 + return; 1043 + } 1044 + if (co_ring_buffer || co_external_memory) { 1045 + if (vmbus_proto_version < VERSION_WIN10_V6_0 || !vmbus_is_confidential()) { 1046 + pr_err("Invalid offer relid=%d: no support for confidential VMBus\n", 1047 + offer->child_relid); 1048 + atomic_dec(&vmbus_connection.offer_in_progress); 1049 + return; 1050 + } 1036 1051 } 1037 1052 1038 1053 oldchannel = find_primary_channel_by_offer(offer); ··· 1129 1112 pr_err("Unable to allocate channel object\n"); 1130 1113 return; 1131 1114 } 1115 + newchannel->co_ring_buffer = co_ring_buffer; 1116 + newchannel->co_external_memory = co_external_memory; 1132 1117 1133 1118 vmbus_setup_channel_state(newchannel, offer); 1134 1119
+3
drivers/hv/connection.c
··· 105 105 vmbus_connection.msg_conn_id = VMBUS_MESSAGE_CONNECTION_ID; 106 106 } 107 107 108 + if (vmbus_is_confidential() && version >= VERSION_WIN10_V6_0) 109 + msg->feature_flags = VMBUS_FEATURE_FLAG_CONFIDENTIAL_CHANNELS; 110 + 108 111 /* 109 112 * shared_gpa_boundary is zero in non-SNP VMs, so it's safe to always 110 113 * bitwise OR it