Commit Graph

870 Commits

Author SHA1 Message Date
Jerry Snitselaar 68c9dc171f remoteproc: Use iommu_paging_domain_alloc()
JIRA: https://issues.redhat.com/browse/RHEL-78704
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

commit fae93d8da6b94ca1a6a497e8a00ad87324188cf7
Author: Lu Baolu <baolu.lu@linux.intel.com>
Date:   Wed Oct 9 12:11:44 2024 +0800

    remoteproc: Use iommu_paging_domain_alloc()

    An iommu domain is allocated in rproc_enable_iommu() and is attached to
    rproc->dev.parent in the same function.

    Use iommu_paging_domain_alloc() to make it explicit.

    Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Acked-by: Beleswar Padhi <b-padhi@ti.com>
    Link: https://lore.kernel.org/r/20241009041147.28391-2-baolu.lu@linux.intel.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>

(cherry picked from commit fae93d8da6b94ca1a6a497e8a00ad87324188cf7)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
2025-04-03 09:23:08 -07:00
Jared Kangas 2221580c2b remoteproc: k3-r5: Delay notification of wakeup event
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 8fa052c29e509f3e47d56d7fc2ca28094d78c60a
Author: Udit Kumar <u-kumar1@ti.com>
Date:   Tue Aug 20 16:20:04 2024 +0530

    remoteproc: k3-r5: Delay notification of wakeup event

    Few times, core1 was scheduled to boot first before core0, which leads
    to error:

    'k3_r5_rproc_start: can not start core 1 before core 0'.

    This was happening due to some scheduling between prepare and start
    callback. The probe function waits for event, which is getting
    triggered by prepare callback. To avoid above condition move event
    trigger to start instead of prepare callback.

    Fixes: 61f6f68447ab ("remoteproc: k3-r5: Wait for core0 power-up before powering up core1")
    Signed-off-by: Udit Kumar <u-kumar1@ti.com>
    [ Applied wakeup event trigger only for Split-Mode booted rprocs ]
    Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20240820105004.2788327-1-b-padhi@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 09:02:17 -07:00
Jared Kangas e176bc9f73 remoteproc: k3-r5: Fix error handling when power-up failed
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 9ab27eb5866ccbf57715cfdba4b03d57776092fb
Author: Jan Kiszka <jan.kiszka@siemens.com>
Date:   Mon Aug 19 17:24:51 2024 +0200

    remoteproc: k3-r5: Fix error handling when power-up failed

    By simply bailing out, the driver was violating its rule and internal
    assumptions that either both or no rproc should be initialized. E.g.,
    this could cause the first core to be available but not the second one,
    leading to crashes on its shutdown later on while trying to dereference
    that second instance.

    Fixes: 61f6f68447ab ("remoteproc: k3-r5: Wait for core0 power-up before powering up core1")
    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Acked-by: Beleswar Padhi <b-padhi@ti.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/9f481156-f220-4adf-b3d9-670871351e26@siemens.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 09:02:13 -07:00
Jared Kangas 7469a0ebb7 remoteproc: k3-dsp: Acquire mailbox handle during probe routine
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit ea1d6fb5b57135e8e05ebfaaf816e199baee96b3
Author: Beleswar Padhi <b-padhi@ti.com>
Date:   Thu Aug 8 13:11:27 2024 +0530

    remoteproc: k3-dsp: Acquire mailbox handle during probe routine

    Acquire the mailbox handle during device probe and do not release handle
    in stop/detach routine or error paths. This removes the redundant
    requests for mbox handle later during rproc start/attach. This also
    allows to defer remoteproc driver's probe if mailbox is not probed yet.

    Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
    Acked-by: Andrew Davis <afd@ti.com>
    Link: https://lore.kernel.org/r/20240808074127.2688131-4-b-padhi@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 09:02:09 -07:00
Jared Kangas 3e92f52900 remoteproc: k3-r5: Acquire mailbox handle during probe routine
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit f3f11cfe890733373ddbb1ce8991ccd4ee5e79e1
Author: Beleswar Padhi <b-padhi@ti.com>
Date:   Thu Aug 8 13:11:26 2024 +0530

    remoteproc: k3-r5: Acquire mailbox handle during probe routine

    Acquire the mailbox handle during device probe and do not release handle
    in stop/detach routine or error paths. This removes the redundant
    requests for mbox handle later during rproc start/attach. This also
    allows to defer remoteproc driver's probe if mailbox is not probed yet.

    Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
    Link: https://lore.kernel.org/r/20240808074127.2688131-3-b-padhi@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 09:02:06 -07:00
Jared Kangas ed84020b52 remoteproc: k3-r5: Use devm_rproc_alloc() helper
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit c81ef0cb576a3995edf24b63e9639881f19a2122
Author: Beleswar Padhi <b-padhi@ti.com>
Date:   Thu Aug 8 13:11:25 2024 +0530

    remoteproc: k3-r5: 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: Beleswar Padhi <b-padhi@ti.com>
    Reviewed-by: Andrew Davis <afd@ti.com>
    Link: https://lore.kernel.org/r/20240808074127.2688131-2-b-padhi@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 09:02:02 -07:00
