Pull VFIO updates from Alex Williamson: - Cleanup vfio iommu_group creation (Christoph Hellwig) - Add individual device reset for vfio/fsl-mc (Diana Craciun) - IGD OpRegion 2.0+ support (Colin Xu) - Use modern cdev lifecycle for vfio_group (Jason Gunthorpe) - Use new mdev API in vfio_ccw (Jason Gunthorpe) * tag 'vfio-v5.16-rc1' of git://github.com/awilliam/linux-vfio: (27 commits) vfio/ccw: Convert to use vfio_register_emulated_iommu_dev() vfio/ccw: Pass vfio_ccw_private not mdev_device to various functions vfio/ccw: Use functions for alloc/free of the vfio_ccw_private vfio/ccw: Remove unneeded GFP_DMA vfio: Use cdev_device_add() instead of device_create() vfio: Use a refcount_t instead of a kref in the vfio_group vfio: Don't leak a group reference if the group already exists vfio: Do not open code the group list search in vfio_create_group() vfio: Delete vfio_get/put_group from vfio_iommu_group_notifier() vfio/pci: Add OpRegion 2.0+ Extended VBT support. vfio/iommu_type1: remove IS_IOMMU_CAP_DOMAIN_IN_CONTAINER vfio/iommu_type1: remove the "external" domain vfio/iommu_type1: initialize pgsize_bitmap in ->open vfio/spapr_tce: reject mediated devices vfio: clean up the check for mediated device in vfio_iommu_type1 vfio: remove the unused mdev iommu hook vfio: move the vfio_iommu_driver_ops interface out of <linux/vfio.h> vfio: remove unused method from vfio_iommu_driver_ops vfio: simplify iommu group allocation for mediated devices vfio: remove the iommudata hack for noiommu groups ...
Showing the changes to include (3 of 23 files). Show all
Unified · Split
| @@ -620,6 +620,20 @@ int dpcon_reset(struct fsl_mc_io *mc_io, · 619 unmodified lines | ||
| 620 | 620 | u32 cmd_flags, |
| 621 | 621 | u16 token); |
| 622 | 622 | |
| 623 | +int fsl_mc_obj_open(struct fsl_mc_io *mc_io, | |
| 624 | + u32 cmd_flags, | |
| 625 | + int obj_id, | |
| 626 | + char *obj_type, | |
| 627 | + u16 *token); | |
| 628 | + | |
| 629 | +int fsl_mc_obj_close(struct fsl_mc_io *mc_io, | |
| 630 | + u32 cmd_flags, | |
| 631 | + u16 token); | |
| 632 | + | |
| 633 | +int fsl_mc_obj_reset(struct fsl_mc_io *mc_io, | |
| 634 | + u32 cmd_flags, | |
| 635 | + u16 token); | |
| 636 | + | |
| 623 | 637 | /** |
| 624 | 638 | * struct dpcon_attr - Structure representing DPCON attributes |
| 625 | 639 | * @id: DPCON object ID |
| @@ -18,7 +18,6 @@ struct mdev_device { · 17 unmodified lines | ||
| 18 | 18 | void *driver_data; |
| 19 | 19 | struct list_head next; |
| 20 | 20 | struct mdev_type *type; |
| 21 | − struct device *iommu_device; | |
| 22 | 21 | bool active; |
| 23 | 22 | }; |
| 24 | 23 | |
| @@ -27,25 +26,6 @@ static inline struct mdev_device *to_mdev_device(struct device *dev) · 2 unmodified lines | ||
| 27 | 26 | return container_of(dev, struct mdev_device, dev); |
| 28 | 27 | } |
| 29 | 28 | |
| 30 | −/* | |
| 31 | − * Called by the parent device driver to set the device which represents | |
| 32 | − * this mdev in iommu protection scope. By default, the iommu device is | |
| 33 | − * NULL, that indicates using vendor defined isolation. | |
| 34 | − * | |
| 35 | − * @dev: the mediated device that iommu will isolate. | |
| 36 | − * @iommu_device: a pci device which represents the iommu for @dev. | |
| 37 | − */ | |
| 38 | −static inline void mdev_set_iommu_device(struct mdev_device *mdev, | |
| 39 | − struct device *iommu_device) | |
| 40 | −{ | |
| 41 | − mdev->iommu_device = iommu_device; | |
| 42 | −} | |
| 43 | − | |
| 44 | −static inline struct device *mdev_get_iommu_device(struct mdev_device *mdev) | |
| 45 | −{ | |
| 46 | − return mdev->iommu_device; | |
| 47 | −} | |
| 48 | − | |
| 49 | 29 | unsigned int mdev_get_type_group_id(struct mdev_device *mdev); |
| 50 | 30 | unsigned int mtype_get_type_group_id(struct mdev_type *mtype); |
| 51 | 31 | struct device *mtype_get_parent_dev(struct mdev_type *mtype); |
| @@ -71,68 +71,17 @@ struct vfio_device_ops { · 70 unmodified lines | ||
| 71 | 71 | int (*match)(struct vfio_device *vdev, char *buf); |
| 72 | 72 | }; |
| 73 | 73 | |
| 74 | −extern struct iommu_group *vfio_iommu_group_get(struct device *dev); | |
| 75 | −extern void vfio_iommu_group_put(struct iommu_group *group, struct device *dev); | |
| 76 | − | |
| 77 | 74 | void vfio_init_group_dev(struct vfio_device *device, struct device *dev, |
| 78 | 75 | const struct vfio_device_ops *ops); |
| 79 | 76 | void vfio_uninit_group_dev(struct vfio_device *device); |
| 80 | 77 | int vfio_register_group_dev(struct vfio_device *device); |
| 78 | +int vfio_register_emulated_iommu_dev(struct vfio_device *device); | |
| 81 | 79 | void vfio_unregister_group_dev(struct vfio_device *device); |
| 82 | 80 | extern struct vfio_device *vfio_device_get_from_dev(struct device *dev); |
| 83 | 81 | extern void vfio_device_put(struct vfio_device *device); |
| 84 | 82 | |
| 85 | 83 | int vfio_assign_device_set(struct vfio_device *device, void *set_id); |
| 86 | 84 | |
| 87 | −/* events for the backend driver notify callback */ | |
| 88 | −enum vfio_iommu_notify_type { | |
| 89 | − VFIO_IOMMU_CONTAINER_CLOSE = 0, | |
| 90 | −}; | |
| 91 | − | |
| 92 | −/** | |
| 93 | − * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks | |
| 94 | − */ | |
| 95 | −struct vfio_iommu_driver_ops { | |
| 96 | − char *name; | |
| 97 | − struct module *owner; | |
| 98 | − void *(*open)(unsigned long arg); | |
| 99 | − void (*release)(void *iommu_data); | |
| 100 | − ssize_t (*read)(void *iommu_data, char __user *buf, | |
| 101 | − size_t count, loff_t *ppos); | |
| 102 | − ssize_t (*write)(void *iommu_data, const char __user *buf, | |
| 103 | − size_t count, loff_t *size); | |
| 104 | − long (*ioctl)(void *iommu_data, unsigned int cmd, | |
| 105 | − unsigned long arg); | |
| 106 | − int (*mmap)(void *iommu_data, struct vm_area_struct *vma); | |
| 107 | − int (*attach_group)(void *iommu_data, | |
| 108 | − struct iommu_group *group); | |
| 109 | − void (*detach_group)(void *iommu_data, | |
| 110 | − struct iommu_group *group); | |
| 111 | − int (*pin_pages)(void *iommu_data, | |
| 112 | − struct iommu_group *group, | |
| 113 | − unsigned long *user_pfn, | |
| 114 | − int npage, int prot, | |
| 115 | − unsigned long *phys_pfn); | |
| 116 | − int (*unpin_pages)(void *iommu_data, | |
| 117 | − unsigned long *user_pfn, int npage); | |
| 118 | − int (*register_notifier)(void *iommu_data, | |
| 119 | − unsigned long *events, | |
| 120 | − struct notifier_block *nb); | |
| 121 | − int (*unregister_notifier)(void *iommu_data, | |
| 122 | − struct notifier_block *nb); | |
| 123 | − int (*dma_rw)(void *iommu_data, dma_addr_t user_iova, | |
| 124 | − void *data, size_t count, bool write); | |
| 125 | − struct iommu_domain *(*group_iommu_domain)(void *iommu_data, | |
| 126 | − struct iommu_group *group); | |
| 127 | − void (*notify)(void *iommu_data, | |
| 128 | − enum vfio_iommu_notify_type event); | |
| 129 | −}; | |
| 130 | − | |
| 131 | −extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops); | |
| 132 | − | |
| 133 | −extern void vfio_unregister_iommu_driver( | |
| 134 | − const struct vfio_iommu_driver_ops *ops); | |
| 135 | − | |
| 136 | 85 | /* |
| 137 | 86 | * External user API |
| 138 | 87 | */ |