|
@@ -23,6 +23,56 @@
|
|
|
|
|
|
#include "vfio_platform_private.h"
|
|
#include "vfio_platform_private.h"
|
|
|
|
|
|
|
|
+static int vfio_platform_set_irq_mask(struct vfio_platform_device *vdev,
|
|
|
|
+ unsigned index, unsigned start,
|
|
|
|
+ unsigned count, uint32_t flags,
|
|
|
|
+ void *data)
|
|
|
|
+{
|
|
|
|
+ return -EINVAL;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int vfio_platform_set_irq_unmask(struct vfio_platform_device *vdev,
|
|
|
|
+ unsigned index, unsigned start,
|
|
|
|
+ unsigned count, uint32_t flags,
|
|
|
|
+ void *data)
|
|
|
|
+{
|
|
|
|
+ return -EINVAL;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int vfio_platform_set_irq_trigger(struct vfio_platform_device *vdev,
|
|
|
|
+ unsigned index, unsigned start,
|
|
|
|
+ unsigned count, uint32_t flags,
|
|
|
|
+ void *data)
|
|
|
|
+{
|
|
|
|
+ return -EINVAL;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int vfio_platform_set_irqs_ioctl(struct vfio_platform_device *vdev,
|
|
|
|
+ uint32_t flags, unsigned index, unsigned start,
|
|
|
|
+ unsigned count, void *data)
|
|
|
|
+{
|
|
|
|
+ int (*func)(struct vfio_platform_device *vdev, unsigned index,
|
|
|
|
+ unsigned start, unsigned count, uint32_t flags,
|
|
|
|
+ void *data) = NULL;
|
|
|
|
+
|
|
|
|
+ switch (flags & VFIO_IRQ_SET_ACTION_TYPE_MASK) {
|
|
|
|
+ case VFIO_IRQ_SET_ACTION_MASK:
|
|
|
|
+ func = vfio_platform_set_irq_mask;
|
|
|
|
+ break;
|
|
|
|
+ case VFIO_IRQ_SET_ACTION_UNMASK:
|
|
|
|
+ func = vfio_platform_set_irq_unmask;
|
|
|
|
+ break;
|
|
|
|
+ case VFIO_IRQ_SET_ACTION_TRIGGER:
|
|
|
|
+ func = vfio_platform_set_irq_trigger;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!func)
|
|
|
|
+ return -ENOTTY;
|
|
|
|
+
|
|
|
|
+ return func(vdev, index, start, count, flags, data);
|
|
|
|
+}
|
|
|
|
+
|
|
int vfio_platform_irq_init(struct vfio_platform_device *vdev)
|
|
int vfio_platform_irq_init(struct vfio_platform_device *vdev)
|
|
{
|
|
{
|
|
int cnt = 0, i;
|
|
int cnt = 0, i;
|
|
@@ -35,13 +85,22 @@ int vfio_platform_irq_init(struct vfio_platform_device *vdev)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
for (i = 0; i < cnt; i++) {
|
|
for (i = 0; i < cnt; i++) {
|
|
|
|
+ int hwirq = vdev->get_irq(vdev, i);
|
|
|
|
+
|
|
|
|
+ if (hwirq < 0)
|
|
|
|
+ goto err;
|
|
|
|
+
|
|
vdev->irqs[i].flags = 0;
|
|
vdev->irqs[i].flags = 0;
|
|
vdev->irqs[i].count = 1;
|
|
vdev->irqs[i].count = 1;
|
|
|
|
+ vdev->irqs[i].hwirq = hwirq;
|
|
}
|
|
}
|
|
|
|
|
|
vdev->num_irqs = cnt;
|
|
vdev->num_irqs = cnt;
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
|
+err:
|
|
|
|
+ kfree(vdev->irqs);
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
void vfio_platform_irq_cleanup(struct vfio_platform_device *vdev)
|
|
void vfio_platform_irq_cleanup(struct vfio_platform_device *vdev)
|