mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] dma-buf: align fd_flags and heap_flags with dma_heap_allocation_data
@ 2024-06-05  1:26 Barry Song
  2024-06-05  9:25 ` Sumit Semwal
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Song @ 2024-06-05  1:26 UTC (permalink / raw)
  To: linaro-mm-sig, linux-media, sumit.semwal
  Cc: Brian.Starkey, benjamin.gaignard, christian.koenig, dri-devel,
	jstultz, linux-kernel, tjmercier, v-songbaohua, hailong.liu

From: Barry Song <v-songbaohua@oppo.com>

dma_heap_allocation_data defines the UAPI as follows:

 struct dma_heap_allocation_data {
 	__u64 len;
 	__u32 fd;
 	__u32 fd_flags;
 	__u64 heap_flags;
 };

However, dma_heap_buffer_alloc() casts both fd_flags and heap_flags
into unsigned int. We're inconsistent with types in the non UAPI
arguments. This patch fixes it.

Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Acked-by: John Stultz <jstultz@google.com>
---
 -v2:
 collect ack of John, thanks!
 refine commit message;

 drivers/dma-buf/dma-heap.c    | 4 ++--
 include/uapi/linux/dma-heap.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index 84ae708fafe7..2298ca5e112e 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -50,8 +50,8 @@ static struct class *dma_heap_class;
 static DEFINE_XARRAY_ALLOC(dma_heap_minors);
 
 static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
-				 unsigned int fd_flags,
-				 unsigned int heap_flags)
+				 u32 fd_flags,
+				 u64 heap_flags)
 {
 	struct dma_buf *dmabuf;
 	int fd;
diff --git a/include/uapi/linux/dma-heap.h b/include/uapi/linux/dma-heap.h
index 6f84fa08e074..a4cf716a49fa 100644
--- a/include/uapi/linux/dma-heap.h
+++ b/include/uapi/linux/dma-heap.h
@@ -19,7 +19,7 @@
 #define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)
 
 /* Currently no heap flags */
-#define DMA_HEAP_VALID_HEAP_FLAGS (0)
+#define DMA_HEAP_VALID_HEAP_FLAGS (0ULL)
 
 /**
  * struct dma_heap_allocation_data - metadata passed from userspace for
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] dma-buf: align fd_flags and heap_flags with dma_heap_allocation_data
  2024-06-05  1:26 [PATCH v2] dma-buf: align fd_flags and heap_flags with dma_heap_allocation_data Barry Song
@ 2024-06-05  9:25 ` Sumit Semwal
  0 siblings, 0 replies; 2+ messages in thread
From: Sumit Semwal @ 2024-06-05  9:25 UTC (permalink / raw)
  To: Barry Song
  Cc: linaro-mm-sig, linux-media, Brian.Starkey, benjamin.gaignard,
	christian.koenig, dri-devel, jstultz, linux-kernel, tjmercier,
	v-songbaohua, hailong.liu

Hello Barry,


On Wed, 5 Jun 2024 at 06:56, Barry Song <21cnbao@gmail.com> wrote:
>
> From: Barry Song <v-songbaohua@oppo.com>
>
> dma_heap_allocation_data defines the UAPI as follows:
>
>  struct dma_heap_allocation_data {
>         __u64 len;
>         __u32 fd;
>         __u32 fd_flags;
>         __u64 heap_flags;
>  };
>
> However, dma_heap_buffer_alloc() casts both fd_flags and heap_flags
> into unsigned int. We're inconsistent with types in the non UAPI
> arguments. This patch fixes it.

Thank you for your patch; I've pushed it to drm-misc-next.

Best,
Sumit.
>
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>
> Acked-by: John Stultz <jstultz@google.com>
> ---
>  -v2:
>  collect ack of John, thanks!
>  refine commit message;
>
>  drivers/dma-buf/dma-heap.c    | 4 ++--
>  include/uapi/linux/dma-heap.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
> index 84ae708fafe7..2298ca5e112e 100644
> --- a/drivers/dma-buf/dma-heap.c
> +++ b/drivers/dma-buf/dma-heap.c
> @@ -50,8 +50,8 @@ static struct class *dma_heap_class;
>  static DEFINE_XARRAY_ALLOC(dma_heap_minors);
>
>  static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
> -                                unsigned int fd_flags,
> -                                unsigned int heap_flags)
> +                                u32 fd_flags,
> +                                u64 heap_flags)
>  {
>         struct dma_buf *dmabuf;
>         int fd;
> diff --git a/include/uapi/linux/dma-heap.h b/include/uapi/linux/dma-heap.h
> index 6f84fa08e074..a4cf716a49fa 100644
> --- a/include/uapi/linux/dma-heap.h
> +++ b/include/uapi/linux/dma-heap.h
> @@ -19,7 +19,7 @@
>  #define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)
>
>  /* Currently no heap flags */
> -#define DMA_HEAP_VALID_HEAP_FLAGS (0)
> +#define DMA_HEAP_VALID_HEAP_FLAGS (0ULL)
>
>  /**
>   * struct dma_heap_allocation_data - metadata passed from userspace for
> --
> 2.34.1
>


-- 
Thanks and regards,

Sumit Semwal (he / him)
Tech Lead - LCG, Vertical Technologies
Linaro.org │ Open source software for ARM SoCs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-05  9:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05  1:26 [PATCH v2] dma-buf: align fd_flags and heap_flags with dma_heap_allocation_data Barry Song
2024-06-05  9:25 ` Sumit Semwal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®