trusty: Retry std_calls on SM_ERR_BUSY
authorArve Hjønnevåg <arve@android.com>
Sun, 5 Oct 2014 00:36:20 +0000 (17:36 -0700)
committerWinnie Hsu <whsu@nvidia.com>
Fri, 2 Dec 2016 18:32:00 +0000 (10:32 -0800)
commit04df39db81eea066669d840c66cb3927d8b81eb9
treee288f8951f4e4b87931278bd16b70b3f981fe4b1
parentf4290cdee4de82599cb0242d743b68b6d7ae715c
trusty: Retry std_calls on SM_ERR_BUSY

If the trusty spinlock is held, or if the strex fails for another
reason, trusty returns SM_ERR_BUSY. Add retry code to handle this.

Without this retry code, std_calls can fail. If the previous smc
call had returned SM_ERR_INTERRUPTED, this failure would cause
the driver to get out of sync with trusty. All later calls would
then fail with SM_ERR_INTERLEAVED_SMC.

Bug 1818826

Change-Id: I9f72bb7ce9af9e1ef0a38aeff62fb83ea51377cf
Signed-off-by: Arve Hjønnevåg <arve@android.com>
(cherry picked from commit e909ef01e6ea5084d05c2ce89a83f63247970e40 from https://android.googlesource.com/kernel/common/+/android-trusty-3.10)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/1255171
(cherry picked from commit f68a02600e571c57f9dbb4b3e51a544c79a83c9f in dev-kernel-3.10)
Reviewed-on: http://git-master/r/1257353
GVS: Gerrit_Virtual_Submit
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
drivers/trusty/trusty.c