[EARLY,RFC,1/4] ion: Add ION_VERSION ioctl

Message ID 1550262252-15558-2-git-send-email-john.stultz@linaro.org
State New
Headers show
Series
  • ION per heap devices
Related show

Commit Message

John Stultz Feb. 15, 2019, 8:24 p.m.
With all the slight interface changes ion has had
through its time in staging, keeping userland working
properly has been a pain. Assuming more churn going
forward, provide a proper version interface.

Cc: Laura Abbott <labbott@redhat.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: John Stultz <john.stultz@linaro.org>

---
 drivers/staging/android/ion/ion-ioctl.c | 4 ++++
 drivers/staging/android/ion/ion.h       | 2 ++
 drivers/staging/android/uapi/ion.h      | 7 +++++++
 3 files changed, 13 insertions(+)

-- 
2.7.4

Comments

Laura Abbott Feb. 19, 2019, 8:46 p.m. | #1
On 2/15/19 12:24 PM, John Stultz wrote:
> With all the slight interface changes ion has had
> through its time in staging, keeping userland working
> properly has been a pain. Assuming more churn going
> forward, provide a proper version interface.
> 
> Cc: Laura Abbott <labbott@redhat.com>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Liam Mark <lmark@codeaurora.org>
> Cc: Brian Starkey <Brian.Starkey@arm.com>
> Cc: Andrew F. Davis <afd@ti.com>
> Cc: Alistair Strachan <astrachan@google.com>
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>   drivers/staging/android/ion/ion-ioctl.c | 4 ++++
>   drivers/staging/android/ion/ion.h       | 2 ++
>   drivers/staging/android/uapi/ion.h      | 7 +++++++
>   3 files changed, 13 insertions(+)
> 
> diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
> index a8d3cc4..458a9f2 100644
> --- a/drivers/staging/android/ion/ion-ioctl.c
> +++ b/drivers/staging/android/ion/ion-ioctl.c
> @@ -13,6 +13,7 @@
>   union ion_ioctl_arg {
>   	struct ion_allocation_data allocation;
>   	struct ion_heap_query query;
> +	u32 version;
>   };
>   
>   static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
> @@ -86,6 +87,9 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>   	case ION_IOC_HEAP_QUERY:
>   		ret = ion_query_heaps(&data.query);
>   		break;
> +	case ION_IOC_VERSION:
> +		data.version = ION_VERSION;
> +		break;
>   	default:
>   		return -ENOTTY;
>   	}
> diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h
> index 47b594c..439e682 100644
> --- a/drivers/staging/android/ion/ion.h
> +++ b/drivers/staging/android/ion/ion.h
> @@ -21,6 +21,8 @@
>   
>   #include "../uapi/ion.h"
>   
> +#define ION_VERSION 3
> +
>   /**
>    * struct ion_platform_heap - defines a heap in the given platform
>    * @type:	type of the heap from ion_heap_type enum
> diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h
> index 5d70098..c480448 100644
> --- a/drivers/staging/android/uapi/ion.h
> +++ b/drivers/staging/android/uapi/ion.h
> @@ -124,4 +124,11 @@ struct ion_heap_query {
>   #define ION_IOC_HEAP_QUERY     _IOWR(ION_IOC_MAGIC, 8, \
>   					struct ion_heap_query)
>   
> +/**
> + * DOC: ION_IOC_VERSION - Get ION interface version
> + *
> + * Takes a u32 and returns the ION interface version
> + */
> +#define ION_IOC_VERSION		_IOR(ION_IOC_MAGIC, 9, u32)
> +
>   #endif /* _UAPI_LINUX_ION_H */
> 

