Change create network UAPI to take a user buffer

To not allow the buffer for a network instance to be changed after
creation, the create network UAPI will now take the network model data
as a user buffer. The content of the user buffer is copied into an
internally allocated DMA buffer that cannot be accessed by the user.

This breaks the current API so the Linux kernel NPU driver version and
the driver library version have been given major version bumps. All the
tests, documentation and other applications affected by the changes have
been updated accordingly.

Change-Id: I25c785d75a24794c3db632e4abe5cfbb1c7ac190
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
diff --git a/kernel/uapi/ethosu.h b/kernel/uapi/ethosu.h
index 4e4d180..35eaf60 100644
--- a/kernel/uapi/ethosu.h
+++ b/kernel/uapi/ethosu.h
@@ -67,7 +67,7 @@
 #define ETHOSU_PMU_EVENT_MAX             8
 
 /* Kernel driver version */
-#define ETHOSU_KERNEL_DRIVER_VERSION_MAJOR 2
+#define ETHOSU_KERNEL_DRIVER_VERSION_MAJOR 3
 #define ETHOSU_KERNEL_DRIVER_VERSION_MINOR 0
 #define ETHOSU_KERNEL_DRIVER_VERSION_PATCH 0
 
@@ -109,13 +109,14 @@
 
 /**
  * enum ethosu_uapi_network_type - Network buffer type.
- * @ETHOSU_UAPI_NETWORK_BUFFER:	Network is stored in a buffer handle.
- * @ETHOSU_UAPI_NETWORK_INDEX:	Network is built into firmware and referenced by
- *                              index.
+ * @ETHOSU_UAPI_NETWORK_USER_BUFFER:	Network data is provided in a user
+ *					buffer.
+ * @ETHOSU_UAPI_NETWORK_INDEX:		Network is built into firmware and
+ *					referenced by index.
  */
 enum ethosu_uapi_network_type {
-	ETHOSU_UAPI_NETWORK_BUFFER = 1,
-	ETHOSU_UAPI_NETWORK_INDEX
+	ETHOSU_UAPI_NETWORK_USER_BUFFER = 1,
+	ETHOSU_UAPI_NETWORK_INDEX,
 };
 
 /**
@@ -127,7 +128,10 @@
 struct ethosu_uapi_network_create {
 	uint32_t type;
 	union {
-		__u32 fd;
+		struct {
+			__u64 data_ptr;
+			__u32 size;
+		}     network;
 		__u32 index;
 	};
 };