Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe0ec623 authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: cntrl: qcom: disable runtime PM support in a graceful manner



MHI relies on runtime PM framework auto-suspend feature. Initial
approach did not stop the auto-suspend timer or disable runtime
PM at device power down. It also re-initialized internal
variables at power up which resulted in a use after free scenario
as an old timer entry was freed again at a time of core collapse.
Disable runtime PM support gracefully at device power down to
avoid such scenarios.

CRs-Fixed: 2352747
Change-Id: I72f370fc77b04c12fdf2a5cf2a46a94fffa99082
Acked-by: default avatarBhaumik Vasav Bhatt <bbhatt@qti.qualcomm.com>
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 0eef6c41
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -52,8 +52,6 @@ enum MHI_DEBUG_LEVEL mhi_ipc_log_lvl = MHI_MSG_LVL_ERROR;

#endif

extern void pm_runtime_init(struct device *dev);

static int mhi_arch_set_bus_request(struct mhi_controller *mhi_cntrl, int index)
{
	struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
@@ -105,7 +103,7 @@ static int mhi_arch_esoc_ops_power_on(void *priv, bool mdm_state)
	MHI_LOG("Enter\n");

	/* reset rpm state */
	pm_runtime_init(&pci_dev->dev);
	pm_runtime_set_active(&pci_dev->dev);
	pm_runtime_enable(&pci_dev->dev);
	mutex_unlock(&mhi_cntrl->pm_mutex);
	pm_runtime_forbid(&pci_dev->dev);
+3 −0
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ void mhi_deinit_pci_dev(struct mhi_controller *mhi_cntrl)
	struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
	struct pci_dev *pci_dev = mhi_dev->pci_dev;

	pm_runtime_mark_last_busy(&pci_dev->dev);
	pm_runtime_dont_use_autosuspend(&pci_dev->dev);
	pm_runtime_disable(&pci_dev->dev);
	pci_free_irq_vectors(pci_dev);
	kfree(mhi_cntrl->irq);
	mhi_cntrl->irq = NULL;