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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 6/5/2023 12:50 PM, Alex Elder wrote:
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 <quic_pheragu@xxxxxxxxxxx>
Signed-off-by: Prakruthi Deepak Heragu <quic_pheragu@xxxxxxxxxxx>
Signed-off-by: Elliot Berman <quic_eberman@xxxxxxxxxxx>

I have a minor suggestion.  I think I'd like to look at this
again, so:

Acked-by: Alex Elder <elder@xxxxxxxxxx>

---
  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


. . .

@@ -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.

+};
+
+/**
+ * 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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux