Thread (3 messages) 3 messages, 2 authors, 2023-06-09

Re: [PATCH v13 22/24] virt: gunyah: Add irqfd interface

From: Elliot Berman <hidden>
Date: 2023-06-09 18:23:06
Also in: linux-arm-msm, linux-devicetree, linux-doc, lkml


On 6/5/2023 12:50 PM, Alex Elder wrote:
On 5/9/23 3:47 PM, Elliot Berman wrote:
quoted
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>
quoted
---
  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
@@ -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),            /* ? */
The BIT macro isn't a standard C macro and isn't defined by Linux, so it 
causes compile errors at least for me when I use it in userspace.
quoted
+};
+
+/**
+ * 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.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help