optee: support routing of rpmb data frames to mmc
Adds support in optee supplicant to route signed (MACed) RPMB frames
from OP-TEE Secure OS to MMC and vice versa to manipulate the RPMB
partition.
Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 726382d..7f870f2 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -315,6 +315,13 @@
param.a3 = res.a3;
handle_rpc(dev, ¶m, &page_list);
} else {
+ /*
+ * In case we've accessed RPMB to serve an RPC
+ * request we need to restore the previously
+ * selected partition as the caller may expect it
+ * to remain unchanged.
+ */
+ optee_suppl_rpmb_release(dev);
return call_err_to_res(res.a0);
}
}
@@ -651,4 +658,5 @@
.probe = optee_probe,
.ops = &optee_ops,
.platdata_auto_alloc_size = sizeof(struct optee_pdata),
+ .priv_auto_alloc_size = sizeof(struct optee_private),
};