Jared Kangas 9fdf553d78 remoteproc: k3-dsp: Fix log levels where appropriate
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 9dfd8d92f7b19ba8eaf5391380a923396f8a9dd0
Author: Garrett Giordano <ggiordano@phytec.com>
Date:   Wed Jun 26 12:14:38 2024 -0700

    remoteproc: k3-dsp: Fix log levels where appropriate

    Driver was logging information as errors. Changed dev_err to dev_dbg
    where appropriate.

    Signed-off-by: Garrett Giordano <ggiordano@phytec.com>
    Acked-by: Andrew Davis <afd@ti.com>
    Link: https://lore.kernel.org/r/20240626191438.490524-1-ggiordano@phytec.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 40c2da4d70 remoteproc: k3-r5: Fix IPC-only mode detection
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit a8631f6d6344d976096b1efafdb2fbb3111bd790
Author: Richard Genoud <richard.genoud@bootlin.com>
Date:   Fri Jun 21 17:00:55 2024 +0200

    remoteproc: k3-r5: Fix IPC-only mode detection

    ret variable was used to test reset status, get from
    reset_control_status() call. But this variable was overwritten by
    ti_sci_proc_get_status() a few lines bellow.
    And as ti_sci_proc_get_status() returns 0 or a negative value (in this
    latter case, followed by a return), the expression !ret was always true,

    Clearly, this was not what was intended:
    In the comment above it's said that "requires both local and module
    resets to be deasserted"; if reset_control_status() returns 0 it means
    that the reset line is deasserted.
    So, it's pretty clear that the return value of reset_control_status()
    was intended to be used instead of ti_sci_proc_get_status() return
    value.

    This could lead in an incorrect IPC-only mode detection if reset line is
    asserted (so reset_control_status() return > 0) and c_state != 0 and
    halted == 0.
    In this case, the old code would have detected an IPC-only mode instead
    of a mismatched mode.

    Fixes: 1168af40b1ad ("remoteproc: k3-r5: Add support for IPC-only mode for all R5Fs")
    Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
    Reviewed-by: Hari Nagalla <hnagalla@ti.com>
    Link: https://lore.kernel.org/r/20240621150058.319524-2-richard.genoud@bootlin.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas ecb9b07e18 remoteproc: k3-r5: Jump to error handling labels in start/stop errors
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 1dc7242f6ee0c99852cb90676d7fe201cf5de422
Author: Beleswar Padhi <b-padhi@ti.com>
Date:   Mon May 6 19:48:49 2024 +0530

    remoteproc: k3-r5: Jump to error handling labels in start/stop errors

    In case of errors during core start operation from sysfs, the driver
    directly returns with the -EPERM error code. Fix this to ensure that
    mailbox channels are freed on error before returning by jumping to the
    'put_mbox' error handling label. Similarly, jump to the 'out' error
    handling label to return with required -EPERM error code during the
    core stop operation from sysfs.

    Fixes: 3c8a9066d584 ("remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs")
    Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
    Link: https://lore.kernel.org/r/20240506141849.1735679-1-b-padhi@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 36788ebe9d remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 3c8a9066d584f5010b6f4ba03bf6b19d28973d52