Like I said on the other thread, I was told no before
https://lore.kernel.org/lkml/1472769644-11039-4-git-send-email-labbott@redhat.com/T/#u
John Stultz Feb. 19, 2019, 9:29 p.m. | #2
On Tue, Feb 19, 2019 at 12:46 PM Laura Abbott <labbott@redhat.com> wrote:
>
> On 2/15/19 12:24 PM, John Stultz wrote:
> > With all the slight interface changes ion has had
> > through its time in staging, keeping userland working
> > properly has been a pain. Assuming more churn going
> > forward, provide a proper version interface.
> >
> > Cc: Laura Abbott <labbott@redhat.com>
> > Cc: Sumit Semwal <sumit.semwal@linaro.org>
> > Cc: Liam Mark <lmark@codeaurora.org>
> > Cc: Brian Starkey <Brian.Starkey@arm.com>
> > Cc: Andrew F. Davis <afd@ti.com>
> > Cc: Alistair Strachan <astrachan@google.com>
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: John Stultz <john.stultz@linaro.org>
> > ---
> >   drivers/staging/android/ion/ion-ioctl.c | 4 ++++
> >   drivers/staging/android/ion/ion.h       | 2 ++
> >   drivers/staging/android/uapi/ion.h      | 7 +++++++
> >   3 files changed, 13 insertions(+)
> >
> > diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
> > index a8d3cc4..458a9f2 100644
> > --- a/drivers/staging/android/ion/ion-ioctl.c
> > +++ b/drivers/staging/android/ion/ion-ioctl.c
> > @@ -13,6 +13,7 @@
> >   union ion_ioctl_arg {
> >       struct ion_allocation_data allocation;
> >       struct ion_heap_query query;
> > +     u32 version;
> >   };
> >
> >   static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
> > @@ -86,6 +87,9 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> >       case ION_IOC_HEAP_QUERY:
> >               ret = ion_query_heaps(&data.query);
> >               break;
> > +     case ION_IOC_VERSION:
> > +             data.version = ION_VERSION;
> > +             break;
> >       default:
> >               return -ENOTTY;
> >       }
> > diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h
> > index 47b594c..439e682 100644
> > --- a/drivers/staging/android/ion/ion.h
> > +++ b/drivers/staging/android/ion/ion.h
> > @@ -21,6 +21,8 @@
> >
> >   #include "../uapi/ion.h"
> >
> > +#define ION_VERSION 3
> > +
> >   /**
> >    * struct ion_platform_heap - defines a heap in the given platform
> >    * @type:   type of the heap from ion_heap_type enum
> > diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h
> > index 5d70098..c480448 100644
> > --- a/drivers/staging/android/uapi/ion.h
> > +++ b/drivers/staging/android/uapi/ion.h
> > @@ -124,4 +124,11 @@ struct ion_heap_query {
> >   #define ION_IOC_HEAP_QUERY     _IOWR(ION_IOC_MAGIC, 8, \
> >                                       struct ion_heap_query)
> >
> > +/**
> > + * DOC: ION_IOC_VERSION - Get ION interface version
> > + *
> > + * Takes a u32 and returns the ION interface version
> > + */
> > +#define ION_IOC_VERSION              _IOR(ION_IOC_MAGIC, 9, u32)
> > +
> >   #endif /* _UAPI_LINUX_ION_H */
> >
>
> Like I said on the other thread, I was told no before
> https://lore.kernel.org/lkml/1472769644-11039-4-git-send-email-labbott@redhat.com/T/#u

Alright, then. I'm ok with dropping it. Hopefully we can just avoid
any more really subtle abi breaks.

thanks
-john

Patch

diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
index a8d3cc4..458a9f2 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -13,6 +13,7 @@ 
 union ion_ioctl_arg {
 	struct ion_allocation_data allocation;
 	struct ion_heap_query query;
+	u32 version;
 };
 
 static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
@@ -86,6 +87,9 @@  long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	case ION_IOC_HEAP_QUERY:
 		ret = ion_query_heaps(&data.query);
 		break;
+	case ION_IOC_VERSION:
+		data.version = ION_VERSION;
+		break;
 	default:
 		return -ENOTTY;
 	}
diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h
index 47b594c..439e682 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -21,6 +21,8 @@ 
 
 #include "../uapi/ion.h"
 
+#define ION_VERSION 3
+
 /**
  * struct ion_platform_heap - defines a heap in the given platform
  * @type:	type of the heap from ion_heap_type enum
diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h
index 5d70098..c480448 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -124,4 +124,11 @@  struct ion_heap_query {
 #define ION_IOC_HEAP_QUERY     _IOWR(ION_IOC_MAGIC, 8, \
 					struct ion_heap_query)
 
+/**
+ * DOC: ION_IOC_VERSION - Get ION interface version
+ *
+ * Takes a u32 and returns the ION interface version
+ */
+#define ION_IOC_VERSION		_IOR(ION_IOC_MAGIC, 9, u32)
+
 #endif /* _UAPI_LINUX_ION_H */