aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/hyperv_vmbus.h4
-rw-r--r--drivers/hv/ring_buffer.c24
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index d8d1fadb398a..3184f6ff4e74 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -570,6 +570,10 @@ u32 hv_get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info);
570void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, 570void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
571 struct hv_ring_buffer_debug_info *debug_info); 571 struct hv_ring_buffer_debug_info *debug_info);
572 572
573void hv_begin_read(struct hv_ring_buffer_info *rbi);
574
575u32 hv_end_read(struct hv_ring_buffer_info *rbi);
576
573/* 577/*
574 * Maximum channels is determined by the size of the interrupt page 578 * Maximum channels is determined by the size of the interrupt page
575 * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt 579 * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 7233c88f01b8..001079287709 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -29,6 +29,30 @@
29 29
30#include "hyperv_vmbus.h" 30#include "hyperv_vmbus.h"
31 31
32void hv_begin_read(struct hv_ring_buffer_info *rbi)
33{
34 rbi->ring_buffer->interrupt_mask = 1;
35 smp_mb();
36}
37
38u32 hv_end_read(struct hv_ring_buffer_info *rbi)
39{
40 u32 read;
41 u32 write;
42
43 rbi->ring_buffer->interrupt_mask = 0;
44 smp_mb();
45
46 /*
47 * Now check to see if the ring buffer is still empty.
48 * If it is not, we raced and we need to process new
49 * incoming messages.
50 */
51 hv_get_ringbuffer_availbytes(rbi, &read, &write);
52
53 return read;
54}
55
32 56
33/* 57/*
34 * hv_get_next_write_location() 58 * hv_get_next_write_location()