aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hv/hyperv_vmbus.h4
-rw-r--r--drivers/hv/ring_buffer.c20
-rw-r--r--include/linux/hyperv.h30
3 files changed, 30 insertions, 24 deletions
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 6a9b54677218..e15a130de3c9 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -292,10 +292,6 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,
292void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, 292void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
293 struct hv_ring_buffer_debug_info *debug_info); 293 struct hv_ring_buffer_debug_info *debug_info);
294 294
295void hv_begin_read(struct hv_ring_buffer_info *rbi);
296
297u32 hv_end_read(struct hv_ring_buffer_info *rbi);
298
299/* 295/*
300 * Maximum channels is determined by the size of the interrupt page 296 * Maximum channels is determined by the size of the interrupt page
301 * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt 297 * 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 1a1e70a45146..75c9eefd55b5 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -32,26 +32,6 @@
32 32
33#include "hyperv_vmbus.h" 33#include "hyperv_vmbus.h"
34 34
35void hv_begin_read(struct hv_ring_buffer_info *rbi)
36{
37 rbi->ring_buffer->interrupt_mask = 1;
38 virt_mb();
39}
40
41u32 hv_end_read(struct hv_ring_buffer_info *rbi)
42{
43
44 rbi->ring_buffer->interrupt_mask = 0;
45 virt_mb();
46
47 /*
48 * Now check to see if the ring buffer is still empty.
49 * If it is not, we raced and we need to process new
50 * incoming messages.
51 */
52 return hv_get_bytes_to_read(rbi);
53}
54
55/* 35/*
56 * When we write to the ring buffer, check if the host needs to 36 * When we write to the ring buffer, check if the host needs to
57 * be signaled. Here is the details of this protocol: 37 * be signaled. Here is the details of this protocol:
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 466374dbc98f..08eb71a22c14 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1513,6 +1513,36 @@ init_cached_read_index(struct vmbus_channel *channel)
1513} 1513}
1514 1514
1515/* 1515/*
1516 * Mask off host interrupt callback notifications
1517 */
1518static inline void hv_begin_read(struct hv_ring_buffer_info *rbi)
1519{
1520 rbi->ring_buffer->interrupt_mask = 1;
1521
1522 /* make sure mask update is not reordered */
1523 virt_mb();
1524}
1525
1526/*
1527 * Re-enable host callback and return number of outstanding bytes
1528 */
1529static inline u32 hv_end_read(struct hv_ring_buffer_info *rbi)
1530{
1531
1532 rbi->ring_buffer->interrupt_mask = 0;
1533
1534 /* make sure mask update is not reordered */
1535 virt_mb();
1536
1537 /*
1538 * Now check to see if the ring buffer is still empty.
1539 * If it is not, we raced and we need to process new
1540 * incoming messages.
1541 */
1542 return hv_get_bytes_to_read(rbi);
1543}
1544
1545/*
1516 * An API to support in-place processing of incoming VMBUS packets. 1546 * An API to support in-place processing of incoming VMBUS packets.
1517 */ 1547 */
1518#define VMBUS_PKT_TRAILER 8 1548#define VMBUS_PKT_TRAILER 8