Skip to content

Commit 2d4f49b

Browse files
andrea-parriSasha Levin
authored andcommitted
Drivers: hv: vmbus: Enable VMBus protocol versions 4.1, 5.1 and 5.2
Hyper-V has added VMBus protocol versions 5.1 and 5.2 in recent release versions. Allow Linux guests to negotiate these new protocol versions on versions of Hyper-V that support them. While on this, also allow guests to negotiate the VMBus protocol version 4.1 (which was missing). Signed-off-by: Andrea Parri <[email protected]> Reviewed-by: Wei Liu <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent bedc61a commit 2d4f49b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

drivers/hv/connection.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ EXPORT_SYMBOL_GPL(vmbus_proto_version);
4444
* Table of VMBus versions listed from newest to oldest.
4545
*/
4646
static __u32 vmbus_versions[] = {
47+
VERSION_WIN10_V5_2,
48+
VERSION_WIN10_V5_1,
4749
VERSION_WIN10_V5,
50+
VERSION_WIN10_V4_1,
4851
VERSION_WIN10,
4952
VERSION_WIN8_1,
5053
VERSION_WIN8,
@@ -68,12 +71,12 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version)
6871
msg->vmbus_version_requested = version;
6972

7073
/*
71-
* VMBus protocol 5.0 (VERSION_WIN10_V5) requires that we must use
72-
* VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate Contact Message,
74+
* VMBus protocol 5.0 (VERSION_WIN10_V5) and higher require that we must
75+
* use VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate Contact Message,
7376
* and for subsequent messages, we must use the Message Connection ID
7477
* field in the host-returned Version Response Message. And, with
75-
* VERSION_WIN10_V5, we don't use msg->interrupt_page, but we tell
76-
* the host explicitly that we still use VMBUS_MESSAGE_SINT(2) for
78+
* VERSION_WIN10_V5 and higher, we don't use msg->interrupt_page, but we
79+
* tell the host explicitly that we still use VMBUS_MESSAGE_SINT(2) for
7780
* compatibility.
7881
*
7982
* On old hosts, we should always use VMBUS_MESSAGE_CONNECTION_ID (1).
@@ -399,7 +402,7 @@ int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep)
399402
case HV_STATUS_INVALID_CONNECTION_ID:
400403
/*
401404
* See vmbus_negotiate_version(): VMBus protocol 5.0
402-
* requires that we must use
405+
* and higher require that we must use
403406
* VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate
404407
* Contact message, but on old hosts that only
405408
* support VMBus protocol 4.0 or lower, here we get

include/linux/hyperv.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,21 @@ static inline u32 hv_get_avail_to_write_percent(
182182
* 2 . 4 (Windows 8)
183183
* 3 . 0 (Windows 8 R2)
184184
* 4 . 0 (Windows 10)
185+
* 4 . 1 (Windows 10 RS3)
185186
* 5 . 0 (Newer Windows 10)
187+
* 5 . 1 (Windows 10 RS4)
188+
* 5 . 2 (Windows Server 2019, RS5)
186189
*/
187190

188191
#define VERSION_WS2008 ((0 << 16) | (13))
189192
#define VERSION_WIN7 ((1 << 16) | (1))
190193
#define VERSION_WIN8 ((2 << 16) | (4))
191194
#define VERSION_WIN8_1 ((3 << 16) | (0))
192-
#define VERSION_WIN10 ((4 << 16) | (0))
195+
#define VERSION_WIN10 ((4 << 16) | (0))
196+
#define VERSION_WIN10_V4_1 ((4 << 16) | (1))
193197
#define VERSION_WIN10_V5 ((5 << 16) | (0))
198+
#define VERSION_WIN10_V5_1 ((5 << 16) | (1))
199+
#define VERSION_WIN10_V5_2 ((5 << 16) | (2))
194200

195201
/* Make maximum size of pipe payload of 16K */
196202
#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)

0 commit comments

Comments
 (0)