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

Commit e76e482e authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam
Browse files

msm: smd: fix SMD probe initialization race condition



As an optimization, do_smd_probe() checks the free_offset and only
schedules the probe worker if the free_offset has changed (which
implies that new SMD channels may have been allocated).

If a remote subsystem allocates all of its SMD channels before SMSM
initialization has been completed, then when smsm_post_init() is
called, smsm_irq_handler() will call do_smd_probe() which will update
the free_offset and schedule the SMD probe worker. The probe worker
will bail because SMD has not been initialized yet (e.g. smd_initialized
isn't true). Once do_smd_probe() is called as part of smd_post_init(), it
compares the free_offset and doesn't see a change, so the SMD probe worker
is not scheduled.

Do not use do_smd_probe() until after SMD has been initialized.

CRs-Fixed: 538710
Change-Id: Ic4e97141202dfcb5f936a9cd38c6dcf9a61ccf8d
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
parent e6edf782
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -2639,7 +2639,6 @@ static irqreturn_t smsm_irq_handler(int irq, void *data)
		if (old_apps != apps) {
			SMSM_DBG("<SM %08x NOTIFY>\n", apps);
			__raw_writel(apps, SMSM_STATE_ADDR(SMSM_APPS_STATE));
			do_smd_probe();
			notify_other_smsm(SMSM_APPS_STATE, (old_apps ^ apps));
		}

@@ -3084,10 +3083,9 @@ void smd_post_init(bool is_legacy)
	if (is_legacy) {
		smd_initialized = 1;
		smd_alloc_loopback_channel();
		tasklet_schedule(&smd_fake_irq_tasklet);
	} else {
		schedule_work(&probe_work);
	}

	schedule_work(&probe_work);
}

/**