提交 b56dda06 编写于 作者: K K. Y. Srinivasan 提交者: Greg Kroah-Hartman

Staging: hv: Move the contents of channel_mgmt.h to hyperv.h

Move the contents of channel_mgmt.h to hyperv.h.
Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: NHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: NAbhishek Kane <v-abkane@microsoft.com>
Signed-off-by: NHank Janssen <hjanssen@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 50ed40e0
master alk-4.19.24 alk-4.19.30 alk-4.19.34 alk-4.19.36 alk-4.19.43 alk-4.19.48 alk-4.19.57 ck-4.19.67 ck-4.19.81 ck-4.19.91 github/fork/deepanshu1422/fix-typo-in-comment github/fork/haosdent/fix-typo linux-next v4.19.91 v4.19.90 v4.19.89 v4.19.88 v4.19.87 v4.19.86 v4.19.85 v4.19.84 v4.19.83 v4.19.82 v4.19.81 v4.19.80 v4.19.79 v4.19.78 v4.19.77 v4.19.76 v4.19.75 v4.19.74 v4.19.73 v4.19.72 v4.19.71 v4.19.70 v4.19.69 v4.19.68 v4.19.67 v4.19.66 v4.19.65 v4.19.64 v4.19.63 v4.19.62 v4.19.61 v4.19.60 v4.19.59 v4.19.58 v4.19.57 v4.19.56 v4.19.55 v4.19.54 v4.19.53 v4.19.52 v4.19.51 v4.19.50 v4.19.49 v4.19.48 v4.19.47 v4.19.46 v4.19.45 v4.19.44 v4.19.43 v4.19.42 v4.19.41 v4.19.40 v4.19.39 v4.19.38 v4.19.37 v4.19.36 v4.19.35 v4.19.34 v4.19.33 v4.19.32 v4.19.31 v4.19.30 v4.19.29 v4.19.28 v4.19.27 v4.19.26 v4.19.25 v4.19.24 v4.19.23 v4.19.22 v4.19.21 v4.19.20 v4.19.19 v4.19.18 v4.19.17 v4.19.16 v4.19.15 v4.19.14 v4.19.13 v4.19.12 v4.19.11 v4.19.10 v4.19.9 v4.19.8 v4.19.7 v4.19.6 v4.19.5 v4.19.4 v4.19.3 v4.19.2 v4.19.1 v4.19 v4.19-rc8 v4.19-rc7 v4.19-rc6 v4.19-rc5 v4.19-rc4 v4.19-rc3 v4.19-rc2 v4.19-rc1 ck-release-21 ck-release-20 ck-release-19.2 ck-release-19.1 ck-release-19 ck-release-18 ck-release-17.2 ck-release-17.1 ck-release-17 ck-release-16 ck-release-15.1 ck-release-15 ck-release-14 ck-release-13.2 ck-release-13 ck-release-12 ck-release-11 ck-release-10 ck-release-9 ck-release-7 alk-release-15 alk-release-14 alk-release-13.2 alk-release-13 alk-release-12 alk-release-11 alk-release-10 alk-release-9 alk-release-7
无相关合并请求
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef _CHANNEL_H_ #ifndef _CHANNEL_H_
#define _CHANNEL_H_ #define _CHANNEL_H_
#include "channel_mgmt.h" #include "hyperv.h"
/* The format must be the same as struct vmdata_gpa_direct */ /* The format must be the same as struct vmdata_gpa_direct */
struct vmbus_channel_packet_page_buffer { struct vmbus_channel_packet_page_buffer {
......
/*
*
* Copyright (c) 2009, Microsoft Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
*
* Authors:
* Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com>
*
*/
#ifndef _CHANNEL_MGMT_H_
#define _CHANNEL_MGMT_H_
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
#include "hyperv.h"
/* Version 1 messages */
enum vmbus_channel_message_type {
CHANNELMSG_INVALID = 0,
CHANNELMSG_OFFERCHANNEL = 1,
CHANNELMSG_RESCIND_CHANNELOFFER = 2,
CHANNELMSG_REQUESTOFFERS = 3,
CHANNELMSG_ALLOFFERS_DELIVERED = 4,
CHANNELMSG_OPENCHANNEL = 5,
CHANNELMSG_OPENCHANNEL_RESULT = 6,
CHANNELMSG_CLOSECHANNEL = 7,
CHANNELMSG_GPADL_HEADER = 8,
CHANNELMSG_GPADL_BODY = 9,
CHANNELMSG_GPADL_CREATED = 10,
CHANNELMSG_GPADL_TEARDOWN = 11,
CHANNELMSG_GPADL_TORNDOWN = 12,
CHANNELMSG_RELID_RELEASED = 13,
CHANNELMSG_INITIATE_CONTACT = 14,
CHANNELMSG_VERSION_RESPONSE = 15,
CHANNELMSG_UNLOAD = 16,
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
CHANNELMSG_VIEWRANGE_ADD = 17,
CHANNELMSG_VIEWRANGE_REMOVE = 18,
#endif
CHANNELMSG_COUNT
};
struct vmbus_channel_message_header {
enum vmbus_channel_message_type msgtype;
u32 padding;
} __packed;
/* Query VMBus Version parameters */
struct vmbus_channel_query_vmbus_version {
struct vmbus_channel_message_header header;
u32 version;
} __packed;
/* VMBus Version Supported parameters */
struct vmbus_channel_version_supported {
struct vmbus_channel_message_header header;
bool version_supported;
} __packed;
/* Offer Channel parameters */
struct vmbus_channel_offer_channel {
struct vmbus_channel_message_header header;
struct vmbus_channel_offer offer;
u32 child_relid;
u8 monitorid;
bool monitor_allocated;
} __packed;
/* Rescind Offer parameters */
struct vmbus_channel_rescind_offer {
struct vmbus_channel_message_header header;
u32 child_relid;
} __packed;
/*
* Request Offer -- no parameters, SynIC message contains the partition ID
* Set Snoop -- no parameters, SynIC message contains the partition ID
* Clear Snoop -- no parameters, SynIC message contains the partition ID
* All Offers Delivered -- no parameters, SynIC message contains the partition
* ID
* Flush Client -- no parameters, SynIC message contains the partition ID
*/
/* Open Channel parameters */
struct vmbus_channel_open_channel {
struct vmbus_channel_message_header header;
/* Identifies the specific VMBus channel that is being opened. */
u32 child_relid;
/* ID making a particular open request at a channel offer unique. */
u32 openid;
/* GPADL for the channel's ring buffer. */
u32 ringbuffer_gpadlhandle;
/* GPADL for the channel's server context save area. */
u32 server_contextarea_gpadlhandle;
/*
* The upstream ring buffer begins at offset zero in the memory
* described by RingBufferGpadlHandle. The downstream ring buffer
* follows it at this offset (in pages).
*/
u32 downstream_ringbuffer_pageoffset;
/* User-specific data to be passed along to the server endpoint. */
unsigned char userdata[MAX_USER_DEFINED_BYTES];
} __packed;
/* Open Channel Result parameters */
struct vmbus_channel_open_result {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 openid;
u32 status;
} __packed;
/* Close channel parameters; */
struct vmbus_channel_close_channel {
struct vmbus_channel_message_header header;
u32 child_relid;
} __packed;
/* Channel Message GPADL */
#define GPADL_TYPE_RING_BUFFER 1
#define GPADL_TYPE_SERVER_SAVE_AREA 2
#define GPADL_TYPE_TRANSACTION 8
/*
* The number of PFNs in a GPADL message is defined by the number of
* pages that would be spanned by ByteCount and ByteOffset. If the
* implied number of PFNs won't fit in this packet, there will be a
* follow-up packet that contains more.
*/
struct vmbus_channel_gpadl_header {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 gpadl;
u16 range_buflen;
u16 rangecount;
struct gpa_range range[0];
} __packed;
/* This is the followup packet that contains more PFNs. */
struct vmbus_channel_gpadl_body {
struct vmbus_channel_message_header header;
u32 msgnumber;
u32 gpadl;
u64 pfn[0];
} __packed;
struct vmbus_channel_gpadl_created {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 gpadl;
u32 creation_status;
} __packed;
struct vmbus_channel_gpadl_teardown {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 gpadl;
} __packed;
struct vmbus_channel_gpadl_torndown {
struct vmbus_channel_message_header header;
u32 gpadl;
} __packed;
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
struct vmbus_channel_view_range_add {
struct vmbus_channel_message_header header;
PHYSICAL_ADDRESS viewrange_base;
u64 viewrange_length;
u32 child_relid;
} __packed;
struct vmbus_channel_view_range_remove {
struct vmbus_channel_message_header header;
PHYSICAL_ADDRESS viewrange_base;
u32 child_relid;
} __packed;
#endif
struct vmbus_channel_relid_released {
struct vmbus_channel_message_header header;
u32 child_relid;
} __packed;
struct vmbus_channel_initiate_contact {
struct vmbus_channel_message_header header;
u32 vmbus_version_requested;
u32 padding2;
u64 interrupt_page;
u64 monitor_page1;
u64 monitor_page2;
} __packed;
struct vmbus_channel_version_response {
struct vmbus_channel_message_header header;
bool version_supported;
} __packed;
enum vmbus_channel_state {
CHANNEL_OFFER_STATE,
CHANNEL_OPENING_STATE,
CHANNEL_OPEN_STATE,
};
struct vmbus_channel {
struct list_head listentry;
struct hv_device *device_obj;
struct timer_list poll_timer; /* SA-111 workaround */
struct work_struct work;
enum vmbus_channel_state state;
struct vmbus_channel_offer_channel offermsg;
/*
* These are based on the OfferMsg.MonitorId.
* Save it here for easy access.
*/
u8 monitor_grp;
u8 monitor_bit;
u32 ringbuffer_gpadlhandle;
/* Allocated memory for ring buffer */
void *ringbuffer_pages;
u32 ringbuffer_pagecount;
struct hv_ring_buffer_info outbound; /* send to parent */
struct hv_ring_buffer_info inbound; /* receive from parent */
spinlock_t inbound_lock;
struct workqueue_struct *controlwq;
/* Channel callback are invoked in this workqueue context */
/* HANDLE dataWorkQueue; */
void (*onchannel_callback)(void *context);
void *channel_callback_context;
};
struct vmbus_channel_debug_info {
u32 relid;
enum vmbus_channel_state state;
struct hv_guid interfacetype;
struct hv_guid interface_instance;
u32 monitorid;
u32 servermonitor_pending;
u32 servermonitor_latency;
u32 servermonitor_connectionid;
u32 clientmonitor_pending;
u32 clientmonitor_latency;
u32 clientmonitor_connectionid;
struct hv_ring_buffer_debug_info inbound;
struct hv_ring_buffer_debug_info outbound;
};
/*
* Represents each channel msg on the vmbus connection This is a
* variable-size data structure depending on the msg type itself
*/
struct vmbus_channel_msginfo {
/* Bookkeeping stuff */
struct list_head msglistentry;
/* So far, this is only used to handle gpadl body message */
struct list_head submsglist;
/* Synchronize the request/response if needed */
struct completion waitevent;
union {
struct vmbus_channel_version_supported version_supported;
struct vmbus_channel_open_result open_result;
struct vmbus_channel_gpadl_torndown gpadl_torndown;
struct vmbus_channel_gpadl_created gpadl_created;
struct vmbus_channel_version_response version_response;
} response;
u32 msgsize;
/*
* The channel message that goes out on the "wire".
* It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
*/
unsigned char msg[0];
};
void free_channel(struct vmbus_channel *channel);
void vmbus_onmessage(void *context);
int vmbus_request_offers(void);
#endif /* _CHANNEL_MGMT_H_ */
...@@ -318,4 +318,293 @@ enum vmbus_packet_type { ...@@ -318,4 +318,293 @@ enum vmbus_packet_type {
#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1 #define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
#include "hyperv.h"
/* Version 1 messages */
enum vmbus_channel_message_type {
CHANNELMSG_INVALID = 0,
CHANNELMSG_OFFERCHANNEL = 1,
CHANNELMSG_RESCIND_CHANNELOFFER = 2,
CHANNELMSG_REQUESTOFFERS = 3,
CHANNELMSG_ALLOFFERS_DELIVERED = 4,
CHANNELMSG_OPENCHANNEL = 5,
CHANNELMSG_OPENCHANNEL_RESULT = 6,
CHANNELMSG_CLOSECHANNEL = 7,
CHANNELMSG_GPADL_HEADER = 8,
CHANNELMSG_GPADL_BODY = 9,
CHANNELMSG_GPADL_CREATED = 10,
CHANNELMSG_GPADL_TEARDOWN = 11,
CHANNELMSG_GPADL_TORNDOWN = 12,
CHANNELMSG_RELID_RELEASED = 13,
CHANNELMSG_INITIATE_CONTACT = 14,
CHANNELMSG_VERSION_RESPONSE = 15,
CHANNELMSG_UNLOAD = 16,
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
CHANNELMSG_VIEWRANGE_ADD = 17,
CHANNELMSG_VIEWRANGE_REMOVE = 18,
#endif
CHANNELMSG_COUNT
};
struct vmbus_channel_message_header {
enum vmbus_channel_message_type msgtype;
u32 padding;
} __packed;
/* Query VMBus Version parameters */
struct vmbus_channel_query_vmbus_version {
struct vmbus_channel_message_header header;
u32 version;
} __packed;
/* VMBus Version Supported parameters */
struct vmbus_channel_version_supported {
struct vmbus_channel_message_header header;
bool version_supported;
} __packed;
/* Offer Channel parameters */
struct vmbus_channel_offer_channel {
struct vmbus_channel_message_header header;
struct vmbus_channel_offer offer;
u32 child_relid;
u8 monitorid;
bool monitor_allocated;
} __packed;
/* Rescind Offer parameters */
struct vmbus_channel_rescind_offer {
struct vmbus_channel_message_header header;
u32 child_relid;
} __packed;
/*
* Request Offer -- no parameters, SynIC message contains the partition ID
* Set Snoop -- no parameters, SynIC message contains the partition ID
* Clear Snoop -- no parameters, SynIC message contains the partition ID
* All Offers Delivered -- no parameters, SynIC message contains the partition
* ID
* Flush Client -- no parameters, SynIC message contains the partition ID
*/
/* Open Channel parameters */
struct vmbus_channel_open_channel {
struct vmbus_channel_message_header header;
/* Identifies the specific VMBus channel that is being opened. */
u32 child_relid;
/* ID making a particular open request at a channel offer unique. */
u32 openid;
/* GPADL for the channel's ring buffer. */
u32 ringbuffer_gpadlhandle;
/* GPADL for the channel's server context save area. */
u32 server_contextarea_gpadlhandle;
/*
* The upstream ring buffer begins at offset zero in the memory
* described by RingBufferGpadlHandle. The downstream ring buffer
* follows it at this offset (in pages).
*/
u32 downstream_ringbuffer_pageoffset;
/* User-specific data to be passed along to the server endpoint. */
unsigned char userdata[MAX_USER_DEFINED_BYTES];
} __packed;
/* Open Channel Result parameters */
struct vmbus_channel_open_result {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 openid;
u32 status;
} __packed;
/* Close channel parameters; */
struct vmbus_channel_close_channel {
struct vmbus_channel_message_header header;
u32 child_relid;
} __packed;
/* Channel Message GPADL */
#define GPADL_TYPE_RING_BUFFER 1
#define GPADL_TYPE_SERVER_SAVE_AREA 2
#define GPADL_TYPE_TRANSACTION 8
/*
* The number of PFNs in a GPADL message is defined by the number of
* pages that would be spanned by ByteCount and ByteOffset. If the
* implied number of PFNs won't fit in this packet, there will be a
* follow-up packet that contains more.
*/
struct vmbus_channel_gpadl_header {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 gpadl;
u16 range_buflen;
u16 rangecount;
struct gpa_range range[0];
} __packed;
/* This is the followup packet that contains more PFNs. */
struct vmbus_channel_gpadl_body {
struct vmbus_channel_message_header header;
u32 msgnumber;
u32 gpadl;
u64 pfn[0];
} __packed;
struct vmbus_channel_gpadl_created {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 gpadl;
u32 creation_status;
} __packed;
struct vmbus_channel_gpadl_teardown {
struct vmbus_channel_message_header header;
u32 child_relid;
u32 gpadl;
} __packed;
struct vmbus_channel_gpadl_torndown {
struct vmbus_channel_message_header header;
u32 gpadl;
} __packed;
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
struct vmbus_channel_view_range_add {
struct vmbus_channel_message_header header;
PHYSICAL_ADDRESS viewrange_base;
u64 viewrange_length;
u32 child_relid;
} __packed;
struct vmbus_channel_view_range_remove {
struct vmbus_channel_message_header header;
PHYSICAL_ADDRESS viewrange_base;
u32 child_relid;
} __packed;
#endif
struct vmbus_channel_relid_released {
struct vmbus_channel_message_header header;
u32 child_relid;
} __packed;
struct vmbus_channel_initiate_contact {
struct vmbus_channel_message_header header;
u32 vmbus_version_requested;
u32 padding2;
u64 interrupt_page;
u64 monitor_page1;
u64 monitor_page2;
} __packed;
struct vmbus_channel_version_response {
struct vmbus_channel_message_header header;
bool version_supported;
} __packed;
enum vmbus_channel_state {
CHANNEL_OFFER_STATE,
CHANNEL_OPENING_STATE,
CHANNEL_OPEN_STATE,
};
struct vmbus_channel {
struct list_head listentry;
struct hv_device *device_obj;
struct timer_list poll_timer; /* SA-111 workaround */
struct work_struct work;
enum vmbus_channel_state state;
struct vmbus_channel_offer_channel offermsg;
/*
* These are based on the OfferMsg.MonitorId.
* Save it here for easy access.
*/
u8 monitor_grp;
u8 monitor_bit;
u32 ringbuffer_gpadlhandle;
/* Allocated memory for ring buffer */
void *ringbuffer_pages;
u32 ringbuffer_pagecount;
struct hv_ring_buffer_info outbound; /* send to parent */
struct hv_ring_buffer_info inbound; /* receive from parent */
spinlock_t inbound_lock;
struct workqueue_struct *controlwq;
/* Channel callback are invoked in this workqueue context */
/* HANDLE dataWorkQueue; */
void (*onchannel_callback)(void *context);
void *channel_callback_context;
};
struct vmbus_channel_debug_info {
u32 relid;
enum vmbus_channel_state state;
struct hv_guid interfacetype;
struct hv_guid interface_instance;
u32 monitorid;
u32 servermonitor_pending;
u32 servermonitor_latency;
u32 servermonitor_connectionid;
u32 clientmonitor_pending;
u32 clientmonitor_latency;
u32 clientmonitor_connectionid;
struct hv_ring_buffer_debug_info inbound;
struct hv_ring_buffer_debug_info outbound;
};
/*
* Represents each channel msg on the vmbus connection This is a
* variable-size data structure depending on the msg type itself
*/
struct vmbus_channel_msginfo {
/* Bookkeeping stuff */
struct list_head msglistentry;
/* So far, this is only used to handle gpadl body message */
struct list_head submsglist;
/* Synchronize the request/response if needed */
struct completion waitevent;
union {
struct vmbus_channel_version_supported version_supported;
struct vmbus_channel_open_result open_result;
struct vmbus_channel_gpadl_torndown gpadl_torndown;
struct vmbus_channel_gpadl_created gpadl_created;
struct vmbus_channel_version_response version_response;
} response;
u32 msgsize;
/*
* The channel message that goes out on the "wire".
* It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
*/
unsigned char msg[0];
};
void free_channel(struct vmbus_channel *channel);
void vmbus_onmessage(void *context);
int vmbus_request_offers(void);
#endif /* _HYPERV_H */ #endif /* _HYPERV_H */
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "hv.h" #include "hv.h"
#include "vmbus_api.h" #include "vmbus_api.h"
#include "channel.h" #include "channel.h"
#include "channel_mgmt.h"
#include "ring_buffer.h" #include "ring_buffer.h"
#include <linux/list.h> #include <linux/list.h>
#include <asm/sync_bitops.h> #include <asm/sync_bitops.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部