History log of /linux-master/drivers/remoteproc/st_remoteproc.c
Revision Date Author Comments
# 173d2c63 22-Jan-2024 Andrew Davis <afd@ti.com>

remoteproc: st: Use devm_rproc_alloc() helper

Use the device lifecycle managed allocation function. This helps prevent
mistakes like freeing out of order in cleanup functions and forgetting to
free on error paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240123184632.725054-8-afd@ti.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>


# 3d8a1869 12-Oct-2023 Nathan Chancellor <nathan@kernel.org>

remoteproc: st: Fix sometimes uninitialized ret in st_rproc_probe()

Clang warns (or errors with CONFIG_WERROR=y):

drivers/remoteproc/st_remoteproc.c:357:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
357 | if (!ddata->config)
| ^~~~~~~~~~~~~~
drivers/remoteproc/st_remoteproc.c:442:9: note: uninitialized use occurs here
442 | return ret;
| ^~~
drivers/remoteproc/st_remoteproc.c:357:2: note: remove the 'if' if its condition is always false
357 | if (!ddata->config)
| ^~~~~~~~~~~~~~~~~~~
358 | goto free_rproc;
| ~~~~~~~~~~~~~~~
drivers/remoteproc/st_remoteproc.c:348:9: note: initialize the variable 'ret' to silence this warning
348 | int ret, i;
| ^
| = 0
1 error generated.

Set ret to -ENODEV, which seems to be a standard return code when
device_get_match_data() returns NULL.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1944
Fixes: 5c77ebcd05ac ("remoteproc: st: Use device_get_match_data()")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20231012-st_remoteproc-fix-sometimes-uninit-v1-1-f64d0f2d5b37@kernel.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>


# 5c77ebcd 09-Oct-2023 Rob Herring <robh@kernel.org>

remoteproc: st: Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20231009211356.3242037-10-robh@kernel.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>


# b8b87e88 04-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

remoteproc: st: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20230504194453.1150368-17-u.kleine-koenig@pengutronix.de
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>


# 1f6fa392 10-Mar-2023 Rob Herring <robh@kernel.org>

remoteproc: st: Use of_property_present() for testing DT property presence

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230310144736.1546972-1-robh@kernel.org


# 8a749189 20-Mar-2023 Mathieu Poirier <mathieu.poirier@linaro.org>

remoteproc: st: Call of_node_put() on iteration error

Function of_phandle_iterator_next() calls of_node_put() on the last
device_node it iterated over, but when the loop exits prematurely it has
to be called explicitly.

Fixes: 3df52ed7f269 ("remoteproc: st: add reserved memory support")
Cc: stable@vger.kernel.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Link: https://lore.kernel.org/r/20230320221826.2728078-3-mathieu.poirier@linaro.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>


# e29ff72b 22-Apr-2020 Clement Leger <cleger@kalray.eu>

remoteproc: remove rproc_elf32_sanity_check

Since checks are present in the remoteproc elf loader before calling
da_to_va, loading a elf64 will work on 32bits flavors of kernel.
Indeed, if a segment size is larger than what size_t can hold, the
loader will return an error so the functionality is equivalent to
what exists today.

Acked-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Clement Leger <cleger@kalray.eu>
Link: https://lore.kernel.org/r/20200422093017.10985-1-cleger@kalray.eu
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 826c3390 02-Mar-2020 Clement Leger <cleger@kalray.eu>

remoteproc: Rename rproc_elf_sanity_check for elf32

Since this function will be modified to support both elf32 and elf64,
rename the existing one to elf32 (which is the only supported format
at the moment). This will allow not to introduce possible side effect
when adding elf64 support (ie: all backends will still support only
elf32 if not requested explicitely using rproc_elf_sanity_check).

Signed-off-by: Clement Leger <cleger@kalray.eu>
Link: https://lore.kernel.org/r/20200302093902.27849-6-cleger@kalray.eu
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# e4ae4b7d 02-Mar-2020 Clement Leger <cleger@kalray.eu>

