]> git.proxmox.com Git - mirror_qemu.git/blob - include/sysemu/iommufd.h
backends/iommufd: Remove mutex
[mirror_qemu.git] / include / sysemu / iommufd.h
1 #ifndef SYSEMU_IOMMUFD_H
2 #define SYSEMU_IOMMUFD_H
3
4 #include "qom/object.h"
5 #include "exec/hwaddr.h"
6 #include "exec/cpu-common.h"
7
8 #define TYPE_IOMMUFD_BACKEND "iommufd"
9 OBJECT_DECLARE_TYPE(IOMMUFDBackend, IOMMUFDBackendClass, IOMMUFD_BACKEND)
10
11 struct IOMMUFDBackendClass {
12 ObjectClass parent_class;
13 };
14
15 struct IOMMUFDBackend {
16 Object parent;
17
18 /*< protected >*/
19 int fd; /* /dev/iommu file descriptor */
20 bool owned; /* is the /dev/iommu opened internally */
21 uint32_t users;
22
23 /*< public >*/
24 };
25
26 int iommufd_backend_connect(IOMMUFDBackend *be, Error **errp);
27 void iommufd_backend_disconnect(IOMMUFDBackend *be);
28
29 int iommufd_backend_alloc_ioas(IOMMUFDBackend *be, uint32_t *ioas_id,
30 Error **errp);
31 void iommufd_backend_free_id(IOMMUFDBackend *be, uint32_t id);
32 int iommufd_backend_map_dma(IOMMUFDBackend *be, uint32_t ioas_id, hwaddr iova,
33 ram_addr_t size, void *vaddr, bool readonly);
34 int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t ioas_id,
35 hwaddr iova, ram_addr_t size);
36 #endif