Author: Beleswar Padhi <b-padhi@ti.com>
Date:   Tue Apr 30 16:23:07 2024 +0530

    remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs

    PSC controller has a limitation that it can only power-up the second
    core when the first core is in ON state. Power-state for core0 should be
    equal to or higher than core1.

    Therefore, prevent core1 from powering up before core0 during the start
    process from sysfs. Similarly, prevent core0 from shutting down before
    core1 has been shut down from sysfs.

    Fixes: 6dedbd1d54 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
    Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20240430105307.1190615-3-b-padhi@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 5c5d2dac06 remoteproc: k3-r5: Wait for core0 power-up before powering up core1
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 61f6f68447aba08aeaa97593af3a7d85a114891f
Author: Apurva Nandan <a-nandan@ti.com>
Date:   Tue Apr 30 16:23:06 2024 +0530

    remoteproc: k3-r5: Wait for core0 power-up before powering up core1

    PSC controller has a limitation that it can only power-up the second core
    when the first core is in ON state. Power-state for core0 should be equal
    to or higher than core1, else the kernel is seen hanging during rproc
    loading.

    Make the powering up of cores sequential, by waiting for the current core
    to power-up before proceeding to the next core, with a timeout of 2sec.
    Add a wait queue event in k3_r5_cluster_rproc_init call, that will wait
    for the current core to be released from reset before proceeding with the
    next core.

    Fixes: 6dedbd1d54 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
    Signed-off-by: Apurva Nandan <a-nandan@ti.com>
    Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20240430105307.1190615-2-b-padhi@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 60aa4be580 remoteproc: k3-dsp: Use devm_rproc_add() helper
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 456a75ab51967c4c594519795a9f49c40662c291
Author: Andrew Davis <afd@ti.com>
Date:   Mon Feb 5 12:27:53 2024 -0600

    remoteproc: k3-dsp: Use devm_rproc_add() helper

    Use device lifecycle managed devm_rproc_add() helper function. This helps
    prevent mistakes like deleting out of order in cleanup functions and
    forgetting to delete on all error paths.

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

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas bb35c82eb9 remoteproc: k3-dsp: Use devm_ioremap_wc() helper
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 8a5d6899e9a5377e8f3e95bf0a64a6d331876b6c
Author: Andrew Davis <afd@ti.com>
Date:   Mon Feb 5 12:27:52 2024 -0600

    remoteproc: k3-dsp: Use devm_ioremap_wc() helper

    Use a device lifecycle managed ioremap helper function. This helps prevent
    mistakes like unmapping out of order in cleanup functions and forgetting
    to unmap on all error paths.

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

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 3360288dd6 remoteproc: k3-dsp: Add devm action to release tsp
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 57ec3c126889604f1323acfadf768c113d9858d8
Author: Andrew Davis <afd@ti.com>
Date:   Mon Feb 5 12:27:51 2024 -0600

    remoteproc: k3-dsp: Add devm action to release tsp

    Use a device lifecycle managed action to release tps ti_sci_proc handle.
    This helps prevent mistakes like releasing out of order in cleanup
    functions and forgetting to release on error paths.

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

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas de8d8828b2 remoteproc: k3-dsp: Use devm_kzalloc() helper
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 585fc027a7f4fc38b6862eeb614c7446f2d5db4a
Author: Andrew Davis <afd@ti.com>
Date:   Mon Feb 5 12:27:50 2024 -0600

    remoteproc: k3-dsp: Use devm_kzalloc() helper

    Use device lifecycle managed devm_kzalloc() helper function. This helps
    prevent mistakes like freeing out of order in cleanup functions and
    forgetting to free on all error paths.

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

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 1fc16712dd remoteproc: k3-dsp: Use devm_ti_sci_get_by_phandle() helper
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 48f9a0858bfc502767206cca1d465b173cc0d650
Author: Andrew Davis <afd@ti.com>
Date:   Mon Feb 5 12:27:49 2024 -0600

    remoteproc: k3-dsp: Use devm_ti_sci_get_by_phandle() helper

    Use the device lifecycle managed TI-SCI get() function. This helps prevent
    mistakes like not put()'ing in the wrong order in cleanup functions and
    forgetting to put() on error paths.

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

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 72d9008308 remoteproc: k3-dsp: Use devm_kcalloc() helper
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 92a0915ac3eb571fc014c249c66db802be7fdac9
Author: Andrew Davis <afd@ti.com>
Date:   Tue Jan 23 12:49:08 2024 -0600

    remoteproc: k3-dsp: Use devm_kcalloc() helper

    Use a device lifecycle managed action to free memory. 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/20240123184913.725435-3-afd@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:44 -07:00
