soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
authorDave Gerlach <d-gerlach@ti.com>
Fri, 2 Nov 2018 10:30:43 +0000 (16:00 +0530)
committerTero Kristo <t-kristo@ti.com>
Tue, 6 Nov 2018 13:26:12 +0000 (15:26 +0200)
commite85a58781a11244e14503d38ba5ebae0798c337a
tree7cea5d465c7756e42009c76dd2c49f5da0008568
parentf7f36a091c185c9d1cce980fed6459ffacdf53d1
soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot

Any user of wkup_m3_ipc calls wkup_m3_ipc_get to get a handle and this
checks the value of the static variable m3_ipc_state to see if the
wkup_m3 is ready. Currently this is populated during probe before
rproc_boot has been called, meaning there is a window of time that
wkup_m3_ipc_get can return a valid handle but the wkup_m3 itself is not
ready, leading to invalid IPC calls to the wkup_m3 and system
instability.

To avoid this, move the population of the m3_ipc_state variable until
after rproc_boot has succeeded to guarantee a valid and usable handle
is always returned.

Reported-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
drivers/soc/ti/wkup_m3_ipc.c