diff mbox series

[meta-arago,scarthgap] linux-libc-headers: add DMA_HEAP_IOCTL_EXPORT uapi patch

Message ID 20260827150719.821469-1-gehariprasath@ti.com
State New
Headers show
Series [meta-arago,scarthgap] linux-libc-headers: add DMA_HEAP_IOCTL_EXPORT uapi patch | expand

Commit Message

Hari Prasath G E Aug. 27, 2026, 3:07 p.m. UTC
Copy the TI vendor kernel dma-heap.h header, which has the
DMA_HEAP_IOCTL_EXPORT ioctl that the default linux-libc-headers
doesn't have.

Signed-off-by: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
---
 .../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

Comments

PRC Automation Aug. 27, 2026, 3:10 p.m. UTC | #1
meta-arago / na / 20260827150719.821469-1-gehariprasath

PRC Results: FAIL

=========================================================
  check-yocto-patches: PASS
=========================================================
Patches
----------------------------------------
All patches passed



=========================================================
  apply-yocto-patch: PASS
=========================================================
scarthgap
=====================
Summary:
- Patch Series: [meta-arago][scarthgap][PATCH] linux-libc-headers: add DMA_HEAP_IOCTL_EXPORT uapi patch
- Submitter: From: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
+From: Andrew Davis <afd@ti.com>
- Date: Date: Thu, 27 Aug 2026 20:37:19 +0530
- Num Patches: 1
- Mailing List (public inbox) Commit SHA: 8a2b9c56deaa04b5d720d43801763cc2c56f4fe2

Applied to:
- Repository: lcpd-prc-meta-arago
- Base Branch: scarthgap-wip
- Commit Author: Ryan Eatmon <reatmon@ti.com>
- Commit Subject: libyang: Fix CVE-2026-41401
- Commit SHA: 73ab0405254988a501b849d221acf5f468cb8997

Patches
----------------------------------------
All patches applied



=========================================================
  check-yocto-repo: FAIL
=========================================================
scarthgap
=====================
FAIL
    WARN: .bbappend files might need a guard to make them check-layer compliant. (GUARD-1)
        meta-arago-distro/recipes-kernel/linux-libc-headers/linux-libc-headers_%.bbappend
    
    ERROR: Patch is not referenced in any recipe. (REPO-1)
        meta-arago-extras/recipes-connectivity/hostap/hostap-daemon-wl18xx/0001-hostapd-change-conf-file-for-better-oob-startup.patch
    
    ERROR: Patch is not referenced in any recipe. (REPO-1)
        meta-arago-extras/recipes-connectivity/open62541/open62541/0001-CMakeLists-do-not-install-git-directories.patch
    
    ERROR: Patch is not referenced in any recipe. (REPO-1)
        meta-arago-extras/recipes-connectivity/open62541/open62541/0001-tests-fix-typing-of-size_t-in-printf.patch
    
    ERROR: Patch is not referenced in any recipe. (REPO-1)
        meta-arago-extras/recipes-devtools/abseil-cpp/abseil-cpp/0001-absl-always-use-asm-sgidefs.h.patch
    
    ERROR: Patch is not referenced in any recipe. (REPO-1)
        meta-arago-extras/recipes-devtools/abseil-cpp/abseil-cpp/0002-Remove-maes-option-from-cross-compilation.patch
    
    ERROR: Patch is not referenced in any recipe. (REPO-1)
        meta-arago-extras/recipes-devtools/abseil-cpp/abseil-cpp/0003-Remove-neon-option-from-cross-compilation.patch
    
    ERROR: Patch is not referenced in any recipe. (REPO-1)
        meta-arago-extras/recipes-extended/sysrepo/libyang/CVE-2026-41401.patch
    
    For details on the above errors/warnings visit: https://lists.yoctoproject.org/g/meta-ti/wiki/40887
Andrew Davis Aug. 27, 2026, 4:51 p.m. UTC | #2
On 8/27/26 10:07 AM, Hari Prasath via lists.yoctoproject.org wrote:
> Copy the TI vendor kernel dma-heap.h header, which has the
> DMA_HEAP_IOCTL_EXPORT ioctl that the default linux-libc-headers
> doesn't have.
> 
> Signed-off-by: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
> ---

https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc#L7

>   .../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 <afd@ti.com>
> +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 <afd@ti.com>
> +Signed-off-by: Udit Kumar <u-kumar1@ti.com>
> +
> +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"
Kumar, Udit Aug. 27, 2026, 4:59 p.m. UTC | #3
On 8/27/2026 10:21 PM, Andrew Davis wrote:
> On 8/27/26 10:07 AM, Hari Prasath via lists.yoctoproject.org wrote:
>> Copy the TI vendor kernel dma-heap.h header, which has the
>> DMA_HEAP_IOCTL_EXPORT ioctl that the default linux-libc-headers
>> doesn't have.
>>
>> Signed-off-by: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
>> ---
> 
> https://github.com/openembedded/openembedded-core/blob/master/meta/
> recipes-kernel/linux-libc-headers/linux-libc-headers.inc#L7

