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 #define VIRTIO_IOMMU_F_BYPASS_CONFIG 6 29 struct virtio_iommu_range_64 { 30 __le64 start; 31 __le64 end; 32 }; 33 struct virtio_iommu_range_32 { 34 __le32 start; 35 __le32 end; 36 }; 37 struct virtio_iommu_config { 38 __le64 page_size_mask; 39 struct virtio_iommu_range_64 input_range; 40 struct virtio_iommu_range_32 domain_range; 41 __le32 probe_size; 42 __u8 bypass; 43 __u8 reserved[3]; 44 }; 45 #define VIRTIO_IOMMU_T_ATTACH 0x01 46 #define VIRTIO_IOMMU_T_DETACH 0x02 47 #define VIRTIO_IOMMU_T_MAP 0x03 48 #define VIRTIO_IOMMU_T_UNMAP 0x04 49 #define VIRTIO_IOMMU_T_PROBE 0x05 50 #define VIRTIO_IOMMU_S_OK 0x00 51 #define VIRTIO_IOMMU_S_IOERR 0x01 52 #define VIRTIO_IOMMU_S_UNSUPP 0x02 53 #define VIRTIO_IOMMU_S_DEVERR 0x03 54 #define VIRTIO_IOMMU_S_INVAL 0x04 55 #define VIRTIO_IOMMU_S_RANGE 0x05 56 #define VIRTIO_IOMMU_S_NOENT 0x06 57 #define VIRTIO_IOMMU_S_FAULT 0x07 58 #define VIRTIO_IOMMU_S_NOMEM 0x08 59 struct virtio_iommu_req_head { 60 __u8 type; 61 __u8 reserved[3]; 62 }; 63 struct virtio_iommu_req_tail { 64 __u8 status; 65 __u8 reserved[3]; 66 }; 67 #define VIRTIO_IOMMU_ATTACH_F_BYPASS (1 << 0) 68 struct virtio_iommu_req_attach { 69 struct virtio_iommu_req_head head; 70 __le32 domain; 71 __le32 endpoint; 72 __le32 flags; 73 __u8 reserved[4]; 74 struct virtio_iommu_req_tail tail; 75 }; 76 struct virtio_iommu_req_detach { 77 struct virtio_iommu_req_head head; 78 __le32 domain; 79 __le32 endpoint; 80 __u8 reserved[8]; 81 struct virtio_iommu_req_tail tail; 82 }; 83 #define VIRTIO_IOMMU_MAP_F_READ (1 << 0) 84 #define VIRTIO_IOMMU_MAP_F_WRITE (1 << 1) 85 #define VIRTIO_IOMMU_MAP_F_MMIO (1 << 2) 86 #define VIRTIO_IOMMU_MAP_F_MASK (VIRTIO_IOMMU_MAP_F_READ | VIRTIO_IOMMU_MAP_F_WRITE | VIRTIO_IOMMU_MAP_F_MMIO) 87 struct virtio_iommu_req_map { 88 struct virtio_iommu_req_head head; 89 __le32 domain; 90 __le64 virt_start; 91 __le64 virt_end; 92 __le64 phys_start; 93 __le32 flags; 94 struct virtio_iommu_req_tail tail; 95 }; 96 struct virtio_iommu_req_unmap { 97 struct virtio_iommu_req_head head; 98 __le32 domain; 99 __le64 virt_start; 100 __le64 virt_end; 101 __u8 reserved[4]; 102 struct virtio_iommu_req_tail tail; 103 }; 104 #define VIRTIO_IOMMU_PROBE_T_NONE 0 105 #define VIRTIO_IOMMU_PROBE_T_RESV_MEM 1 106 #define VIRTIO_IOMMU_PROBE_T_MASK 0xfff 107 struct virtio_iommu_probe_property { 108 __le16 type; 109 __le16 length; 110 }; 111 #define VIRTIO_IOMMU_RESV_MEM_T_RESERVED 0 112 #define VIRTIO_IOMMU_RESV_MEM_T_MSI 1 113 struct virtio_iommu_probe_resv_mem { 114 struct virtio_iommu_probe_property head; 115 __u8 subtype; 116 __u8 reserved[3]; 117 __le64 start; 118 __le64 end; 119 }; 120 struct virtio_iommu_req_probe { 121 struct virtio_iommu_req_head head; 122 __le32 endpoint; 123 __u8 reserved[64]; 124 __u8 properties[]; 125 }; 126 #define VIRTIO_IOMMU_FAULT_R_UNKNOWN 0 127 #define VIRTIO_IOMMU_FAULT_R_DOMAIN 1 128 #define VIRTIO_IOMMU_FAULT_R_MAPPING 2 129 #define VIRTIO_IOMMU_FAULT_F_READ (1 << 0) 130 #define VIRTIO_IOMMU_FAULT_F_WRITE (1 << 1) 131 #define VIRTIO_IOMMU_FAULT_F_EXEC (1 << 2) 132 #define VIRTIO_IOMMU_FAULT_F_ADDRESS (1 << 8) 133 struct virtio_iommu_fault { 134 __u8 reason; 135 __u8 reserved[3]; 136 __le32 flags; 137 __le32 endpoint; 138 __u8 reserved2[4]; 139 __le64 address; 140 }; 141 #endif 142