|
3 | 3 | * Copyright © 2023 Intel Corporation |
4 | 4 | */ |
5 | 5 |
|
6 | | -#ifndef _XE_DRM_H_ |
7 | | -#define _XE_DRM_H_ |
| 6 | +#ifndef _UAPI_XE_DRM_H_ |
| 7 | +#define _UAPI_XE_DRM_H_ |
8 | 8 |
|
9 | 9 | #include "drm.h" |
10 | 10 |
|
@@ -140,7 +140,7 @@ extern "C" { |
140 | 140 | * redefine the interface more easily than an ever growing struct of |
141 | 141 | * increasing complexity, and for large parts of that interface to be |
142 | 142 | * entirely optional. The downside is more pointer chasing; chasing across |
143 | | - * the boundary with pointers encapsulated inside u64. |
| 143 | + * the __user boundary with pointers encapsulated inside u64. |
144 | 144 | * |
145 | 145 | * Example chaining: |
146 | 146 | * |
@@ -1013,6 +1013,20 @@ struct drm_xe_vm_destroy { |
1013 | 1013 | * valid on VMs with DRM_XE_VM_CREATE_FLAG_FAULT_MODE set. The CPU address |
1014 | 1014 | * mirror flag are only valid for DRM_XE_VM_BIND_OP_MAP operations, the BO |
1015 | 1015 | * handle MBZ, and the BO offset MBZ. |
| 1016 | + * - %DRM_XE_VM_BIND_FLAG_MADVISE_AUTORESET - Can be used in combination with |
| 1017 | + * %DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR to reset madvises when the underlying |
| 1018 | + * CPU address space range is unmapped (typically with munmap(2) or brk(2)). |
| 1019 | + * The madvise values set with %DRM_IOCTL_XE_MADVISE are reset to the values |
| 1020 | + * that were present immediately after the %DRM_IOCTL_XE_VM_BIND. |
| 1021 | + * The reset GPU virtual address range is the intersection of the range bound |
| 1022 | + * using %DRM_IOCTL_XE_VM_BIND and the virtual CPU address space range |
| 1023 | + * unmapped. |
| 1024 | + * This functionality is present to mimic the behaviour of CPU address space |
| 1025 | + * madvises set using madvise(2), which are typically reset on unmap. |
| 1026 | + * Note: free(3) may or may not call munmap(2) and/or brk(2), and may thus |
| 1027 | + * not invoke autoreset. Neither will stack variables going out of scope. |
| 1028 | + * Therefore it's recommended to always explicitly reset the madvises when |
| 1029 | + * freeing the memory backing a region used in a %DRM_IOCTL_XE_MADVISE call. |
1016 | 1030 | * |
1017 | 1031 | * The @prefetch_mem_region_instance for %DRM_XE_VM_BIND_OP_PREFETCH can also be: |
1018 | 1032 | * - %DRM_XE_CONSULT_MEM_ADVISE_PREF_LOC, which ensures prefetching occurs in |
@@ -1119,6 +1133,7 @@ struct drm_xe_vm_bind_op { |
1119 | 1133 | #define DRM_XE_VM_BIND_FLAG_DUMPABLE (1 << 3) |
1120 | 1134 | #define DRM_XE_VM_BIND_FLAG_CHECK_PXP (1 << 4) |
1121 | 1135 | #define DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR (1 << 5) |
| 1136 | +#define DRM_XE_VM_BIND_FLAG_MADVISE_AUTORESET (1 << 6) |
1122 | 1137 | /** @flags: Bind flags */ |
1123 | 1138 | __u32 flags; |
1124 | 1139 |
|
@@ -2258,4 +2273,4 @@ struct drm_xe_vm_query_mem_range_attr { |
2258 | 2273 | } |
2259 | 2274 | #endif |
2260 | 2275 |
|
2261 | | -#endif /* _XE_DRM_H_ */ |
| 2276 | +#endif /* _UAPI_XE_DRM_H_ */ |
0 commit comments