lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250821-vdev_next-20250821_sriov-v3-5-e1b017c48d4a@quicinc.com>
Date: Thu, 21 Aug 2025 18:25:37 +0530
From: Vivek.Pernamitta@...cinc.com
To: Manivannan Sadhasivam <mani@...nel.org>
CC: <mhi@...ts.linux.dev>, <linux-arm-msm@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>,
        Vivek Pernamitta <quic_vpernami@...cinc.com>
Subject: [PATCH v3 5/6] bus: mhi: core: Improve mhi_sync_power_up handling
 for SYS_ERR state

From: Vivek Pernamitta <quic_vpernami@...cinc.com>

In power-up, reboot, or recovery scenarios, mhi_sync_power_up() is invoked
by the controller driver to wait for the device to enter Mission Mode.

However, in some cases, the device may be in SYS_ERR state due to a
previous device reset. SYS_ERR is a valid state, but currently, the host
exits at wait_event_timeout() prematurely when MHI_PM_IN_ERROR_STATE is
detected, causing mhi_sync_power_up() to fail.

If MHI is torn down before SYS_ERR is serviced, recovery is not possible.
Instead of aborting, the SYS_ERR handler should process the error and queue
the next state transition to bring the device into Mission Mode.

This change ensures mhi_sync_power_up() waits for Mission Mode even
after SYS_ERR, enabling proper recovery and improving robustness.

Signed-off-by: Vivek Pernamitta <quic_vpernami@...cinc.com>
---
 drivers/bus/mhi/host/internal.h | 2 ++
 drivers/bus/mhi/host/pm.c       | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/internal.h
index 034be33565b78eff9bdefd93faa4f3ce93825bad..9e37e5c9a6c7e07d54300adce51c9db9052e477a 100644
--- a/drivers/bus/mhi/host/internal.h
+++ b/drivers/bus/mhi/host/internal.h
@@ -170,6 +170,8 @@ enum mhi_pm_state {
 							MHI_PM_IN_ERROR_STATE(pm_state))
 #define MHI_PM_IN_SUSPEND_STATE(pm_state)		(pm_state & \
 							(MHI_PM_M3_ENTER | MHI_PM_M3))
+#define MHI_PM_IN_UNRECOVERABLE_ERROR(pm_state)		((pm_state == MHI_PM_FW_DL_ERR) || \
+							(pm_state >= MHI_PM_SYS_ERR_FAIL))
 
 #define NR_OF_CMD_RINGS					1
 #define CMD_EL_PER_RING					128
diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
index 33d92bf2fc3ed48db5f7fe80e4f0ef9fe2d2f2ab..e908bbce79e9a8a76881b5d040c7e9d4985124dc 100644
--- a/drivers/bus/mhi/host/pm.c
+++ b/drivers/bus/mhi/host/pm.c
@@ -1279,7 +1279,7 @@ int mhi_sync_power_up(struct mhi_controller *mhi_cntrl)
 		mhi_cntrl->ready_timeout_ms : mhi_cntrl->timeout_ms;
 	wait_event_timeout(mhi_cntrl->state_event,
 			   MHI_IN_MISSION_MODE(mhi_cntrl->ee) ||
-			   MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state),
+			   MHI_PM_IN_UNRECOVERABLE_ERROR(mhi_cntrl->pm_state),
 			   msecs_to_jiffies(timeout_ms));
 
 	ret = (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT;

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