| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef __UM_VFIO_USER_H |
| 3 | #define __UM_VFIO_USER_H |
| 4 | |
| 5 | struct uml_vfio_user_device { |
| 6 | int device; |
| 7 | |
| 8 | struct { |
| 9 | uint64_t size; |
| 10 | uint64_t offset; |
| 11 | } *region; |
| 12 | int num_regions; |
| 13 | |
| 14 | int32_t *irqfd; |
| 15 | int irq_count; |
| 16 | }; |
| 17 | |
| 18 | int uml_vfio_user_open_container(void); |
| 19 | int uml_vfio_user_setup_iommu(int container); |
| 20 | |
| 21 | int uml_vfio_user_get_group_id(const char *device); |
| 22 | int uml_vfio_user_open_group(int group_id); |
| 23 | int uml_vfio_user_set_container(int container, int group); |
| 24 | int uml_vfio_user_unset_container(int container, int group); |
| 25 | |
| 26 | int uml_vfio_user_setup_device(struct uml_vfio_user_device *dev, |
| 27 | int group, const char *device); |
| 28 | void uml_vfio_user_teardown_device(struct uml_vfio_user_device *dev); |
| 29 | |
| 30 | int uml_vfio_user_activate_irq(struct uml_vfio_user_device *dev, int index); |
| 31 | void uml_vfio_user_deactivate_irq(struct uml_vfio_user_device *dev, int index); |
| 32 | int uml_vfio_user_update_irqs(struct uml_vfio_user_device *dev); |
| 33 | |
| 34 | int uml_vfio_user_cfgspace_read(struct uml_vfio_user_device *dev, |
| 35 | unsigned int offset, void *buf, int size); |
| 36 | int uml_vfio_user_cfgspace_write(struct uml_vfio_user_device *dev, |
| 37 | unsigned int offset, const void *buf, int size); |
| 38 | |
| 39 | int uml_vfio_user_bar_read(struct uml_vfio_user_device *dev, int bar, |
| 40 | unsigned int offset, void *buf, int size); |
| 41 | int uml_vfio_user_bar_write(struct uml_vfio_user_device *dev, int bar, |
| 42 | unsigned int offset, const void *buf, int size); |
| 43 | |
| 44 | #endif /* __UM_VFIO_USER_H */ |
| 45 | |