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

Commit 13305135 authored by Bhaumik Bhatt's avatar Bhaumik Bhatt
Browse files

mhi: core: handle low priority events after controller is ready



Controller gets a callback at mission mode entrypoint. Ensure
that is done before handling any bandwidth scaling requests
from low priority worker thread as there is a possibility of a
race.

Change-Id: I9592699a395021fd6f72a2b3e42ed8b80ec097aa
Signed-off-by: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
parent 59af5126
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1643,6 +1643,7 @@ irqreturn_t mhi_intvec_handlr(int irq_number, void *dev)
	wake_up_all(&mhi_cntrl->state_event);
	MHI_VERB("Exit\n");

	if (MHI_IN_MISSION_MODE(mhi_cntrl->ee))
		schedule_work(&mhi_cntrl->low_priority_worker);

	return IRQ_WAKE_THREAD;
+8 −8
Original line number Diff line number Diff line
@@ -459,22 +459,24 @@ int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl)
static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl)
{
	int i, ret;
	enum mhi_ee ee = 0;
	struct mhi_event *mhi_event;

	MHI_LOG("Processing Mission Mode Transition\n");

	write_lock_irq(&mhi_cntrl->pm_lock);
	if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state))
		mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl);
		ee = mhi_get_exec_env(mhi_cntrl);
	write_unlock_irq(&mhi_cntrl->pm_lock);

	if (!MHI_IN_MISSION_MODE(mhi_cntrl->ee))
	if (!MHI_IN_MISSION_MODE(ee))
		return -EIO;

	wake_up_all(&mhi_cntrl->state_event);

	mhi_cntrl->status_cb(mhi_cntrl, mhi_cntrl->priv_data,
			     MHI_CB_EE_MISSION_MODE);
	mhi_cntrl->ee = ee;

	wake_up_all(&mhi_cntrl->state_event);

	/* force MHI to be in M0 state before continuing */
	ret = __mhi_device_get_sync(mhi_cntrl);
@@ -802,11 +804,9 @@ void mhi_low_priority_worker(struct work_struct *work)
		 TO_MHI_EXEC_STR(mhi_cntrl->ee));

	/* check low priority event rings and process events */
	list_for_each_entry(mhi_event, &mhi_cntrl->lp_ev_rings, node) {
		if (MHI_IN_MISSION_MODE(mhi_cntrl->ee))
	list_for_each_entry(mhi_event, &mhi_cntrl->lp_ev_rings, node)
		mhi_event->process_event(mhi_cntrl, mhi_event, U32_MAX);
}
}

void mhi_pm_sys_err_worker(struct work_struct *work)
{