aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hyperv.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hyperv.h')
-rw-r--r--include/linux/hyperv.h101
1 files changed, 90 insertions, 11 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 68ed7f7e1fc9..e73b852156b1 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -122,12 +122,53 @@
122#define REG_U32 4 122#define REG_U32 4
123#define REG_U64 8 123#define REG_U64 8
124 124
125/*
126 * As we look at expanding the KVP functionality to include
127 * IP injection functionality, we need to maintain binary
128 * compatibility with older daemons.
129 *
130 * The KVP opcodes are defined by the host and it was unfortunate
131 * that I chose to treat the registration operation as part of the
132 * KVP operations defined by the host.
133 * Here is the level of compatibility
134 * (between the user level daemon and the kernel KVP driver) that we
135 * will implement:
136 *
137 * An older daemon will always be supported on a newer driver.
138 * A given user level daemon will require a minimal version of the
139 * kernel driver.
140 * If we cannot handle the version differences, we will fail gracefully
141 * (this can happen when we have a user level daemon that is more
142 * advanced than the KVP driver.
143 *
144 * We will use values used in this handshake for determining if we have
145 * workable user level daemon and the kernel driver. We begin by taking the
146 * registration opcode out of the KVP opcode namespace. We will however,
147 * maintain compatibility with the existing user-level daemon code.
148 */
149
150/*
151 * Daemon code not supporting IP injection (legacy daemon).
152 */
153
154#define KVP_OP_REGISTER 4
155
156/*
157 * Daemon code supporting IP injection.
158 * The KVP opcode field is used to communicate the
159 * registration information; so define a namespace that
160 * will be distinct from the host defined KVP opcode.
161 */
162
163#define KVP_OP_REGISTER1 100
164
125enum hv_kvp_exchg_op { 165enum hv_kvp_exchg_op {
126 KVP_OP_GET = 0, 166 KVP_OP_GET = 0,
127 KVP_OP_SET, 167 KVP_OP_SET,
128 KVP_OP_DELETE, 168 KVP_OP_DELETE,
129 KVP_OP_ENUMERATE, 169 KVP_OP_ENUMERATE,
130 KVP_OP_REGISTER, 170 KVP_OP_GET_IP_INFO,
171 KVP_OP_SET_IP_INFO,
131 KVP_OP_COUNT /* Number of operations, must be last. */ 172 KVP_OP_COUNT /* Number of operations, must be last. */
132}; 173};
133 174
@@ -140,6 +181,39 @@ enum hv_kvp_exchg_pool {
140 KVP_POOL_COUNT /* Number of pools, must be last. */ 181 KVP_POOL_COUNT /* Number of pools, must be last. */
141}; 182};
142 183
184/*
185 * Some Hyper-V status codes.
186 */
187
188#define HV_S_OK 0x00000000
189#define HV_E_FAIL 0x80004005
190#define HV_S_CONT 0x80070103
191#define HV_ERROR_NOT_SUPPORTED 0x80070032
192#define HV_ERROR_MACHINE_LOCKED 0x800704F7
193#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F
194#define HV_INVALIDARG 0x80070057
195#define HV_GUID_NOTFOUND 0x80041002
196
197#define ADDR_FAMILY_NONE 0x00
198#define ADDR_FAMILY_IPV4 0x01
199#define ADDR_FAMILY_IPV6 0x02
200
201#define MAX_ADAPTER_ID_SIZE 128
202#define MAX_IP_ADDR_SIZE 1024
203#define MAX_GATEWAY_SIZE 512
204
205
206struct hv_kvp_ipaddr_value {
207 __u16 adapter_id[MAX_ADAPTER_ID_SIZE];
208 __u8 addr_family;
209 __u8 dhcp_enabled;
210 __u16 ip_addr[MAX_IP_ADDR_SIZE];
211 __u16 sub_net[MAX_IP_ADDR_SIZE];
212 __u16 gate_way[MAX_GATEWAY_SIZE];
213 __u16 dns_addr[MAX_IP_ADDR_SIZE];
214} __attribute__((packed));
215
216
143struct hv_kvp_hdr { 217struct hv_kvp_hdr {
144 __u8 operation; 218 __u8 operation;
145 __u8 pool; 219 __u8 pool;
@@ -181,16 +255,26 @@ struct hv_kvp_register {
181}; 255};
182 256
183struct hv_kvp_msg { 257struct hv_kvp_msg {
184 struct hv_kvp_hdr kvp_hdr; 258 union {
259 struct hv_kvp_hdr kvp_hdr;
260 int error;
261 };
185 union { 262 union {
186 struct hv_kvp_msg_get kvp_get; 263 struct hv_kvp_msg_get kvp_get;
187 struct hv_kvp_msg_set kvp_set; 264 struct hv_kvp_msg_set kvp_set;
188 struct hv_kvp_msg_delete kvp_delete; 265 struct hv_kvp_msg_delete kvp_delete;
189 struct hv_kvp_msg_enumerate kvp_enum_data; 266 struct hv_kvp_msg_enumerate kvp_enum_data;
267 struct hv_kvp_ipaddr_value kvp_ip_val;
190 struct hv_kvp_register kvp_register; 268 struct hv_kvp_register kvp_register;
191 } body; 269 } body;
192} __attribute__((packed)); 270} __attribute__((packed));
193 271
272struct hv_kvp_ip_msg {
273 __u8 operation;
274 __u8 pool;
275 struct hv_kvp_ipaddr_value kvp_ip_val;
276} __attribute__((packed));
277
194#ifdef __KERNEL__ 278#ifdef __KERNEL__
195#include <linux/scatterlist.h> 279#include <linux/scatterlist.h>
196#include <linux/list.h> 280#include <linux/list.h>
@@ -405,7 +489,7 @@ struct vmtransfer_page_range {
405struct vmtransfer_page_packet_header { 489struct vmtransfer_page_packet_header {
406 struct vmpacket_descriptor d; 490 struct vmpacket_descriptor d;
407 u16 xfer_pageset_id; 491 u16 xfer_pageset_id;
408 bool sender_owns_set; 492 u8 sender_owns_set;
409 u8 reserved; 493 u8 reserved;
410 u32 range_cnt; 494 u32 range_cnt;
411 struct vmtransfer_page_range ranges[1]; 495 struct vmtransfer_page_range ranges[1];
@@ -559,7 +643,7 @@ struct vmbus_channel_query_vmbus_version {
559/* VMBus Version Supported parameters */ 643/* VMBus Version Supported parameters */
560struct vmbus_channel_version_supported { 644struct vmbus_channel_version_supported {
561 struct vmbus_channel_message_header header; 645 struct vmbus_channel_message_header header;
562 bool version_supported; 646 u8 version_supported;
563} __packed; 647} __packed;
564 648
565/* Offer Channel parameters */ 649/* Offer Channel parameters */
@@ -568,7 +652,7 @@ struct vmbus_channel_offer_channel {
568 struct vmbus_channel_offer offer; 652 struct vmbus_channel_offer offer;
569 u32 child_relid; 653 u32 child_relid;
570 u8 monitorid; 654 u8 monitorid;
571 bool monitor_allocated; 655 u8 monitor_allocated;
572} __packed; 656} __packed;
573 657
574/* Rescind Offer parameters */ 658/* Rescind Offer parameters */
@@ -704,7 +788,7 @@ struct vmbus_channel_initiate_contact {
704 788
705struct vmbus_channel_version_response { 789struct vmbus_channel_version_response {
706 struct vmbus_channel_message_header header; 790 struct vmbus_channel_message_header header;
707 bool version_supported; 791 u8 version_supported;
708} __packed; 792} __packed;
709 793
710enum vmbus_channel_state { 794enum vmbus_channel_state {
@@ -977,11 +1061,6 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
977#define ICMSGHDRFLAG_REQUEST 2 1061#define ICMSGHDRFLAG_REQUEST 2
978#define ICMSGHDRFLAG_RESPONSE 4 1062#define ICMSGHDRFLAG_RESPONSE 4
979 1063
980#define HV_S_OK 0x00000000
981#define HV_E_FAIL 0x80004005
982#define HV_S_CONT 0x80070103
983#define HV_ERROR_NOT_SUPPORTED 0x80070032
984#define HV_ERROR_MACHINE_LOCKED 0x800704F7
985 1064
986/* 1065/*
987 * While we want to handle util services as regular devices, 1066 * While we want to handle util services as regular devices,