blob: 3a7bf82f6603fa4e52c671f3cbada9de4f8d62b2 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferrisb8a95e22019-10-02 18:29:20 -07007#ifndef _UAPI_IOMMU_H
8#define _UAPI_IOMMU_H
9#include <linux/types.h>
10#define IOMMU_FAULT_PERM_READ (1 << 0)
11#define IOMMU_FAULT_PERM_WRITE (1 << 1)
12#define IOMMU_FAULT_PERM_EXEC (1 << 2)
13#define IOMMU_FAULT_PERM_PRIV (1 << 3)
14enum iommu_fault_type {
15 IOMMU_FAULT_DMA_UNRECOV = 1,
16 IOMMU_FAULT_PAGE_REQ,
17};
18enum iommu_fault_reason {
19 IOMMU_FAULT_REASON_UNKNOWN = 0,
20 IOMMU_FAULT_REASON_PASID_FETCH,
21 IOMMU_FAULT_REASON_BAD_PASID_ENTRY,
22 IOMMU_FAULT_REASON_PASID_INVALID,
23 IOMMU_FAULT_REASON_WALK_EABT,
24 IOMMU_FAULT_REASON_PTE_FETCH,
25 IOMMU_FAULT_REASON_PERMISSION,
26 IOMMU_FAULT_REASON_ACCESS,
27 IOMMU_FAULT_REASON_OOR_ADDRESS,
28};
29struct iommu_fault_unrecoverable {
30 __u32 reason;
31#define IOMMU_FAULT_UNRECOV_PASID_VALID (1 << 0)
32#define IOMMU_FAULT_UNRECOV_ADDR_VALID (1 << 1)
33#define IOMMU_FAULT_UNRECOV_FETCH_ADDR_VALID (1 << 2)
34 __u32 flags;
35 __u32 pasid;
36 __u32 perm;
37 __u64 addr;
38 __u64 fetch_addr;
39};
40struct iommu_fault_page_request {
41#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
42#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
43#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
Christopher Ferris25c18d42020-10-14 17:42:58 -070044#define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070045 __u32 flags;
46 __u32 pasid;
47 __u32 grpid;
48 __u32 perm;
49 __u64 addr;
50 __u64 private_data[2];
51};
52struct iommu_fault {
53 __u32 type;
54 __u32 padding;
55 union {
56 struct iommu_fault_unrecoverable event;
57 struct iommu_fault_page_request prm;
58 __u8 padding2[56];
59 };
60};
61enum iommu_page_response_code {
62 IOMMU_PAGE_RESP_SUCCESS = 0,
63 IOMMU_PAGE_RESP_INVALID,
64 IOMMU_PAGE_RESP_FAILURE,
65};
66struct iommu_page_response {
Christopher Ferris32ff3f82020-12-14 13:10:04 -080067 __u32 argsz;
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070068#define IOMMU_PAGE_RESP_VERSION_1 1
69 __u32 version;
70#define IOMMU_PAGE_RESP_PASID_VALID (1 << 0)
71 __u32 flags;
72 __u32 pasid;
73 __u32 grpid;
74 __u32 code;
75};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070076#endif