From b26210cda63564a7478486faaea713f6ea965633 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 5 Jan 2018 15:57:58 -0800 Subject: remoteproc: Remove depricated crash completion The crash handling now happens in a single execution context, so there's no longer a need for a completion to synchronize this. Reviewed-By: Loic Pallardy Tested-By: Loic Pallardy Signed-off-by: Bjorn Andersson --- include/linux/remoteproc.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 44e630eb3d94..6f1d8e025c81 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -406,7 +406,6 @@ enum rproc_crash_type { * @index: index of this rproc device * @crash_handler: workqueue for handling a crash * @crash_cnt: crash counter - * @crash_comp: completion used to sync crash handler and the rproc reload * @recovery_disabled: flag that state if recovery was disabled * @max_notifyid: largest allocated notify id. * @table_ptr: pointer to the resource table in effect @@ -437,7 +436,6 @@ struct rproc { int index; struct work_struct crash_handler; unsigned int crash_cnt; - struct completion crash_comp; bool recovery_disabled; int max_notifyid; struct resource_table *table_ptr; -- cgit v1.2.3 From a4b24c7560ba64c3c54d8f90ee033a6f0565f8d3 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 5 Jan 2018 15:57:59 -0800 Subject: remoteproc: Cache resource table size We don't re-read the resource table during a recovery, so it is possible in the recovery path that the resource table has a different size than cached_table. Store the original size of cached_table to avoid these getting out of sync. Reviewed-By: Loic Pallardy Tested-By: Loic Pallardy Signed-off-by: Bjorn Andersson --- include/linux/remoteproc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux') diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 6f1d8e025c81..6fdc62e29d6f 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -410,6 +410,7 @@ enum rproc_crash_type { * @max_notifyid: largest allocated notify id. * @table_ptr: pointer to the resource table in effect * @cached_table: copy of the resource table + * @table_sz: size of @cached_table * @has_iommu: flag to indicate if remote processor is behind an MMU */ struct rproc { @@ -440,6 +441,7 @@ struct rproc { int max_notifyid; struct resource_table *table_ptr; struct resource_table *cached_table; + size_t table_sz; bool has_iommu; bool auto_boot; }; -- cgit v1.2.3 From fb98e2bdbd5f5949459dcfe9976bdafdb0ed1948 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 5 Jan 2018 15:58:00 -0800 Subject: remoteproc: Clone rproc_ops in rproc_alloc() In order to allow rproc_alloc() to, in a future patch, update entries in the "ops" struct we need to make a local copy of it. Reviewed-By: Loic Pallardy Tested-By: Loic Pallardy Signed-off-by: Bjorn Andersson --- include/linux/remoteproc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 6fdc62e29d6f..cc4d30a790b3 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -419,7 +419,7 @@ struct rproc { const char *name; char *firmware; void *priv; - const struct rproc_ops *ops; + struct rproc_ops *ops; struct device dev; const struct rproc_fw_ops *fw_ops; atomic_t power; -- cgit v1.2.3 From 0f21f9cc9d868784c7564edc0cfeddd25ca9621a Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 5 Jan 2018 15:58:01 -0800 Subject: remoteproc: Merge rproc_ops and rproc_fw_ops There are currently a few different schemes used for overriding fw_ops or parts of fw_ops. Merge fw_ops into rproc_ops and expose the default ELF-loader symbols so that they can be assigned by the drivers. To keep backwards compatibility with the "default" case, a driver not specifying the "load" operation is assumed to want the full ELF-loader suit of functions. Reviewed-By: Loic Pallardy Tested-By: Loic Pallardy Signed-off-by: Bjorn Andersson --- include/linux/remoteproc.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index cc4d30a790b3..ca2021cf7b39 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -324,6 +324,7 @@ struct rproc_mem_entry { }; struct rproc; +struct firmware; /** * struct rproc_ops - platform-specific device handlers @@ -331,12 +332,26 @@ struct rproc; * @stop: power off the device * @kick: kick a virtqueue (virtqueue id given as a parameter) * @da_to_va: optional platform hook to perform address translations + * @find_rsc_table: find the resource table inside the firmware image + * @find_loaded_rsc_table: find the loaded resouce table + * @load: load firmeware to memory, where the remote processor + * expects to find it + * @sanity_check: sanity check the fw image + * @get_boot_addr: get boot address to entry point specified in firmware */ struct rproc_ops { int (*start)(struct rproc *rproc); int (*stop)(struct rproc *rproc); void (*kick)(struct rproc *rproc, int vqid); void * (*da_to_va)(struct rproc *rproc, u64 da, int len); + struct resource_table *(*find_rsc_table)(struct rproc *rproc, + const struct firmware *fw, + int *tablesz); + struct resource_table *(*find_loaded_rsc_table)( + struct rproc *rproc, const struct firmware *fw); + int (*load)(struct rproc *rproc, const struct firmware *fw); + int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); + u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); }; /** @@ -390,7 +405,6 @@ enum rproc_crash_type { * @priv: private data which belongs to the platform-specific rproc module * @ops: platform-specific start/stop rproc handlers * @dev: virtual device for refcounting and common remoteproc behavior - * @fw_ops: firmware-specific handlers * @power: refcount of users who need this rproc powered up * @state: state of the device * @lock: lock which protects concurrent manipulations of the rproc @@ -421,7 +435,6 @@ struct rproc { void *priv; struct rproc_ops *ops; struct device dev; - const struct rproc_fw_ops *fw_ops; atomic_t power; unsigned int state; struct mutex lock; -- cgit v1.2.3 From 58b640906702bcc083ac783bf10325e22c67d9fc Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 5 Jan 2018 15:58:03 -0800 Subject: remoteproc: Move resource table load logic to find Extend the previous operation of finding the resource table in the ELF with the extra step of populating the rproc struct with a copy and the size. This allows drivers to override the mechanism used for acquiring the resource table, or omit it for firmware that is known not to have a resource table. This leaves the custom, dummy, find_rsc_table implementations found in some drivers dangling. Reviewed-By: Loic Pallardy Tested-By: Loic Pallardy Signed-off-by: Bjorn Andersson --- include/linux/remoteproc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/linux') diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index ca2021cf7b39..cc853745e3a1 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -332,6 +332,7 @@ struct firmware; * @stop: power off the device * @kick: kick a virtqueue (virtqueue id given as a parameter) * @da_to_va: optional platform hook to perform address translations + * @load_rsc_table: load resource table from firmware image * @find_rsc_table: find the resource table inside the firmware image * @find_loaded_rsc_table: find the loaded resouce table * @load: load firmeware to memory, where the remote processor @@ -344,6 +345,7 @@ struct rproc_ops { int (*stop)(struct rproc *rproc); void (*kick)(struct rproc *rproc, int vqid); void * (*da_to_va)(struct rproc *rproc, u64 da, int len); + int (*load_rsc_table)(struct rproc *rproc, const struct firmware *fw); struct resource_table *(*find_rsc_table)(struct rproc *rproc, const struct firmware *fw, int *tablesz); -- cgit v1.2.3 From 4f6fd5a03779cefdf3401ed20690f67ff76cf1ff Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 5 Jan 2018 15:58:04 -0800 Subject: remoteproc: Drop dangling find_rsc_table dummies As the core now deals with the lack of a resource table, remove the dangling custom dummy implementations of find_rsc_table from drivers. Reviewed-By: Loic Pallardy Tested-By: Loic Pallardy Signed-off-by: Bjorn Andersson --- include/linux/remoteproc.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/linux') diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index cc853745e3a1..728d421fffe9 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -333,7 +333,6 @@ struct firmware; * @kick: kick a virtqueue (virtqueue id given as a parameter) * @da_to_va: optional platform hook to perform address translations * @load_rsc_table: load resource table from firmware image - * @find_rsc_table: find the resource table inside the firmware image * @find_loaded_rsc_table: find the loaded resouce table * @load: load firmeware to memory, where the remote processor * expects to find it @@ -346,9 +345,6 @@ struct rproc_ops { void (*kick)(struct rproc *rproc, int vqid); void * (*da_to_va)(struct rproc *rproc, u64 da, int len); int (*load_rsc_table)(struct rproc *rproc, const struct firmware *fw); - struct resource_table *(*find_rsc_table)(struct rproc *rproc, - const struct firmware *fw, - int *tablesz); struct resource_table *(*find_loaded_rsc_table)( struct rproc *rproc, const struct firmware *fw); int (*load)(struct rproc *rproc, const struct firmware *fw); -- cgit v1.2.3