Drivers: hv: util: Correctly support ws2008R2 and earlier
PATCH 1/1 Drivers: hv: util: Correctly support ws2008R2 and earlier
The current code does not correctly negotiate the version numbers for the util driver when hosted on earlier hosts. The version numbers presented by this driver were not compatible with the version numbers supported by Windows Server 2008. Fix this problem.
I would like to thank Olaf Hering ([email protected]) for identifying the problem.
Signed-off-by K. Y. Srinivasan <[email protected]>
--- drivers/hv/hv_kvp.c | 38 +++++++++++++++++-------- drivers/hv/hv_snapshot.c | 6 ++-- drivers/hv/hv_util.c | 71 +++++++++++++++++++++++++++++++++++----------- include/linux/hyperv.h | 7 +++- 4 files changed, 88 insertions(+), 34 deletions(-)
drivers/hv/hv_kvp.c +26 -12
@@ -32,13 +32,17 @@/* * Pre win8 version numbers used in ws2008 and ws 2008 r2 (win7) */ +#define WS2008_SRV_MAJOR 1 +#define WS2008_SRV_MINOR 0 +#define WS2008_SRV_VERSION (WS2008_SRV_MAJOR << 16 | WS2008_SRV_MINOR) +#define WIN7_SRV_MAJOR 3#define WIN7_SRV_MINOR 0 -#define WIN7_SRV_MAJOR_MINOR (WIN7_SRV_MAJOR << 16 | WIN7_SRV_MINOR) +#define WIN7_SRV_VERSION (WIN7_SRV_MAJOR << 16 | WIN7_SRV_MINOR)#define WIN8_SRV_MAJOR 4#define WIN8_SRV_MINOR 0 -#define WIN8_SRV_MAJOR_MINOR (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR) +#define WIN8_SRV_VERSION (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR)/* * Global state maintained for transaction that is being processed.
@@ -587,6 +591,8 @@ void hv_kvp_onchannelcallback(void *context)struct icmsg_hdr *icmsghdrp;struct icmsg_negotiate *negop =NULL ; +int util_fw_version; +int kvp_srv_version;if (kvp_transaction.active) {/*
@@ -606,17 +612,26 @@ void hv_kvp_onchannelcallback(void *context)if (icmsghdrp->icmsgtype ==ICMSGTYPE_NEGOTIATE ) {/* -* We start with win8 version and if the host cannot -* support that we use the previous version. +* Based on the host, select appropriate +* framework and service versions we will +* negotiate. */ -if (vmbus_prep_negotiate_resp (icmsghdrp, negop, - recv_buffer,UTIL_FW_MAJOR_MINOR , -WIN8_SRV_MAJOR_MINOR )) - goto done; - +switch (vmbus_proto_version) { +case (VERSION_WS2008 ): + util_fw_version =UTIL_WS2K8_FW_VERSION ; + kvp_srv_version =WS2008_SRV_VERSION ; +break ; +case (VERSION_WIN7 ): + util_fw_version =UTIL_FW_VERSION ; + kvp_srv_version =WIN7_SRV_VERSION ; +break ; +default : + util_fw_version =UTIL_FW_VERSION ; + kvp_srv_version =WIN8_SRV_VERSION ; + }vmbus_prep_negotiate_resp (icmsghdrp, negop, - recv_buffer,UTIL_FW_MAJOR_MINOR , -WIN7_SRV_MAJOR_MINOR ); + recv_buffer, util_fw_version, + kvp_srv_version); }else { kvp_msg = (struct hv_kvp_msg *)&recv_buffer[
@@ -649,7 +664,6 @@ void hv_kvp_onchannelcallback(void *context)return ; } -done: icmsghdrp->icflags =ICMSGHDRFLAG_TRANSACTION |ICMSGHDRFLAG_RESPONSE ;
drivers/hv/hv_snapshot.c +3 -3
@@ -26,7 +26,7 @@#define VSS_MAJOR 5#define VSS_MINOR 0 -#define VSS_MAJOR_MINOR (VSS_MAJOR << 16 | VSS_MINOR) +#define VSS_VERSION (VSS_MAJOR << 16 | VSS_MINOR)
@@ -190,8 +190,8 @@ void hv_vss_onchannelcallback(void *context)if (icmsghdrp->icmsgtype ==ICMSGTYPE_NEGOTIATE ) {vmbus_prep_negotiate_resp (icmsghdrp, negop, - recv_buffer,UTIL_FW_MAJOR_MINOR , -VSS_MAJOR_MINOR ); + recv_buffer,UTIL_FW_VERSION , +VSS_VERSION ); }else { vss_msg = (struct hv_vss_msg *)&recv_buffer[ sizeof(struct vmbuspipe_hdr) +
drivers/hv/hv_util.c +54 -17
115 lines not on this page · raw message
include/linux/hyperv.h +5 -2
@@ -30,10 +30,13 @@/* * Framework version for util services. */ +#define UTIL_FW_MINOR 0 + +#define UTIL_WS2K8_FW_MAJOR 1 +#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)#define UTIL_FW_MAJOR 3 -#define UTIL_FW_MINOR 0 -#define UTIL_FW_MAJOR_MINOR (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR) +#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)/*
Signature · 1 line
1.7.4.1