On 20/01/2023 22:46, Elliot Berman wrote:
Allow userspace to attach an ioeventfd to an mmio address within the guest.
Co-developed-by: Prakruthi Deepak Heragu <quic_pheragu@xxxxxxxxxxx>
Signed-off-by: Prakruthi Deepak Heragu <quic_pheragu@xxxxxxxxxxx>
Signed-off-by: Elliot Berman <quic_eberman@xxxxxxxxxxx>
---
Documentation/virt/gunyah/vm-manager.rst | 21 +++++
drivers/virt/gunyah/Kconfig | 9 ++
drivers/virt/gunyah/Makefile | 1 +
drivers/virt/gunyah/gunyah_ioeventfd.c | 109 +++++++++++++++++++++++
include/uapi/linux/gunyah.h | 10 +++
5 files changed, 150 insertions(+)
create mode 100644 drivers/virt/gunyah/gunyah_ioeventfd.c
+MODULE_LICENSE("GPL");
diff --git a/include/uapi/linux/gunyah.h b/include/uapi/linux/gunyah.h
index a947f0317ca9..3cc387f0831a 100644
--- a/include/uapi/linux/gunyah.h
+++ b/include/uapi/linux/gunyah.h
@@ -65,11 +65,21 @@ struct gh_fn_irqfd_arg {
__u32 flags;
};
+struct gh_fn_ioeventfd_arg {
+ __u64 datamatch;
+ __u64 addr; /* legal mmio address */
+ __u32 len; /* 1, 2, 4, or 8 bytes; or 0 to ignore length */
+ __s32 fd;
+#define GH_IOEVENTFD_DATAMATCH (1UL << 0)
+ __u32 flags;
This is not naturally aligned, consider adding a reserved __u32 field to
be able to make this compatible with both 32 and 64 bit machines.
I see few other uapi structures that suffer exact same issue.
--srini
+};
+
struct gh_vm_function {
char name[GUNYAH_FUNCTION_NAME_SIZE];
union {
struct gh_fn_vcpu_arg vcpu;
struct gh_fn_irqfd_arg irqfd;
+ struct gh_fn_ioeventfd_arg ioeventfd;
char data[GUNYAH_FUNCTION_MAX_ARG_SIZE];
};
};