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

John Stultz john.stultz at linaro.org
Fri Feb 15 20:24:09 UTC 2019


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 at redhat.com>
Cc: Sumit Semwal <sumit.semwal at linaro.org>
Cc: Liam Mark <lmark at codeaurora.org>
Cc: Brian Starkey <Brian.Starkey at arm.com>
Cc: Andrew F. Davis <afd at ti.com>
Cc: Alistair Strachan <astrachan at google.com>
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: John Stultz <john.stultz at 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 */
-- 
2.7.4



More information about the dri-devel mailing list