@zigc/lib 0.16.0 → 0.17.0-dev.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/c/fcntl.zig +6 -1
  2. package/c/inttypes.zig +0 -10
  3. package/c/math.zig +46 -122
  4. package/c/pthread.zig +57 -0
  5. package/c/search.zig +1 -27
  6. package/c/stdlib/drand48.zig +0 -57
  7. package/c/stdlib.zig +0 -100
  8. package/c/string.zig +20 -7
  9. package/c/strings.zig +0 -38
  10. package/c/unistd.zig +27 -26
  11. package/c/wchar.zig +10 -0
  12. package/c.zig +2 -2
  13. package/compiler/aro/aro/CodeGen.zig +5 -6
  14. package/compiler/aro/aro/Compilation.zig +17 -14
  15. package/compiler/aro/aro/Driver.zig +14 -13
  16. package/compiler/aro/aro/Parser.zig +20 -15
  17. package/compiler/aro/aro/Pragma.zig +3 -2
  18. package/compiler/aro/aro/Preprocessor.zig +9 -6
  19. package/compiler/aro/aro/pragmas/message.zig +3 -2
  20. package/compiler/aro/aro/text_literal.zig +3 -2
  21. package/compiler/aro/assembly_backend/x86_64.zig +4 -4
  22. package/compiler/build_runner.zig +0 -2
  23. package/compiler/reduce/Walk.zig +7 -7
  24. package/compiler/test_runner.zig +2 -2
  25. package/compiler/translate-c/Translator.zig +6 -2
  26. package/compiler/translate-c/main.zig +1 -1
  27. package/compiler_rt/cos.zig +0 -2
  28. package/compiler_rt/divmodei4.zig +40 -17
  29. package/compiler_rt/exp.zig +1 -6
  30. package/compiler_rt/exp2.zig +1 -6
  31. package/compiler_rt/exp_f128.zig +377 -0
  32. package/compiler_rt/fabs.zig +0 -2
  33. package/compiler_rt/fma.zig +0 -2
  34. package/compiler_rt/fmax.zig +0 -2
  35. package/compiler_rt/fmin.zig +0 -2
  36. package/compiler_rt/fmod.zig +0 -2
  37. package/compiler_rt/limb64.zig +876 -15
  38. package/compiler_rt/log.zig +0 -2
  39. package/compiler_rt/log10.zig +0 -2
  40. package/compiler_rt/log2.zig +0 -2
  41. package/compiler_rt/mulXi3.zig +1 -1
  42. package/compiler_rt/round.zig +0 -2
  43. package/compiler_rt/sin.zig +0 -2
  44. package/compiler_rt/sincos.zig +0 -2
  45. package/compiler_rt/sqrt.zig +0 -2
  46. package/compiler_rt/ssp.zig +1 -1
  47. package/compiler_rt/tan.zig +0 -2
  48. package/compiler_rt/trunc.zig +0 -2
  49. package/compiler_rt/udivmodei4.zig +28 -0
  50. package/fuzzer.zig +2 -0
  51. package/libc/include/aarch64-linux-any/asm/hwcap.h +1 -0
  52. package/libc/include/aarch64-linux-any/asm/unistd_64.h +1 -0
  53. package/libc/include/any-linux-any/asm-generic/errno.h +2 -0
  54. package/libc/include/any-linux-any/asm-generic/unistd.h +4 -1
  55. package/libc/include/any-linux-any/drm/amdgpu_drm.h +20 -6
  56. package/libc/include/any-linux-any/drm/amdxdna_accel.h +8 -0
  57. package/libc/include/any-linux-any/drm/drm_fourcc.h +6 -6
  58. package/libc/include/any-linux-any/drm/panfrost_drm.h +75 -1
  59. package/libc/include/any-linux-any/drm/panthor_drm.h +154 -3
  60. package/libc/include/any-linux-any/drm/rocket_accel.h +74 -24
  61. package/libc/include/any-linux-any/drm/xe_drm.h +89 -6
  62. package/libc/include/any-linux-any/linux/android/binder.h +1 -1
  63. package/libc/include/any-linux-any/linux/bpf.h +28 -0
  64. package/libc/include/any-linux-any/linux/btrfs.h +1 -0
  65. package/libc/include/any-linux-any/linux/btrfs_tree.h +32 -2
  66. package/libc/include/any-linux-any/linux/dma-buf.h +1 -0
  67. package/libc/include/any-linux-any/linux/dpll.h +1 -0
  68. package/libc/include/any-linux-any/linux/elf.h +2 -0
  69. package/libc/include/any-linux-any/linux/ethtool.h +21 -5
  70. package/libc/include/any-linux-any/linux/fs.h +1 -0
  71. package/libc/include/any-linux-any/linux/hyperv.h +1 -1
  72. package/libc/include/any-linux-any/linux/idxd.h +134 -134
  73. package/libc/include/any-linux-any/linux/if_alg.h +1 -1
  74. package/libc/include/any-linux-any/linux/if_link.h +1 -0
  75. package/libc/include/any-linux-any/linux/input-event-codes.h +4 -0
  76. package/libc/include/any-linux-any/linux/io_uring/bpf_filter.h +68 -0
  77. package/libc/include/any-linux-any/linux/io_uring/query.h +5 -1
  78. package/libc/include/any-linux-any/linux/io_uring.h +33 -2
  79. package/libc/include/any-linux-any/linux/iommufd.h +39 -0
  80. package/libc/include/any-linux-any/linux/kfd_ioctl.h +13 -3
  81. package/libc/include/any-linux-any/linux/kfd_sysfs.h +2 -1
  82. package/libc/include/any-linux-any/linux/kvm.h +30 -6
  83. package/libc/include/any-linux-any/linux/landlock.h +22 -8
  84. package/libc/include/any-linux-any/linux/magic.h +1 -0
  85. package/libc/include/any-linux-any/linux/mempolicy.h +3 -0
  86. package/libc/include/any-linux-any/linux/mount.h +11 -2
  87. package/libc/include/any-linux-any/linux/mptcp_pm.h +1 -1
  88. package/libc/include/any-linux-any/linux/mshv.h +2 -0
  89. package/libc/include/any-linux-any/linux/netfilter_bridge.h +5 -4
  90. package/libc/include/any-linux-any/linux/netfilter_ipv4.h +4 -5
  91. package/libc/include/any-linux-any/linux/netfilter_ipv6.h +3 -4
  92. package/libc/include/any-linux-any/linux/nfs.h +1 -1
  93. package/libc/include/any-linux-any/linux/nfsd_netlink.h +1 -0
  94. package/libc/include/any-linux-any/linux/nilfs2_api.h +2 -2
  95. package/libc/include/any-linux-any/linux/nilfs2_ondisk.h +97 -66
  96. package/libc/include/any-linux-any/linux/nl80211.h +104 -3
  97. package/libc/include/any-linux-any/linux/pci.h +7 -0
  98. package/libc/include/any-linux-any/linux/pci_regs.h +65 -6
  99. package/libc/include/any-linux-any/linux/pcitest.h +1 -0
  100. package/libc/include/any-linux-any/linux/perf_event.h +24 -3
  101. package/libc/include/any-linux-any/linux/pkt_sched.h +1 -0
  102. package/libc/include/any-linux-any/linux/prctl.h +30 -0
  103. package/libc/include/any-linux-any/linux/rseq.h +62 -5
  104. package/libc/include/any-linux-any/linux/shm.h +0 -1
  105. package/libc/include/any-linux-any/linux/stddef.h +4 -0
  106. package/libc/include/any-linux-any/linux/sysctl.h +1 -2
  107. package/libc/include/any-linux-any/linux/taskstats.h +12 -1
  108. package/libc/include/any-linux-any/linux/tcp.h +23 -3
  109. package/libc/include/any-linux-any/linux/typelimits.h +8 -0
  110. package/libc/include/any-linux-any/linux/ublk_cmd.h +120 -1
  111. package/libc/include/any-linux-any/linux/v4l2-controls.h +63 -0
  112. package/libc/include/any-linux-any/linux/vbox_vmmdev_types.h +2 -2
  113. package/libc/include/any-linux-any/linux/vduse.h +80 -5
  114. package/libc/include/any-linux-any/linux/version.h +3 -3
  115. package/libc/include/any-linux-any/linux/vfio.h +4 -0
  116. package/libc/include/any-linux-any/linux/videodev2.h +3 -0
  117. package/libc/include/any-linux-any/linux/virtio_ring.h +1 -2
  118. package/libc/include/any-linux-any/linux/vmclock-abi.h +20 -0
  119. package/libc/include/any-linux-any/rdma/bnxt_re-abi.h +16 -0
  120. package/libc/include/any-linux-any/rdma/ib_user_ioctl_cmds.h +16 -0
  121. package/libc/include/any-linux-any/rdma/mana-abi.h +3 -0
  122. package/libc/include/any-linux-any/scsi/scsi_bsg_ufs.h +8 -9
  123. package/libc/include/any-linux-any/sound/sof/tokens.h +6 -0
  124. package/libc/include/arc-linux-any/asm/swab.h +0 -63
  125. package/libc/include/arc-linux-any/asm/unistd_32.h +1 -0
  126. package/libc/include/arm-linux-any/asm/ptrace.h +0 -9
  127. package/libc/include/arm-linux-any/asm/unistd-eabi.h +1 -0
  128. package/libc/include/arm-linux-any/asm/unistd-oabi.h +1 -0
  129. package/libc/include/csky-linux-any/asm/unistd_32.h +1 -0
  130. package/libc/include/hexagon-linux-any/asm/unistd_32.h +1 -0
  131. package/libc/include/loongarch-linux-any/asm/hwcap.h +1 -0
  132. package/libc/include/loongarch-linux-any/asm/kvm.h +1 -0
  133. package/libc/include/loongarch-linux-any/asm/kvm_para.h +1 -0
  134. package/libc/include/loongarch-linux-any/asm/unistd_32.h +2 -0
  135. package/libc/include/loongarch-linux-any/asm/unistd_64.h +2 -0
  136. package/libc/include/m68k-linux-any/asm/unistd_32.h +1 -0
  137. package/libc/include/mips-linux-any/asm/errno.h +2 -0
  138. package/libc/include/mips-linux-any/asm/unistd_n32.h +1 -0
  139. package/libc/include/mips-linux-any/asm/unistd_n64.h +1 -0
  140. package/libc/include/mips-linux-any/asm/unistd_o32.h +1 -0
  141. package/libc/include/powerpc-linux-any/asm/unistd_32.h +1 -0
  142. package/libc/include/powerpc-linux-any/asm/unistd_64.h +1 -0
  143. package/libc/include/riscv-linux-any/asm/hwprobe.h +4 -0
  144. package/libc/include/riscv-linux-any/asm/kvm.h +3 -0
  145. package/libc/include/riscv-linux-any/asm/ptrace.h +37 -0
  146. package/libc/include/riscv-linux-any/asm/sigcontext.h +1 -0
  147. package/libc/include/riscv-linux-any/asm/unistd_32.h +1 -0
  148. package/libc/include/riscv-linux-any/asm/unistd_64.h +1 -0
  149. package/libc/include/s390x-linux-any/asm/unistd_64.h +1 -0
  150. package/libc/include/sparc-linux-any/asm/errno.h +2 -0
  151. package/libc/include/sparc-linux-any/asm/ioctls.h +4 -4
  152. package/libc/include/sparc-linux-any/asm/unistd_32.h +2 -0
  153. package/libc/include/sparc-linux-any/asm/unistd_64.h +2 -0
  154. package/libc/include/x86-linux-any/asm/auxvec.h +0 -4
  155. package/libc/include/x86-linux-any/asm/kvm.h +13 -8
  156. package/libc/include/x86-linux-any/asm/svm.h +16 -16
  157. package/libc/include/x86-linux-any/asm/unistd_32.h +1 -0
  158. package/libc/include/x86-linux-any/asm/unistd_64.h +1 -0
  159. package/libc/include/x86-linux-any/asm/unistd_x32.h +1 -0
  160. package/libc/include/xtensa-linux-any/asm/unistd_32.h +1 -0
  161. package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
  162. package/package.json +1 -1
  163. package/std/Build/Cache.zig +6 -6
  164. package/std/Build/Step/Compile.zig +0 -1
  165. package/std/Build/Step/Run.zig +2 -2
  166. package/std/Build/Step.zig +2 -4
  167. package/std/Build/WebServer.zig +2 -2
  168. package/std/Build.zig +0 -3
  169. package/std/Io/Dir.zig +7 -2
  170. package/std/Io/Dispatch.zig +3 -13
  171. package/std/Io/File/Writer.zig +8 -6
  172. package/std/Io/Reader.zig +8 -9
  173. package/std/Io/Semaphore.zig +112 -17
  174. package/std/Io/Terminal.zig +1 -1
  175. package/std/Io/Threaded.zig +171 -37
  176. package/std/Io/Uring.zig +13 -15
  177. package/std/Io/Writer.zig +46 -42
  178. package/std/Io/net.zig +11 -11
  179. package/std/Io.zig +90 -26
  180. package/std/SemanticVersion.zig +1 -1
  181. package/std/Target/Query.zig +2 -2
  182. package/std/Target.zig +50 -5
  183. package/std/array_hash_map.zig +9 -18
  184. package/std/builtin.zig +4 -0
  185. package/std/c/haiku.zig +3 -0
  186. package/std/c/serenity.zig +1 -6
  187. package/std/c.zig +89 -7
  188. package/std/compress/flate/Decompress.zig +2 -3
  189. package/std/compress/zstd/Decompress.zig +2 -4
  190. package/std/crypto/Certificate.zig +13 -1
  191. package/std/crypto/ascon.zig +75 -33
  192. package/std/crypto/codecs/asn1/Oid.zig +12 -1
  193. package/std/crypto/codecs/base64_hex_ct.zig +2 -4
  194. package/std/crypto/ml_kem.zig +2 -9
  195. package/std/crypto/tls/Client.zig +79 -4
  196. package/std/crypto/tls.zig +1 -1
  197. package/std/crypto.zig +1 -0
  198. package/std/debug/Pdb.zig +1 -1
  199. package/std/debug.zig +4 -3
  200. package/std/fmt.zig +8 -3
  201. package/std/fs/path.zig +6 -4
  202. package/std/heap/BufferFirstAllocator.zig +165 -0
  203. package/std/heap.zig +2 -126
  204. package/std/http/Client.zig +21 -24
  205. package/std/http.zig +3 -4
  206. package/std/json/Scanner.zig +2 -2
  207. package/std/os/emscripten.zig +1 -1
  208. package/std/os/linux/IoUring.zig +2 -0
  209. package/std/os/linux/aarch64.zig +41 -12
  210. package/std/os/linux/arc.zig +173 -0
  211. package/std/os/linux/arm.zig +41 -12
  212. package/std/os/linux/hexagon.zig +33 -11
  213. package/std/os/linux/loongarch32.zig +41 -13
  214. package/std/os/linux/loongarch64.zig +41 -12
  215. package/std/os/linux/m68k.zig +41 -13
  216. package/std/os/linux/mips.zig +67 -36
  217. package/std/os/linux/mips64.zig +60 -29
  218. package/std/os/linux/mipsn32.zig +60 -29
  219. package/std/os/linux/or1k.zig +41 -12
  220. package/std/os/linux/powerpc.zig +41 -12
  221. package/std/os/linux/powerpc64.zig +41 -12
  222. package/std/os/linux/riscv32.zig +41 -12
  223. package/std/os/linux/riscv64.zig +41 -12
  224. package/std/os/linux/s390x.zig +44 -7
  225. package/std/os/linux/sparc64.zig +83 -52
  226. package/std/os/linux/syscalls.zig +26 -1
  227. package/std/os/linux/thumb.zig +52 -36
  228. package/std/os/linux/x32.zig +41 -12
  229. package/std/os/linux/x86.zig +42 -13
  230. package/std/os/linux/x86_64.zig +41 -12
  231. package/std/os/linux.zig +412 -436
  232. package/std/os/uefi/tables/boot_services.zig +9 -8
  233. package/std/os.zig +41 -0
  234. package/std/process.zig +1 -1
  235. package/std/sort.zig +3 -3
  236. package/std/zig/Ast/Render.zig +3 -3
  237. package/std/zig/AstGen.zig +44 -98
  238. package/std/zig/AstRlAnnotate.zig +0 -11
  239. package/std/zig/BuiltinFn.zig +0 -32
  240. package/std/zig/LibCInstallation.zig +4 -3
  241. package/std/zig/Parse.zig +7 -7
  242. package/std/zig/WindowsSdk.zig +13 -13
  243. package/std/zig/Zir.zig +50 -63
  244. package/std/zig/ZonGen.zig +6 -5
  245. package/std/zig/llvm/Builder.zig +12 -12
  246. package/std/zig.zig +1 -10
  247. package/std/zip.zig +5 -5
  248. package/zig.h +340 -1
  249. package/libc/include/hexagon-linux-any/asm/signal.h +0 -29
  250. package/libc/include/s390x-linux-any/asm/tape390.h +0 -103
  251. package/libc/mingw/math/fdiml.c +0 -24
  252. package/libc/mingw/winpthreads/spinlock.c +0 -82
  253. package/libc/musl/src/linux/tee.c +0 -8
  254. package/libc/musl/src/math/fdimf.c +0 -10
  255. package/libc/musl/src/math/fdiml.c +0 -18
  256. package/libc/musl/src/string/strdup.c +0 -10
  257. package/libc/musl/src/string/strndup.c +0 -12
  258. package/libc/musl/src/string/wcsdup.c +0 -10
  259. package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
  260. package/libc/musl/src/thread/pthread_spin_init.c +0 -6
  261. package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
  262. package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
  263. package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
  264. package/libc/musl/src/unistd/dup2.c +0 -20
  265. package/libc/musl/src/unistd/dup3.c +0 -26
  266. package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
  267. package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
  268. package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
