Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef _UAPI_LINUX_VIRTIO_IOMMU_H |
| 20 | #define _UAPI_LINUX_VIRTIO_IOMMU_H |
| 21 | #include <linux/types.h> |
| 22 | #define VIRTIO_IOMMU_F_INPUT_RANGE 0 |
| 23 | #define VIRTIO_IOMMU_F_DOMAIN_RANGE 1 |
| 24 | #define VIRTIO_IOMMU_F_MAP_UNMAP 2 |
| 25 | #define VIRTIO_IOMMU_F_BYPASS 3 |
| 26 | #define VIRTIO_IOMMU_F_PROBE 4 |
| 27 | #define VIRTIO_IOMMU_F_MMIO 5 |
| 28 | struct virtio_iommu_range_64 { |
| 29 | __le64 start; |
| 30 | __le64 end; |
| 31 | }; |
| 32 | struct virtio_iommu_range_32 { |
| 33 | __le32 start; |
| 34 | __le32 end; |
| 35 | }; |
| 36 | struct virtio_iommu_config { |
| 37 | __le64 page_size_mask; |
| 38 | struct virtio_iommu_range_64 input_range; |
| 39 | struct virtio_iommu_range_32 domain_range; |
| 40 | __le32 probe_size; |
| 41 | }; |
| 42 | #define VIRTIO_IOMMU_T_ATTACH 0x01 |
| 43 | #define VIRTIO_IOMMU_T_DETACH 0x02 |
| 44 | #define VIRTIO_IOMMU_T_MAP 0x03 |
| 45 | #define VIRTIO_IOMMU_T_UNMAP 0x04 |
| 46 | #define VIRTIO_IOMMU_T_PROBE 0x05 |
| 47 | #define VIRTIO_IOMMU_S_OK 0x00 |
| 48 | #define VIRTIO_IOMMU_S_IOERR 0x01 |
| 49 | #define VIRTIO_IOMMU_S_UNSUPP 0x02 |
| 50 | #define VIRTIO_IOMMU_S_DEVERR 0x03 |
| 51 | #define VIRTIO_IOMMU_S_INVAL 0x04 |
| 52 | #define VIRTIO_IOMMU_S_RANGE 0x05 |
| 53 | #define VIRTIO_IOMMU_S_NOENT 0x06 |
| 54 | #define VIRTIO_IOMMU_S_FAULT 0x07 |
| 55 | #define VIRTIO_IOMMU_S_NOMEM 0x08 |
| 56 | struct virtio_iommu_req_head { |
| 57 | __u8 type; |
| 58 | __u8 reserved[3]; |
| 59 | }; |
| 60 | struct virtio_iommu_req_tail { |
| 61 | __u8 status; |
| 62 | __u8 reserved[3]; |
| 63 | }; |
| 64 | struct virtio_iommu_req_attach { |
| 65 | struct virtio_iommu_req_head head; |
| 66 | __le32 domain; |
| 67 | __le32 endpoint; |
| 68 | __u8 reserved[8]; |
| 69 | struct virtio_iommu_req_tail tail; |
| 70 | }; |
| 71 | struct virtio_iommu_req_detach { |
| 72 | struct virtio_iommu_req_head head; |
| 73 | __le32 domain; |
| 74 | __le32 endpoint; |
| 75 | __u8 reserved[8]; |
| 76 | struct virtio_iommu_req_tail tail; |
| 77 | }; |
| 78 | #define VIRTIO_IOMMU_MAP_F_READ (1 << 0) |
| 79 | #define VIRTIO_IOMMU_MAP_F_WRITE (1 << 1) |
| 80 | #define VIRTIO_IOMMU_MAP_F_MMIO (1 << 2) |
| 81 | #define VIRTIO_IOMMU_MAP_F_MASK (VIRTIO_IOMMU_MAP_F_READ | VIRTIO_IOMMU_MAP_F_WRITE | VIRTIO_IOMMU_MAP_F_MMIO) |
| 82 | struct virtio_iommu_req_map { |
| 83 | struct virtio_iommu_req_head head; |
| 84 | __le32 domain; |
| 85 | __le64 virt_start; |
| 86 | __le64 virt_end; |
| 87 | __le64 phys_start; |
| 88 | __le32 flags; |
| 89 | struct virtio_iommu_req_tail tail; |
| 90 | }; |
| 91 | struct virtio_iommu_req_unmap { |
| 92 | struct virtio_iommu_req_head head; |
| 93 | __le32 domain; |
| 94 | __le64 virt_start; |
| 95 | __le64 virt_end; |
| 96 | __u8 reserved[4]; |
| 97 | struct virtio_iommu_req_tail tail; |
| 98 | }; |
| 99 | #define VIRTIO_IOMMU_PROBE_T_NONE 0 |
| 100 | #define VIRTIO_IOMMU_PROBE_T_RESV_MEM 1 |
| 101 | #define VIRTIO_IOMMU_PROBE_T_MASK 0xfff |
| 102 | struct virtio_iommu_probe_property { |
| 103 | __le16 type; |
| 104 | __le16 length; |
| 105 | }; |
| 106 | #define VIRTIO_IOMMU_RESV_MEM_T_RESERVED 0 |
| 107 | #define VIRTIO_IOMMU_RESV_MEM_T_MSI 1 |
| 108 | struct virtio_iommu_probe_resv_mem { |
| 109 | struct virtio_iommu_probe_property head; |
| 110 | __u8 subtype; |
| 111 | __u8 reserved[3]; |
| 112 | __le64 start; |
| 113 | __le64 end; |
| 114 | }; |
| 115 | struct virtio_iommu_req_probe { |
| 116 | struct virtio_iommu_req_head head; |
| 117 | __le32 endpoint; |
| 118 | __u8 reserved[64]; |
| 119 | __u8 properties[]; |
| 120 | }; |
| 121 | #define VIRTIO_IOMMU_FAULT_R_UNKNOWN 0 |
| 122 | #define VIRTIO_IOMMU_FAULT_R_DOMAIN 1 |
| 123 | #define VIRTIO_IOMMU_FAULT_R_MAPPING 2 |
| 124 | #define VIRTIO_IOMMU_FAULT_F_READ (1 << 0) |
| 125 | #define VIRTIO_IOMMU_FAULT_F_WRITE (1 << 1) |
| 126 | #define VIRTIO_IOMMU_FAULT_F_EXEC (1 << 2) |
| 127 | #define VIRTIO_IOMMU_FAULT_F_ADDRESS (1 << 8) |
| 128 | struct virtio_iommu_fault { |
| 129 | __u8 reason; |
| 130 | __u8 reserved[3]; |
| 131 | __le32 flags; |
| 132 | __le32 endpoint; |
| 133 | __u8 reserved2[4]; |
| 134 | __le64 address; |
| 135 | }; |
| 136 | #endif |