Jared Kangas 2943b56966 remoteproc: k3-dsp: Add devm action to release reserved memory
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 961a919a6dbd24b670766ae0613085d63e9c79e3
Author: Andrew Davis <afd@ti.com>
Date:   Tue Jan 23 12:49:07 2024 -0600

    remoteproc: k3-dsp: Add devm action to release reserved memory

    Use a device lifecycle managed action to release reserved memory. This
    helps prevent mistakes like releasing out of order in cleanup functions
    and forgetting to release on error paths.

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

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas f74bb108ab remoteproc: k3-dsp: Use devm_rproc_alloc() helper
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 64e17ec2504a542acd239f91589927ed266bca13
Author: Andrew Davis <afd@ti.com>
Date:   Tue Jan 23 12:49:06 2024 -0600

    remoteproc: k3-dsp: 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/20240123184913.725435-1-afd@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas 076da61be7 remoteproc: k3-dsp: Convert to platform remove callback returning void
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 3f978d9889a2531e48d97cef7f5126f4104ee69c
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu Nov 23 22:17:01 2023 +0100

    remoteproc: k3-dsp: 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 ignored (apart
    from emitting a warning) 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. Eventually after all drivers
    are converted, .remove_new() will be renamed to .remove().

    There is no change in behaviour as .remove() already returned zero
    unconditionally.

    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/20231123211657.518181-8-u.kleine-koenig@pengutronix.de
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas b828bce5df remoteproc: k3-dsp: Use symbolic error codes in error messages
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit cfd0b5c4fd1d23d1c68f704dcd74c1dbdfd7c144
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu Nov 23 22:17:00 2023 +0100

    remoteproc: k3-dsp: Use symbolic error codes in error messages

    The error message

            failed to send mailbox message (-EINVAL)

    is (for a human) more useful than

            failed to send mailbox message, status = -22

    Adapt all error messages to use the symbolic names instead of the
    numeric constants. The error paths in .probe() make use of
    dev_err_probe() which automatically handles EPROBE_DEFER.

    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/20231123211657.518181-7-u.kleine-koenig@pengutronix.de>
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas abf673cdb2 remoteproc: k3-dsp: Suppress duplicate error message in .remove()
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit bddae3e7ae70586b3805fdbce193760f13b4d73e
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu Nov 23 22:16:59 2023 +0100

    remoteproc: k3-dsp: Suppress duplicate error message in .remove()

    When the remove callback returns non-zero, the driver core emits an
    error message about the error value being ignored. As the driver already
    emits an error message already, return zero. This has no effect apart
    from suppressing the core's message. The platform device gets unbound
    irrespective of the return value.

    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/20231123211657.518181-6-u.kleine-koenig@pengutronix.de
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas 376ecd6f41 remoteproc: Explicitly include correct DT includes
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 3440d8da79ba983330457b2400b15e7b1b002ac3
Author: Rob Herring <robh@kernel.org>
Date:   Fri Jul 14 11:49:33 2023 -0600

    remoteproc: Explicitly include correct DT includes

    The DT of_device.h and of_platform.h date back to the separate
    of_platform_bus_type before it as merged into the regular platform bus.
    As part of that merge prepping Arm DT support 13 years ago, they
    "temporarily" include each other. They also include platform_device.h
    and of.h. As a result, there's a pretty much random mix of those include
    files used throughout the tree. In order to detangle these headers and
    replace the implicit includes with struct declarations, users need to
    explicitly include the correct includes.

    Signed-off-by: Rob Herring <robh@kernel.org>
    Link: https://lore.kernel.org/r/20230714174935.4063513-1-robh@kernel.org
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas 8fd0766a22 remoteproc: k3-r5: Use separate compatible string for TI AM62x SoC family
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 51723657be6865c3eb86e4fa7778cfaa4a97bddd
Author: Devarsh Thakkar <devarsht@ti.com>
Date:   Mon Mar 27 20:58:32 2023 +0530

    remoteproc: k3-r5: Use separate compatible string for TI AM62x SoC family

    AM62 and AM62A SoCs use single core R5F which is a new scenario
    different than the one being used with CLUSTER_MODE_SINGLECPU which is
    for utilizing a single core from a set of cores available in R5F cluster
    present in the SoC.

    To support this single core scenario map it with newly defined
    CLUSTER_MODE_SINGLECORE and use it when compatible is set to
    ti,am62-r5fss.

    Also set PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE config for
    CLUSTER_MODE_SINGLECORE too as it is required by R5 core when it is
    being as general purpose core instead of device manager.

    For IPC-only mode when config flag PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE
    is set, skip overriding to CLUSTER_MODE_SINGLECPU when
    CLUSTER_MODE_SINGLECORE is set as same flag is applicable for single
    core configuration too.

    Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
    Link: https://lore.kernel.org/r/20230327152832.923480-4-devarsht@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas 9b69e61ada remoteproc: k3-r5: Simplify cluster mode setting usage
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 7f402919278aa5b8eec82a7dad2e0cb8e6bdee14
Author: Devarsh Thakkar <devarsht@ti.com>
Date:   Mon Mar 27 20:58:30 2023 +0530

    remoteproc: k3-r5: Simplify cluster mode setting usage

    Check the validity of mode against SoC supported modes right
    at the probe to minimize the usage of same check further in the code.

    Set default value of cluster-mode only if cluster-mode device tree property
    is empty.

    In case devicetree provided cluster-mode property is invalid For e.g. using
    CLUSTER_MODE_SINGLECPU on any SoC other than am64x then return error.

    If firmware has set the PROC_BOOT_STATUS_FLAG_R5_SINGLECORE_ONLY flag then
    what it means is that only CLUSTER_MODE_SINGLECPU is possible to use [1]
    and hence there is no need to check for soc_data->single_cpu_mode first and
    then checking cluster mode.

    PROC_BOOT_CFG_FLAG_R5_SINGLE_CORE flag can be set directly for
    CLUSTER_MODE_SINGLECPU without checking for soc_data->single_cpu_mode since
    that check has already been done during probe.

    For IPC-only mode, directly override cluster mode as per config flag set by
    bootloader without checking for soc specific data. This because config
    flag would already have been validated by firmware when bootloader was
    setting it.

    Link:
    [1] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/security/PROC_BOOT.html?highlight=singlecore_only#arm-r5

    Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
    Link: https://lore.kernel.org/r/20230327152832.923480-2-devarsht@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas fd15452c22 remoteproc: k3-c7x: Add support for C7xv DSP on AM62A SoC
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit 41909ba6d82483791db47add5e2baac0458550d2
Author: Jai Luthra <j-luthra@ti.com>
Date:   Fri Dec 30 07:24:53 2022 -0600

    remoteproc: k3-c7x: Add support for C7xv DSP on AM62A SoC

    Add support to the K3 DSP remoteproc driver to configure the C7xv
    subsystem core on AM62A SoCs. The C7xv susbsytem is based on C71 DSP
    with anlytics engine for deep learning purposes. The remoteproc
    handling for device management is similar to the C66/C71 DSPs on K3
    J7 family SoCs, even though there are additional hardware accelerators
    and IP updates to C7xv subsystem.

    Signed-off-by: Jai Luthra <j-luthra@ti.com>
    Signed-off-by: Hari Nagalla <hnagalla@ti.com>
    Link: https://lore.kernel.org/r/20221230132453.32022-3-hnagalla@ti.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:43 -07:00
