Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp266946lqn; Fri, 12 Apr 2024 00:08:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVIPckn2xALdSGGxmLsY6YprEHm9IOSwV+5IEHWRlfZfot4r0jIAqZZrmMh0cSpua3BNWlO+Hp0qIslamPInR0QquMSnE0HwFX2wYF6Q== X-Google-Smtp-Source: AGHT+IGkpDsHtFPZlOcgF66T1W1xZzEEb0sPKogXfJWQHVkuSM85giqeCXB3mPe7juMt27IzZVN6 X-Received: by 2002:a50:d605:0:b0:56d:fc9f:cca0 with SMTP id x5-20020a50d605000000b0056dfc9fcca0mr1084123edi.41.1712905680250; Fri, 12 Apr 2024 00:08:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712905680; cv=pass; d=google.com; s=arc-20160816; b=SRmrT8Gk6OH65L5hEvHk156W1WroBDreJ2bnU8A5deyiXegBOzUWNIl7oRdlUszXeA aWoOLNjUXbbEdQq4NdLkV5UaZJt6fM9qgxAW4vhoGXpJSTxst2bYboEHXEVmPoCq9OA+ +uApnWfI1VIXxErE99T+5BnUyES7jE3djyGXUuyCVb1yPDhBA2f5alzOpsoUFI0PfSDH T55O+ILAyJpalLsD85pJtf282K+wkTIiB2ZMxweJR/gAO0Bz8jnXwoLBlu9YsTpQ/uo5 Zu/B83x2Rxvmp5rJe3STuZUCZQ00+/TFfpD62TH5VH+Woc9pKzR/L5tU8PXWtc+iJrMv 4jUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=mLJ6WBpywrEkNYqayoCZ2xhXGhuIn8yJpIzmzY4EqOQ=; fh=7Y7YAM6cG9au5V6Ht9dE7WGMvC4g+gdE6VRshiDKYUk=; b=oPS8Gp+f4MUwZ7S6ILJ4fb0Cziwo2b3du7or75Q4oI7Vymu9V3OeuzOpgT/IW4yK+L uasV1tqycIvgTcPQRsYV912V/OAEV7I7r0gk1moiaPlKmcMS2B5qSrBXKSqqKSAMkHAO u/QFxqDGdahuLNacV0SE01/XOK6MU+t7ioTFgZ073kcJs8jukYpCceB9VYSgPPVvtw75 Hjqc939laXG2C89Zpsv+OhhI//29j/wIiCdMGpQOBq/CKLJxbdYXnekHDjKjTnvq4vv5 RBH9jhAl3EEYvubuU21nxtpY/m7JptVj7OU+2kV2CAm/iqFHvXECA9fpLgsid3aD75Ya iaiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hNCmohwj; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-142107-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142107-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l2-20020a50d6c2000000b0056e33366ec1si1458674edj.399.2024.04.12.00.08.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142107-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hNCmohwj; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-142107-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142107-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CAD021F20EFA for ; Fri, 12 Apr 2024 07:07:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 162474AEEF; Fri, 12 Apr 2024 07:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hNCmohwj" Received: from mail-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 203571DDDB for ; Fri, 12 Apr 2024 07:06:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712905571; cv=none; b=HNS47fuASOALHu5isnuANn0FicovqqU6/qU8/SR4keMusRxM7qH3o3UNvWnNKgRq+NzgaSLyAMSKiT9wg/mvgsEmqg/+Dg3CucWPuAtQHOvScFLAWofNbgXEZzrnpH+kvlqJoKAs2OVR01FjikW1BYJhbAsRJuHPbu4OVI4M1zo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712905571; c=relaxed/simple; bh=tRy1Ie/x50JtBT1fGqNzSa8ffN/Y9DEvPlT0J6K/VMs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=FqVoDhtH4Kr+paUUlyYrLjuUgX1w/gPuYKKUhOiSkw5HOACoRrRSeOaCBdXSzEeJ8rkhjhm2JOnxfy4mm90AEQX6mJlr546Q/WOTCJ1MshbUwfbxyqQVIRtzAMzGTYJ/5VBRKk0jZIsPqJ05U+hu6htoJFuTkaYfhFzykukpKFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hNCmohwj; arc=none smtp.client-ip=209.85.217.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-47a337c18d3so270084137.1 for ; Fri, 12 Apr 2024 00:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712905568; x=1713510368; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mLJ6WBpywrEkNYqayoCZ2xhXGhuIn8yJpIzmzY4EqOQ=; b=hNCmohwjd55EC7MfutLZFtFZhS/FIphu9ApH1RZk+8gy2rIIwvWxpdgBKFKE4auF2t hCMDdRzz0U0kAz7LyQKxuowRYxIOs82MsMk5C1Q4Py6Noh49f83omRTIiwA31/26eLQQ YKFgspGZwrguKGOXupJHPmHAJPG5k+ZwI/4MDaLF+tBTClSfYKLz8Z99XtZtbLX9XgDp X4l5FStwlurRqov8kfUo3KXdwHAlGgflqKh1zNoP5eROsa4QajkvEqJGm+80sTQGsS73 d+sT+7ungZIq9lkLCEQHw4ePpxI9MdIUgUgGCfnKJhfVPo9NoBN8w6KCIv8Oq9HSIumW YR9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712905568; x=1713510368; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mLJ6WBpywrEkNYqayoCZ2xhXGhuIn8yJpIzmzY4EqOQ=; b=NQcSe+l7lO5Z/yOvJxslJ/nVWfREpq6GOmHp6Lfk/bsvZPRZ7z4DFshMBFGOU8u7+c gJlT8d2u8aWro6yFRdOvfox/VjBy/8fcz/nYikvOEVPyghg7bDEaktmEjfZqmkBcNfU6 YD/qd3ZpCTRSTTSxfihfY5QgynUGIs8NwMrKKTaKFn2TIvJUCI0d/aWFmBO+axF0ybCX WLg8Xxj9eXJw7GuC2RkmQ6tnxBpYk8EEDWSUXpwv2g8gRUfqP/vYsOh7av7o0jc90rS5 IDpohFqA/BCO7l8nKirdJ8byBdn8bd3yRtLbSBycebZHko2BKqjIy/f0n/hgMtkRh8BF 9YcQ== X-Gm-Message-State: AOJu0YxFi3m2tgLkREjpyDHEZLXAbEu+ixRjYB/YcAZ3xM8cXVVasTaj m6Pg8hxpk7mT/q+VVQAC7c2LfMVH4NgTymeBgHNvQUsxAd4Mw7FSUVSJhNsUONavsMF5klFAOYY SSfbMDJAfM9R3I+L7bEkv9hZ56jTRiN0t92KkUQ== X-Received: by 2002:a05:6102:1593:b0:471:2478:71fd with SMTP id g19-20020a056102159300b00471247871fdmr2131259vsv.33.1712905567970; Fri, 12 Apr 2024 00:06:07 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240405115318.904143-1-jens.wiklander@linaro.org> <20240405115318.904143-4-jens.wiklander@linaro.org> In-Reply-To: From: Sumit Garg Date: Fri, 12 Apr 2024 12:35:56 +0530 Message-ID: Subject: Re: [PATCH v4 3/3] optee: probe RPMB device using RPMB subsystem To: Jens Wiklander Cc: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, op-tee@lists.trustedfirmware.org, Shyam Saini , Ulf Hansson , Linus Walleij , Jerome Forissier , Ilias Apalodimas , Bart Van Assche , Randy Dunlap , Ard Biesheuvel , Arnd Bergmann , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 11 Apr 2024 at 12:23, Jens Wiklander wr= ote: > > Hi Sumit, > > On Wed, Apr 10, 2024 at 12:48=E2=80=AFPM Sumit Garg wrote: > > > > Hi Jens, > > > > On Fri, 5 Apr 2024 at 17:23, Jens Wiklander = wrote: > > > > > > Adds support in the OP-TEE drivers (both SMC and FF-A ABIs) to probe = and > > > use an RPMB device via the RPBM subsystem instead of passing the RPMB > > > > s/RPBM/RPMB/ > > Thanks, I'll fix it. > > > > > > frames via tee-supplicant in user space. A fallback mechanism is kept= to > > > route RPMB frames via tee-supplicant if the RPMB subsystem isn't > > > available. > > > > > > The OP-TEE RPC ABI is extended to support iterating over all RPMB > > > devices until one is found with the expected RPMB key already > > > programmed. > > > > > > Signed-off-by: Jens Wiklander > > > --- > > > drivers/tee/optee/core.c | 30 ++++ > > > drivers/tee/optee/device.c | 7 + > > > drivers/tee/optee/ffa_abi.c | 8 + > > > drivers/tee/optee/optee_private.h | 21 ++- > > > drivers/tee/optee/optee_rpc_cmd.h | 35 +++++ > > > drivers/tee/optee/rpc.c | 233 ++++++++++++++++++++++++++++= ++ > > > drivers/tee/optee/smc_abi.c | 7 + > > > 7 files changed, 340 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c > > > index 3aed554bc8d8..082691c10a90 100644 > > > --- a/drivers/tee/optee/core.c > > > +++ b/drivers/tee/optee/core.c > > > @@ -11,6 +11,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -80,6 +81,31 @@ void optee_pool_op_free_helper(struct tee_shm_pool= *pool, struct tee_shm *shm, > > > shm->pages =3D NULL; > > > } > > > > > > +void optee_bus_scan_rpmb(struct work_struct *work) > > > +{ > > > + struct optee *optee =3D container_of(work, struct optee, > > > + rpmb_scan_bus_work); > > > + int ret; > > > + > > > + if (!optee->rpmb_scan_bus_done) { > > > + ret =3D optee_enumerate_devices(PTA_CMD_GET_DEVICES_R= PMB); > > > + optee->rpmb_scan_bus_done =3D !ret; > > > + if (ret && ret !=3D -ENODEV) > > > + pr_info("Scanning for RPMB device: ret %d\n",= ret); > > > + } > > > +} > > > + > > > +int optee_rpmb_intf_rdev(struct notifier_block *intf, unsigned long = action, > > > + void *data) > > > +{ > > > + struct optee *optee =3D container_of(intf, struct optee, rpmb= _intf); > > > + > > > + if (action =3D=3D RPMB_NOTIFY_ADD_DEVICE) > > > + schedule_work(&optee->rpmb_scan_bus_work); > > > + > > > + return 0; > > > +} > > > + > > > static void optee_bus_scan(struct work_struct *work) > > > { > > > WARN_ON(optee_enumerate_devices(PTA_CMD_GET_DEVICES_SUPP)); > > > @@ -161,6 +187,8 @@ void optee_release_supp(struct tee_context *ctx) > > > > > > void optee_remove_common(struct optee *optee) > > > { > > > + rpmb_interface_unregister(&optee->rpmb_intf); > > > + cancel_work_sync(&optee->rpmb_scan_bus_work); > > > /* Unregister OP-TEE specific client devices on TEE bus */ > > > optee_unregister_devices(); > > > > > > @@ -177,6 +205,8 @@ void optee_remove_common(struct optee *optee) > > > tee_shm_pool_free(optee->pool); > > > optee_supp_uninit(&optee->supp); > > > mutex_destroy(&optee->call_queue.mutex); > > > + rpmb_dev_put(optee->rpmb_dev); > > > + mutex_destroy(&optee->rpmb_dev_mutex); > > > } > > > > > > static int smc_abi_rc; > > > diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c > > > index 4b1092127694..4274876857c8 100644 > > > --- a/drivers/tee/optee/device.c > > > +++ b/drivers/tee/optee/device.c > > > @@ -43,6 +43,13 @@ static int get_devices(struct tee_context *ctx, u3= 2 session, > > > ret =3D tee_client_invoke_func(ctx, &inv_arg, param); > > > if ((ret < 0) || ((inv_arg.ret !=3D TEEC_SUCCESS) && > > > (inv_arg.ret !=3D TEEC_ERROR_SHORT_BUFFER))= ) { > > > + /* > > > + * TEE_ERROR_STORAGE_NOT_AVAILABLE is returned when g= etting > > > + * the list of device TAs that depends on RPMB but a = usable > > > + * RPMB device isn't found. > > > + */ > > > + if (inv_arg.ret =3D=3D TEE_ERROR_STORAGE_NOT_AVAILABL= E) > > > + return -ENODEV; > > > pr_err("PTA_CMD_GET_DEVICES invoke function err: %x\n= ", > > > inv_arg.ret); > > > return -EINVAL; > > > diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.= c > > > index ecb5eb079408..a8dfdb30b4e8 100644 > > > --- a/drivers/tee/optee/ffa_abi.c > > > +++ b/drivers/tee/optee/ffa_abi.c > > > @@ -7,6 +7,7 @@ > > > > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -934,6 +935,7 @@ static int optee_ffa_probe(struct ffa_device *ffa= _dev) > > > optee_cq_init(&optee->call_queue, 0); > > > optee_supp_init(&optee->supp); > > > optee_shm_arg_cache_init(optee, arg_cache_flags); > > > + mutex_init(&optee->rpmb_dev_mutex); > > > ffa_dev_set_drvdata(ffa_dev, optee); > > > ctx =3D teedev_open(optee->teedev); > > > if (IS_ERR(ctx)) { > > > @@ -955,6 +957,9 @@ static int optee_ffa_probe(struct ffa_device *ffa= _dev) > > > if (rc) > > > goto err_unregister_devices; > > > > > > + INIT_WORK(&optee->rpmb_scan_bus_work, optee_bus_scan_rpmb); > > > + optee->rpmb_intf.notifier_call =3D optee_rpmb_intf_rdev; > > > + rpmb_interface_register(&optee->rpmb_intf); > > > pr_info("initialized driver\n"); > > > return 0; > > > > > > @@ -968,6 +973,9 @@ static int optee_ffa_probe(struct ffa_device *ffa= _dev) > > > teedev_close_context(ctx); > > > err_rhashtable_free: > > > rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_f= n, NULL); > > > + rpmb_dev_put(optee->rpmb_dev); > > > + mutex_destroy(&optee->rpmb_dev_mutex); > > > + rpmb_interface_unregister(&optee->rpmb_intf); > > > optee_supp_uninit(&optee->supp); > > > mutex_destroy(&optee->call_queue.mutex); > > > mutex_destroy(&optee->ffa.mutex); > > > diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/op= tee_private.h > > > index 7a5243c78b55..ae72f3dda1d2 100644 > > > --- a/drivers/tee/optee/optee_private.h > > > +++ b/drivers/tee/optee/optee_private.h > > > @@ -8,6 +8,7 @@ > > > > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -20,11 +21,13 @@ > > > /* Some Global Platform error codes used in this driver */ > > > #define TEEC_SUCCESS 0x00000000 > > > #define TEEC_ERROR_BAD_PARAMETERS 0xFFFF0006 > > > +#define TEEC_ERROR_ITEM_NOT_FOUND 0xFFFF0008 > > > #define TEEC_ERROR_NOT_SUPPORTED 0xFFFF000A > > > #define TEEC_ERROR_COMMUNICATION 0xFFFF000E > > > #define TEEC_ERROR_OUT_OF_MEMORY 0xFFFF000C > > > #define TEEC_ERROR_BUSY 0xFFFF000D > > > #define TEEC_ERROR_SHORT_BUFFER 0xFFFF0010 > > > +#define TEE_ERROR_STORAGE_NOT_AVAILABLE 0xF0100003 > > > > > > #define TEEC_ORIGIN_COMMS 0x00000002 > > > > > > @@ -197,6 +200,12 @@ struct optee_ops { > > > * @notif: notification synchronization struct > > > * @supp: supplicant synchronization struct for RPC to = supplicant > > > * @pool: shared memory pool > > > + * @mutex: mutex protecting @rpmb_dev > > > + * @rpmb_dev: current RPMB device or NULL > > > + * @rpmb_scan_bus_done flag if device registation of RPMB dependent = devices > > > + * was already done > > > + * @rpmb_scan_bus_work workq to for an RPMB device and to scan optee= bus > > > + * and register RPMB dependent optee drivers > > > * @rpc_param_count: If > 0 number of RPC parameters to make room = for > > > * @scan_bus_done flag if device registation was already done. > > > * @scan_bus_work workq to scan optee bus and register optee dr= ivers > > > @@ -215,9 +224,15 @@ struct optee { > > > struct optee_notif notif; > > > struct optee_supp supp; > > > struct tee_shm_pool *pool; > > > + /* Protects rpmb_dev pointer */ > > > + struct mutex rpmb_dev_mutex; > > > + struct rpmb_dev *rpmb_dev; > > > + struct notifier_block rpmb_intf; > > > unsigned int rpc_param_count; > > > - bool scan_bus_done; > > > + bool scan_bus_done; > > > + bool rpmb_scan_bus_done; > > > struct work_struct scan_bus_work; > > > + struct work_struct rpmb_scan_bus_work; > > > }; > > > > > > struct optee_session { > > > @@ -280,8 +295,12 @@ int optee_cancel_req(struct tee_context *ctx, u3= 2 cancel_id, u32 session); > > > > > > #define PTA_CMD_GET_DEVICES 0x0 > > > #define PTA_CMD_GET_DEVICES_SUPP 0x1 > > > +#define PTA_CMD_GET_DEVICES_RPMB 0x2 > > > int optee_enumerate_devices(u32 func); > > > void optee_unregister_devices(void); > > > +void optee_bus_scan_rpmb(struct work_struct *work); > > > +int optee_rpmb_intf_rdev(struct notifier_block *intf, unsigned long = action, > > > + void *data); > > > > > > int optee_pool_op_alloc_helper(struct tee_shm_pool *pool, struct tee= _shm *shm, > > > size_t size, size_t align, > > > diff --git a/drivers/tee/optee/optee_rpc_cmd.h b/drivers/tee/optee/op= tee_rpc_cmd.h > > > index f3f06e0994a7..f351a8ac69fc 100644 > > > --- a/drivers/tee/optee/optee_rpc_cmd.h > > > +++ b/drivers/tee/optee/optee_rpc_cmd.h > > > @@ -16,6 +16,14 @@ > > > * and sends responses. > > > */ > > > > > > +/* > > > + * Replay Protected Memory Block access > > > + * > > > + * [in] memref[0] Frames to device > > > + * [out] memref[1] Frames from device > > > + */ > > > +#define OPTEE_RPC_CMD_RPMB 1 > > > + > > > /* > > > * Get time > > > * > > > @@ -103,4 +111,31 @@ > > > /* I2C master control flags */ > > > #define OPTEE_RPC_I2C_FLAGS_TEN_BIT BIT(0) > > > > > > +/* > > > + * Reset RPMB probing > > > + * > > > + * Releases an eventually already used RPMB devices and starts over = searching > > > + * for RPMB devices. Returns the kind of shared memory to use in sub= sequent > > > + * OPTEE_RPC_CMD_RPMB_PROBE_NEXT and OPTEE_RPC_CMD_RPMB calls. > > > + * > > > + * [out] value[0].a OPTEE_RPC_SHM_TYPE_*, the parameter for > > > + * OPTEE_RPC_CMD_SHM_ALLOC > > > + */ > > > +#define OPTEE_RPC_CMD_RPMB_PROBE_RESET 22 > > > + > > > > AFAICS from [1], this RPMB reset probing is only used to check if the > > kernel supports RPMB probing or not. I suppose that should be detected > > via a single RPC call like: OPTEE_RPC_CMD_RPMB_PROBE. Other than that > > the shared memory allocation type can be used as > > THREAD_SHM_TYPE_KERNEL_PRIVATE if OPTEE_RPC_CMD_RPMB_PROBE works > > otherwise THREAD_SHM_TYPE_APPLICATION can be used for legacy RPMB init > > via tee-supplicant. > > > > Is there any other specific scenario I am missing which requires an > > explicit RPMB probe reset call? > > That assumes that we're not going to implement > OPTEE_RPC_CMD_RPMB_PROBE_RESET and OPTEE_RPC_CMD_RPMB_PROBE_NEXT in > the tee-supplicant. We should implement those RPCs in the > tee-supplicant too since it solves the problem with finding the RPMB > device without device-specific runtime arguments for the > tee-supplicant. IMO, we should try to deprecate the tee-supplicant accesses to hardware RPMB. The tee-supplicant can be useful for RPMB emulation scenarios where we shouldn't require the dynamic discovery of RPMB. > > I'd also like to keep the ABI flexible so we for instance can handle a > removable RPMB from the secure world. That's an interesting scenario but I am not sure if we really would like to deal with the complications of removable RPMB like what we should do if a TA is accessing RPMB during which it is hot plugged? However, I am in favour of an ABI which is simple enough to maintain and allow flexibility for extension like adding a new RPC when it's really needed etc. -Sumit