That is usual problem with when uapi is getting updated
https://github.com/TexasInstruments/ti-linux-kernel/blob/ti-linux-6.18.y/include/uapi/linux/dma-heap.h#L78


Now SW stack using this ioctl will fail to compile in case of
1- using include from rootfs or
2- compiling on target itself

recommendation is understood,

thanks for suggesting alternative way out

> 
>>   .../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 <afd@ti.com>
>> +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 <afd@ti.com>
>> +Signed-off-by: Udit Kumar <u-kumar1@ti.com>
>> +
>> +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"
>
Ryan Eatmon Aug. 27, 2026, 9:08 p.m. UTC | #4
On 8/27/2026 11:51 AM, Andrew Davis wrote:
> On 8/27/26 10:07 AM, Hari Prasath via lists.yoctoproject.org wrote:
>> Copy the TI vendor kernel dma-heap.h header, which has the
>> DMA_HEAP_IOCTL_EXPORT ioctl that the default linux-libc-headers
>> doesn't have.
>>
>> Signed-off-by: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
>> ---
> 
> https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc#L7
> 

Hari, what happened to doing this like what NXP did?  Install this 
header into a different subdir in /usr/include?

https://github.com/nxp-imx/meta-imx/blob/wrynose-6.18.20-2.0.0/meta-imx-bsp/recipes-kernel/linux/linux-imx-headers_6.18.bb

I don't think doing it this way is going to be the right way of doing it.
Hari Prasath G E Aug. 28, 2026, 3:26 a.m. UTC | #5
Hello Andrew,

On 8/27/2026 10:21 PM, Andrew Davis wrote:
> On 8/27/26 10:07 AM, Hari Prasath via lists.yoctoproject.org wrote:
>> Copy the TI vendor kernel dma-heap.h header, which has the
>> DMA_HEAP_IOCTL_EXPORT ioctl that the default linux-libc-headers
>> doesn't have.
>>
>> Signed-off-by: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
>> ---
> 
> https://github.com/openembedded/openembedded-core/blob/master/meta/ 
> recipes-kernel/linux-libc-headers/linux-libc-headers.inc#L7
> 

I read this note and tried even writing a separate recipe for TI vendor 
kernel headers, but bitbake simply wouldn't allow me to copy to 
/usr/include/linux where the linux-libc-headers is copying to. I can try 
to install in a different location like /usr/include/ti/linux or 
something similar. But in this case, the userspace application need to 
make adjustments in their code to include it from the new location 
(which is possible). I am trying it out with a build, will keep you 
posted and send a new patch.

Regards,
Hari

>>   .../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 <afd@ti.com>
>> +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 <afd@ti.com>
>> +Signed-off-by: Udit Kumar <u-kumar1@ti.com>
>> +
>> +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"
>
Hari Prasath G E Aug. 28, 2026, 6:31 a.m. UTC | #6
Hello Ryan,

On 8/28/2026 2:38 AM, Ryan Eatmon wrote:
> 
> 
> On 8/27/2026 11:51 AM, Andrew Davis wrote:
>> On 8/27/26 10:07 AM, Hari Prasath via lists.yoctoproject.org wrote:
>>> Copy the TI vendor kernel dma-heap.h header, which has the
>>> DMA_HEAP_IOCTL_EXPORT ioctl that the default linux-libc-headers
>>> doesn't have.
>>>
>>> Signed-off-by: Hari Prasath Gujulan Elango <gehariprasath@ti.com>
>>> ---
>>
>> https://github.com/openembedded/openembedded-core/blob/master/meta/ 
>> recipes-kernel/linux-libc-headers/linux-libc-headers.inc#L7
>>
> 
> Hari, what happened to doing this like what NXP did?  Install this 
> header into a different subdir in /usr/include?
> 
> https://github.com/nxp-imx/meta-imx/blob/wrynose-6.18.20-2.0.0/meta-imx- 
> bsp/recipes-kernel/linux/linux-imx-headers_6.18.bb
> 
> I don't think doing it this way is going to be the right way of doing it.

I did try this approach. The downside I saw was it clone's the entire 
kernel source repo again which took too long. I also ended up in some 
do_unpack() failures (the logs which I shared with you) so I gave up on 
this approach. I have sent a new patch which ends up doing the same i.e. 
it copies the needed UAPI header into /usr/include/ti/linux, same as 
what NXP does.

Regards,
Hari

> 
>
diff mbox series

Patch

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 <afd@ti.com>
+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 <afd@ti.com>
+Signed-off-by: Udit Kumar <u-kumar1@ti.com>
+
+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"