+++ /dev/null
-From 3c8a9066d584f5010b6f4ba03bf6b19d28973d52 Mon Sep 17 00:00:00 2001
-From: Beleswar Padhi <b-padhi@ti.com>
-Date: Tue, 30 Apr 2024 16:23:07 +0530
-Subject: remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs
-
-From: Beleswar Padhi <b-padhi@ti.com>
-
-commit 3c8a9066d584f5010b6f4ba03bf6b19d28973d52 upstream.
-
-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: 6dedbd1d5443 ("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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/remoteproc/ti_k3_r5_remoteproc.c | 23 +++++++++++++++++++++--
- 1 file changed, 21 insertions(+), 2 deletions(-)
-
---- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
-+++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
-@@ -503,7 +503,7 @@ static int k3_r5_rproc_start(struct rpro
- struct k3_r5_cluster *cluster = kproc->cluster;
- struct mbox_client *client = &kproc->client;
- struct device *dev = kproc->dev;
-- struct k3_r5_core *core;
-+ struct k3_r5_core *core0, *core;
- u32 boot_addr;
- int ret;
-
-@@ -552,6 +552,15 @@ static int k3_r5_rproc_start(struct rpro
- goto unroll_core_run;
- }
- } else {
-+ /* do not allow core 1 to start before core 0 */
-+ core0 = list_first_entry(&cluster->cores, struct k3_r5_core,
-+ elem);
-+ if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
-+ dev_err(dev, "%s: can not start core 1 before core 0\n",
-+ __func__);
-+ return -EPERM;
-+ }
-+
- ret = k3_r5_core_run(core);
- if (ret)
- goto put_mbox;
-@@ -596,7 +605,8 @@ static int k3_r5_rproc_stop(struct rproc
- {
- struct k3_r5_rproc *kproc = rproc->priv;
- struct k3_r5_cluster *cluster = kproc->cluster;
-- struct k3_r5_core *core = kproc->core;
-+ struct device *dev = kproc->dev;
-+ struct k3_r5_core *core1, *core = kproc->core;
- int ret;
-
- /* halt all applicable cores */
-@@ -609,6 +619,15 @@ static int k3_r5_rproc_stop(struct rproc
- }
- }
- } else {
-+ /* do not allow core 0 to stop before core 1 */
-+ core1 = list_last_entry(&cluster->cores, struct k3_r5_core,
-+ elem);
-+ if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
-+ dev_err(dev, "%s: can not stop core 0 before core 1\n",
-+ __func__);
-+ return -EPERM;
-+ }
-+
- ret = k3_r5_core_halt(core);
- if (ret)
- goto out;
+++ /dev/null
-From 1dc7242f6ee0c99852cb90676d7fe201cf5de422 Mon Sep 17 00:00:00 2001
-From: Beleswar Padhi <b-padhi@ti.com>
-Date: Mon, 6 May 2024 19:48:49 +0530
-Subject: remoteproc: k3-r5: Jump to error handling labels in start/stop errors
-
-From: Beleswar Padhi <b-padhi@ti.com>
-
-commit 1dc7242f6ee0c99852cb90676d7fe201cf5de422 upstream.
-
-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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/remoteproc/ti_k3_r5_remoteproc.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
---- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
-+++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
-@@ -558,7 +558,8 @@ static int k3_r5_rproc_start(struct rpro
- if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
- dev_err(dev, "%s: can not start core 1 before core 0\n",
- __func__);
-- return -EPERM;
-+ ret = -EPERM;
-+ goto put_mbox;
- }
-
- ret = k3_r5_core_run(core);
-@@ -625,7 +626,8 @@ static int k3_r5_rproc_stop(struct rproc
- if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
- dev_err(dev, "%s: can not stop core 0 before core 1\n",
- __func__);
-- return -EPERM;
-+ ret = -EPERM;
-+ goto out;
- }
-
- ret = k3_r5_core_halt(core);
+++ /dev/null
-From 61f6f68447aba08aeaa97593af3a7d85a114891f Mon Sep 17 00:00:00 2001
-From: Apurva Nandan <a-nandan@ti.com>
-Date: Tue, 30 Apr 2024 16:23:06 +0530
-Subject: remoteproc: k3-r5: Wait for core0 power-up before powering up core1
-
-From: Apurva Nandan <a-nandan@ti.com>
-
-commit 61f6f68447aba08aeaa97593af3a7d85a114891f upstream.
-
-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: 6dedbd1d5443 ("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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/remoteproc/ti_k3_r5_remoteproc.c | 33 +++++++++++++++++++++++++++++++
- 1 file changed, 33 insertions(+)
-
---- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
-+++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
-@@ -98,12 +98,14 @@ struct k3_r5_soc_data {
- * @dev: cached device pointer
- * @mode: Mode to configure the Cluster - Split or LockStep
- * @cores: list of R5 cores within the cluster
-+ * @core_transition: wait queue to sync core state changes
- * @soc_data: SoC-specific feature data for a R5FSS
- */
- struct k3_r5_cluster {
- struct device *dev;
- enum cluster_mode mode;
- struct list_head cores;
-+ wait_queue_head_t core_transition;
- const struct k3_r5_soc_data *soc_data;
- };
-
-@@ -123,6 +125,7 @@ struct k3_r5_cluster {
- * @atcm_enable: flag to control ATCM enablement
- * @btcm_enable: flag to control BTCM enablement
- * @loczrama: flag to dictate which TCM is at device address 0x0
-+ * @released_from_reset: flag to signal when core is out of reset
- */
- struct k3_r5_core {
- struct list_head elem;
-@@ -139,6 +142,7 @@ struct k3_r5_core {
- u32 atcm_enable;
- u32 btcm_enable;
- u32 loczrama;
-+ bool released_from_reset;
- };
-
- /**
-@@ -416,6 +420,8 @@ static int k3_r5_rproc_prepare(struct rp
- ret);
- return ret;
- }
-+ core->released_from_reset = true;
-+ wake_up_interruptible(&cluster->core_transition);
-
- /*
- * Newer IP revisions like on J7200 SoCs support h/w auto-initialization
-@@ -754,6 +760,12 @@ static int k3_r5_rproc_configure(struct
- core = kproc->core;
- }
-
-+ /*
-+ * Skip the waiting mechanism for sequential power-on of cores if the
-+ * core has already been booted by another entity.
-+ */
-+ core->released_from_reset = c_state;
-+
- ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl,
- &stat);
- if (ret < 0)
-@@ -1066,6 +1078,26 @@ static int k3_r5_cluster_rproc_init(stru
- if (cluster->mode == CLUSTER_MODE_LOCKSTEP ||
- cluster->mode == CLUSTER_MODE_SINGLECPU)
- break;
-+
-+ /*
-+ * R5 cores require to be powered on sequentially, core0
-+ * should be in higher power state than core1 in a cluster
-+ * So, wait for current core to power up before proceeding
-+ * to next core and put timeout of 2sec for each core.
-+ *
-+ * This waiting mechanism is necessary because
-+ * rproc_auto_boot_callback() for core1 can be called before
-+ * core0 due to thread execution order.
-+ */
-+ ret = wait_event_interruptible_timeout(cluster->core_transition,
-+ core->released_from_reset,
-+ msecs_to_jiffies(2000));
-+ if (ret <= 0) {
-+ dev_err(dev,
-+ "Timed out waiting for %s core to power up!\n",
-+ rproc->name);
-+ return ret;
-+ }
- }
-
- return 0;
-@@ -1483,6 +1515,7 @@ static int k3_r5_probe(struct platform_d
- CLUSTER_MODE_SPLIT : CLUSTER_MODE_LOCKSTEP;
- cluster->soc_data = data;
- INIT_LIST_HEAD(&cluster->cores);
-+ init_waitqueue_head(&cluster->core_transition);
-
- ret = of_property_read_u32(np, "ti,cluster-mode", &cluster->mode);
- if (ret < 0 && ret != -EINVAL) {
ocfs2-fix-races-between-hole-punching-and-aio-dio.patch
pci-rockchip-ep-remove-wrong-mask-on-subsys_vendor_id.patch
dmaengine-axi-dmac-fix-possible-race-in-remove.patch
-remoteproc-k3-r5-wait-for-core0-power-up-before-powering-up-core1.patch
-remoteproc-k3-r5-do-not-allow-core1-to-power-up-before-core0-via-sysfs.patch
riscv-rewrite-__kernel_map_pages-to-fix-sleeping-in-invalid-context.patch
intel_th-pci-add-granite-rapids-support.patch
intel_th-pci-add-granite-rapids-soc-support.patch
mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch
mptcp-pm-update-add_addr-counters-after-connect.patch
kbuild-remove-support-for-clang-s-thinlto-caching.patch
-remoteproc-k3-r5-jump-to-error-handling-labels-in-start-stop-errors.patch
greybus-fix-use-after-free-bug-in-gb_interface_release-due-to-race-condition.patch
usb-storage-alauda-check-whether-the-media-is-initia.patch
i2c-at91-fix-the-functionality-flags-of-the-slave-on.patch