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

Drivers: hv: VMBus protocol version 6.0

The confidential VMBus is supported starting from the protocol
version 6.0 onwards.

Provide the required definitions. No functional changes.

Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
Reviewed-by: Alok Tiwari <alok.a.tiwari@oracle.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
6802d8af 92c7053b

+65 -19
+2
drivers/hv/hyperv_vmbus.h
··· 333 333 334 334 /* General vmbus interface */ 335 335 336 + bool vmbus_is_confidential(void); 337 + 336 338 struct hv_device *vmbus_device_create(const guid_t *type, 337 339 const guid_t *instance, 338 340 struct vmbus_channel *channel);
+12
drivers/hv/vmbus_drv.c
··· 57 57 int vmbus_interrupt; 58 58 59 59 /* 60 + * If the Confidential VMBus is used, the data on the "wire" is not 61 + * visible to either the host or the hypervisor. 62 + */ 63 + static bool is_confidential; 64 + 65 + bool vmbus_is_confidential(void) 66 + { 67 + return is_confidential; 68 + } 69 + EXPORT_SYMBOL_GPL(vmbus_is_confidential); 70 + 71 + /* 60 72 * The panic notifier below is responsible solely for unloading the 61 73 * vmbus connection, which is necessary in a panic event. 62 74 *
+1
include/hyperv/hvgdk_mini.h
··· 260 260 #define HYPERV_CPUID_VIRT_STACK_PROPERTIES 0x40000082 261 261 /* Support for the extended IOAPIC RTE format */ 262 262 #define HYPERV_VS_PROPERTIES_EAX_EXTENDED_IOAPIC_RTE BIT(2) 263 + #define HYPERV_VS_PROPERTIES_EAX_CONFIDENTIAL_VMBUS_AVAILABLE BIT(3) 263 264 264 265 #define HYPERV_HYPERVISOR_PRESENT_BIT 0x80000000 265 266 #define HYPERV_CPUID_MIN 0x40000005
+50 -19
include/linux/hyperv.h
··· 265 265 * Linux kernel. 266 266 */ 267 267 268 - #define VERSION_WS2008 ((0 << 16) | (13)) 269 - #define VERSION_WIN7 ((1 << 16) | (1)) 270 - #define VERSION_WIN8 ((2 << 16) | (4)) 271 - #define VERSION_WIN8_1 ((3 << 16) | (0)) 272 - #define VERSION_WIN10 ((4 << 16) | (0)) 273 - #define VERSION_WIN10_V4_1 ((4 << 16) | (1)) 274 - #define VERSION_WIN10_V5 ((5 << 16) | (0)) 275 - #define VERSION_WIN10_V5_1 ((5 << 16) | (1)) 276 - #define VERSION_WIN10_V5_2 ((5 << 16) | (2)) 277 - #define VERSION_WIN10_V5_3 ((5 << 16) | (3)) 268 + #define VMBUS_MAKE_VERSION(MAJ, MIN) ((((u32)MAJ) << 16) | (MIN)) 269 + #define VERSION_WS2008 VMBUS_MAKE_VERSION(0, 13) 270 + #define VERSION_WIN7 VMBUS_MAKE_VERSION(1, 1) 271 + #define VERSION_WIN8 VMBUS_MAKE_VERSION(2, 4) 272 + #define VERSION_WIN8_1 VMBUS_MAKE_VERSION(3, 0) 273 + #define VERSION_WIN10 VMBUS_MAKE_VERSION(4, 0) 274 + #define VERSION_WIN10_V4_1 VMBUS_MAKE_VERSION(4, 1) 275 + #define VERSION_WIN10_V5 VMBUS_MAKE_VERSION(5, 0) 276 + #define VERSION_WIN10_V5_1 VMBUS_MAKE_VERSION(5, 1) 277 + #define VERSION_WIN10_V5_2 VMBUS_MAKE_VERSION(5, 2) 278 + #define VERSION_WIN10_V5_3 VMBUS_MAKE_VERSION(5, 3) 279 + #define VERSION_WIN10_V6_0 VMBUS_MAKE_VERSION(6, 0) 278 280 279 281 /* Make maximum size of pipe payload of 16K */ 280 282 #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) ··· 337 335 } __packed; 338 336 339 337 /* Server Flags */ 340 - #define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1 341 - #define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2 342 - #define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4 343 - #define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10 344 - #define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100 345 - #define VMBUS_CHANNEL_PARENT_OFFER 0x200 346 - #define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400 347 - #define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER 0x2000 338 + #define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 0x0001 339 + /* 340 + * This flag indicates that the channel is offered by the paravisor, and must 341 + * use encrypted memory for the channel ring buffer. 342 + */ 343 + #define VMBUS_CHANNEL_CONFIDENTIAL_RING_BUFFER 0x0002 344 + /* 345 + * This flag indicates that the channel is offered by the paravisor, and must 346 + * use encrypted memory for GPA direct packets and additional GPADLs. 347 + */ 348 + #define VMBUS_CHANNEL_CONFIDENTIAL_EXTERNAL_MEMORY 0x0004 349 + #define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x0010 350 + #define VMBUS_CHANNEL_LOOPBACK_OFFER 0x0100 351 + #define VMBUS_CHANNEL_PARENT_OFFER 0x0200 352 + #define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x0400 353 + #define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER 0x2000 348 354 349 355 struct vmpacket_descriptor { 350 356 u16 type; ··· 631 621 u32 child_relid; 632 622 } __packed; 633 623 624 + /* 625 + * Used by the paravisor only, means that the encrypted ring buffers and 626 + * the encrypted external memory are supported 627 + */ 628 + #define VMBUS_FEATURE_FLAG_CONFIDENTIAL_CHANNELS 0x10 629 + 634 630 struct vmbus_channel_initiate_contact { 635 631 struct vmbus_channel_message_header header; 636 632 u32 vmbus_version_requested; ··· 646 630 struct { 647 631 u8 msg_sint; 648 632 u8 msg_vtl; 649 - u8 reserved[6]; 633 + u8 reserved[2]; 634 + u32 feature_flags; /* VMBus version 6.0 */ 650 635 }; 651 636 }; 652 637 u64 monitor_page1; ··· 1020 1003 1021 1004 /* boolean to control visibility of sysfs for ring buffer */ 1022 1005 bool ring_sysfs_visible; 1006 + /* The ring buffer is encrypted */ 1007 + bool co_ring_buffer; 1008 + /* The external memory is encrypted */ 1009 + bool co_external_memory; 1023 1010 }; 1024 1011 1025 1012 #define lock_requestor(channel, flags) \ ··· 1047 1026 u64 vmbus_request_addr_match(struct vmbus_channel *channel, u64 trans_id, 1048 1027 u64 rqst_addr); 1049 1028 u64 vmbus_request_addr(struct vmbus_channel *channel, u64 trans_id); 1029 + 1030 + static inline bool is_co_ring_buffer(const struct vmbus_channel_offer_channel *o) 1031 + { 1032 + return !!(o->offer.chn_flags & VMBUS_CHANNEL_CONFIDENTIAL_RING_BUFFER); 1033 + } 1034 + 1035 + static inline bool is_co_external_memory(const struct vmbus_channel_offer_channel *o) 1036 + { 1037 + return !!(o->offer.chn_flags & VMBUS_CHANNEL_CONFIDENTIAL_EXTERNAL_MEMORY); 1038 + } 1050 1039 1051 1040 static inline bool is_hvsock_offer(const struct vmbus_channel_offer_channel *o) 1052 1041 {