.../0001-dma-heap-add-export-ioctl.patch | 58 +++++++++++++++++++
.../linux-libc-headers_%.bbappend | 10 ++++
2 files changed, 68 insertions(+)
create mode 100644 meta-arago-distro/recipes-kernel/linux-libc-
headers/linux-libc-headers/0001-dma-heap-add-export-ioctl.patch
create mode 100644 meta-arago-distro/recipes-kernel/linux-libc-
headers/linux-libc-headers_%.bbappend
diff --git a/meta-arago-distro/recipes-kernel/linux-libc-headers/
linux-libc-headers/0001-dma-heap-add-export-ioctl.patch b/meta-arago-
distro/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-dma-
heap-add-export-ioctl.patch
new file mode 100644
index 00000000..e96c9ff0
--- /dev/null
+++ b/meta-arago-distro/recipes-kernel/linux-libc-headers/linux-libc-
headers/0001-dma-heap-add-export-ioctl.patch
@@ -0,0 +1,58 @@
+From: Andrew Davis <[email protected]>
+Subject: [PATCH] dma-buf: heaps: expose DMA_HEAP_IOCTL_EXPORT uapi
+
+Mirrors ti-linux-kernel commit 8715cc31cfe8a191ade660ff787fedbadcb187d4
+("TI: HACK: dma-buf: heaps: Add Heap export from offset IOCTL"), limited
+to the include/uapi/linux/dma-heap.h hunk. The kernel already ships this
+ioctl; linux-libc-headers fetches its own independent pristine tarball
+and knows nothing about it, so userspace can't see the symbol without
+this patch.
+
+Upstream-Status: Inappropriate [TI kernel hack, not upstream]
+Signed-off-by: Andrew Davis <[email protected]>
+Signed-off-by: Udit Kumar <[email protected]>
+
+diff --git a/include/uapi/linux/dma-heap.h b/include/uapi/linux/dma-
heap.h
+index a4cf716a49fa6..db749800b6c16 100644
+--- a/include/uapi/linux/dma-heap.h
++++ b/include/uapi/linux/dma-heap.h
+@@ -39,6 +39,25 @@ struct dma_heap_allocation_data {
+ __u64 heap_flags;
+ };
+
++/**
++ * struct dma_heap_export_data - metadata passed from userspace for
export
++ * @offset: offset from heap base
++ * @len: size of the allocation
++ * @fd: will be populated with a fd which provides the
++ * handle to the allocated dma-buf
++ * @fd_flags: file descriptor flags used when allocating
++ * @heap_flags: flags passed to heap
++ *
++ * Provided by userspace as an argument to the ioctl
++ */
++struct dma_heap_export_data {
++ __u64 offset;
++ __u64 len;
++ __u32 fd;
++ __u32 fd_flags;
++ __u64 heap_flags;
++};
++
+ #define DMA_HEAP_IOC_MAGIC 'H'
+
+ /**
+@@ -50,4 +69,13 @@ struct dma_heap_allocation_data {
+ #define DMA_HEAP_IOCTL_ALLOC _IOWR(DMA_HEAP_IOC_MAGIC, 0x0,\
+ struct dma_heap_allocation_data)
+
++/**
++ * DOC: DMA_HEAP_IOCTL_EXPORT - allocate memory at offset
++ *
++ * Takes a dma_heap_export_data struct and returns it with the fd field
++ * populated with the dmabuf handle of the export.
++ */
++#define DMA_HEAP_IOCTL_EXPORT _IOWR(DMA_HEAP_IOC_MAGIC, 0x1,\
++ struct dma_heap_export_data)
++
+ #endif /* _UAPI_LINUX_DMABUF_POOL_H */
diff --git a/meta-arago-distro/recipes-kernel/linux-libc-headers/
linux-libc-headers_%.bbappend b/meta-arago-distro/recipes-kernel/
linux-libc-headers/linux-libc-headers_%.bbappend
new file mode 100644
index 00000000..7f0345ab
--- /dev/null
+++ b/meta-arago-distro/recipes-kernel/linux-libc-headers/linux-libc-
headers_%.bbappend
@@ -0,0 +1,10 @@
+# linux-libc-headers fetches its own pristine kernel.org tarball,
independent
+# of ti-linux-kernel, so it doesn't see TI's out-of-tree dma-heap
ioctl even
+# though the running kernel already has it. This carries a minimal,
purely
+# additive patch (no existing symbols touched) so that ioctl is
visible to
+# userspace via /usr/include/linux/dma-heap.h without re-sourcing the
whole
+# recipe from our kernel tree.
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
+
+SRC_URI += "file://0001-dma-heap-add-export-ioctl.patch"