]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
arm: optee: don't print warning about "wrong" RPC buffer
authorVolodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Mon, 5 Oct 2020 09:12:32 +0000 (09:12 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 20 Oct 2020 20:20:28 +0000 (13:20 -0700)
The OP-TEE mediator tracks the cookie value of the last buffer which was
requested by OP-TEE. This tracked value serves one important purpose: if
OP-TEE wants to request another buffer, we know that it finished
importing the previous one and we can free the page list associated with
it.

Also, we had a false premise that OP_TEE frees requested buffers in
reversed order. So we checked rpc_data_cookie during handling of the
OPTEE_RPC_CMD_SHM_FREE call and printed a warning if the cookie of the
buffer which is requested to be freed differs from the last allocated
one.

During testing of RPMB FS services I discovered that RPMB code frees
request and response buffers in the same order is it allocated them. And
this is perfectly fine, actually.

So, we are removing mentioned warning message in Xen, as it is perfectly
normal to free buffers in arbitrary order.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
[stefano: fix grammar]
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
xen/arch/arm/tee/optee.c

index 8a39fe33b0ef5c53c6716989b54ae878020204f7..ee8535974214f7b9f5e06a056ab622e5e90ccfad 100644 (file)
@@ -1127,25 +1127,7 @@ static int handle_rpc_return(struct optee_domain *ctx,
          */
         if ( shm_rpc->xen_arg->cmd == OPTEE_RPC_CMD_SHM_FREE )
         {
-            uint64_t cookie = shm_rpc->xen_arg->params[0].u.value.b;
-
-            free_optee_shm_buf(ctx, cookie);
-
-            /*
-             * OP-TEE asks to free the buffer, but this is not the same
-             * buffer we previously allocated for it. While nothing
-             * prevents OP-TEE from asking this, it is the strange
-             * situation. This may or may not be caused by a bug in
-             * OP-TEE or mediator. But is better to print warning.
-             */
-            if ( call->rpc_data_cookie && call->rpc_data_cookie != cookie )
-            {
-                gprintk(XENLOG_ERR,
-                        "Saved RPC cookie does not corresponds to OP-TEE's (%"PRIx64" != %"PRIx64")\n",
-                        call->rpc_data_cookie, cookie);
-
-                WARN();
-            }
+            free_optee_shm_buf(ctx, shm_rpc->xen_arg->params[0].u.value.b);
             call->rpc_data_cookie = 0;
         }
         unmap_domain_page(shm_rpc->xen_arg);