summaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-04 22:07:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-04 22:15:35 -0400
commitaf82455f7dbd9dc20244d80d033721b30d22c065 (patch)
tree3b9246456e82ae116b57834a2f0b4a307a016474 /drivers/hv
parent0be75179df5e20306528800fc7c6a504b12b97db (diff)
parent2a76f89fa58c769241cfc21f2614705591519ae3 (diff)
Merge tag 'char-misc-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH: "Here is the big set of new char/misc driver drivers and features for 4.12-rc1. There's lots of new drivers added this time around, new firmware drivers from Google, more auxdisplay drivers, extcon drivers, fpga drivers, and a bunch of other driver updates. Nothing major, except if you happen to have the hardware for these drivers, and then you will be happy :) All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (136 commits) firmware: google memconsole: Fix return value check in platform_memconsole_init() firmware: Google VPD: Fix return value check in vpd_platform_init() goldfish_pipe: fix build warning about using too much stack. goldfish_pipe: An implementation of more parallel pipe fpga fr br: update supported version numbers fpga: region: release FPGA region reference in error path fpga altera-hps2fpga: disable/unprepare clock on error in alt_fpga_bridge_probe() mei: drop the TODO from samples firmware: Google VPD sysfs driver firmware: Google VPD: import lib_vpd source files misc: lkdtm: Add volatile to intentional NULL pointer reference eeprom: idt_89hpesx: Add OF device ID table misc: ds1682: Add OF device ID table misc: tsl2550: Add OF device ID table w1: Remove unneeded use of assert() and remove w1_log.h w1: Use kernel common min() implementation uio_mf624: Align memory regions to page size and set correct offsets uio_mf624: Refactor memory info initialization uio: Allow handling of non page-aligned memory regions hangcheck-timer: Fix typo in comment ...
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/channel.c10
-rw-r--r--drivers/hv/channel_mgmt.c48
-rw-r--r--drivers/hv/connection.c65
-rw-r--r--drivers/hv/hv.c5
-rw-r--r--drivers/hv/hv_balloon.c2
-rw-r--r--drivers/hv/hv_fcopy.c2
-rw-r--r--drivers/hv/hv_kvp.c12
-rw-r--r--drivers/hv/hv_snapshot.c2
-rw-r--r--drivers/hv/hyperv_vmbus.h29
-rw-r--r--drivers/hv/ring_buffer.c22
-rw-r--r--drivers/hv/vmbus_drv.c4
11 files changed, 90 insertions, 111 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 321b8833fa6f..736ac76d2a6a 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -333,7 +333,7 @@ static int create_gpadl_header(void *kbuffer, u32 size,
333 * Gpadl is u32 and we are using a pointer which could 333 * Gpadl is u32 and we are using a pointer which could
334 * be 64-bit 334 * be 64-bit
335 * This is governed by the guest/host protocol and 335 * This is governed by the guest/host protocol and
336 * so the hypervisor gurantees that this is ok. 336 * so the hypervisor guarantees that this is ok.
337 */ 337 */
338 for (i = 0; i < pfncurr; i++) 338 for (i = 0; i < pfncurr; i++)
339 gpadl_body->pfn[i] = slow_virt_to_phys( 339 gpadl_body->pfn[i] = slow_virt_to_phys(
@@ -380,7 +380,7 @@ nomem:
380} 380}
381 381
382/* 382/*
383 * vmbus_establish_gpadl - Estabish a GPADL for the specified buffer 383 * vmbus_establish_gpadl - Establish a GPADL for the specified buffer
384 * 384 *
385 * @channel: a channel 385 * @channel: a channel
386 * @kbuffer: from kmalloc or vmalloc 386 * @kbuffer: from kmalloc or vmalloc
@@ -731,7 +731,7 @@ int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel,
731 /* Setup the descriptor */ 731 /* Setup the descriptor */
732 desc.type = VM_PKT_DATA_USING_GPA_DIRECT; 732 desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
733 desc.flags = flags; 733 desc.flags = flags;
734 desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */ 734 desc.dataoffset8 = descsize >> 3; /* in 8-bytes granularity */
735 desc.length8 = (u16)(packetlen_aligned >> 3); 735 desc.length8 = (u16)(packetlen_aligned >> 3);
736 desc.transactionid = requestid; 736 desc.transactionid = requestid;
737 desc.rangecount = pagecount; 737 desc.rangecount = pagecount;
@@ -792,7 +792,7 @@ int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel,
792 /* Setup the descriptor */ 792 /* Setup the descriptor */
793 desc->type = VM_PKT_DATA_USING_GPA_DIRECT; 793 desc->type = VM_PKT_DATA_USING_GPA_DIRECT;
794 desc->flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; 794 desc->flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
795 desc->dataoffset8 = desc_size >> 3; /* in 8-bytes grandularity */ 795 desc->dataoffset8 = desc_size >> 3; /* in 8-bytes granularity */
796 desc->length8 = (u16)(packetlen_aligned >> 3); 796 desc->length8 = (u16)(packetlen_aligned >> 3);
797 desc->transactionid = requestid; 797 desc->transactionid = requestid;
798 desc->rangecount = 1; 798 desc->rangecount = 1;
@@ -842,7 +842,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
842 /* Setup the descriptor */ 842 /* Setup the descriptor */
843 desc.type = VM_PKT_DATA_USING_GPA_DIRECT; 843 desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
844 desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; 844 desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
845 desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */ 845 desc.dataoffset8 = descsize >> 3; /* in 8-bytes granularity */
846 desc.length8 = (u16)(packetlen_aligned >> 3); 846 desc.length8 = (u16)(packetlen_aligned >> 3);
847 desc.transactionid = requestid; 847 desc.transactionid = requestid;
848 desc.rangecount = 1; 848 desc.rangecount = 1;
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index fbcb06352308..735f9363f2e4 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -1080,30 +1080,30 @@ static void vmbus_onversion_response(
1080} 1080}
1081 1081
1082/* Channel message dispatch table */ 1082/* Channel message dispatch table */
1083struct vmbus_channel_message_table_entry 1083const struct vmbus_channel_message_table_entry
1084 channel_message_table[CHANNELMSG_COUNT] = { 1084channel_message_table[CHANNELMSG_COUNT] = {
1085 {CHANNELMSG_INVALID, 0, NULL}, 1085 { CHANNELMSG_INVALID, 0, NULL },
1086 {CHANNELMSG_OFFERCHANNEL, 0, vmbus_onoffer}, 1086 { CHANNELMSG_OFFERCHANNEL, 0, vmbus_onoffer },
1087 {CHANNELMSG_RESCIND_CHANNELOFFER, 0, vmbus_onoffer_rescind}, 1087 { CHANNELMSG_RESCIND_CHANNELOFFER, 0, vmbus_onoffer_rescind },
1088 {CHANNELMSG_REQUESTOFFERS, 0, NULL}, 1088 { CHANNELMSG_REQUESTOFFERS, 0, NULL },
1089 {CHANNELMSG_ALLOFFERS_DELIVERED, 1, vmbus_onoffers_delivered}, 1089 { CHANNELMSG_ALLOFFERS_DELIVERED, 1, vmbus_onoffers_delivered },
1090 {CHANNELMSG_OPENCHANNEL, 0, NULL}, 1090 { CHANNELMSG_OPENCHANNEL, 0, NULL },
1091 {CHANNELMSG_OPENCHANNEL_RESULT, 1, vmbus_onopen_result}, 1091 { CHANNELMSG_OPENCHANNEL_RESULT, 1, vmbus_onopen_result },
1092 {CHANNELMSG_CLOSECHANNEL, 0, NULL}, 1092 { CHANNELMSG_CLOSECHANNEL, 0, NULL },
1093 {CHANNELMSG_GPADL_HEADER, 0, NULL}, 1093 { CHANNELMSG_GPADL_HEADER, 0, NULL },
1094 {CHANNELMSG_GPADL_BODY, 0, NULL}, 1094 { CHANNELMSG_GPADL_BODY, 0, NULL },
1095 {CHANNELMSG_GPADL_CREATED, 1, vmbus_ongpadl_created}, 1095 { CHANNELMSG_GPADL_CREATED, 1, vmbus_ongpadl_created },
1096 {CHANNELMSG_GPADL_TEARDOWN, 0, NULL}, 1096 { CHANNELMSG_GPADL_TEARDOWN, 0, NULL },
1097 {CHANNELMSG_GPADL_TORNDOWN, 1, vmbus_ongpadl_torndown}, 1097 { CHANNELMSG_GPADL_TORNDOWN, 1, vmbus_ongpadl_torndown },
1098 {CHANNELMSG_RELID_RELEASED, 0, NULL}, 1098 { CHANNELMSG_RELID_RELEASED, 0, NULL },
1099 {CHANNELMSG_INITIATE_CONTACT, 0, NULL}, 1099 { CHANNELMSG_INITIATE_CONTACT, 0, NULL },
1100 {CHANNELMSG_VERSION_RESPONSE, 1, vmbus_onversion_response}, 1100 { CHANNELMSG_VERSION_RESPONSE, 1, vmbus_onversion_response },
1101 {CHANNELMSG_UNLOAD, 0, NULL}, 1101 { CHANNELMSG_UNLOAD, 0, NULL },
1102 {CHANNELMSG_UNLOAD_RESPONSE, 1, vmbus_unload_response}, 1102 { CHANNELMSG_UNLOAD_RESPONSE, 1, vmbus_unload_response },
1103 {CHANNELMSG_18, 0, NULL}, 1103 { CHANNELMSG_18, 0, NULL },
1104 {CHANNELMSG_19, 0, NULL}, 1104 { CHANNELMSG_19, 0, NULL },
1105 {CHANNELMSG_20, 0, NULL}, 1105 { CHANNELMSG_20, 0, NULL },
1106 {CHANNELMSG_TL_CONNECT_REQUEST, 0, NULL}, 1106 { CHANNELMSG_TL_CONNECT_REQUEST, 0, NULL },
1107}; 1107};
1108 1108
1109/* 1109/*
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index a8366fec1458..fce27fb141cc 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -296,44 +296,47 @@ struct vmbus_channel *relid2channel(u32 relid)
296 296
297/* 297/*
298 * vmbus_on_event - Process a channel event notification 298 * vmbus_on_event - Process a channel event notification
299 *
300 * For batched channels (default) optimize host to guest signaling
301 * by ensuring:
302 * 1. While reading the channel, we disable interrupts from host.
303 * 2. Ensure that we process all posted messages from the host
304 * before returning from this callback.
305 * 3. Once we return, enable signaling from the host. Once this
306 * state is set we check to see if additional packets are
307 * available to read. In this case we repeat the process.
308 * If this tasklet has been running for a long time
309 * then reschedule ourselves.
299 */ 310 */
300void vmbus_on_event(unsigned long data) 311void vmbus_on_event(unsigned long data)
301{ 312{
302 struct vmbus_channel *channel = (void *) data; 313 struct vmbus_channel *channel = (void *) data;
303 void (*callback_fn)(void *); 314 unsigned long time_limit = jiffies + 2;
304 315
305 /* 316 do {
306 * A channel once created is persistent even when there 317 void (*callback_fn)(void *);
307 * is no driver handling the device. An unloading driver 318
308 * sets the onchannel_callback to NULL on the same CPU 319 /* A channel once created is persistent even when
309 * as where this interrupt is handled (in an interrupt context). 320 * there is no driver handling the device. An
310 * Thus, checking and invoking the driver specific callback takes 321 * unloading driver sets the onchannel_callback to NULL.
311 * care of orderly unloading of the driver.
312 */
313 callback_fn = READ_ONCE(channel->onchannel_callback);
314 if (unlikely(callback_fn == NULL))
315 return;
316
317 (*callback_fn)(channel->channel_callback_context);
318
319 if (channel->callback_mode == HV_CALL_BATCHED) {
320 /*
321 * This callback reads the messages sent by the host.
322 * We can optimize host to guest signaling by ensuring:
323 * 1. While reading the channel, we disable interrupts from
324 * host.
325 * 2. Ensure that we process all posted messages from the host
326 * before returning from this callback.
327 * 3. Once we return, enable signaling from the host. Once this
328 * state is set we check to see if additional packets are
329 * available to read. In this case we repeat the process.
330 */ 322 */
331 if (hv_end_read(&channel->inbound) != 0) { 323 callback_fn = READ_ONCE(channel->onchannel_callback);
332 hv_begin_read(&channel->inbound); 324 if (unlikely(callback_fn == NULL))
325 return;
333 326
334 tasklet_schedule(&channel->callback_event); 327 (*callback_fn)(channel->channel_callback_context);
335 } 328
336 } 329 if (channel->callback_mode != HV_CALL_BATCHED)
330 return;
331
332 if (likely(hv_end_read(&channel->inbound) == 0))
333 return;
334
335 hv_begin_read(&channel->inbound);
336 } while (likely(time_before(jiffies, time_limit)));
337
338 /* The time limit (2 jiffies) has been reached */
339 tasklet_schedule(&channel->callback_event);
337} 340}
338 341
339/* 342/*
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 665a64f1611e..12e7baecb84e 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -254,7 +254,10 @@ int hv_synic_init(unsigned int cpu)
254 shared_sint.as_uint64 = 0; 254 shared_sint.as_uint64 = 0;
255 shared_sint.vector = HYPERVISOR_CALLBACK_VECTOR; 255 shared_sint.vector = HYPERVISOR_CALLBACK_VECTOR;
256 shared_sint.masked = false; 256 shared_sint.masked = false;
257 shared_sint.auto_eoi = true; 257 if (ms_hyperv.hints & HV_X64_DEPRECATING_AEOI_RECOMMENDED)
258 shared_sint.auto_eoi = false;
259 else
260 shared_sint.auto_eoi = true;
258 261
259 hv_set_synint_state(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, 262 hv_set_synint_state(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT,
260 shared_sint.as_uint64); 263 shared_sint.as_uint64);
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 5fd03e59cee5..f5728deff893 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -722,8 +722,6 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
722 5*HZ); 722 5*HZ);
723 post_status(&dm_device); 723 post_status(&dm_device);
724 } 724 }
725
726 return;
727} 725}
728 726
729static void hv_online_page(struct page *pg) 727static void hv_online_page(struct page *pg)
diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c
index a5596a642ed0..daa75bd41f86 100644
--- a/drivers/hv/hv_fcopy.c
+++ b/drivers/hv/hv_fcopy.c
@@ -186,8 +186,6 @@ static void fcopy_send_data(struct work_struct *dummy)
186 } 186 }
187 } 187 }
188 kfree(smsg_out); 188 kfree(smsg_out);
189
190 return;
191} 189}
192 190
193/* 191/*
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index a1adfe2cfb34..e99ff2ddad40 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -69,7 +69,7 @@ static const int fw_versions[] = {
69 * 69 *
70 * While the request/response protocol is guaranteed by the host, we further 70 * While the request/response protocol is guaranteed by the host, we further
71 * ensure this by serializing packet processing in this driver - we do not 71 * ensure this by serializing packet processing in this driver - we do not
72 * read additional packets from the VMBUs until the current packet is fully 72 * read additional packets from the VMBUS until the current packet is fully
73 * handled. 73 * handled.
74 */ 74 */
75 75
@@ -397,7 +397,7 @@ kvp_send_key(struct work_struct *dummy)
397 * the max lengths specified. We will however, reserve room 397 * the max lengths specified. We will however, reserve room
398 * for the string terminating character - in the utf16s_utf8s() 398 * for the string terminating character - in the utf16s_utf8s()
399 * function we limit the size of the buffer where the converted 399 * function we limit the size of the buffer where the converted
400 * string is placed to HV_KVP_EXCHANGE_MAX_*_SIZE -1 to gaurantee 400 * string is placed to HV_KVP_EXCHANGE_MAX_*_SIZE -1 to guarantee
401 * that the strings can be properly terminated! 401 * that the strings can be properly terminated!
402 */ 402 */
403 403
@@ -483,8 +483,6 @@ kvp_send_key(struct work_struct *dummy)
483 } 483 }
484 484
485 kfree(message); 485 kfree(message);
486
487 return;
488} 486}
489 487
490/* 488/*
@@ -533,7 +531,7 @@ kvp_respond_to_host(struct hv_kvp_msg *msg_to_host, int error)
533 */ 531 */
534 if (error) { 532 if (error) {
535 /* 533 /*
536 * Something failed or we have timedout; 534 * Something failed or we have timed out;
537 * terminate the current host-side iteration. 535 * terminate the current host-side iteration.
538 */ 536 */
539 goto response_done; 537 goto response_done;
@@ -607,8 +605,8 @@ response_done:
607 * This callback is invoked when we get a KVP message from the host. 605 * This callback is invoked when we get a KVP message from the host.
608 * The host ensures that only one KVP transaction can be active at a time. 606 * The host ensures that only one KVP transaction can be active at a time.
609 * KVP implementation in Linux needs to forward the key to a user-mde 607 * KVP implementation in Linux needs to forward the key to a user-mde
610 * component to retrive the corresponding value. Consequently, we cannot 608 * component to retrieve the corresponding value. Consequently, we cannot
611 * respond to the host in the conext of this callback. Since the host 609 * respond to the host in the context of this callback. Since the host
612 * guarantees that at most only one transaction can be active at a time, 610 * guarantees that at most only one transaction can be active at a time,
613 * we stash away the transaction state in a set of global variables. 611 * we stash away the transaction state in a set of global variables.
614 */ 612 */
diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index e659d1b94a57..6831efd73394 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -212,8 +212,6 @@ static void vss_send_op(void)
212 } 212 }
213 213
214 kfree(vss_msg); 214 kfree(vss_msg);
215
216 return;
217} 215}
218 216
219static void vss_handle_request(struct work_struct *dummy) 217static void vss_handle_request(struct work_struct *dummy)
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 884f83bba1ab..6113e915c50e 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -218,8 +218,8 @@ struct hv_per_cpu_context {
218 218
219struct hv_context { 219struct hv_context {
220 /* We only support running on top of Hyper-V 220 /* We only support running on top of Hyper-V
221 * So at this point this really can only contain the Hyper-V ID 221 * So at this point this really can only contain the Hyper-V ID
222 */ 222 */
223 u64 guestid; 223 u64 guestid;
224 224
225 void *tsc_page; 225 void *tsc_page;
@@ -248,14 +248,6 @@ struct hv_context {
248 248
249extern struct hv_context hv_context; 249extern struct hv_context hv_context;
250 250
251struct hv_ring_buffer_debug_info {
252 u32 current_interrupt_mask;
253 u32 current_read_index;
254 u32 current_write_index;
255 u32 bytes_avail_toread;
256 u32 bytes_avail_towrite;
257};
258
259/* Hv Interface */ 251/* Hv Interface */
260 252
261extern int hv_init(void); 253extern int hv_init(void);
@@ -289,9 +281,6 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,
289 void *buffer, u32 buflen, u32 *buffer_actual_len, 281 void *buffer, u32 buflen, u32 *buffer_actual_len,
290 u64 *requestid, bool raw); 282 u64 *requestid, bool raw);
291 283
292void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
293 struct hv_ring_buffer_debug_info *debug_info);
294
295/* 284/*
296 * Maximum channels is determined by the size of the interrupt page 285 * Maximum channels is determined by the size of the interrupt page
297 * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt 286 * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt
@@ -376,7 +365,7 @@ struct vmbus_channel_message_table_entry {
376 void (*message_handler)(struct vmbus_channel_message_header *msg); 365 void (*message_handler)(struct vmbus_channel_message_header *msg);
377}; 366};
378 367
379extern struct vmbus_channel_message_table_entry 368extern const struct vmbus_channel_message_table_entry
380 channel_message_table[CHANNELMSG_COUNT]; 369 channel_message_table[CHANNELMSG_COUNT];
381 370
382 371
@@ -403,17 +392,17 @@ int vmbus_post_msg(void *buffer, size_t buflen, bool can_sleep);
403void vmbus_on_event(unsigned long data); 392void vmbus_on_event(unsigned long data);
404void vmbus_on_msg_dpc(unsigned long data); 393void vmbus_on_msg_dpc(unsigned long data);
405 394
406int hv_kvp_init(struct hv_util_service *); 395int hv_kvp_init(struct hv_util_service *srv);
407void hv_kvp_deinit(void); 396void hv_kvp_deinit(void);
408void hv_kvp_onchannelcallback(void *); 397void hv_kvp_onchannelcallback(void *context);
409 398
410int hv_vss_init(struct hv_util_service *); 399int hv_vss_init(struct hv_util_service *srv);
411void hv_vss_deinit(void); 400void hv_vss_deinit(void);
412void hv_vss_onchannelcallback(void *); 401void hv_vss_onchannelcallback(void *context);
413 402
414int hv_fcopy_init(struct hv_util_service *); 403int hv_fcopy_init(struct hv_util_service *srv);
415void hv_fcopy_deinit(void); 404void hv_fcopy_deinit(void);
416void hv_fcopy_onchannelcallback(void *); 405void hv_fcopy_onchannelcallback(void *context);
417void vmbus_initiate_unload(bool crash); 406void vmbus_initiate_unload(bool crash);
418 407
419static inline void hv_poll_channel(struct vmbus_channel *channel, 408static inline void hv_poll_channel(struct vmbus_channel *channel,
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index c3f1a9e33cef..1f450c39a9b0 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -75,8 +75,6 @@ static void hv_signal_on_write(u32 old_write, struct vmbus_channel *channel)
75 */ 75 */
76 if (old_write == READ_ONCE(rbi->ring_buffer->read_index)) 76 if (old_write == READ_ONCE(rbi->ring_buffer->read_index))
77 vmbus_setevent(channel); 77 vmbus_setevent(channel);
78
79 return;
80} 78}
81 79
82/* Get the next write location for the specified ring buffer. */ 80/* Get the next write location for the specified ring buffer. */
@@ -210,6 +208,7 @@ void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
210 ring_info->ring_buffer->interrupt_mask; 208 ring_info->ring_buffer->interrupt_mask;
211 } 209 }
212} 210}
211EXPORT_SYMBOL_GPL(hv_ringbuffer_get_debuginfo);
213 212
214/* Initialize the ring buffer. */ 213/* Initialize the ring buffer. */
215int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, 214int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
@@ -269,14 +268,13 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
269int hv_ringbuffer_write(struct vmbus_channel *channel, 268int hv_ringbuffer_write(struct vmbus_channel *channel,
270 const struct kvec *kv_list, u32 kv_count) 269 const struct kvec *kv_list, u32 kv_count)
271{ 270{
272 int i = 0; 271 int i;
273 u32 bytes_avail_towrite; 272 u32 bytes_avail_towrite;
274 u32 totalbytes_towrite = 0; 273 u32 totalbytes_towrite = sizeof(u64);
275
276 u32 next_write_location; 274 u32 next_write_location;
277 u32 old_write; 275 u32 old_write;
278 u64 prev_indices = 0; 276 u64 prev_indices;
279 unsigned long flags = 0; 277 unsigned long flags;
280 struct hv_ring_buffer_info *outring_info = &channel->outbound; 278 struct hv_ring_buffer_info *outring_info = &channel->outbound;
281 279
282 if (channel->rescind) 280 if (channel->rescind)
@@ -285,8 +283,6 @@ int hv_ringbuffer_write(struct vmbus_channel *channel,
285 for (i = 0; i < kv_count; i++) 283 for (i = 0; i < kv_count; i++)
286 totalbytes_towrite += kv_list[i].iov_len; 284 totalbytes_towrite += kv_list[i].iov_len;
287 285
288 totalbytes_towrite += sizeof(u64);
289
290 spin_lock_irqsave(&outring_info->ring_lock, flags); 286 spin_lock_irqsave(&outring_info->ring_lock, flags);
291 287
292 bytes_avail_towrite = hv_get_bytes_to_write(outring_info); 288 bytes_avail_towrite = hv_get_bytes_to_write(outring_info);
@@ -349,18 +345,16 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,
349 u64 *requestid, bool raw) 345 u64 *requestid, bool raw)
350{ 346{
351 u32 bytes_avail_toread; 347 u32 bytes_avail_toread;
352 u32 next_read_location = 0; 348 u32 next_read_location;
353 u64 prev_indices = 0; 349 u64 prev_indices = 0;
354 struct vmpacket_descriptor desc; 350 struct vmpacket_descriptor desc;
355 u32 offset; 351 u32 offset;
356 u32 packetlen; 352 u32 packetlen;
357 int ret = 0;
358 struct hv_ring_buffer_info *inring_info = &channel->inbound; 353 struct hv_ring_buffer_info *inring_info = &channel->inbound;
359 354
360 if (buflen <= 0) 355 if (buflen <= 0)
361 return -EINVAL; 356 return -EINVAL;
362 357
363
364 *buffer_actual_len = 0; 358 *buffer_actual_len = 0;
365 *requestid = 0; 359 *requestid = 0;
366 360
@@ -371,7 +365,7 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,
371 * No error is set when there is even no header, drivers are 365 * No error is set when there is even no header, drivers are
372 * supposed to analyze buffer_actual_len. 366 * supposed to analyze buffer_actual_len.
373 */ 367 */
374 return ret; 368 return 0;
375 } 369 }
376 370
377 init_cached_read_index(inring_info); 371 init_cached_read_index(inring_info);
@@ -417,7 +411,7 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,
417 411
418 hv_signal_on_read(channel); 412 hv_signal_on_read(channel);
419 413
420 return ret; 414 return 0;
421} 415}
422 416
423/* 417/*
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 8370b9dc6037..0087b49095eb 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -787,8 +787,6 @@ static void vmbus_shutdown(struct device *child_device)
787 787
788 if (drv->shutdown) 788 if (drv->shutdown)
789 drv->shutdown(dev); 789 drv->shutdown(dev);
790
791 return;
792} 790}
793 791
794 792
@@ -855,7 +853,7 @@ void vmbus_on_msg_dpc(unsigned long data)
855 struct hv_message *msg = (struct hv_message *)page_addr + 853 struct hv_message *msg = (struct hv_message *)page_addr +
856 VMBUS_MESSAGE_SINT; 854 VMBUS_MESSAGE_SINT;
857 struct vmbus_channel_message_header *hdr; 855 struct vmbus_channel_message_header *hdr;
858 struct vmbus_channel_message_table_entry *entry; 856 const struct vmbus_channel_message_table_entry *entry;
859 struct onmessage_work_context *ctx; 857 struct onmessage_work_context *ctx;
860 u32 message_type = msg->header.message_type; 858 u32 message_type = msg->header.message_type;
861 859