Re: [PATCH v13 22/24] virt: gunyah: Add irqfd interface
From: Alex Elder <hidden>
Date: 2023-06-05 19:51:40
Also in:
linux-arm-kernel, linux-arm-msm, linux-doc, lkml
On 5/9/23 3:47 PM, Elliot Berman wrote:
Enable support for creating irqfds which can raise an interrupt on a Gunyah virtual machine. irqfds are exposed to userspace as a Gunyah VM function with the name "irqfd". If the VM devicetree is not configured to create a doorbell with the corresponding label, userspace will still be able to assert the eventfd but no interrupt will be raised on the guest. Co-developed-by: Prakruthi Deepak Heragu <redacted> Signed-off-by: Prakruthi Deepak Heragu <redacted> Signed-off-by: Elliot Berman <redacted>
I have a minor suggestion. I think I'd like to look at this again, so: Acked-by: Alex Elder <redacted>
--- Documentation/virt/gunyah/vm-manager.rst | 2 +- drivers/virt/gunyah/Kconfig | 9 ++ drivers/virt/gunyah/Makefile | 1 + drivers/virt/gunyah/gunyah_irqfd.c | 180 +++++++++++++++++++++++ include/uapi/linux/gunyah.h | 35 +++++ 5 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 drivers/virt/gunyah/gunyah_irqfd.c
. . .
quoted hunk ↗ jump to hunk
@@ -99,6 +102,38 @@ struct gh_fn_vcpu_arg { __u32 id; }; +/** + * enum gh_irqfd_flags - flags for use in gh_fn_irqfd_arg + * @GH_IRQFD_FLAGS_LEVEL: make the interrupt operate like a level triggered + * interrupt on guest side. Triggering IRQFD before + * guest handles the interrupt causes interrupt to + * stay asserted. + */ +enum gh_irqfd_flags { + GH_IRQFD_FLAGS_LEVEL = 1UL << 0,
BIT(0), /* ? */
+};
+
+/**
+ * struct gh_fn_irqfd_arg - Arguments to create an irqfd function.
+ *
+ * Create this function with &GH_VM_ADD_FUNCTION using type &GH_FN_IRQFD.
+ *
+ * Allows setting an eventfd to directly trigger a guest interrupt.
+ * irqfd.fd specifies the file descriptor to use as the eventfd.
+ * irqfd.label corresponds to the doorbell label used in the guest VM's devicetree.
+ *
+ * @fd: an eventfd which when written to will raise a doorbell
+ * @label: Label of the doorbell created on the guest VM
+ * @flags: see &enum gh_irqfd_flags
+ * @padding: padding bytes
+ */
+struct gh_fn_irqfd_arg {
+ __u32 fd;
+ __u32 label;
+ __u32 flags;
+ __u32 padding;
+};
+
/**
* struct gh_fn_desc - Arguments to create a VM function
* @type: Type of the function. See &enum gh_fn_type.