aboutsummaryrefslogtreecommitdiff
path: root/memory.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-07-26 14:26:11 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2011-07-29 08:25:43 -0500
commit3e9d69e737025e987be3ce804f667ffeb07e4c53 (patch)
tree5eb0e7ced480839ed5f757f1c59244df1875128f /memory.h
parent74901c3bd06a02b54f23172cb870127b49390bd0 (diff)
memory: add ioeventfd support
As with the rest of the memory API, the caller associates an eventfd with an address, and the memory API takes care of registering or unregistering when the address is made visible or invisible to the guest. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'memory.h')
-rw-r--r--memory.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/memory.h b/memory.h
index 003c999219..c280a39d2c 100644
--- a/memory.h
+++ b/memory.h
@@ -98,6 +98,7 @@ struct MemoryRegionOps {
};
typedef struct CoalescedMemoryRange CoalescedMemoryRange;
+typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
struct MemoryRegion {
/* All fields are private - violators will be prosecuted */
@@ -120,6 +121,8 @@ struct MemoryRegion {
QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced;
const char *name;
uint8_t dirty_log_mask;
+ unsigned ioeventfd_nb;
+ MemoryRegionIoeventfd *ioeventfds;
};
struct MemoryRegionPortio {
@@ -364,6 +367,48 @@ void memory_region_add_coalescing(MemoryRegion *mr,
void memory_region_clear_coalescing(MemoryRegion *mr);
/**
+ * memory_region_add_eventfd: Request an eventfd to be triggered when a word
+ * is written to a location.
+ *
+ * Marks a word in an IO region (initialized with memory_region_init_io())
+ * as a trigger for an eventfd event. The I/O callback will not be called.
+ * The caller must be prepared to handle failure (hat is, take the required
+ * action if the callback _is_ called).
+ *
+ * @mr: the memory region being updated.
+ * @addr: the address within @mr that is to be monitored
+ * @size: the size of the access to trigger the eventfd
+ * @match_data: whether to match against @data, instead of just @addr
+ * @data: the data to match against the guest write
+ * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
+ **/
+void memory_region_add_eventfd(MemoryRegion *mr,
+ target_phys_addr_t addr,
+ unsigned size,
+ bool match_data,
+ uint64_t data,
+ int fd);
+
+/**
+ * memory_region_del_eventfd: Cancel and eventfd.
+ *
+ * Cancels an eventfd trigger request by a previous memory_region_add_eventfd()
+ * call.
+ *
+ * @mr: the memory region being updated.
+ * @addr: the address within @mr that is to be monitored
+ * @size: the size of the access to trigger the eventfd
+ * @match_data: whether to match against @data, instead of just @addr
+ * @data: the data to match against the guest write
+ * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
+ */
+void memory_region_del_eventfd(MemoryRegion *mr,
+ target_phys_addr_t addr,
+ unsigned size,
+ bool match_data,
+ uint64_t data,
+ int fd);
+/**
* memory_region_add_subregion: Add a sub-region to a container.
*
* Adds a sub-region at @offset. The sub-region may not overlap with other