These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / vfio / platform / vfio_platform_private.h
index 5d31e04..42816dd 100644 (file)
@@ -56,6 +56,10 @@ struct vfio_platform_device {
        u32                             num_irqs;
        int                             refcnt;
        struct mutex                    igate;
+       struct module                   *parent_module;
+       const char                      *compat;
+       struct module                   *reset_module;
+       struct device                   *device;
 
        /*
         * These fields should be filled by the bus specific binder
@@ -67,6 +71,16 @@ struct vfio_platform_device {
        struct resource*
                (*get_resource)(struct vfio_platform_device *vdev, int i);
        int     (*get_irq)(struct vfio_platform_device *vdev, int i);
+       int     (*reset)(struct vfio_platform_device *vdev);
+};
+
+typedef int (*vfio_platform_reset_fn_t)(struct vfio_platform_device *vdev);
+
+struct vfio_platform_reset_node {
+       struct list_head link;
+       char *compat;
+       struct module *owner;
+       vfio_platform_reset_fn_t reset;
 };
 
 extern int vfio_platform_probe_common(struct vfio_platform_device *vdev,
@@ -82,4 +96,29 @@ extern int vfio_platform_set_irqs_ioctl(struct vfio_platform_device *vdev,
                                        unsigned start, unsigned count,
                                        void *data);
 
+extern void __vfio_platform_register_reset(struct vfio_platform_reset_node *n);
+extern void vfio_platform_unregister_reset(const char *compat,
+                                          vfio_platform_reset_fn_t fn);
+#define vfio_platform_register_reset(__compat, __reset)                \
+static struct vfio_platform_reset_node __reset ## _node = {    \
+       .owner = THIS_MODULE,                                   \
+       .compat = __compat,                                     \
+       .reset = __reset,                                       \
+};                                                             \
+__vfio_platform_register_reset(&__reset ## _node)
+
+#define module_vfio_reset_handler(compat, reset)               \
+MODULE_ALIAS("vfio-reset:" compat);                            \
+static int __init reset ## _module_init(void)                  \
+{                                                              \
+       vfio_platform_register_reset(compat, reset);            \
+       return 0;                                               \
+};                                                             \
+static void __exit reset ## _module_exit(void)                 \
+{                                                              \
+       vfio_platform_unregister_reset(compat, reset);          \
+};                                                             \
+module_init(reset ## _module_init);                            \
+module_exit(reset ## _module_exit)
+
 #endif /* VFIO_PLATFORM_PRIVATE_H */