Jared Kangas d33f0d01bb remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init
JIRA: https://issues.redhat.com/browse/RHEL-60788

commit fa220c05d282e7479abe08b54e3bdffd06c25e97
Author: Miaoqian Lin <linmq006@gmail.com>
Date:   Sun Jun 5 12:33:34 2022 +0400

    remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init

    Every iteration of for_each_available_child_of_node() decrements
    the reference count of the previous node.
    When breaking early from a for_each_available_child_of_node() loop,
    we need to explicitly call of_node_put() on the child node.
    Add missing of_node_put() to avoid refcount leak.

    Fixes: 6dedbd1d54 ("remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem")
    Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
    Acked-by: Suman Anna <s-anna@ti.com>
    Link: https://lore.kernel.org/r/20220605083334.23942-1-linmq006@gmail.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Jared Kangas <jkangas@redhat.com>
2024-09-30 08:51:42 -07:00
Lucas Zampieri 0a7758cc4c
Merge: Backport TI net changes and dependencies
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3860

JIRA: https://issues.redhat.com/browse/RHEL-29244
```
Omitted-fix: 766475cb526b ("ARM: omap1: add back omap_set_dma_priority() stub")
             This is a 32 bit ARM fix, which we don't build, so skip it.
Omitted-fix: cad7526f33ce ("net: dsa: ocelot: unlock on error in vsc9959_qos_port_tas_set()")
             This fix isn't related to TI, and my backport only brings in the TI bit so the ocelot fix it
             doesn't really make sense. cs9's original backport also skipped the ocelot bits, so it doesn't
             require fixing either.
```
Tested by merging down into main-automotive, applying the config changes needed from RHEL-29245, and
running on TI's J784S4EVM board.

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>

Approved-by: Jerry Snitselaar <jsnitsel@redhat.com>
Approved-by: Eric Chanudet <echanude@redhat.com>
Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Approved-by: Jarod Wilson <jarod@redhat.com>

Merged-by: Lucas Zampieri <lzampier@redhat.com>
2024-04-15 14:22:14 -03:00
Radu Rendec aa11f53d74 remoteproc: qcom_q6v5_adsp: Convert to dev_pm_domain_attach|detach_list()
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit db34c47d56d5ad91f61978c367d55069a81255e6
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue Jan 30 13:39:50 2024 +0100

    remoteproc: qcom_q6v5_adsp: Convert to dev_pm_domain_attach|detach_list()

    Let's avoid some of the boilerplate code to manage the various PM domain
    cases, by converting into using dev_pm_domain_attach|detach_list().

    As a part of the conversion, we are moving over to use device_links, which
    simplifies the runtime PM support too. Moreover, while attaching let's
    trust that an already attached single PM domain is the correct one.

    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Cc: Bjorn Andersson <andersson@kernel.org>
    Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
    Cc: <linux-remoteproc@vger.kernel.org>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://lore.kernel.org/r/20240130123951.236243-5-ulf.hansson@linaro.org

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:10 -04:00
Radu Rendec 53eb6f9a08 remoteproc: imx_rproc: Convert to dev_pm_domain_attach|detach_list()
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit 3f6905fb2fdeaf5faaecfc6b80fe30c5a32b612b
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue Jan 30 13:39:49 2024 +0100

    remoteproc: imx_rproc: Convert to dev_pm_domain_attach|detach_list()

    Let's avoid the boilerplate code to manage the multiple PM domain case, by
    converting into using dev_pm_domain_attach|detach_list().

    Cc: Bjorn Andersson <andersson@kernel.org>
    Cc: Shawn Guo <shawnguo@kernel.org>
    Cc: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: Daniel Baluta <daniel.baluta@nxp.com>
    Cc: <linux-remoteproc@vger.kernel.org>
    Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://lore.kernel.org/r/20240130123951.236243-4-ulf.hansson@linaro.org

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:10 -04:00
Radu Rendec 890c07af6d remoteproc: imx_dsp_rproc: Convert to dev_pm_domain_attach|detach_list()
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit ccd946889a3754332297e00f1535f6d7bf48f946
Author: Ulf Hansson <ulf.hansson@linaro.org>
Date:   Tue Jan 30 13:39:48 2024 +0100

    remoteproc: imx_dsp_rproc: Convert to dev_pm_domain_attach|detach_list()

    Let's avoid the boilerplate code to manage the multiple PM domain case, by
    converting into using dev_pm_domain_attach|detach_list().

    Cc: Bjorn Andersson <andersson@kernel.org>
    Cc: Shawn Guo <shawnguo@kernel.org>
    Cc: Sascha Hauer <s.hauer@pengutronix.de>
    Cc: Daniel Baluta <daniel.baluta@nxp.com>
    Cc: <linux-remoteproc@vger.kernel.org>
    Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Link: https://lore.kernel.org/r/20240130123951.236243-3-ulf.hansson@linaro.org

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:10 -04:00
Radu Rendec 1e486c75a1 remoteproc: qcom_q6v5_adsp: Fix iommu_map() compatibility
JIRA: https://issues.redhat.com/browse/RHEL-29555
Upstream-status: RHEL-only

