Commit 2d4f49b3 authored by Andrea Parri's avatar Andrea Parri Committed by Sasha Levin

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: default avatarAndrea Parri <parri.andrea@gmail.com>
Reviewed-by: default avatarWei Liu <wei.liu@kernel.org>
Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent bedc61a9
...@@ -44,7 +44,10 @@ EXPORT_SYMBOL_GPL(vmbus_proto_version); ...@@ -44,7 +44,10 @@ EXPORT_SYMBOL_GPL(vmbus_proto_version);
* Table of VMBus versions listed from newest to oldest. * Table of VMBus versions listed from newest to oldest.
*/ */
static __u32 vmbus_versions[] = { static __u32 vmbus_versions[] = {
VERSION_WIN10_V5_2,
VERSION_WIN10_V5_1,
VERSION_WIN10_V5, VERSION_WIN10_V5,
VERSION_WIN10_V4_1,
VERSION_WIN10, VERSION_WIN10,
VERSION_WIN8_1, VERSION_WIN8_1,
VERSION_WIN8, VERSION_WIN8,
...@@ -68,12 +71,12 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) ...@@ -68,12 +71,12 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version)
msg->vmbus_version_requested = version; msg->vmbus_version_requested = version;
/* /*
* VMBus protocol 5.0 (VERSION_WIN10_V5) requires that we must use * VMBus protocol 5.0 (VERSION_WIN10_V5) and higher require that we must
* VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate Contact Message, * use VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate Contact Message,
* and for subsequent messages, we must use the Message Connection ID * and for subsequent messages, we must use the Message Connection ID
* field in the host-returned Version Response Message. And, with * field in the host-returned Version Response Message. And, with
* VERSION_WIN10_V5, we don't use msg->interrupt_page, but we tell * VERSION_WIN10_V5 and higher, we don't use msg->interrupt_page, but we
* the host explicitly that we still use VMBUS_MESSAGE_SINT(2) for * tell the host explicitly that we still use VMBUS_MESSAGE_SINT(2) for
* compatibility. * compatibility.
* *
* On old hosts, we should always use VMBUS_MESSAGE_CONNECTION_ID (1). * 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) ...@@ -399,7 +402,7 @@ int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep)
case HV_STATUS_INVALID_CONNECTION_ID: case HV_STATUS_INVALID_CONNECTION_ID:
/* /*
* See vmbus_negotiate_version(): VMBus protocol 5.0 * See vmbus_negotiate_version(): VMBus protocol 5.0
* requires that we must use * and higher require that we must use
* VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate * VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate
* Contact message, but on old hosts that only * Contact message, but on old hosts that only
* support VMBus protocol 4.0 or lower, here we get * support VMBus protocol 4.0 or lower, here we get
......
...@@ -182,15 +182,21 @@ static inline u32 hv_get_avail_to_write_percent( ...@@ -182,15 +182,21 @@ static inline u32 hv_get_avail_to_write_percent(
* 2 . 4 (Windows 8) * 2 . 4 (Windows 8)
* 3 . 0 (Windows 8 R2) * 3 . 0 (Windows 8 R2)
* 4 . 0 (Windows 10) * 4 . 0 (Windows 10)
* 4 . 1 (Windows 10 RS3)
* 5 . 0 (Newer Windows 10) * 5 . 0 (Newer Windows 10)
* 5 . 1 (Windows 10 RS4)
* 5 . 2 (Windows Server 2019, RS5)
*/ */
#define VERSION_WS2008 ((0 << 16) | (13)) #define VERSION_WS2008 ((0 << 16) | (13))
#define VERSION_WIN7 ((1 << 16) | (1)) #define VERSION_WIN7 ((1 << 16) | (1))
#define VERSION_WIN8 ((2 << 16) | (4)) #define VERSION_WIN8 ((2 << 16) | (4))
#define VERSION_WIN8_1 ((3 << 16) | (0)) #define VERSION_WIN8_1 ((3 << 16) | (0))
#define VERSION_WIN10 ((4 << 16) | (0)) #define VERSION_WIN10 ((4 << 16) | (0))
#define VERSION_WIN10_V4_1 ((4 << 16) | (1))
#define VERSION_WIN10_V5 ((5 << 16) | (0)) #define VERSION_WIN10_V5 ((5 << 16) | (0))
#define VERSION_WIN10_V5_1 ((5 << 16) | (1))
#define VERSION_WIN10_V5_2 ((5 << 16) | (2))
/* Make maximum size of pipe payload of 16K */ /* Make maximum size of pipe payload of 16K */
#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment