Create device for Ethos-U kernel driver

When the Ethos-U kernel driver is probed it creates a /dev/ethosu<nr>
device node, which user space use ioctl to communicate with. When
the driver is removed the Ethos-U resources must live on until all
open file handles have been closed.

The rpmsg device can be removed for a number of reasons, for example
if the firmware is stopped or the remoteproc driver is removed. To
allow the remove to complete without waiting for all file handles to
close, a new 'struct device' is created by the kernel driver. This
device will be used to memory allocations and will live on until the
last file handle has been closed.

Change-Id: I790d8219960f25fe64f58c11a865eb65c7b08974
diff --git a/kernel/ethosu_cancel_inference.c b/kernel/ethosu_cancel_inference.c
index ee630f5..6661522 100644
--- a/kernel/ethosu_cancel_inference.c
+++ b/kernel/ethosu_cancel_inference.c
@@ -28,6 +28,7 @@
 #include "ethosu_device.h"
 #include "ethosu_inference.h"
 
+#include <linux/remoteproc.h>
 #include <linux/wait.h>
 
 /****************************************************************************
@@ -110,6 +111,7 @@
 
 	/* Unlock the mutex before going to block on the condition */
 	device_unlock(dev);
+
 	/* wait for response to arrive back */
 	timeout = wait_for_completion_timeout(&cancellation->done,
 					      msecs_to_jiffies(
@@ -123,11 +125,14 @@
 		dev_warn(dev,
 			 "Msg: Cancel Inference response lost - timeoutdev");
 		ret = -EIO;
+
+		rproc_report_crash(rproc_get_by_child(dev), RPROC_FATAL_ERROR);
 		goto deregister;
 	}
 
 	if (cancellation->errno) {
 		ret = cancellation->errno;
+		rproc_report_crash(rproc_get_by_child(dev), RPROC_FATAL_ERROR);
 		goto deregister;
 	}
 
@@ -138,6 +143,7 @@
 kfree:
 	dev_info(dev,
 		 "Cancel inference destroy. cancel=0x%pK", cancellation);
+
 	/* decrease the reference on the inference we are refering to */
 	ethosu_inference_put(cancellation->inf);
 	devm_kfree(dev, cancellation);