tee: amdtee: unload TA only when its refcount becomes 0
authorRijo Thomas <Rijo-john.Thomas@amd.com>
Wed, 14 Apr 2021 17:38:27 +0000 (23:08 +0530)
committerJens Wiklander <jens.wiklander@linaro.org>
Wed, 5 May 2021 11:00:11 +0000 (13:00 +0200)
commit9f015b3765bf593b3ed5d3b588e409dc0ffa9f85
tree0bd7503a0029b6125299e9649d56963e7a781bac
parent9f4ad9e425a1d3b6a34617b8ea226d56a119a717
tee: amdtee: unload TA only when its refcount becomes 0

Same Trusted Application (TA) can be loaded in multiple TEE contexts.

If it is a single instance TA, the TA should not get unloaded from AMD
Secure Processor, while it is still in use in another TEE context.

Therefore reference count TA and unload it when the count becomes zero.

Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver")
Reviewed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/amdtee/amdtee_private.h
drivers/tee/amdtee/call.c
drivers/tee/amdtee/core.c