Commit graph

296 commits

Author SHA1 Message Date
Tobias Jordan 278d744c46 remoteproc: qcom: Fix potential device node leaks
Add missing of_node_put()s at two places for device nodes returned by
of_parse_phandle().

Fixes: 051fb70fd4 ("remoteproc: qcom: Driver for the self-authenticating
 Hexagon v5")
Signed-off-by: Tobias Jordan <Tobias.Jordan@elektrobit.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-25 16:46:55 -07:00
Arnaud Pouliquen fcd58037f2 remoteproc: fix crashed parameter logic on stop call
Fix rproc_add_subdev parameter name and inverse the crashed logic.

Fixes: 880f5b3882 ("remoteproc: Pass type of shutdown to subdev remove")
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-25 16:43:55 -07:00
Sibi Sankar 730b2ad8f7 remoteproc: fix null pointer dereference on glink only platforms
Currently calling list_del on smd subdev remove path results in
null pointer dereference on glink only platforms. Fix this by
adding safety checks in glink/smd subdev remove paths.

Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-05 22:53:16 -07:00
Arnd Bergmann dea4bd1975 soc: qcom: qmi: add CONFIG_NET dependency
Access to the socket API and the root network namespace is only available
when networking is enabled:

ERROR: "kernel_sendmsg" [drivers/soc/qcom/qmi_helpers.ko] undefined!
ERROR: "sock_release" [drivers/soc/qcom/qmi_helpers.ko] undefined!
ERROR: "sock_create_kern" [drivers/soc/qcom/qmi_helpers.ko] undefined!
ERROR: "kernel_getsockname" [drivers/soc/qcom/qmi_helpers.ko] undefined!
ERROR: "init_net" [drivers/soc/qcom/qmi_helpers.ko] undefined!
ERROR: "kernel_recvmsg" [drivers/soc/qcom/qmi_helpers.ko] undefined!

Adding a dependency on CONFIG_NET lets us build it in all randconfig
builds.

Fixes: 9b8a11e826 ("soc: qcom: Introduce QMI encoder/decoder")
Acked-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-27 13:43:29 -07:00
Christophe JAILLET 99a31adfb2 remoteproc: imx_rproc: Slightly simplify code in 'imx_rproc_probe()'
We can return directly at the beginning of the function and save the 'err'
label.
We can also explicitly return 0 when the probe succeed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-18 15:43:46 -07:00
Christophe JAILLET 96a30d7f91 remoteproc: imx_rproc: Re-use existing error handling path in 'imx_rproc_probe()'
Avoid some code ducplication and be more future-proof.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-18 15:43:46 -07:00
Christophe JAILLET de6f83f85b remoteproc: imx_rproc: Fix an error handling path in 'imx_rproc_probe()'
If 'of_device_get_match_data()' fails, we must undo the previous
'rproc_alloc()' call.

Fixes: a0ff4aa6f0 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-18 15:43:46 -07:00
Bjorn Andersson 1fb82ee806 remoteproc: qcom: Introduce sysmon
The sysmon client communicates either via a dedicated SMD/GLINK channel
or via QMI encoded messages over IPCROUTER with remote processors in
order to perform graceful shutdown and inform about other remote
processors shutting down.

Acked-By: Chris Lew <clew@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-12 16:57:22 -08:00
Bjorn Andersson 880f5b3882 remoteproc: Pass type of shutdown to subdev remove
remoteproc instances can be stopped either by invoking shutdown or by an
attempt to recover from a crash. For some subdev types it's expected to
clean up gracefully during a shutdown, but are unable to do so during a
crash - so pass this information to the subdev remove functions.

Acked-By: Chris Lew <clew@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-12 16:57:22 -08:00
Sarangdhar Joshi dcb57ed43d remoteproc: qcom: Register segments for core dump
Register MDT segments with the remoteproc core dump functionality in
order to include them in a core dump, in case of a recovery of the remote
processor.

Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-12 11:05:46 -08:00
Bjorn Andersson 4dd27f544c soc: qcom: mdt-loader: Return relocation base
In order to implement support for grabbing core dumps in remoteproc it's
necessary to know the relocated base of the image, as the offsets from
the virtual memory base might not be based on the physical address.

Return the adjusted physical base address to the caller.

Acked-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-12 11:05:38 -08:00
Bjorn Andersson c1d35c1ab4 remoteproc: Rename "load_rsc_table" to "parse_fw"
The resource table is just one possible source of information that can
be extracted from the firmware file. Generalize this interface to allow
drivers to override this with parsers of other types of information.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-12 11:05:30 -08:00
Sarangdhar Joshi 2666ca9197 remoteproc: Add remote processor coredump support
As the remoteproc framework restarts the remote processor after a fatal
event, it's useful to be able to acquire a coredump of the remote
processor's state, for post mortem debugging.

This patch introduces a mechanism for extracting the memory contents
after the remote has stopped and before the restart sequence has begun
in the recovery path. The remoteproc framework builds the core dump in
memory and use devcoredump to expose this to user space.

Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
[bjorn: Use vmalloc instead of composing the ELF on the fly]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-12 11:05:29 -08:00
Jitendra Sharma 2d02d15804 remoteproc: Remove null character write of shared mem
remoteproc is writing '\0' in the shared mem region. This
region is shared among multiple clients that are also trying
to read. Hence they miss first character.

Remove this null character write, as this mem area is
supposed to be Read only.

Further during every subsystem reboot, this region is
initialized with default, hence no need to write this
region.

Signed-off-by: Jitendra Sharma <shajit@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-12 10:30:15 -08:00
Linus Torvalds 2deb41b245 remoteproc updates for v4.16
This contains a few bug fixes and a cleanup up of the resource-table handling
 in the framework, which removes the need for drivers with no resource table to
 provide a fake one.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJaeJRAAAoJEAsfOT8Nma3FcwYP/jk/ubIEEF8Ne2ZRhcyT9J/2
 4sT8NJhmtHIALOlQPtKcHv766ukFtzN4Xd8fUgHiivVMOrYBbfiuO1MNXXEq2kyf
 7lWqC1eJRaa7wmlQumNw5aIOvJPuCu0oFd+K8CoKowLco32tURzJ9ANtYeXKTc/n
 KCk4KgigXRzlUP+J8TZ75Uop+N5WREGbqOHhP/J8+PYmHY+IxPN4K1CHlOBITpJz
 eLX+gs51UUKOFLGusVS5CLpUOYUc+bfWkGGeqRzMISCloSDkxdwIGuVa630VE1sJ
 QkxvvNbhQWmaaeBfplMhNHT7wHgE87c2P6mvABu5Rsf+u8V3o6JzbBW5XgxxT5uU
 QER4NRzZ/288vuOnr6FPvmR5ZZg9TaU/9Ef1vYNFEXR1uhquBmYulSbJ9FenM2up
 qQkVRQuLWYo5JLRWshVMvA0u+HGv7iA+kcGGBTfWJQgYJTG7ytmEamqoCchBOiM1
 cGOxGVkSD5tt8XBvSUx6wsmEkBqU8MGKbf77XFhYDBJNU2ZLuoETPnj2+Wjh8Myo
 5R1B0jBsWjGZ90AAXoKT2rbw2QeaADpFSneWKVbDEyTczmFDjQNZ5Qhuk1X1U3wq
 VZwmZwe2TsdaRZJhO+8SfdfspR71j2ollT1iLO2ESR5lbZZmouBm+EeW8c/ri8yW
 ei1bP8q5f2qYfSNga0hc
 =awTj
 -----END PGP SIGNATURE-----

Merge tag 'rproc-v4.16' of git://github.com/andersson/remoteproc

Pull remoteproc updates from Bjorn Andersson:
 "This contains a few bug fixes and a cleanup up of the resource-table
  handling in the framework, which removes the need for drivers with no
  resource table to provide a fake one"

* tag 'rproc-v4.16' of git://github.com/andersson/remoteproc:
  remoteproc: Reset table_ptr on stop
  remoteproc: Drop dangling find_rsc_table dummies
  remoteproc: Move resource table load logic to find
  remoteproc: Don't handle empty resource table
  remoteproc: Merge rproc_ops and rproc_fw_ops
  remoteproc: Clone rproc_ops in rproc_alloc()
  remoteproc: Cache resource table size
  remoteproc: Remove depricated crash completion
  virtio_remoteproc: correct put_device virtio_device.dev
2018-02-05 10:07:40 -08:00
Bjorn Andersson 0a8b81cb2e remoteproc: Reset table_ptr on stop
The installed resource table is no longer accessible after stopping the
remote, so update table_ptr to point to the local copy.

Reviewed-By: Loic Pallardy <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:30:04 -08:00
Bjorn Andersson 4f6fd5a037 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 <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:30:00 -08:00
Bjorn Andersson 58b6409067 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 <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:29:53 -08:00
Bjorn Andersson d4bb86f2c3 remoteproc: Don't handle empty resource table
Allow a NULL table_ptr to have the same meaning as a table with 0
entries, allowing a subsequent patch to skip the assignment step.

A few other places in the implementation does dereference table_ptr, but
they are currently all coming from rproc_handle_resources().

Reviewed-By: Loic Pallardy <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:29:48 -08:00
Bjorn Andersson 0f21f9cc9d 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 <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:29:40 -08:00
Bjorn Andersson fb98e2bdbd 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 <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:29:34 -08:00
Bjorn Andersson a4b24c7560 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 <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:29:29 -08:00
Bjorn Andersson b26210cda6 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 <loic.pallardy@st.com>
Tested-By: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-15 09:29:16 -08:00
weiping zhang 900a163ede virtio_remoteproc: correct put_device virtio_device.dev
rproc_virtio_dev_release will be called iff virtio_device.dev's
reference count drops to 0. Here we just put vdev.dev, and then
rproc->dev's cleanup will be done in rproc_virtio_dev_release.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-02 09:32:30 -08:00
Vasyl Gomonovych a1fcc45589 remoteproc: qcom: Use PTR_ERR_OR_ZERO() in glink prob
Fix ptr_ret.cocci warnings:
drivers/remoteproc/qcom_common.c:60:8-14: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-11-28 15:02:27 -08:00
Linus Torvalds 4f88bd23ba remoteproc updates for v4.15
This adds an interface for configuring Qualcomm's "secure SMMU" and adds
 support for booting the modem Hexagon on MSM8996.
 
 Two new debugfs entries are added in the remoteproc core to introspect the list
 of memory carveouts and the loaded resource table.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJaD26iAAoJEAsfOT8Nma3FUp0QAL/WZhL8QsvVFbAlv/Aa6NKm
 z8blXscD0GKdQWDWGaGPtpbnpOWOYhJs9WxstiB2q9ooSa9brIdjG5ukr4DTgtRs
 12If5tfkVFIjlBhAdYYK+biNSQtZE+37jb7aJ+j4N3Po3O72pxekcLMLhAdvY6yk
 zHnhDZ8N7KBxAa0eOg7PJz7AGRF6BHhPxkqgJm0FzBj4HLQ/lwrv6iYJRrZgw6CT
 OhIHgPwCSHmt2fTO2QDLOWJtbVMSFhunHbuYlzPwvhMAGCT87VmXCIkW8iVhcD24
 uJMrFbQoBoWVMB68JgGUKd7SSs8pV7DMrGfJll1kBEQfMLynn8Omre7WDAfwjUEn
 ACasSDWdWEPABJoIRVkGhS+2BnfCehdvDC7QxFFPAf8oc49O3t6DyXcCQdcVkzzE
 f1r/G2JKsoNQxjklFJewU5r0EjWgvV/78Dmpi7tuUtjgMSyEqkYORmInbbFIqZrU
 9bHCqrmlxuRFSklxoG2u7F2SVYgMVlqM4rmj8QqR85SeIfyZtcCx5i5yAj8dZsI1
 JVjucOCROHFqs/3SYFKlo6x4XHIchJD4p64QOXPCVhw7R1NXTPRTFBCQ75PKdiD1
 d7kcGhdaz2cMeN1WRhIQ00lh/uiDNd4Ez7sDuU8MnWiEcIs1/ZP1LCHZTNttoljH
 rWZp4XlrhT+Vx91zV5u5
 =lnNj
 -----END PGP SIGNATURE-----

Merge tag 'rproc-v4.15' of git://github.com/andersson/remoteproc

Pull remoteproc updates from Bjorn Andersson:
 "This adds an interface for configuring Qualcomm's "secure SMMU" and
  adds support for booting the modem Hexagon on MSM8996.

  Two new debugfs entries are added in the remoteproc core to introspect
  the list of memory carveouts and the loaded resource table"

* tag 'rproc-v4.15' of git://github.com/andersson/remoteproc:
  remoteproc: qcom: Fix error handling paths in order to avoid memory leaks
  remoteproc: qcom: Drop pr_err in q6v5_xfer_mem_ownership()
  remoteproc: debug: add carveouts list dump feature
  remoteproc: debug: add resource table dump feature
  remoteproc: qcom: Add support for mss remoteproc on msm8996
  remoteproc: qcom: Make secure world call for mem ownership switch
  remoteproc: qcom: refactor mss fw image loading sequence
  firmware: scm: Add new SCM call API for switching memory ownership
2017-11-17 20:14:10 -08:00
Linus Torvalds bedf571986 rpmsg updates for v4.15
This turn RPMSG_VIRTIO into a user selectable config, fixes a few bugs in GLINK
 and provides the support for specifying initial buffer sizes for GLINK
 channels.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJaD2r+AAoJEAsfOT8Nma3F/tMP/24c6KyWfmkhRYXA5gJmEjnD
 PpzhfNonTYl225ZRutR6M4+gpOt6Ljtu8gvGzqXuPRNBf4CNCMqTRvQt0nF+jZnw
 QciY3dtDMKdCGC3hZoxCX6d1GjjtqvPL4SJW4zkcgYw4SnN5nISFw9iHpdDcX5bx
 RoCcCzq7rPRBRs4HNQ7wDSFTh9UAr5tAY5i4HwsAAoGejlhhioduDWoLp4dgGV5j
 Nc7wOU8KQZzPivN/i9ma8WdjZDzy9oSz0PRF6nbGnvFp/NOlxA3rj1DVIB7ONaV0
 Ttod4Fs5Mj1GrsBKQ4rf2qVwjTIM2x721wJDBAzqJ6fRtHwCFim2THMZPx0s7pa9
 SqX+ZUmV9WD8TBz+mQcLYG3mHqZIlpE4f+uAc8XWruISyij7j9QVoqzZxtGRI1H/
 SFu21ovlZieuBRS3g8soxkjFmHzlvvyzrv8p/+t4KqAtb1csTVPAxEsT8PddHzPR
 +c8mUKgFlcJnmi4ILg3rIo7Z3BLfz7C7jIZpRBXEe2Z2JA1aHbUrUWDpw/QhHoEy
 rlASk0f4h4uhAYlsxJDYx+Wg5b3DV0H/ouy5qzDdxlB78Gvw+6/2RUPSeummu2Mt
 5rKg0anw1GtAGYlXx14HVX427HY3y6mrmNERlfPnwkwfQfTbYVQ6vMp1op+8XF0H
 KbxkyufQlZnimLJjwD6W
 =jirb
 -----END PGP SIGNATURE-----

Merge tag 'rpmsg-v4.15' of git://github.com/andersson/remoteproc

Pull rpmsg updates from Bjorn Andersson:

 - turn RPMSG_VIRTIO into a user selectable config

 - fix few bugs in GLINK

 - provide the support for specifying initial buffer sizes for GLINK
   channels.

* tag 'rpmsg-v4.15' of git://github.com/andersson/remoteproc:
  rpmsg: glink: The mbox client knows_txdone
  rpmsg: glink: Add missing MODULE_LICENSE
  rpmsg: glink: Use best fit intent during tx
  rpmsg: glink: Add support to preallocate intents
  dt-bindings: soc: qcom: Support GLINK intents
  rpmsg: glink: Initialize the "intent_req_comp" completion variable
  rpmsg: Allow RPMSG_VIRTIO to be enabled via menuconfig or defconfig
2017-11-17 20:12:08 -08:00
Christophe JAILLET 1a5d5c592e remoteproc: qcom: Fix error handling paths in order to avoid memory leaks
In case of error returned by 'q6v5_xfer_mem_ownership', we must free
some resources before returning.

In 'q6v5_mpss_init_image()', add a new label to undo a previous
'dma_alloc_attrs()'.
In 'q6v5_mpss_load()', re-use the already existing error handling code to
undo a previous 'request_firmware()', as already done in the other error
handling paths of the function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-11-14 23:20:11 -08:00
Bjorn Andersson 9f2a4342a8 remoteproc: qcom: Drop pr_err in q6v5_xfer_mem_ownership()
The pr_err() in q6v5_xfer_mem_ownership() prints, upon failure, the
memory range that failed to be transitioned. But on 32-bit architectures
with CONFIG_PHYS_ADDR_T_64BIT set we cannot cast the phys_addr_t
variable to a pointer, per below build error. Instead these should be
formatted with %pap.

In file included from include/linux/kernel.h:14:0,
                 from include/linux/clk.h:16,
                 from drivers/remoteproc/qcom_q6v5_pil.c:18:
drivers/remoteproc/qcom_q6v5_pil.c: In function 'q6v5_xfer_mem_ownership':
drivers/remoteproc/qcom_q6v5_pil.c:337:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
          (void *)addr, (void *)(addr + size),
          ^

Most callers will upon failure print a specific error message describing
which memory region that we failed to pass ownership of, so rather than
fixing the format string this patch fixes up the last callers and drop
the print from this function, saving us from spamming the log in most of
these error cases.

Fixes: 6c5a9dc248 ("remoteproc: qcom: Make secure world call for mem ownership switch")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-11-06 22:37:39 -08:00
Loic Pallardy b891883941 remoteproc: debug: add carveouts list dump feature
This patch offers the capability to dump memory carveouts associated
to one remoteprocessor.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-11-06 21:57:27 -08:00
Loic Pallardy bdd8edb9b0 remoteproc: debug: add resource table dump feature
This patch adds the capability to display the content of
the resource table associated to a remote processor firmware.

Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-11-06 21:57:21 -08:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Avaneesh Kumar Dwivedi 9f058fa2ef remoteproc: qcom: Add support for mss remoteproc on msm8996
This patch add support for mss boot on msm8996. Major changes
include initializing mss rproc for msm8996, making appropriate
change for executing mss reset sequence etc.

Tested-and-acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-30 18:37:23 -07:00
Avaneesh Kumar Dwivedi 6c5a9dc248 remoteproc: qcom: Make secure world call for mem ownership switch
MSS proc on msm8996 can not access fw loaded region without stage
second translation of memory pages where mpss image are loaded.
This patch in order to enable mss boot on msm8996 invoke scm call
to switch or share ownership between apps and modem.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
[bjorn: Corrected error path in q6v5_start()]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-30 18:37:22 -07:00
Avaneesh Kumar Dwivedi 94c907859a remoteproc: qcom: refactor mss fw image loading sequence
This patch refactor code to first load all firmware blobs
and then update modem proc to authenticate and boot fw.

Tested-and-acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-30 18:37:22 -07:00
Anup Patel 4d91d7b099 rpmsg: Allow RPMSG_VIRTIO to be enabled via menuconfig or defconfig
Currently, RPMSG_VIRTIO can only be enabled if some other kconfig
option selects it. This does not allow it to be enabled for
virtualized systems where Virtio RPMSG is available over Virtio
MMIO or PCI transport.

This patch updates RPMSG_VIRTIO kconfig option so that we can
enable the VirtIO RPMSG driver via menuconfig or defconfig. The
patch also removes "select RPMSG_VIRTIO" from various remoteproc
kconfig options because it is now user selectable.

Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-25 21:51:05 -07:00
Wei Yongjun 68a39a3e9f remoteproc: imx_rproc: fix return value check in imx_rproc_addr_init()
In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-11 10:47:47 -07:00
Arnd Bergmann ab759b9732 remoteproc: qcom: fix RPMSG_QCOM_GLINK_SMEM dependencies
When RPMSG_QCOM_GLINK_SMEM=m and one driver causes the qcom_common.c file
to be compiled as built-in, we get a link error:

drivers/remoteproc/qcom_common.o: In function `glink_subdev_remove':
qcom_common.c:(.text+0x130): undefined reference to `qcom_glink_smem_unregister'
qcom_common.c:(.text+0x130): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `qcom_glink_smem_unregister'
drivers/remoteproc/qcom_common.o: In function `glink_subdev_probe':
qcom_common.c:(.text+0x160): undefined reference to `qcom_glink_smem_register'
qcom_common.c:(.text+0x160): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `qcom_glink_smem_register'

Out of the three PIL driver instances, QCOM_ADSP_PIL already has a
Kconfig dependency to prevent this from happening, but the other two
do not. This adds the same dependency there.

Fixes: eea07023e6 ("remoteproc: qcom: adsp: Allow defining GLINK edge")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-10 11:28:20 -07:00
Dan Carpenter 68c2d645eb remoteproc: imx_rproc: fix a couple off by one bugs
The priv->mem[] array has IMX7D_RPROC_MEM_MAX elements so the > should
be >= to avoid writing one element beyond the end of the array.

Fixes: a0ff4aa6f0 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-10 11:22:55 -07:00
Linus Torvalds 7151202b64 rpmsg updates for v4.14
This extends the Qualcomm GLINK implementation to support the additional
 features used for communicating with modem and DSP coprocessors in modern
 Qualcomm platforms.
 
 In addition to this there's support for placing virtio RPMSG buffers in
 non-System RAM.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJZswd9AAoJEAsfOT8Nma3FSigQALyq2wNtf60tkTKW0f2K8cM6
 JpnEKAKqO1t5ZkokEevT05PLT4rqXuidrDVOBJ3VQ7LtSqJOiTjGyN9YM8t+WBVG
 ts0Yg69+wUxBATg9iM2JiUsKn8gH8swUAtf16dmkL/Ca8BJKOHGYTUjADfwuFrEg
 EAGcLZnlwz736xdo9qZu/Ke9rItz6CDOD3AphbpJbcv7Wj2F/mEuqMZjfLk+1Mo8
 C3wXx9jIzW1siNtT0OY9raUNV5gLaGS2zZ+DYwrwjND7Eh0TqeLxyJ1OS7f2kOZ5
 P6zcrYw02WbDVW7LUzVegj5PejZm/wdFZ5hSvishEfZZVT+wGHBK34mfObe0moJZ
 Wp8jFSXKqECIEU3x/2DtPAHi+mittDpQ3FCkElWKJRD6B3HTySHjvM0lOor+zYKB
 gRX4QUR6jwkSRAbV6GP24Z8SL9kU6TXOSoOQvuzuKhB30JzADJPuQnGZR0SftYiH
 YJG/RT9FklbljWP9hIgey3QPNHPoL3IzNBU2iyEjdraabmNaFEb++wpLdpCZdnGf
 1HMLrMfUmd3QKRtXvT+5Q6CjnfzwFk1ii1naN3Ky9rar3WRtij5bzo8eveR8i9ag
 DtWA88N9mnpSUao14o5vKN830q3/fkwW6HyT0nCd59Wq94cMNfiMdFPVXvO0xVAF
 mjP4JXHbqNhdJySWR4Du
 =PVGN
 -----END PGP SIGNATURE-----

Merge tag 'rpmsg-v4.14' of git://github.com/andersson/remoteproc

Pull rpmsg updates from Bjorn Andersson:
 "This extends the Qualcomm GLINK implementation to support the
  additional features used for communicating with modem and DSP
  coprocessors in modern Qualcomm platforms.

  In addition to this there's support for placing virtio RPMSG buffers
  in non-System RAM"

* tag 'rpmsg-v4.14' of git://github.com/andersson/remoteproc: (29 commits)
  rpmsg: glink: initialize ret to zero to ensure error status check is correct
  rpmsg: glink: fix null pointer dereference on a null intent
  dt-bindings: soc: qcom: Extend GLINK to cover SMEM
  remoteproc: qcom: adsp: Allow defining GLINK edge
  rpmsg: glink: Export symbols from common code
  rpmsg: glink: Release idr lock before returning on error
  rpmsg: glink: Handle remote rx done command
  rpmsg: glink: Request for intents when unavailable
  rpmsg: glink: Use the intents passed by remote
  rpmsg: glink: Receive and store the remote intent buffers
  rpmsg: glink: Add announce_create ops and preallocate intents
  rpmsg: glink: Add rx done command
  rpmsg: glink: Make RX FIFO peak accessor to take an offset
  rpmsg: glink: Use the local intents when receiving data
  rpmsg: glink: Add support for TX intents
  rpmsg: glink: Fix idr_lock from mutex to spinlock
  rpmsg: glink: Add support for transport version negotiation
  rpmsg: glink: Introduce glink smem based transport
  rpmsg: glink: Do a mbox_free_channel in remove
  rpmsg: glink: Return -EAGAIN when there is no FIFO space
  ...
2017-09-09 14:34:38 -07:00
Bjorn Andersson 7c89717f82 remoteproc: Introduce rproc handle accessor for children
In certain circumstances rpmsg devices needs to acquire a handle to the
ancestor remoteproc instance, e.g. to invoke rproc_report_crash() when a
fatal error is detected. Introduce an interface that walks the device
tree in search for a remoteproc instance and return this.

Tested-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-09-01 15:49:13 -07:00
Bjorn Andersson 4fec0a5a19 remoteproc: qcom: Make ssr_notifiers local
The ssr_notifiers variable should be local, so add the missing static
storage classifier.

Fixes: 1e140df049 ("remoteproc: qcom: Add support for SSR notifications")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-09-01 15:42:29 -07:00
Bjorn Andersson eea07023e6 remoteproc: qcom: adsp: Allow defining GLINK edge
Introduce the GLINK subdev, which allows the definition of a GLINK edge
as child of a remoteproc.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-09-01 15:31:23 -07:00
Bjorn Andersson f9cbbd256c remoteproc: Stop subdevices in reverse order
Subdevices might depend on earlier registered subdevices for
communication purposes, as such they should be stopped in reverse order
so that said communication channel is removed after the dependent
subdevice is stopped.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-30 16:29:55 -07:00
Oleksij Rempel a0ff4aa6f0 remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver
Provide a basic driver to control Cortex M4 co-processor found
on NXP i.MX7D and i.MX6SX.
Currently it is able to resolve addresses between M4 and main CPU,
start and stop the co-processor. Other functionality is not provided
or test.

This driver was tested on NXP i.MX7D and expected to work on
i.MX6SX as well.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-30 16:07:41 -07:00
Himanshu Jha c76929b3c6 remoteproc: qcom: Use PTR_ERR_OR_ZERO
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29 15:34:19 -07:00
Philipp Zabel 1e13c7fb49 remoteproc: st: explicitly request exclusive reset control
Commit a53e35db70 ("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>
2017-08-27 23:18:52 -07:00
Philipp Zabel 5acbf7e520 remoteproc: qcom: explicitly request exclusive reset control
Commit a53e35db70 ("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: 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>
2017-08-27 23:18:35 -07:00
Philipp Zabel f5f98654a2 remoteproc/keystone: explicitly request exclusive reset control
Commit a53e35db70 ("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: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-remoteproc@vger.kernel.org
Acked-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-27 23:16:22 -07:00
Suman Anna b4daf89057 remoteproc/keystone: Add support for Keystone 66AK2G SOCs
Add support to the keystone remoteproc driver for managing the
DSP present in the Keystone 2 66AK2G SoC. The 66AK2G SoC has
a Power Management Micro Controller (PMMC) that manages the
individual device's power, clock and reset functionalities.

The keystone remoteproc driver already uses standard frameworks
for reset and clock control, so it doesn't require any significant
modifications other than a new compatible suitable for 66AK2G DSP.

The binding document is also updated to reflect the modified
property values used by the 66AK2G DSP node as compared to the
values used by existing Keystone 2 DSPs.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-24 12:01:29 -07:00