The iommu_map() prototype was changed upstream in commit 1369459b2e219
("iommu: Add a gfp parameter to iommu_map()"), and this change was
already backported to the RHEL kernel. Around the same time, upstream
commit 126848ad83496 ("remoteproc: qcom: Add support for memory
sandbox"), which is backported in this merge request, added an
incompatible call to iommu_map() to the Qualcomm Q6V5 ADSP driver.
Upstream, the incompatibility was fixed during branch integration,
and is part of merge commit f3a2439f20d91 ("Merge tag 'rproc-v6.3'
of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux").

Let's backport the incompatibility fix as a standalone RHEL-only patch,
since the merge commit cannot be backported per se.

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:09 -04:00
Radu Rendec e5fd4d4731 remoteproc: qcom: using pm_runtime_resume_and_get to simplify the code
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit 8672e79d98bc702084f65ef6d118333bd73f09a2
Author: ran jianping <ran.jianping@zte.com.cn>
Date:   Thu Apr 28 06:45:45 2022 +0000

    remoteproc: qcom: using pm_runtime_resume_and_get to simplify the code

    Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
    pm_runtime_put_noidle. This change is just to simplify the code, no
    actual functional changes.

    Reported-by: Zeal Robot <zealci@zte.com.cn>
    Signed-off-by: ran jianping <ran.jianping@zte.com.cn>
    Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
    Link: https://lore.kernel.org/r/20220428064545.3850057-1-ran.jianping@zte.com.cn

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:09 -04:00
Radu Rendec d511c26733 remoteproc: qcom: Add support for memory sandbox
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit f22eedff28aff912bde7f8deabebd121cb64fae3
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Wed Sep 28 17:57:53 2022 +0530

    remoteproc: qcom: Add support for memory sandbox

    Update pil driver with SMMU mapping for allowing authorised
    memory access to ADSP firmware, by carveout reserved adsp memory
    region from device tree file.

    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/1664368073-13659-8-git-send-email-quic_srivasam@quicinc.com

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:09 -04:00
Radu Rendec 7471edd4cf remoteproc: qcom: Add efuse evb selection control
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit 9ece961916631aab81b9d9f8d9c2770d05548662
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Wed Sep 28 17:57:52 2022 +0530

    remoteproc: qcom: Add efuse evb selection control

    Add efuse evb selection control and enable it for starting ADSP.

    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/1664368073-13659-7-git-send-email-quic_srivasam@quicinc.com

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:08 -04:00
Radu Rendec 8d6e664726 remoteproc: qcom: Replace hard coded values with macros
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit c36d6aa67932788ec04820ba65693ccd41b1042f
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Wed Sep 28 17:57:51 2022 +0530

    remoteproc: qcom: Replace hard coded values with macros

    Replace hard coded values of QDSP6 boot control reg params
    with appropriate macro names.

    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/1664368073-13659-6-git-send-email-quic_srivasam@quicinc.com

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:08 -04:00
Radu Rendec 170339951f remoteproc: qcom: Update rproc parse firmware callback
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit 48ab209c6f5f84a5adcd68e150dc0f614c8bfba7
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Wed Sep 28 17:57:50 2022 +0530

    remoteproc: qcom: Update rproc parse firmware callback

    Change parse_fw callback in rproc ops from qcom_register_dump_segments
    to local function such that, it can perform coredump segments registration
    and it can parse section header in memory sandboxing required platforms.

    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/1664368073-13659-5-git-send-email-quic_srivasam@quicinc.com

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:08 -04:00
Radu Rendec 89e0db97ba remoteproc: qcom: Add compatible name for SC7280 ADSP
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit 66cab0c5c3f9dae0213b9d02af03791b75565986
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Wed Sep 28 17:57:49 2022 +0530

    remoteproc: qcom: Add compatible name for SC7280 ADSP

    Update adsp pil data and compatible name for loading ADSP
    binary on SC7280 based platforms.

    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/1664368073-13659-4-git-send-email-quic_srivasam@quicinc.com

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:07 -04:00
Radu Rendec f5fa4aade2 remoteproc: qcom: Add flag in adsp private data structure
JIRA: https://issues.redhat.com/browse/RHEL-29555

commit 272dca8d14c46d03c633756d150b1c48c1dcb594
Author: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Date:   Wed Sep 28 17:57:48 2022 +0530

    remoteproc: qcom: Add flag in adsp private data structure

    Add flag in qcom_adsp private data structure and initialize
    it to distinguish ADSP modules, which has iommu requirement,
    for using iommu selectively.

    Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Reviewed-by: Sibi Sankar <quic_sibis@quicinc.com>
    Signed-off-by: Bjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/1664368073-13659-3-git-send-email-quic_srivasam@quicinc.com

Signed-off-by: Radu Rendec <rrendec@redhat.com>
2024-03-20 13:50:07 -04:00
Andrew Halaney 8ef54a5a73 soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR
JIRA: https://issues.redhat.com/browse/RHEL-29244

commit 0211cc1e4fbbc81853227147bf0982c47362c567
Author: Suman Anna <s-anna@ti.com>
Date:   Fri Apr 14 10:25:42 2023 +0530

    soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR

    The PRUSS CFG module is represented as a syscon node and is currently
    managed by the PRUSS platform driver. Add easy accessor functions to set
    GPI mode, MII_RT event enable/disable and XFR (XIN XOUT) enable/disable
    to enable the PRUSS Ethernet usecase. These functions reuse the generic
    pruss_cfg_update() API function.

    Signed-off-by: Suman Anna <s-anna@ti.com>
    Co-developed-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
    Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>
    Signed-off-by: Puranjay Mohan <p-mohan@ti.com>
    Reviewed-by: Roger Quadros <rogerq@kernel.org>
    Reviewed-by: Tony Lindgren <tony@atomide.com>
    Reviewed-by: Simon Horman <simon.horman@corigine.com>
    Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
    Link: https://lore.kernel.org/r/20230414045542.3249939-5-danishanwar@ti.com
    Signed-off-by: Nishanth Menon <nm@ti.com>

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
2024-03-15 09:34:02 -05:00
Scott Weaver c9b6150777 Merge: remoteproc: imx_dsp_rproc: driver updates
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2936

Description:
Updates for NXP remoteproc: imx_dsp_rproc

Bugzilla: http://bugzilla.redhat.com/2230679

Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=54631968

Tested: Did sanity boot testing on (nxp-imx8mquad-01.edge1) system.

Signed-off-by: Steve Best <sbest@redhat.com>

Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: John B. Wyatt IV <jwyatt@redhat.com>

Signed-off-by: Scott Weaver <scweaver@redhat.com>
2023-10-06 19:39:26 -04:00
Steve Best 6a0b086eb9 remoteproc: imx: Convert to platform remove callback returning void
Bugzilla: https://bugzilla.redhat.com/2230674

commit 94ea6edd4926398a1d3fcedf4a1d218c7d80c873
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu May 4 21:44:38 2023 +0200

    remoteproc: imx: 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: Iuliana Prodan <iuliana.prodan@nxp.com>
    Link: https://lore.kernel.org/r/20230504194453.1150368-4-u.kleine-koenig@pengutronix.de
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-16 12:39:46 -04:00
Steve Best 3685a51a57 remoteproc: imx_rproc: Call of_node_put() on iteration error
Bugzilla: https://bugzilla.redhat.com/2230674

commit 5ef074e805ecfd9a16dbb7b6b88bbfa8abad7054
Author: Mathieu Poirier <mathieu.poirier@linaro.org>
Date:   Mon Mar 20 16:18:25 2023 -0600

    remoteproc: imx_rproc: 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: b29b4249f8 ("remoteproc: imx_rproc: add i.MX specific parse fw hook")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Reviewed-by: Peng Fan <peng.fan@nxp.com>
    Link: https://lore.kernel.org/r/20230320221826.2728078-5-mathieu.poirier@linaro.org
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-16 12:39:38 -04:00
Steve Best ed8aefcc84 remoteproc: imx_dsp_rproc: use modern pm_ops
Bugzilla: https://bugzilla.redhat.com/2230679

commit 47f64e7ef95a58e5c56f2ec62cbadbe868661149
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Thu Apr 20 23:36:04 2023 +0200

    remoteproc: imx_dsp_rproc: use modern pm_ops

    Without CONFIG_PM, the driver warns about unused functions:

    drivers/remoteproc/imx_dsp_rproc.c:1210:12: error: 'imx_dsp_runtime_suspend' defined but not used [-Werror=unused-function]
     1210 | static int imx_dsp_runtime_suspend(struct device *dev)
          |            ^~~~~~~~~~~~~~~~~~~~~~~
    drivers/remoteproc/imx_dsp_rproc.c:1178:12: error: 'imx_dsp_runtime_resume' defined but not used [-Werror=unused-function]
     1178 | static int imx_dsp_runtime_resume(struct device *dev)
          |            ^~~~~~~~~~~~~~~~~~~~~~

    Change the old SET_SYSTEM_SLEEP_PM_OPS()/SET_RUNTIME_PM_OPS()
    helpers to their modern replacements that avoid the warning,
    and remove the now unnecessary __maybe_unused annotations
    on the other PM helper functions.

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>
    Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Link: https://lore.kernel.org/r/20230420213610.2219080-1-arnd@kernel.org
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-15 08:28:37 -04:00
Steve Best f1a07aacae remoteproc: imx_dsp: Convert to platform remove callback returning void
Bugzilla: https://bugzilla.redhat.com/2230679

commit 31c1a5b70475a7e3bed89903edec4ac1a68057c4
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu May 4 21:44:37 2023 +0200

    remoteproc: imx_dsp: 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: Iuliana Prodan <iuliana.prodan@nxp.com>
    Link: https://lore.kernel.org/r/20230504194453.1150368-3-u.kleine-koenig@pengutronix.de
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-15 08:28:26 -04:00
Steve Best 1745645a08 remoteproc: imx_dsp_rproc: Fix kernel test robot sparse warning
Bugzilla: https://bugzilla.redhat.com/2230679

commit 3c497f624d40171ebead1a6705793100d92ecb85
Author: Mathieu Poirier <mathieu.poirier@linaro.org>
Date:   Fri Apr 7 10:14:29 2023 -0600

    remoteproc: imx_dsp_rproc: Fix kernel test robot sparse warning

    This patch fixes the kernel test robot warning reported here:

    https://lore.kernel.org/bpf/642f916b.pPIKZ%2Fl%2F%2Fbw8tvIH%25lkp@intel.com/T/

    Fixes: 408ec1ff0caa ("remoteproc: imx_dsp_rproc: Add custom memory copy implementation for i.MX DSP Cores")
    Link: https://lore.kernel.org/r/20230407161429.3973177-1-mathieu.poirier@linaro.org
    Tested-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-15 08:28:20 -04:00
Steve Best 89338c3cc1 remoteproc: imx_dsp_rproc: Improve exception handling in imx_dsp_rproc_mbox_alloc()
Bugzilla: https://bugzilla.redhat.com/2230679

commit 5de6ef496eee0c0063aceec7b9843fb824bd85ce
Author: Markus Elfring <Markus.Elfring@web.de>
Date:   Thu Apr 6 22:00:24 2023 +0200

    remoteproc: imx_dsp_rproc: Improve exception handling in imx_dsp_rproc_mbox_alloc()

    The label “err_out” was used to jump to another pointer check
    despite of the detail in the implementation of the function
    “imx_dsp_rproc_mbox_alloc” that it was determined already
    that the corresponding variable contained an error pointer
    because of a failed call of the function “mbox_request_channel_byname”.

    Thus perform the following adjustments:

    1. Return directly after a call of the function
       “mbox_request_channel_byname” failed for the input parameter “tx”.

    2. Use more appropriate labels instead.

    3. Reorder jump targets at the end.

    4. Omit a function call and three extra checks.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    Link: https://lore.kernel.org/r/d0e18bb1-afc4-8b6f-bb1c-b74b3bad908e@web.de
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-15 08:28:14 -04:00
Steve Best 7566241338 remoteproc: imx_dsp_rproc: Call of_node_put() on iteration error
Bugzilla: https://bugzilla.redhat.com/2230679

commit e0e01de8ee146986872e54e8365f4b4654819412
Author: Mathieu Poirier <mathieu.poirier@linaro.org>
Date:   Mon Mar 20 16:18:26 2023 -0600

    remoteproc: imx_dsp_rproc: 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: ec0e5549f358 ("remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX")
    Cc: stable@vger.kernel.org
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
    Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
    Link: https://lore.kernel.org/r/20230320221826.2728078-6-mathieu.poirier@linaro.org
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-15 08:28:07 -04:00
Steve Best dc96a0f471 remoteproc: imx_dsp_rproc: Add custom memory copy implementation for i.MX DSP Cores
Bugzilla: https://bugzilla.redhat.com/2230679

commit 408ec1ff0caa340c57eecf4cbd14ef0132036a50
Author: Iuliana Prodan <iuliana.prodan@nxp.com>
Date:   Tue Feb 21 19:03:56 2023 +0200

    remoteproc: imx_dsp_rproc: Add custom memory copy implementation for i.MX DSP Cores

    The IRAM is part of the HiFi DSP.
    According to hardware specification only 32-bits write are allowed
    otherwise we get a Kernel panic.

    Therefore add a custom memory copy and memset functions to deal with
    the above restriction.

    Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Link: https://lore.kernel.org/r/20230221170356.27923-1-iuliana.prodan@oss.nxp.com
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-15 08:28:00 -04:00
Steve Best bb440c1ccd remoteproc: imx_dsp_rproc: Add module parameter to ignore ready flag from remote processor
Bugzilla: https://bugzilla.redhat.com/2230679

commit 11bb42a94648af7d4fd570b7f7f26e74d9561ef0
Author: Iuliana Prodan <iuliana.prodan@nxp.com>
Date:   Fri Feb 17 11:41:24 2023 +0200

    remoteproc: imx_dsp_rproc: Add module parameter to ignore ready flag from remote processor

    There are cases when we want to test a simple "hello world"
    application on the DSP and we don't have IPC between the cores.
    Therefore, do not wait for a confirmation from the remote processor
    at start.

    Added "no_mailboxes" flag while inserting the module to not initialize
    any mailboxes, and so ignore remote processor reply after start.
    By default, this is off - do not ignore reply from rproc.

    Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
    Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
    Link: https://lore.kernel.org/r/20230217094124.9440-1-iuliana.prodan@oss.nxp.com
    [Fixed checkpatch warning]
    Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Signed-off-by: Steve Best <sbest@redhat.com>
2023-08-15 08:27:53 -04:00