Patch "remoteproc: k3-r5: Fix IPC-only mode detection" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     remoteproc-k3-r5-fix-ipc-only-mode-detection.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4a06f277612fe320a4f7acd2fe5c420896c3e43d
Author: Richard Genoud <richard.genoud@xxxxxxxxxxx>
Date:   Fri Jun 21 17:00:55 2024 +0200

    remoteproc: k3-r5: Fix IPC-only mode detection
    
    [ Upstream commit a8631f6d6344d976096b1efafdb2fbb3111bd790 ]
    
    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@xxxxxxxxxxx>
    Reviewed-by: Hari Nagalla <hnagalla@xxxxxx>
    Link: https://lore.kernel.org/r/20240621150058.319524-2-richard.genoud@xxxxxxxxxxx
    Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
index 50e486bcfa103..39a47540c5900 100644
--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
@@ -1144,6 +1144,7 @@ static int k3_r5_rproc_configure_mode(struct k3_r5_rproc *kproc)
 	u32 atcm_enable, btcm_enable, loczrama;
 	struct k3_r5_core *core0;
 	enum cluster_mode mode = cluster->mode;
+	int reset_ctrl_status;
 	int ret;
 
 	core0 = list_first_entry(&cluster->cores, struct k3_r5_core, elem);
@@ -1160,11 +1161,11 @@ static int k3_r5_rproc_configure_mode(struct k3_r5_rproc *kproc)
 			 r_state, c_state);
 	}
 
-	ret = reset_control_status(core->reset);
-	if (ret < 0) {
+	reset_ctrl_status = reset_control_status(core->reset);
+	if (reset_ctrl_status < 0) {
 		dev_err(cdev, "failed to get initial local reset status, ret = %d\n",
-			ret);
-		return ret;
+			reset_ctrl_status);
+		return reset_ctrl_status;
 	}
 
 	/*
@@ -1199,7 +1200,7 @@ static int k3_r5_rproc_configure_mode(struct k3_r5_rproc *kproc)
 	 * irrelevant if module reset is asserted (POR value has local reset
 	 * deasserted), and is deemed as remoteproc mode
 	 */
-	if (c_state && !ret && !halted) {
+	if (c_state && !reset_ctrl_status && !halted) {
 		dev_info(cdev, "configured R5F for IPC-only mode\n");
 		kproc->rproc->state = RPROC_DETACHED;
 		ret = 1;
@@ -1217,7 +1218,7 @@ static int k3_r5_rproc_configure_mode(struct k3_r5_rproc *kproc)
 		ret = 0;
 	} else {
 		dev_err(cdev, "mismatched mode: local_reset = %s, module_reset = %s, core_state = %s\n",
-			!ret ? "deasserted" : "asserted",
+			!reset_ctrl_status ? "deasserted" : "asserted",
 			c_state ? "deasserted" : "asserted",
 			halted ? "halted" : "unhalted");
 		ret = -EINVAL;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux