aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2013-05-23 15:02:32 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-03 17:09:14 -0400
commite68d2971d26577b932a16333ce165af98a96e068 (patch)
tree641b8143d41993366c4d0d0b6546a1695acba83b /include
parent8d7bda51888d14c07cbebacc5a10be776477bb63 (diff)
Drivers: hv: vmbus: Implement multi-channel support
Starting with Win8, the host supports multiple sub-channels for a given device. As in the past, the initial channel offer specifies the device and is associated with both the type and the instance GUIDs. For performance critical devices, the host may support multiple sub-channels. The sub-channels share the same type and instance GUID as the primary channel. The number of sub-channels offerrred to the guest depends on the number of virtual CPUs assigned to the guest. The guest can request the creation of these sub-channels and once created and opened, the guest can distribute the traffic across all the channels (the primary and the sub-channels). A request sent on a sub-channel will have the response delivered on the same sub-channel. At channel (sub-channel) creation we bind the channel interrupt to a CPU and with this sub-channel support we will be able to spread the interrupt load of a given device across all available CPUs. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/hyperv.h62
1 files changed, 61 insertions, 1 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index c2559847d7ee..405e05a28e65 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -909,6 +909,7 @@ enum vmbus_channel_state {
909 CHANNEL_OFFER_STATE, 909 CHANNEL_OFFER_STATE,
910 CHANNEL_OPENING_STATE, 910 CHANNEL_OPENING_STATE,
911 CHANNEL_OPEN_STATE, 911 CHANNEL_OPEN_STATE,
912 CHANNEL_OPENED_STATE,
912}; 913};
913 914
914struct vmbus_channel_debug_info { 915struct vmbus_channel_debug_info {
@@ -1046,6 +1047,38 @@ struct vmbus_channel {
1046 * preserve the earlier behavior. 1047 * preserve the earlier behavior.
1047 */ 1048 */
1048 u32 target_vp; 1049 u32 target_vp;
1050 /*
1051 * Support for sub-channels. For high performance devices,
1052 * it will be useful to have multiple sub-channels to support
1053 * a scalable communication infrastructure with the host.
1054 * The support for sub-channels is implemented as an extention
1055 * to the current infrastructure.
1056 * The initial offer is considered the primary channel and this
1057 * offer message will indicate if the host supports sub-channels.
1058 * The guest is free to ask for sub-channels to be offerred and can
1059 * open these sub-channels as a normal "primary" channel. However,
1060 * all sub-channels will have the same type and instance guids as the
1061 * primary channel. Requests sent on a given channel will result in a
1062 * response on the same channel.
1063 */
1064
1065 /*
1066 * Sub-channel creation callback. This callback will be called in
1067 * process context when a sub-channel offer is received from the host.
1068 * The guest can open the sub-channel in the context of this callback.
1069 */
1070 void (*sc_creation_callback)(struct vmbus_channel *new_sc);
1071
1072 spinlock_t sc_lock;
1073 /*
1074 * All Sub-channels of a primary channel are linked here.
1075 */
1076 struct list_head sc_list;
1077 /*
1078 * The primary channel this sub-channel belongs to.
1079 * This will be NULL for the primary channel.
1080 */
1081 struct vmbus_channel *primary_channel;
1049}; 1082};
1050 1083
1051static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 1084static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
@@ -1057,6 +1090,34 @@ void vmbus_onmessage(void *context);
1057 1090
1058int vmbus_request_offers(void); 1091int vmbus_request_offers(void);
1059 1092
1093/*
1094 * APIs for managing sub-channels.
1095 */
1096
1097void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
1098 void (*sc_cr_cb)(struct vmbus_channel *new_sc));
1099
1100/*
1101 * Retrieve the (sub) channel on which to send an outgoing request.
1102 * When a primary channel has multiple sub-channels, we choose a
1103 * channel whose VCPU binding is closest to the VCPU on which
1104 * this call is being made.
1105 */
1106struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary);
1107
1108/*
1109 * Check if sub-channels have already been offerred. This API will be useful
1110 * when the driver is unloaded after establishing sub-channels. In this case,
1111 * when the driver is re-loaded, the driver would have to check if the
1112 * subchannels have already been established before attempting to request
1113 * the creation of sub-channels.
1114 * This function returns TRUE to indicate that subchannels have already been
1115 * created.
1116 * This function should be invoked after setting the callback function for
1117 * sub-channel creation.
1118 */
1119bool vmbus_are_subchannels_present(struct vmbus_channel *primary);
1120
1060/* The format must be the same as struct vmdata_gpa_direct */ 1121/* The format must be the same as struct vmdata_gpa_direct */
1061struct vmbus_channel_packet_page_buffer { 1122struct vmbus_channel_packet_page_buffer {
1062 u16 type; 1123 u16 type;
@@ -1327,7 +1388,6 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1327 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \ 1388 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \
1328 } 1389 }
1329 1390
1330
1331/* 1391/*
1332 * Common header for Hyper-V ICs 1392 * Common header for Hyper-V ICs
1333 */ 1393 */