svn commit: r302612 - in head/sys/dev/hyperv: include vmbus
Sepherosa Ziehau
sephe at FreeBSD.org
Tue Jul 12 03:38:31 UTC 2016
Author: sephe
Date: Tue Jul 12 03:38:29 2016
New Revision: 302612
URL: https://svnweb.freebsd.org/changeset/base/302612
Log:
hyperv: Nuke unused stuffs
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6913
Modified:
head/sys/dev/hyperv/include/hyperv.h
head/sys/dev/hyperv/vmbus/hv_connection.c
head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
head/sys/dev/hyperv/vmbus/hyperv.c
Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 03:32:07 2016 (r302611)
+++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 12 03:38:29 2016 (r302612)
@@ -179,8 +179,6 @@ typedef struct hv_vmbus_channel_offer {
} __packed hv_vmbus_channel_offer;
-typedef uint32_t hv_gpadl_handle;
-
typedef struct {
uint16_t type;
uint16_t data_offset8;
@@ -352,14 +350,6 @@ typedef struct {
} __packed hv_vmbus_channel_query_vmbus_version;
/*
- * VMBus Version Supported parameters
- */
-typedef struct {
- hv_vmbus_channel_msg_header header;
- hv_bool_uint8_t version_supported;
-} __packed hv_vmbus_channel_version_supported;
-
-/*
* Channel Offer parameters
*/
typedef struct {
@@ -397,171 +387,13 @@ typedef struct
uint32_t child_rel_id;
} __packed hv_vmbus_channel_rescind_offer;
-
-/*
- * 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
- */
-typedef struct
-{
- hv_vmbus_channel_msg_header header;
-
- /*
- * Identifies the specific VMBus channel that is being opened.
- */
- uint32_t child_rel_id;
-
- /*
- * ID making a particular open request at a channel offer unique.
- */
- uint32_t open_id;
-
- /*
- * GPADL for the channel's ring buffer.
- */
- hv_gpadl_handle ring_buffer_gpadl_handle;
-
- /*
- * Before win8, all incoming channel interrupts are only
- * delivered on cpu 0. Setting this value to 0 would
- * preserve the earlier behavior.
- */
- uint32_t target_vcpu;
-
- /*
- * The upstream ring buffer begins at offset zero in the memory described
- * by ring_buffer_gpadl_handle. The downstream ring buffer follows it at
- * this offset (in pages).
- */
- uint32_t downstream_ring_buffer_page_offset;
-
- /*
- * User-specific data to be passed along to the server endpoint.
- */
- uint8_t user_data[HV_MAX_USER_DEFINED_BYTES];
-
-} __packed hv_vmbus_channel_open_channel;
-
-typedef uint32_t hv_nt_status;
-
-/*
- * Open Channel Result parameters
- */
-typedef struct
-{
- hv_vmbus_channel_msg_header header;
- uint32_t child_rel_id;
- uint32_t open_id;
- hv_nt_status status;
-} __packed hv_vmbus_channel_open_result;
-
-/*
- * Close channel parameters
- */
-typedef struct
-{
- hv_vmbus_channel_msg_header header;
- uint32_t child_rel_id;
-} __packed hv_vmbus_channel_close_channel;
-
-/*
- * Channel Message GPADL
- */
-#define HV_GPADL_TYPE_RING_BUFFER 1
-#define HV_GPADL_TYPE_SERVER_SAVE_AREA 2
-#define HV_GPADL_TYPE_TRANSACTION 8
-
-/*
- * The number of PFNs in a GPADL message is defined by the number of pages
- * that would be spanned by byte_count and byte_offset. If the implied number
- * of PFNs won't fit in this packet, there will be a follow-up packet that
- * contains more
- */
-
-typedef struct {
- hv_vmbus_channel_msg_header header;
- uint32_t child_rel_id;
- uint32_t gpadl;
- uint16_t range_buf_len;
- uint16_t range_count;
- hv_gpa_range range[0];
-} __packed hv_vmbus_channel_gpadl_header;
-
-/*
- * This is the follow-up packet that contains more PFNs
- */
-typedef struct {
- hv_vmbus_channel_msg_header header;
- uint32_t message_number;
- uint32_t gpadl;
- uint64_t pfn[0];
-} __packed hv_vmbus_channel_gpadl_body;
-
-typedef struct {
- hv_vmbus_channel_msg_header header;
- uint32_t child_rel_id;
- uint32_t gpadl;
- uint32_t creation_status;
-} __packed hv_vmbus_channel_gpadl_created;
-
-typedef struct {
- hv_vmbus_channel_msg_header header;
- uint32_t child_rel_id;
- uint32_t gpadl;
-} __packed hv_vmbus_channel_gpadl_teardown;
-
-typedef struct {
- hv_vmbus_channel_msg_header header;
- uint32_t gpadl;
-} __packed hv_vmbus_channel_gpadl_torndown;
-
typedef struct {
hv_vmbus_channel_msg_header header;
uint32_t child_rel_id;
} __packed hv_vmbus_channel_relid_released;
-typedef hv_vmbus_channel_msg_header hv_vmbus_channel_unload;
-
#define HW_MACADDR_LEN 6
-/*
- * Fixme: Added to quiet "typeof" errors involving hv_vmbus.h when
- * the including C file was compiled with "-std=c99".
- */
-#ifndef typeof
-#define typeof __typeof
-#endif
-
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-typedef void *hv_vmbus_handle;
-
-#ifndef CONTAINING_RECORD
-#define CONTAINING_RECORD(address, type, field) ((type *)( \
- (uint8_t *)(address) - \
- (uint8_t *)(&((type *)0)->field)))
-#endif /* CONTAINING_RECORD */
-
-
-#define container_of(ptr, type, member) ({ \
- __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-
enum {
HV_VMBUS_IVAR_TYPE,
HV_VMBUS_IVAR_INSTANCE,
Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 03:32:07 2016 (r302611)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 03:38:29 2016 (r302612)
@@ -70,10 +70,6 @@ hv_vmbus_connect(struct vmbus_softc *sc)
*/
hv_vmbus_g_connection.connect_state = HV_CONNECTING;
- TAILQ_INIT(&hv_vmbus_g_connection.channel_msg_anchor);
- mtx_init(&hv_vmbus_g_connection.channel_msg_lock, "vmbus channel msg",
- NULL, MTX_DEF);
-
TAILQ_INIT(&hv_vmbus_g_connection.channel_anchor);
mtx_init(&hv_vmbus_g_connection.channel_lock, "vmbus channel",
NULL, MTX_DEF);
@@ -93,8 +89,6 @@ int
hv_vmbus_disconnect(void)
{
- mtx_destroy(&hv_vmbus_g_connection.channel_msg_lock);
-
free(hv_vmbus_g_connection.channels, M_DEVBUF);
hv_vmbus_g_connection.connect_state = HV_DISCONNECTED;
@@ -165,40 +159,6 @@ vmbus_event_proc_compat(struct vmbus_sof
}
/**
- * Send a msg on the vmbus's message connection
- */
-int hv_vmbus_post_message(void *buffer, size_t bufferLen)
-{
- hv_vmbus_connection_id connId;
- sbintime_t time = SBT_1MS;
- int retries;
- int ret;
-
- connId.as_uint32_t = 0;
- connId.u.id = HV_VMBUS_MESSAGE_CONNECTION_ID;
-
- /*
- * We retry to cope with transient failures caused by host side's
- * insufficient resources. 20 times should suffice in practice.
- */
- for (retries = 0; retries < 20; retries++) {
- ret = hv_vmbus_post_msg_via_msg_ipc(connId,
- HYPERV_MSGTYPE_CHANNEL, buffer, bufferLen);
- if (ret == HV_STATUS_SUCCESS)
- return (0);
-
- pause_sbt("pstmsg", time, 0, C_HARDCLOCK);
- if (time < SBT_1S * 2)
- time *= 2;
- }
-
- KASSERT(ret == HV_STATUS_SUCCESS,
- ("Error VMBUS: Message Post Failed, ret=%d\n", ret));
-
- return (EAGAIN);
-}
-
-/**
* Send an event notification to the parent
*/
int
Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 03:32:07 2016 (r302611)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 03:38:29 2016 (r302612)
@@ -90,47 +90,6 @@ typedef struct {
hv_vmbus_ring_buffer_debug_info outbound;
} hv_vmbus_channel_debug_info;
-typedef union {
- hv_vmbus_channel_version_supported version_supported;
- hv_vmbus_channel_open_result open_result;
- hv_vmbus_channel_gpadl_torndown gpadl_torndown;
- hv_vmbus_channel_gpadl_created gpadl_created;
-} hv_vmbus_channel_msg_response;
-
-/*
- * Represents each channel msg on the vmbus connection
- * This is a variable-size data structure depending on
- * the msg type itself
- */
-typedef struct hv_vmbus_channel_msg_info {
- /*
- * Bookkeeping stuff
- */
- TAILQ_ENTRY(hv_vmbus_channel_msg_info) msg_list_entry;
- /*
- * So far, this is only used to handle
- * gpadl body message
- */
- TAILQ_HEAD(, hv_vmbus_channel_msg_info) sub_msg_list_anchor;
- /*
- * Synchronize the request/response if
- * needed.
- * KYS: Use a semaphore for now.
- * Not perf critical.
- */
- struct sema wait_sema;
- hv_vmbus_channel_msg_response response;
- uint32_t message_size;
- /**
- * The channel message that goes out on
- * the "wire". It will contain at
- * minimum the
- * hv_vmbus_channel_msg_header
- * header.
- */
- unsigned char msg[0];
-} hv_vmbus_channel_msg_info;
-
/*
* The format must be the same as hv_vm_data_gpa_direct
*/
@@ -244,8 +203,6 @@ typedef struct {
hv_vmbus_connect_state connect_state;
uint32_t next_gpadl_handle;
- TAILQ_HEAD(, hv_vmbus_channel_msg_info) channel_msg_anchor;
- struct mtx channel_msg_lock;
/**
* List of primary channels. Sub channels will be linked
* under their primary channel.
@@ -321,17 +278,6 @@ typedef struct {
} hv_vmbus_monitor_page;
/*
- * Define the hv_vmbus_post_message hypercall input structure
- */
-typedef struct {
- hv_vmbus_connection_id connection_id;
- uint32_t reserved;
- hv_vmbus_msg_type message_type;
- uint32_t payload_size;
- uint64_t payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
-} hv_vmbus_input_post_message;
-
-/*
* Declare the various hypercall operations
*/
typedef enum {
@@ -398,12 +344,6 @@ uint32_t hv_ring_buffer_read_end(
void hv_vmbus_free_vmbus_channel(hv_vmbus_channel *channel);
void hv_vmbus_release_unattached_channels(void);
-uint16_t hv_vmbus_post_msg_via_msg_ipc(
- hv_vmbus_connection_id connection_id,
- hv_vmbus_msg_type message_type,
- void *payload,
- size_t payload_size);
-
uint16_t hv_vmbus_signal_event(void *con_id);
struct hv_device* hv_vmbus_child_device_create(
@@ -423,7 +363,6 @@ int hv_vmbus_child_device_unregister(
*/
int hv_vmbus_connect(struct vmbus_softc *);
int hv_vmbus_disconnect(void);
-int hv_vmbus_post_message(void *buffer, size_t buf_size);
int hv_vmbus_set_event(hv_vmbus_channel *channel);
#endif /* __HYPERV_PRIV_H__ */
Modified: head/sys/dev/hyperv/vmbus/hyperv.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 03:32:07 2016 (r302611)
+++ head/sys/dev/hyperv/vmbus/hyperv.c Tue Jul 12 03:38:29 2016 (r302612)
@@ -126,51 +126,6 @@ hypercall_post_message(bus_addr_t msg_pa
}
/**
- * @brief Post a message using the hypervisor message IPC.
- * (This involves a hypercall.)
- */
-hv_vmbus_status
-hv_vmbus_post_msg_via_msg_ipc(
- hv_vmbus_connection_id connection_id,
- hv_vmbus_msg_type message_type,
- void* payload,
- size_t payload_size)
-{
- struct alignedinput {
- uint64_t alignment8;
- hv_vmbus_input_post_message msg;
- };
-
- hv_vmbus_input_post_message* aligned_msg;
- hv_vmbus_status status;
- size_t addr;
-
- if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
- return (EMSGSIZE);
-
- addr = (size_t) malloc(sizeof(struct alignedinput), M_DEVBUF,
- M_ZERO | M_NOWAIT);
- KASSERT(addr != 0,
- ("Error VMBUS: malloc failed to allocate message buffer!"));
- if (addr == 0)
- return (ENOMEM);
-
- aligned_msg = (hv_vmbus_input_post_message*)
- (HV_ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN));
-
- aligned_msg->connection_id = connection_id;
- aligned_msg->message_type = message_type;
- aligned_msg->payload_size = payload_size;
- memcpy((void*) aligned_msg->payload, payload, payload_size);
-
- status = hv_vmbus_do_hypercall(
- HV_CALL_POST_MESSAGE, aligned_msg, 0) & 0xFFFF;
-
- free((void *) addr, M_DEVBUF);
- return (status);
-}
-
-/**
* @brief Signal an event on the specified connection using the hypervisor
* event IPC. (This involves a hypercall.)
*/
More information about the svn-src-all
mailing list