@@ -443,8 +443,6 @@ pub fn logq(a: f128) callconv(.c) f128 {
443
443
 
444
444
  pub fn logl(x: c_longdouble) callconv(.c) c_longdouble {
445
445
  switch (@typeInfo(c_longdouble).float.bits) {
446
- 16 => return __logh(x),
447
- 32 => return logf(x),
448
446
  64 => return log(x),
449
447
  80 => return __logx(x),
450
448
  128 => return logq(x),
@@ -177,8 +177,6 @@ pub fn log10q(a: f128) callconv(.c) f128 {
177
177
 
178
178
  pub fn log10l(x: c_longdouble) callconv(.c) c_longdouble {
179
179
  switch (@typeInfo(c_longdouble).float.bits) {
180
- 16 => return __log10h(x),
181
- 32 => return log10f(x),
182
180
  64 => return log10(x),
183
181
  80 => return __log10x(x),
184
182
  128 => return log10q(x),
@@ -170,8 +170,6 @@ pub fn log2q(a: f128) callconv(.c) f128 {
170
170
 
171
171
  pub fn log2l(x: c_longdouble) callconv(.c) c_longdouble {
172
172
  switch (@typeInfo(c_longdouble).float.bits) {
173
- 16 => return __log2h(x),
174
- 32 => return log2f(x),
175
173
  64 => return log2(x),
176
174
  80 => return __log2x(x),
177
175
  128 => return log2q(x),
@@ -63,7 +63,7 @@ fn DoubleInt(comptime T: type) type {
63
63
  };
64
64
  }
65
65
 
66
- fn muldXi(comptime T: type, a: T, b: T) DoubleInt(T) {
66
+ pub fn muldXi(comptime T: type, a: T, b: T) DoubleInt(T) {
67
67
  const DT = DoubleInt(T);
68
68
  const word_t = compiler_rt.HalveInt(DT, false);
69
69
  const bits_in_word_2 = @sizeOf(T) * 8 / 2;
@@ -142,8 +142,6 @@ pub fn roundq(x_: f128) callconv(.c) f128 {
142
142
 
143
143
  pub fn roundl(x: c_longdouble) callconv(.c) c_longdouble {
144
144
  switch (@typeInfo(c_longdouble).float.bits) {
145
- 16 => return __roundh(x),
146
- 32 => return roundf(x),
147
145
  64 => return round(x),
148
146
  80 => return __roundx(x),
149
147
  128 => return roundq(x),
@@ -189,8 +189,6 @@ pub fn sinq(x: f128) callconv(.c) f128 {
189
189
 
190
190
  pub fn sinl(x: c_longdouble) callconv(.c) c_longdouble {
191
191
  switch (@typeInfo(c_longdouble).float.bits) {
192
- 16 => return sinh(x),
193
- 32 => return sinf(x),
194
192
  64 => return sin(x),
195
193
  80 => return sinx(x),
196
194
  128 => return sinq(x),
@@ -292,8 +292,6 @@ pub fn sincosq(x: f128, r_sin: *f128, r_cos: *f128) callconv(.c) void {
292
292
 
293
293
  pub fn sincosl(x: c_longdouble, r_sin: *c_longdouble, r_cos: *c_longdouble) callconv(.c) void {
294
294
  switch (@typeInfo(c_longdouble).float.bits) {
295
- 16 => return sincosh(x, r_sin, r_cos),
296
- 32 => return sincosf(x, r_sin, r_cos),
297
295
  64 => return sincos(x, r_sin, r_cos),
298
296
  80 => return sincosx(x, r_sin, r_cos),
299
297
  128 => return sincosq(x, r_sin, r_cos),
@@ -481,8 +481,6 @@ fn _Qp_sqrt(c: *f128, a: *f128) callconv(.c) void {
481
481
 
482
482
  pub fn sqrtl(x: c_longdouble) callconv(.c) c_longdouble {
483
483
  switch (@typeInfo(c_longdouble).float.bits) {
484
- 16 => return __sqrth(x),
485
- 32 => return sqrtf(x),
486
484
  64 => return sqrt(x),
487
485
  80 => return __sqrtx(x),
488
486
  128 => return sqrtq(x),
@@ -24,7 +24,7 @@ extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.c) ?[*]u8
24
24
  comptime {
25
25
  @export(&__stack_chk_fail, .{ .name = if (builtin.os.tag == .openbsd) "__stack_smash_handler" else "__stack_chk_fail", .linkage = compiler_rt.linkage, .visibility = compiler_rt.visibility });
26
26
  symbol(&__chk_fail, "__chk_fail");
27
- symbol(&__stack_chk_guard, "__stack_chk_guard");
27
+ symbol(&__stack_chk_guard, if (builtin.os.tag == .openbsd) "__guard_local" else "__stack_chk_guard");
28
28
  symbol(&__strcpy_chk, "__strcpy_chk");
29
29
  symbol(&__strncpy_chk, "__strncpy_chk");
30
30
  symbol(&__strcat_chk, "__strcat_chk");
@@ -164,8 +164,6 @@ pub fn tanq(x: f128) callconv(.c) f128 {
164
164
 
165
165
  pub fn tanl(x: c_longdouble) callconv(.c) c_longdouble {
166
166
  switch (@typeInfo(c_longdouble).float.bits) {
167
- 16 => return tanh(x),
168
- 32 => return tanf(x),
169
167
  64 => return tan(x),
170
168
  80 => return tanx(x),
171
169
  128 => return tanq(x),
@@ -99,8 +99,6 @@ pub fn truncq(x: f128) callconv(.c) f128 {
99
99
 
100
100
  pub fn truncl(x: c_longdouble) callconv(.c) c_longdouble {
101
101
  switch (@typeInfo(c_longdouble).float.bits) {
102
- 16 => return __trunch(x),
103
- 32 => return truncf(x),
104
102
  64 => return trunc(x),
105
103
  80 => return __truncx(x),
106
104
  128 => return truncq(x),
@@ -13,6 +13,8 @@ const max_limbs = std.math.divCeil(usize, 65535, 32) catch unreachable; // max s
13
13
  comptime {
14
14
  symbol(&__udivei4, "__udivei4");
15
15
  symbol(&__umodei4, "__umodei4");
16
+ symbol(&__udivei5, "__udivei5");
17
+ symbol(&__umodei5, "__umodei5");
16
18
  }
17
19
 
18
20
  /// Get the value of a limb.
@@ -132,6 +134,32 @@ pub fn __umodei4(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) ca
132
134
  @call(.always_inline, divmod, .{ null, r, u, v }) catch unreachable;
133
135
  }
134
136
 
137
+ pub fn __udivei5(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, t_p: [*]u8, bits: usize) callconv(.c) void {
138
+ @setRuntimeSafety(compiler_rt.test_safety);
139
+ const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
140
+ const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size]));
141
+ const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
142
+ const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size]));
143
+ const tu: []u32 = @ptrCast(@alignCast(t_p[0..byte_size]));
144
+ _ = tu;
145
+ const tv: []u32 = @ptrCast(@alignCast(t_p[byte_size..][0..byte_size]));
146
+ _ = tv;
147
+ @call(.always_inline, divmod, .{ q, null, u, v }) catch unreachable;
148
+ }
149
+
150
+ pub fn __umodei5(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, t_p: [*]u8, bits: usize) callconv(.c) void {
151
+ @setRuntimeSafety(compiler_rt.test_safety);
152
+ const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
153
+ const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size]));
154
+ const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
155
+ const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size]));
156
+ const tu: []u32 = @ptrCast(@alignCast(t_p[0..byte_size]));
157
+ _ = tu;
158
+ const tv: []u32 = @ptrCast(@alignCast(t_p[byte_size..][0..byte_size]));
159
+ _ = tv;
160
+ @call(.always_inline, divmod, .{ null, r, u, v }) catch unreachable;
161
+ }
162
+
135
163
  test "__udivei4/__umodei4" {
136
164
  if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
137
165
  if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
package/fuzzer.zig CHANGED
@@ -171,6 +171,8 @@ const Executable = struct {
171
171
 
172
172
  const cache_dir = Io.Dir.cwd().createDirPathOpen(io, cache_dir_path, .{}) catch |e|
173
173
  panic("failed to open directory '{s}': {t}", .{ cache_dir_path, e });
174
+ cache_dir.createDirPath(io, "tmp") catch |e|
175
+ panic("failed to create directory 'tmp': {t}", .{e});
174
176
  log_f = cache_dir.createFile(io, "tmp/libfuzzer.log", .{ .truncate = false }) catch |e|
175
177
  panic("failed to create file 'tmp/libfuzzer.log': {t}", .{e});
176
178
  self.cache_f = cache_dir.createDirPathOpen(io, "f", .{}) catch |e|
@@ -146,5 +146,6 @@
146
146
  #define HWCAP3_MTE_FAR (1UL << 0)
147
147
  #define HWCAP3_MTE_STORE_ONLY (1UL << 1)
148
148
  #define HWCAP3_LSFE (1UL << 2)
149
+ #define HWCAP3_LS64 (1UL << 3)
149
150
 
150
151
  #endif /* __ASM_HWCAP_H */
@@ -327,6 +327,7 @@
327
327
  #define __NR_file_getattr 468
328
328
  #define __NR_file_setattr 469
329
329
  #define __NR_listns 470
330
+ #define __NR_rseq_slice_yield 471
330
331
 
331
332
 
332
333
  #endif /* _ASM_UNISTD_64_H */
@@ -55,6 +55,7 @@
55
55
  #define EMULTIHOP 72 /* Multihop attempted */
56
56
  #define EDOTDOT 73 /* RFS specific error */
57
57
  #define EBADMSG 74 /* Not a data message */
58
+ #define EFSBADCRC EBADMSG /* Bad CRC detected */
58
59
  #define EOVERFLOW 75 /* Value too large for defined data type */
59
60
  #define ENOTUNIQ 76 /* Name not unique on network */
60
61
  #define EBADFD 77 /* File descriptor in bad state */
@@ -98,6 +99,7 @@
98
99
  #define EINPROGRESS 115 /* Operation now in progress */
99
100
  #define ESTALE 116 /* Stale file handle */
100
101
  #define EUCLEAN 117 /* Structure needs cleaning */
102
+ #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
101
103
  #define ENOTNAM 118 /* Not a XENIX named type file */
102
104
  #define ENAVAIL 119 /* No XENIX semaphores available */
103
105
  #define EISNAM 120 /* Is a named type file */
@@ -860,8 +860,11 @@ __SYSCALL(__NR_file_setattr, sys_file_setattr)
860
860
  #define __NR_listns 470
861
861
  __SYSCALL(__NR_listns, sys_listns)
862
862
 
863
+ #define __NR_rseq_slice_yield 471
864
+ __SYSCALL(__NR_rseq_slice_yield, sys_rseq_slice_yield)
865
+
863
866
  #undef __NR_syscalls
864
- #define __NR_syscalls 471
867
+ #define __NR_syscalls 472
865
868
 
866
869
  /*
867
870
  * 32 bit systems traditionally used different
@@ -105,8 +105,6 @@ extern "C" {
105
105
  *
106
106
  * %AMDGPU_GEM_DOMAIN_DOORBELL Doorbell. It is an MMIO region for
107
107
  * signalling user mode queues.
108
- *
109
- * %AMDGPU_GEM_DOMAIN_MMIO_REMAP MMIO remap page (special mapping for HDP flushing).
110
108
  */
111
109
  #define AMDGPU_GEM_DOMAIN_CPU 0x1
112
110
  #define AMDGPU_GEM_DOMAIN_GTT 0x2
@@ -115,15 +113,13 @@ extern "C" {
115
113
  #define AMDGPU_GEM_DOMAIN_GWS 0x10
116
114
  #define AMDGPU_GEM_DOMAIN_OA 0x20
117
115
  #define AMDGPU_GEM_DOMAIN_DOORBELL 0x40
118
- #define AMDGPU_GEM_DOMAIN_MMIO_REMAP 0x80
119
116
  #define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \
120
117
  AMDGPU_GEM_DOMAIN_GTT | \
121
118
  AMDGPU_GEM_DOMAIN_VRAM | \
122
119
  AMDGPU_GEM_DOMAIN_GDS | \
123
120
  AMDGPU_GEM_DOMAIN_GWS | \
124
121
  AMDGPU_GEM_DOMAIN_OA | \
125
- AMDGPU_GEM_DOMAIN_DOORBELL | \
126
- AMDGPU_GEM_DOMAIN_MMIO_REMAP)
122
+ AMDGPU_GEM_DOMAIN_DOORBELL)
127
123
 
128
124
  /* Flag that CPU access will be required for the case of VRAM domain */
129
125
  #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0)
@@ -883,7 +879,7 @@ struct drm_amdgpu_gem_list_handles_entry {
883
879
  #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)
884
880
  /* executable mapping, new for VI */
885
881
  #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3)
886
- /* partially resident texture */
882
+ /* unmapped page of partially resident textures */
887
883
  #define AMDGPU_VM_PAGE_PRT (1 << 4)
888
884
  /* MTYPE flags use bit 5 to 8 */
889
885
  #define AMDGPU_VM_MTYPE_MASK (0xf << 5)
@@ -1427,6 +1423,7 @@ struct drm_amdgpu_info_vbios {
1427
1423
  #define AMDGPU_VRAM_TYPE_LPDDR4 11
1428
1424
  #define AMDGPU_VRAM_TYPE_LPDDR5 12
1429
1425
  #define AMDGPU_VRAM_TYPE_HBM3E 13
1426
+ #define AMDGPU_VRAM_TYPE_HBM4 14
1430
1427
 
1431
1428
  struct drm_amdgpu_info_device {
1432
1429
  /** PCI Device ID */
@@ -1629,9 +1626,25 @@ struct drm_amdgpu_info_uq_metadata_gfx {
1629
1626
  __u32 csa_alignment;
1630
1627
  };
1631
1628
 
1629
+ struct drm_amdgpu_info_uq_metadata_compute {
1630
+ /* EOP size for gfx11 */
1631
+ __u32 eop_size;
1632
+ /* EOP base virtual alignment for gfx11 */
1633
+ __u32 eop_alignment;
1634
+ };
1635
+
1636
+ struct drm_amdgpu_info_uq_metadata_sdma {
1637
+ /* context save area size for sdma6 */
1638
+ __u32 csa_size;
1639
+ /* context save area base virtual alignment for sdma6 */
1640
+ __u32 csa_alignment;
1641
+ };
1642
+
1632
1643
  struct drm_amdgpu_info_uq_metadata {
1633
1644
  union {
1634
1645
  struct drm_amdgpu_info_uq_metadata_gfx gfx;
1646
+ struct drm_amdgpu_info_uq_metadata_compute compute;
1647
+ struct drm_amdgpu_info_uq_metadata_sdma sdma;
1635
1648
  };
1636
1649
  };
1637
1650
 
@@ -1654,6 +1667,7 @@ struct drm_amdgpu_info_uq_metadata {
1654
1667
  #define AMDGPU_FAMILY_GC_10_3_6 149 /* GC 10.3.6 */
1655
1668
  #define AMDGPU_FAMILY_GC_10_3_7 151 /* GC 10.3.7 */
1656
1669
  #define AMDGPU_FAMILY_GC_11_5_0 150 /* GC 11.5.0 */
1670
+ #define AMDGPU_FAMILY_GC_11_5_4 154 /* GC 11.5.4 */
1657
1671
  #define AMDGPU_FAMILY_GC_12_0_0 152 /* GC 12.0.0 */
1658
1672
 
1659
1673
  #if defined(__cplusplus)
@@ -19,6 +19,14 @@ extern "C" {
19
19
  #define AMDXDNA_INVALID_BO_HANDLE 0
20
20
  #define AMDXDNA_INVALID_FENCE_HANDLE 0
21
21
 
22
+ /*
23
+ * Define hardware context priority
24
+ */
25
+ #define AMDXDNA_QOS_REALTIME_PRIORITY 0x100
26
+ #define AMDXDNA_QOS_HIGH_PRIORITY 0x180
27
+ #define AMDXDNA_QOS_NORMAL_PRIORITY 0x200
28
+ #define AMDXDNA_QOS_LOW_PRIORITY 0x280
29
+
22
30
  enum amdxdna_device_type {
23
31
  AMDXDNA_DEV_TYPE_UNKNOWN = -1,
24
32
  AMDXDNA_DEV_TYPE_KMQ,
@@ -401,8 +401,8 @@ extern "C" {
401
401
  * implementation can multiply the values by 2^6=64. For that reason the padding
402
402
  * must only contain zeros.
403
403
  * index 0 = Y plane, [15:0] z:Y [6:10] little endian
404
- * index 1 = Cr plane, [15:0] z:Cr [6:10] little endian
405
- * index 2 = Cb plane, [15:0] z:Cb [6:10] little endian
404
+ * index 1 = Cb plane, [15:0] z:Cb [6:10] little endian
405
+ * index 2 = Cr plane, [15:0] z:Cr [6:10] little endian
406
406
  */
407
407
  #define DRM_FORMAT_S010 fourcc_code('S', '0', '1', '0') /* 2x2 subsampled Cb (1) and Cr (2) planes 10 bits per channel */
408
408
  #define DRM_FORMAT_S210 fourcc_code('S', '2', '1', '0') /* 2x1 subsampled Cb (1) and Cr (2) planes 10 bits per channel */
@@ -414,8 +414,8 @@ extern "C" {
414
414
  * implementation can multiply the values by 2^4=16. For that reason the padding
415
415
  * must only contain zeros.
416
416
  * index 0 = Y plane, [15:0] z:Y [4:12] little endian
417
- * index 1 = Cr plane, [15:0] z:Cr [4:12] little endian
418
- * index 2 = Cb plane, [15:0] z:Cb [4:12] little endian
417
+ * index 1 = Cb plane, [15:0] z:Cb [4:12] little endian
418
+ * index 2 = Cr plane, [15:0] z:Cr [4:12] little endian
419
419
  */
420
420
  #define DRM_FORMAT_S012 fourcc_code('S', '0', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes 12 bits per channel */
421
421
  #define DRM_FORMAT_S212 fourcc_code('S', '2', '1', '2') /* 2x1 subsampled Cb (1) and Cr (2) planes 12 bits per channel */
@@ -424,8 +424,8 @@ extern "C" {
424
424
  /*
425
425
  * 3 plane YCbCr
426
426
  * index 0 = Y plane, [15:0] Y little endian
427
- * index 1 = Cr plane, [15:0] Cr little endian
428
- * index 2 = Cb plane, [15:0] Cb little endian
427
+ * index 1 = Cb plane, [15:0] Cb little endian
428
+ * index 2 = Cr plane, [15:0] Cr little endian
429
429
  */
430
430
  #define DRM_FORMAT_S016 fourcc_code('S', '0', '1', '6') /* 2x2 subsampled Cb (1) and Cr (2) planes 16 bits per channel */
431
431
  #define DRM_FORMAT_S216 fourcc_code('S', '2', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes 16 bits per channel */
@@ -24,6 +24,8 @@ extern "C" {
24
24
  #define DRM_PANFROST_SET_LABEL_BO 0x09
25
25
  #define DRM_PANFROST_JM_CTX_CREATE 0x0a
26
26
  #define DRM_PANFROST_JM_CTX_DESTROY 0x0b
27
+ #define DRM_PANFROST_SYNC_BO 0x0c
28
+ #define DRM_PANFROST_QUERY_BO_INFO 0x0d
27
29
 
28
30
  #define DRM_IOCTL_PANFROST_SUBMIT DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
29
31
  #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
@@ -35,6 +37,8 @@ extern "C" {
35
37
  #define DRM_IOCTL_PANFROST_SET_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SET_LABEL_BO, struct drm_panfrost_set_label_bo)
36
38
  #define DRM_IOCTL_PANFROST_JM_CTX_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_CREATE, struct drm_panfrost_jm_ctx_create)
37
39
  #define DRM_IOCTL_PANFROST_JM_CTX_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_JM_CTX_DESTROY, struct drm_panfrost_jm_ctx_destroy)
40
+ #define DRM_IOCTL_PANFROST_SYNC_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SYNC_BO, struct drm_panfrost_sync_bo)
41
+ #define DRM_IOCTL_PANFROST_QUERY_BO_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_QUERY_BO_INFO, struct drm_panfrost_query_bo_info)
38
42
 
39
43
  /*
40
44
  * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module
@@ -120,9 +124,12 @@ struct drm_panfrost_wait_bo {
120
124
  __s64 timeout_ns;
121
125
  };
122
126
 
123
- /* Valid flags to pass to drm_panfrost_create_bo */
127
+ /* Valid flags to pass to drm_panfrost_create_bo.
128
+ * PANFROST_BO_WB_MMAP can't be set if PANFROST_BO_HEAP is.
129
+ */
124
130
  #define PANFROST_BO_NOEXEC 1
125
131
  #define PANFROST_BO_HEAP 2
132
+ #define PANFROST_BO_WB_MMAP 4
126
133
 
127
134
  /**
128
135
  * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
@@ -228,6 +235,13 @@ enum drm_panfrost_param {
228
235
  DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP,
229
236
  DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP_FREQUENCY,
230
237
  DRM_PANFROST_PARAM_ALLOWED_JM_CTX_PRIORITIES,
238
+ DRM_PANFROST_PARAM_SELECTED_COHERENCY,
239
+ };
240
+
241
+ enum drm_panfrost_gpu_coherency {
242
+ DRM_PANFROST_GPU_COHERENCY_ACE_LITE = 0,
243
+ DRM_PANFROST_GPU_COHERENCY_ACE = 1,
244
+ DRM_PANFROST_GPU_COHERENCY_NONE = 31,
231
245
  };
232
246
 
233
247
  struct drm_panfrost_get_param {
@@ -301,6 +315,66 @@ struct drm_panfrost_set_label_bo {
301
315
  __u64 label;
302
316
  };
303
317
 
318
+ /* Valid flags to pass to drm_panfrost_bo_sync_op */
319
+ #define PANFROST_BO_SYNC_CPU_CACHE_FLUSH 0
320
+ #define PANFROST_BO_SYNC_CPU_CACHE_FLUSH_AND_INVALIDATE 1
321
+
322
+ /**
323
+ * struct drm_panthor_bo_flush_map_op - BO map sync op
324
+ */
325
+ struct drm_panfrost_bo_sync_op {
326
+ /** @handle: Handle of the buffer object to sync. */
327
+ __u32 handle;
328
+
329
+ /** @type: Type of sync operation. */
330
+ __u32 type;
331
+
332
+ /**
333
+ * @offset: Offset into the BO at which the sync range starts.
334
+ *
335
+ * This will be rounded down to the nearest cache line as needed.
336
+ */
337
+ __u32 offset;
338
+
339
+ /**
340
+ * @size: Size of the range to sync
341
+ *
342
+ * @size + @offset will be rounded up to the nearest cache line as
343
+ * needed.
344
+ */
345
+ __u32 size;
346
+ };
347
+
348
+ /**
349
+ * struct drm_panfrost_sync_bo - ioctl argument for syncing BO maps
350
+ */
351
+ struct drm_panfrost_sync_bo {
352
+ /** Array of struct drm_panfrost_bo_sync_op */
353
+ __u64 ops;
354
+
355
+ /** Number of BO sync ops */
356
+ __u32 op_count;
357
+
358
+ __u32 pad;
359
+ };
360
+
361
+ /** BO comes from a different subsystem. */
362
+ #define DRM_PANFROST_BO_IS_IMPORTED (1 << 0)
363
+
364
+ struct drm_panfrost_query_bo_info {
365
+ /** Handle of the object being queried. */
366
+ __u32 handle;
367
+
368
+ /** Extra flags that are not coming from the BO_CREATE ioctl(). */
369
+ __u32 extra_flags;
370
+
371
+ /** Flags passed at creation time. */
372
+ __u32 create_flags;
373
+
374
+ /** Will be zero on return. */
375
+ __u32 pad;
376
+ };
377
+
304
378
  /* Definitions for coredump decoding in user space */
305
379
  #define PANFROSTDUMP_MAJOR 1
306
380
  #define PANFROSTDUMP_MINOR 0
@@ -144,6 +144,16 @@ enum drm_panthor_ioctl_id {
144
144
  * pgoff_t size.
145
145
  */
146
146
  DRM_PANTHOR_SET_USER_MMIO_OFFSET,
147
+
148
+ /** @DRM_PANTHOR_BO_SYNC: Sync BO data to/from the device */
149
+ DRM_PANTHOR_BO_SYNC,
150
+
151
+ /**
152
+ * @DRM_PANTHOR_BO_QUERY_INFO: Query information about a BO.
153
+ *
154
+ * This is useful for imported BOs.
155
+ */
156
+ DRM_PANTHOR_BO_QUERY_INFO,
147
157
  };
148
158
 
149
159
  /**
@@ -245,6 +255,26 @@ enum drm_panthor_dev_query_type {
245
255
  DRM_PANTHOR_DEV_QUERY_GROUP_PRIORITIES_INFO,
246
256
  };
247
257
 
258
+ /**
259
+ * enum drm_panthor_gpu_coherency: Type of GPU coherency
260
+ */
261
+ enum drm_panthor_gpu_coherency {
262
+ /**
263
+ * @DRM_PANTHOR_GPU_COHERENCY_ACE_LITE: ACE Lite coherency.
264
+ */
265
+ DRM_PANTHOR_GPU_COHERENCY_ACE_LITE = 0,
266
+
267
+ /**
268
+ * @DRM_PANTHOR_GPU_COHERENCY_ACE: ACE coherency.
269
+ */
270
+ DRM_PANTHOR_GPU_COHERENCY_ACE = 1,
271
+
272
+ /**
273
+ * @DRM_PANTHOR_GPU_COHERENCY_NONE: No coherency.
274
+ */
275
+ DRM_PANTHOR_GPU_COHERENCY_NONE = 31,
276
+ };
277
+
248
278
  /**
249
279
  * struct drm_panthor_gpu_info - GPU information
250
280
  *
@@ -301,7 +331,16 @@ struct drm_panthor_gpu_info {
301
331
  */
302
332
  __u32 thread_max_barrier_size;
303
333
 
304
- /** @coherency_features: Coherency features. */
334
+ /**
335
+ * @coherency_features: Coherency features.
336
+ *
337
+ * Combination of drm_panthor_gpu_coherency flags.
338
+ *
339
+ * Note that this is just what the coherency protocols supported by the
340
+ * GPU, but the actual coherency in place depends on the SoC
341
+ * integration and is reflected by
342
+ * drm_panthor_gpu_info::selected_coherency.
343
+ */
305
344
  __u32 coherency_features;
306
345
 
307
346
  /** @texture_features: Texture features. */
@@ -310,8 +349,12 @@ struct drm_panthor_gpu_info {
310
349
  /** @as_present: Bitmask encoding the number of address-space exposed by the MMU. */
311
350
  __u32 as_present;
312
351
 
313
- /** @pad0: MBZ. */
314
- __u32 pad0;
352
+ /**
353
+ * @selected_coherency: Coherency selected for this device.
354
+ *
355
+ * One of drm_panthor_gpu_coherency.
356
+ */
357
+ __u32 selected_coherency;
315
358
 
316
359
  /** @shader_present: Bitmask encoding the shader cores exposed by the GPU. */
317
360
  __u64 shader_present;
@@ -638,6 +681,15 @@ struct drm_panthor_vm_get_state {
638
681
  enum drm_panthor_bo_flags {
639
682
  /** @DRM_PANTHOR_BO_NO_MMAP: The buffer object will never be CPU-mapped in userspace. */
640
683
  DRM_PANTHOR_BO_NO_MMAP = (1 << 0),
684
+
685
+ /**
686
+ * @DRM_PANTHOR_BO_WB_MMAP: Force "Write-Back Cacheable" CPU mapping.
687
+ *
688
+ * CPU map the buffer object in userspace by forcing the "Write-Back
689
+ * Cacheable" cacheability attribute. The mapping otherwise uses the
690
+ * "Non-Cacheable" attribute if the GPU is not IO coherent.
691
+ */
692
+ DRM_PANTHOR_BO_WB_MMAP = (1 << 1),
641
693
  };
642
694
 
643
695
  /**
@@ -1040,6 +1092,101 @@ struct drm_panthor_set_user_mmio_offset {
1040
1092
  __u64 offset;
1041
1093
  };
1042
1094
 
1095
+ /**
1096
+ * enum drm_panthor_bo_sync_op_type - BO sync type
1097
+ */
1098
+ enum drm_panthor_bo_sync_op_type {
1099
+ /** @DRM_PANTHOR_BO_SYNC_CPU_CACHE_FLUSH: Flush CPU caches. */
1100
+ DRM_PANTHOR_BO_SYNC_CPU_CACHE_FLUSH = 0,
1101
+
1102
+ /** @DRM_PANTHOR_BO_SYNC_CPU_CACHE_FLUSH_AND_INVALIDATE: Flush and invalidate CPU caches. */
1103
+ DRM_PANTHOR_BO_SYNC_CPU_CACHE_FLUSH_AND_INVALIDATE = 1,
1104
+ };
1105
+
1106
+ /**
1107
+ * struct drm_panthor_bo_sync_op - BO map sync op
1108
+ */
1109
+ struct drm_panthor_bo_sync_op {
1110
+ /** @handle: Handle of the buffer object to sync. */
1111
+ __u32 handle;
1112
+
1113
+ /** @type: Type of operation. */
1114
+ __u32 type;
1115
+
1116
+ /**
1117
+ * @offset: Offset into the BO at which the sync range starts.
1118
+ *
1119
+ * This will be rounded down to the nearest cache line as needed.
1120
+ */
1121
+ __u64 offset;
1122
+
1123
+ /**
1124
+ * @size: Size of the range to sync
1125
+ *
1126
+ * @size + @offset will be rounded up to the nearest cache line as
1127
+ * needed.
1128
+ */
1129
+ __u64 size;
1130
+ };
1131
+
1132
+ /**
1133
+ * struct drm_panthor_bo_sync - BO map sync request
1134
+ */
1135
+ struct drm_panthor_bo_sync {
1136
+ /**
1137
+ * @ops: Array of struct drm_panthor_bo_sync_op sync operations.
1138
+ */
1139
+ struct drm_panthor_obj_array ops;
1140
+ };
1141
+
1142
+ /**
1143
+ * enum drm_panthor_bo_extra_flags - Set of flags returned on a BO_QUERY_INFO request
1144
+ *
1145
+ * Those are flags reflecting BO properties that are not directly coming from the flags
1146
+ * passed are creation time, or information on BOs that were imported from other drivers.
1147
+ */
1148
+ enum drm_panthor_bo_extra_flags {
1149
+ /**
1150
+ * @DRM_PANTHOR_BO_IS_IMPORTED: BO has been imported from an external driver.
1151
+ *
1152
+ * Note that imported dma-buf handles are not flagged as imported if they
1153
+ * where exported by panthor. Only buffers that are coming from other drivers
1154
+ * (dma heaps, other GPUs, display controllers, V4L, ...).
1155
+ *
1156
+ * It's also important to note that all imported BOs are mapped cached and can't
1157
+ * be considered IO-coherent even if the GPU is. This means they require explicit
1158
+ * syncs that must go through the DRM_PANTHOR_BO_SYNC ioctl (userland cache
1159
+ * maintenance is not allowed in that case, because extra operations might be
1160
+ * needed to make changes visible to the CPU/device, like buffer migration when the
1161
+ * exporter is a GPU with its own VRAM).
1162
+ */
1163
+ DRM_PANTHOR_BO_IS_IMPORTED = (1 << 0),
1164
+ };
1165
+
1166
+ /**
1167
+ * struct drm_panthor_bo_query_info - Query BO info
1168
+ */
1169
+ struct drm_panthor_bo_query_info {
1170
+ /** @handle: Handle of the buffer object to query flags on. */
1171
+ __u32 handle;
1172
+
1173
+ /**
1174
+ * @extra_flags: Combination of enum drm_panthor_bo_extra_flags flags.
1175
+ */
1176
+ __u32 extra_flags;
1177
+
1178
+ /**
1179
+ * @create_flags: Flags passed at creation time.
1180
+ *
1181
+ * Combination of enum drm_panthor_bo_flags flags.
1182
+ * Will be zero if the buffer comes from a different driver.
1183
+ */
1184
+ __u32 create_flags;
1185
+
1186
+ /** @pad: Will be zero on return. */
1187
+ __u32 pad;
1188
+ };
1189
+
1043
1190
  /**
1044
1191
  * DRM_IOCTL_PANTHOR() - Build a Panthor IOCTL number
1045
1192
  * @__access: Access type. Must be R, W or RW.
@@ -1086,6 +1233,10 @@ enum {
1086
1233
  DRM_IOCTL_PANTHOR(WR, BO_SET_LABEL, bo_set_label),
1087
1234
  DRM_IOCTL_PANTHOR_SET_USER_MMIO_OFFSET =
1088
1235
  DRM_IOCTL_PANTHOR(WR, SET_USER_MMIO_OFFSET, set_user_mmio_offset),
1236
+ DRM_IOCTL_PANTHOR_BO_SYNC =
1237
+ DRM_IOCTL_PANTHOR(WR, BO_SYNC, bo_sync),
1238
+ DRM_IOCTL_PANTHOR_BO_QUERY_INFO =
1239
+ DRM_IOCTL_PANTHOR(WR, BO_QUERY_INFO, bo_query_info),
1089
1240
  };
1090
1241
 
1091
1242
  #if defined(__cplusplus)