remoteproc: Use u64 type for boot_addr

elf64 entry is defined as a u64. Since boot_addr is used to store the
elf entry point, change boot_addr type to u64 to support both elf32
and elf64. In the same time, fix users that were using this variable.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Clement Leger <cleger@kalray.eu>
Link: https://lore.kernel.org/r/20200302093902.27849-4-cleger@kalray.eu
[bjorn: Fixes up return type of rproc_get_boot_addr()]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3df52ed7 10-Jan-2019 Loic Pallardy <loic.pallardy@st.com>

remoteproc: st: add reserved memory support

ST remote processor needs some specified memory regions for
firmware and IPC.
Memory regions are defined as reserved memory and should
be registered in remoteproc core thanks to rproc_add_carveout
function before rproc_start. For this, st rproc driver implements
prepare ops.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 1e13c7fb 19-Jul-2017 Philipp Zabel <p.zabel@pengutronix.de>

remoteproc: st: explicitly request exclusive reset control

Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.

No functional changes.

Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-remoteproc@vger.kernel.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 231c8dfd 31-Jan-2017 Loic Pallardy <loic.pallardy@st.com>

remoteproc: st: add virtio communication support

This patch provides virtio communication support based on mailbox
for ST co-processors.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 3e49ecf6 31-Jan-2017 Loic Pallardy <loic.pallardy@st.com>

remoteproc: st: correct probe error management

Associated clock is prepared in st_rproc_parse_dt function.
it should be unprepared in case of error during probing.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# c008fad2 01-Jan-2017 Bhumika Goyal <bhumirks@gmail.com>

drivers: remoteproc: constify rproc_ops structures

Declare rproc_ops structures as const as they are only passed as an
argument to the function rproc_alloc. This argument is of type const, so
rproc_ops structures having this property can be declared const too.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct rproc_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
@@
rproc_alloc(...,&i@p,...)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct rproc_ops i;

File size details:

Size of the file remoteproc/da8xx_remoteproc.o remains the same before and
after applying the changes.

text data bss dec hex filename
1312 100 4 1416 588 remoteproc/da8xx_remoteproc.o
1312 100 4 1416 588 remoteproc/da8xx_remoteproc.o

970 240 0 1210 4ba remoteproc/omap_remoteproc.o
1002 192 0 1194 4aa remoteproc/omap_remoteproc.o

1901 240 0 2141 85d remoteproc/st_remoteproc.o
1933 192 0 2125 84d remoteproc/st_remoteproc.o

1288 96 0 1384 568 remoteproc/st_slim_rproc.o
1320 64 0 1384 568 remoteproc/st_slim_rproc.o

2121 240 0 2361 939 remoteproc/wkup_m3_rproc.o
2161 192 0 2353 931 remoteproc/wkup_m3_rproc.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 1d701d3d 17-Oct-2016 Wei Yongjun <weiyongjun1@huawei.com>

remoteproc: st: Fix error return code in st_rproc_probe()

Fix to return a negative error code from the st_rproc_state() error
handling case instead of 0, as done elsewhere in this function.

Fixes: 63edb0310a5c ("remoteproc: Supply controller driver for ST's Remote Processors")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 433c0e04 02-Oct-2016 Bjorn Andersson <bjorn.andersson@linaro.org>

remoteproc: Split driver and consumer dereferencing

In order to be able to lock a rproc driver implementations only when
used by a client, we must differ between the dereference operation of a
client and the implementation itself.

This patch brings no functional change.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 4b28038f 19-Mar-2016 Vladimir Zapolskiy <vz@mleia.com>

remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value

syscon_regmap_lookup_by_phandle() returns either a valid pointer to
struct regmap or ERR_PTR() error value, check for NULL is invalid and
on error path may lead to oops, the change corrects the check.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 63edb031 11-Jan-2016 Lee Jones <lee.jones@linaro.org>

remoteproc: Supply controller driver for ST's Remote Processors

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>