From: Harshal Dev <harshal.dev@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Jens Wiklander <jens.wiklander@linaro.org>,
Jens Wiklander <jens.wiklander@oss.qualcomm.com>,
Sumit Garg <sumit.garg@kernel.org>,
Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Basant Kumar <basantk@qti.qualcomm.com>,
Apurupa Pattapu <apurupa@qti.qualcomm.com>,
Arun Kumar Neelakantam <aneelaka@qti.qualcomm.com>,
op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 6/6] firmware: qcom: Add support for TEE based EFI-var client driver
Date: Fri, 24 Jul 2026 14:44:46 +0530 [thread overview]
Message-ID: <7c7ec8eb-d809-4e1b-9467-4c9105ab00e9@oss.qualcomm.com> (raw)
In-Reply-To: <w3oebwhvheb6scbdv2dshhr6t4sx3nwalmlw4akqf4sj3n2nmm@s7e3xtr7cuev>
Hi Dmitry,
On 22-07-2026 02:07 pm, Dmitry Baryshkov wrote:
> On Wed, Jul 22, 2026 at 12:29:17PM +0530, Harshal Dev wrote:
>> On Qualcomm SoC based platforms, UEFI stores EFI variables within the
>> Replay Protected Memory Block (RPMB) which is only accessible by the
>> Qualcomm Trusted Execution Environment (QTEE).
>>
>> For Qualcomm platforms without emulated RPMB support, specifically
>> platforms where RPMB is not located within SPI-NOR storage and instead
>> located on UFS/EMMC storage, non-volatile EFI variables can only be set via
>> a callback request from the UEFI Trusted Application (TA) to the RPMB
>> service running in user-space (within the QTEE supplicant).
>>
>> Unlike the QCOMTEE driver, the QSEECOM driver (used by the current
>> uefisecapp client driver) does not support callback requests. And on
>> certain Qualcomm platforms such as the RB3Gen2, attempts to access the
>> QSEECOM interface fail due to lack of support within QTEE.
>> On all such platforms, a TEE based uefisecapp client driver must be used to
>> access cached/volatile EFI variables within the uefisecapp TA and ensure
>> persistence of writes to non-volatile EFI variables through the RPMB
>> service hosted in the QTEE supplicant.
>>
>> Add support for a TEE based uefisecapp client driver which installs efivar
>> operations after obtaining an object reference to the uefisecapp service.
>> This enables the kernel/user-space to access/modify both volatile EFI vars
>> stored by the Secure Application (in-memory) and non-volatile ones stored
>> within RPMB.
>>
>> Signed-off-by: Harshal Dev <harshal.dev@oss.qualcomm.com>
>> ---
>> MAINTAINERS | 7 +
>> drivers/firmware/qcom/Kconfig | 24 ++
>> drivers/firmware/qcom/Makefile | 1 +
>> drivers/firmware/qcom/qcom_tee_uefisecapp.c | 525 ++++++++++++++++++++++++++++
>> drivers/firmware/qcom/qcom_tee_uefisecapp.h | 120 +++++++
>> 5 files changed, 677 insertions(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 10d12b51b1f6..e8316007370f 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -22018,6 +22018,13 @@ L: linux-arm-msm@vger.kernel.org
>> S: Maintained
>> F: drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>>
>> +QUALCOMM TEE UEFISECAPP DRIVER
>> +M: Harshal Dev <harshal.dev@oss.qualcomm.com>
>> +L: linux-arm-msm@vger.kernel.org
>> +S: Maintained
>> +F: drivers/firmware/qcom/qcom_tee_uefisecapp.c
>> +F: drivers/firmware/qcom/qcom_tee_uefisecapp.h
>> +
>> QUALCOMM RMNET DRIVER
>> M: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>
>> M: Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>
>> diff --git a/drivers/firmware/qcom/Kconfig b/drivers/firmware/qcom/Kconfig
>> index b477d54b495a..20ce8b58e490 100644
>> --- a/drivers/firmware/qcom/Kconfig
>> +++ b/drivers/firmware/qcom/Kconfig
>> @@ -74,4 +74,28 @@ config QCOM_QSEECOM_UEFISECAPP
>> Select Y here to provide access to EFI variables on the aforementioned
>> platforms.
>>
>> +config QCOM_TEE_UEFISECAPP
>> + tristate "Qualcomm TEE UEFI Secure App client driver"
>> + depends on QCOMTEE
>> + depends on EFI
>> + depends on !QCOM_QSEECOM_UEFISECAPP
>
> Nope. The kernels can be built for multiple platforms. Implement a
> runtime selection, which uefisecapp client is to be used.
>
I agree. I reflected on this yesterday, and in hindsight it feels we do not
really need to add a !QCOM_QSEECOM_UEFISECAPP. Both of these drivers can co-exist.
Both drivers attempt to register to the efivar interface via efivar_register(),
but only one will ever succeed. Since both QCOM_QSEECOM_UEFISECAPP and QCOM_QSEECOM
are built into the kernel with 'y' the default path will be QSEECOM based when
both are supported.
I can drop this 'depends' in v3, and instead add a commit which enables this by
default with CONFIG_QCOM_TEE_UEFISECAPP=m. Let me know your thoughts.
>> + help
>> + On Qualcomm SoC based platforms without emulated RPMB support,
>
> What is emulated RPMB support? How does a user (or a distro maintainer)
> understand if this needs to be enabled or not?
Ack. I will try to use simpler terms here to help distro maintainers. If device has
UFS/eMMC storage, this driver is the only way to access EFI variables within
RPMB. So it should be set to 'm'.
If device is SPI-NOR based, this driver will still work. User can decide
if they want to use this or continue with the old QSEECOM path.
Regards,
Harshal
>
>> + specifically platforms where RPMB is not present within SPI-NOR storage
>> + and instead located on UFS/EMMC storage, non-volatile EFI variables can
>> + only be set via a callback request from the UEFI Secure Application to
>> + the RPMB service running in user-space (within the QTEE supplicant:
>> + github.com/qualcomm/minkipc). Unlike the QCOMTEE driver, the QSEECOM
>> + driver used by the QSEECOM based uefisecapp does not support callback
>> + requests. And so on these platforms, the TEE based uefisecapp client
>> + driver must be used to ensure persistence of non-volatile EFI variables
>> + via writes through the RPMB service hosted in the QTEE supplicant.
>> +
>> + This module provides a TEE client driver for uefisecapp, installing efivar
>> + operations to allow the kernel and user-space access to EFI variables.
>> +
>> + Select m here to provide access to EFI variables on the aforementioned
>> + platforms if your Linux distribution has QTEE supplicant installed and
>> + running.
>> +
>> endmenu
>> diff --git a/drivers/firmware/qcom/Makefile b/drivers/firmware/qcom/Makefile
>> index 0be40a1abc13..d780490b2865 100644
>> --- a/drivers/firmware/qcom/Makefile
>> +++ b/drivers/firmware/qcom/Makefile
>> @@ -8,3 +8,4 @@ qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
>> obj-$(CONFIG_QCOM_TZMEM) += qcom_tzmem.o
>> obj-$(CONFIG_QCOM_QSEECOM) += qcom_qseecom.o
>> obj-$(CONFIG_QCOM_QSEECOM_UEFISECAPP) += qcom_qseecom_uefisecapp.o
>> +obj-$(CONFIG_QCOM_TEE_UEFISECAPP) += qcom_tee_uefisecapp.o
>> diff --git a/drivers/firmware/qcom/qcom_tee_uefisecapp.c b/drivers/firmware/qcom/qcom_tee_uefisecapp.c
>> new file mode 100644
>> index 000000000000..9a5a6f145a9f
>> --- /dev/null
>> +++ b/drivers/firmware/qcom/qcom_tee_uefisecapp.c
>> @@ -0,0 +1,525 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
>> + */
>> +
>> +#include <linux/efi.h>
>> +#include <linux/tee.h>
>> +#include <linux/tee_drv.h>
>> +#include <linux/ucs2_string.h>
>> +#include "qcom_tee_uefisecapp.h"
>
> You are the only user, inline the header here.
>
>> +
>> +static struct qcomtee_uefisec_app uefisec_app;
>
> Do you need global data? Can it be obtained from other context variables
> using container_of()?
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Harshal Dev via OP-TEE <op-tee@lists.trustedfirmware.org>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Jens Wiklander <jens.wiklander@oss.qualcomm.com>,
Sumit Garg <sumit.garg@kernel.org>,
Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Basant Kumar <basantk@qti.qualcomm.com>,
Apurupa Pattapu <apurupa@qti.qualcomm.com>,
Arun Kumar Neelakantam <aneelaka@qti.qualcomm.com>,
op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 6/6] firmware: qcom: Add support for TEE based EFI-var client driver
Date: Fri, 24 Jul 2026 14:44:46 +0530 [thread overview]
Message-ID: <7c7ec8eb-d809-4e1b-9467-4c9105ab00e9@oss.qualcomm.com> (raw)
In-Reply-To: <w3oebwhvheb6scbdv2dshhr6t4sx3nwalmlw4akqf4sj3n2nmm@s7e3xtr7cuev>
Hi Dmitry,
On 22-07-2026 02:07 pm, Dmitry Baryshkov wrote:
> On Wed, Jul 22, 2026 at 12:29:17PM +0530, Harshal Dev wrote:
>> On Qualcomm SoC based platforms, UEFI stores EFI variables within the
>> Replay Protected Memory Block (RPMB) which is only accessible by the
>> Qualcomm Trusted Execution Environment (QTEE).
>>
>> For Qualcomm platforms without emulated RPMB support, specifically
>> platforms where RPMB is not located within SPI-NOR storage and instead
>> located on UFS/EMMC storage, non-volatile EFI variables can only be set via
>> a callback request from the UEFI Trusted Application (TA) to the RPMB
>> service running in user-space (within the QTEE supplicant).
>>
>> Unlike the QCOMTEE driver, the QSEECOM driver (used by the current
>> uefisecapp client driver) does not support callback requests. And on
>> certain Qualcomm platforms such as the RB3Gen2, attempts to access the
>> QSEECOM interface fail due to lack of support within QTEE.
>> On all such platforms, a TEE based uefisecapp client driver must be used to
>> access cached/volatile EFI variables within the uefisecapp TA and ensure
>> persistence of writes to non-volatile EFI variables through the RPMB
>> service hosted in the QTEE supplicant.
>>
>> Add support for a TEE based uefisecapp client driver which installs efivar
>> operations after obtaining an object reference to the uefisecapp service.
>> This enables the kernel/user-space to access/modify both volatile EFI vars
>> stored by the Secure Application (in-memory) and non-volatile ones stored
>> within RPMB.
>>
>> Signed-off-by: Harshal Dev <harshal.dev@oss.qualcomm.com>
>> ---
>> MAINTAINERS | 7 +
>> drivers/firmware/qcom/Kconfig | 24 ++
>> drivers/firmware/qcom/Makefile | 1 +
>> drivers/firmware/qcom/qcom_tee_uefisecapp.c | 525 ++++++++++++++++++++++++++++
>> drivers/firmware/qcom/qcom_tee_uefisecapp.h | 120 +++++++
>> 5 files changed, 677 insertions(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 10d12b51b1f6..e8316007370f 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -22018,6 +22018,13 @@ L: linux-arm-msm@vger.kernel.org
>> S: Maintained
>> F: drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>>
>> +QUALCOMM TEE UEFISECAPP DRIVER
>> +M: Harshal Dev <harshal.dev@oss.qualcomm.com>
>> +L: linux-arm-msm@vger.kernel.org
>> +S: Maintained
>> +F: drivers/firmware/qcom/qcom_tee_uefisecapp.c
>> +F: drivers/firmware/qcom/qcom_tee_uefisecapp.h
>> +
>> QUALCOMM RMNET DRIVER
>> M: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>
>> M: Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>
>> diff --git a/drivers/firmware/qcom/Kconfig b/drivers/firmware/qcom/Kconfig
>> index b477d54b495a..20ce8b58e490 100644
>> --- a/drivers/firmware/qcom/Kconfig
>> +++ b/drivers/firmware/qcom/Kconfig
>> @@ -74,4 +74,28 @@ config QCOM_QSEECOM_UEFISECAPP
>> Select Y here to provide access to EFI variables on the aforementioned
>> platforms.
>>
>> +config QCOM_TEE_UEFISECAPP
>> + tristate "Qualcomm TEE UEFI Secure App client driver"
>> + depends on QCOMTEE
>> + depends on EFI
>> + depends on !QCOM_QSEECOM_UEFISECAPP
>
> Nope. The kernels can be built for multiple platforms. Implement a
> runtime selection, which uefisecapp client is to be used.
>
I agree. I reflected on this yesterday, and in hindsight it feels we do not
really need to add a !QCOM_QSEECOM_UEFISECAPP. Both of these drivers can co-exist.
Both drivers attempt to register to the efivar interface via efivar_register(),
but only one will ever succeed. Since both QCOM_QSEECOM_UEFISECAPP and QCOM_QSEECOM
are built into the kernel with 'y' the default path will be QSEECOM based when
both are supported.
I can drop this 'depends' in v3, and instead add a commit which enables this by
default with CONFIG_QCOM_TEE_UEFISECAPP=m. Let me know your thoughts.
>> + help
>> + On Qualcomm SoC based platforms without emulated RPMB support,
>
> What is emulated RPMB support? How does a user (or a distro maintainer)
> understand if this needs to be enabled or not?
Ack. I will try to use simpler terms here to help distro maintainers. If device has
UFS/eMMC storage, this driver is the only way to access EFI variables within
RPMB. So it should be set to 'm'.
If device is SPI-NOR based, this driver will still work. User can decide
if they want to use this or continue with the old QSEECOM path.
Regards,
Harshal
>
>> + specifically platforms where RPMB is not present within SPI-NOR storage
>> + and instead located on UFS/EMMC storage, non-volatile EFI variables can
>> + only be set via a callback request from the UEFI Secure Application to
>> + the RPMB service running in user-space (within the QTEE supplicant:
>> + github.com/qualcomm/minkipc). Unlike the QCOMTEE driver, the QSEECOM
>> + driver used by the QSEECOM based uefisecapp does not support callback
>> + requests. And so on these platforms, the TEE based uefisecapp client
>> + driver must be used to ensure persistence of non-volatile EFI variables
>> + via writes through the RPMB service hosted in the QTEE supplicant.
>> +
>> + This module provides a TEE client driver for uefisecapp, installing efivar
>> + operations to allow the kernel and user-space access to EFI variables.
>> +
>> + Select m here to provide access to EFI variables on the aforementioned
>> + platforms if your Linux distribution has QTEE supplicant installed and
>> + running.
>> +
>> endmenu
>> diff --git a/drivers/firmware/qcom/Makefile b/drivers/firmware/qcom/Makefile
>> index 0be40a1abc13..d780490b2865 100644
>> --- a/drivers/firmware/qcom/Makefile
>> +++ b/drivers/firmware/qcom/Makefile
>> @@ -8,3 +8,4 @@ qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
>> obj-$(CONFIG_QCOM_TZMEM) += qcom_tzmem.o
>> obj-$(CONFIG_QCOM_QSEECOM) += qcom_qseecom.o
>> obj-$(CONFIG_QCOM_QSEECOM_UEFISECAPP) += qcom_qseecom_uefisecapp.o
>> +obj-$(CONFIG_QCOM_TEE_UEFISECAPP) += qcom_tee_uefisecapp.o
>> diff --git a/drivers/firmware/qcom/qcom_tee_uefisecapp.c b/drivers/firmware/qcom/qcom_tee_uefisecapp.c
>> new file mode 100644
>> index 000000000000..9a5a6f145a9f
>> --- /dev/null
>> +++ b/drivers/firmware/qcom/qcom_tee_uefisecapp.c
>> @@ -0,0 +1,525 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
>> + */
>> +
>> +#include <linux/efi.h>
>> +#include <linux/tee.h>
>> +#include <linux/tee_drv.h>
>> +#include <linux/ucs2_string.h>
>> +#include "qcom_tee_uefisecapp.h"
>
> You are the only user, inline the header here.
>
>> +
>> +static struct qcomtee_uefisec_app uefisec_app;
>
> Do you need global data? Can it be obtained from other context variables
> using container_of()?
>
>
next prev parent reply other threads:[~2026-07-24 9:14 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 6:59 [PATCH v2 0/6] Add TEE based client driver for UEFI Secure Application Harshal Dev
2026-07-22 6:59 ` Harshal Dev via OP-TEE
2026-07-22 6:59 ` [PATCH v2 1/6] tee: qcomtee: Track the object invocation context Harshal Dev
2026-07-22 6:59 ` Harshal Dev via OP-TEE
2026-07-22 6:59 ` [PATCH v2 2/6] tee: Add kernel client object invoke helper Harshal Dev
2026-07-22 6:59 ` Harshal Dev via OP-TEE
2026-07-22 6:59 ` [PATCH v2 3/6] tee: qcomtee: Allow object invokes from kernel clients Harshal Dev
2026-07-22 6:59 ` Harshal Dev via OP-TEE
2026-07-29 7:06 ` Amirreza Zarrabi
2026-07-29 7:06 ` Amirreza Zarrabi via OP-TEE
2026-07-31 7:38 ` Harshal Dev
2026-07-31 7:38 ` Harshal Dev via OP-TEE
2026-07-22 6:59 ` [PATCH v2 4/6] tee: Export uuidv5 generation for TEE backends Harshal Dev
2026-07-22 6:59 ` Harshal Dev via OP-TEE
2026-07-22 6:59 ` [PATCH v2 5/6] tee: qcomtee: Add support for registering QTEE services on TEE bus Harshal Dev
2026-07-22 6:59 ` Harshal Dev via OP-TEE
2026-07-22 8:29 ` Dmitry Baryshkov
2026-07-22 8:29 ` Dmitry Baryshkov via OP-TEE
2026-07-24 9:13 ` Harshal Dev
2026-07-24 9:13 ` Harshal Dev via OP-TEE
2026-07-29 7:05 ` Amirreza Zarrabi via OP-TEE
2026-07-29 7:05 ` Amirreza Zarrabi
2026-07-31 8:35 ` Harshal Dev
2026-07-31 8:35 ` Harshal Dev via OP-TEE
2026-07-22 6:59 ` [PATCH v2 6/6] firmware: qcom: Add support for TEE based EFI-var client driver Harshal Dev
2026-07-22 6:59 ` Harshal Dev via OP-TEE
2026-07-22 8:37 ` Dmitry Baryshkov
2026-07-22 8:37 ` Dmitry Baryshkov via OP-TEE
2026-07-24 9:14 ` Harshal Dev [this message]
2026-07-24 9:14 ` Harshal Dev via OP-TEE
2026-07-24 10:09 ` Harshal Dev
2026-07-24 10:09 ` Harshal Dev via OP-TEE
2026-07-22 8:26 ` [PATCH v2 0/6] Add TEE based client driver for UEFI Secure Application Dmitry Baryshkov
2026-07-22 8:26 ` Dmitry Baryshkov via OP-TEE
2026-07-24 9:13 ` Harshal Dev
2026-07-24 9:13 ` Harshal Dev via OP-TEE
2026-08-03 14:52 ` Harshal Dev via OP-TEE
2026-08-03 14:52 ` Harshal Dev
2026-08-10 5:41 ` Harshal Dev via OP-TEE
2026-08-10 5:41 ` Harshal Dev
2026-08-10 7:07 ` Dmitry Baryshkov via OP-TEE
2026-08-10 7:07 ` Dmitry Baryshkov
2026-08-12 11:30 ` Harshal Dev via OP-TEE
2026-08-12 11:30 ` Harshal Dev
2026-08-17 6:24 ` Harshal Dev via OP-TEE
2026-08-17 6:24 ` Harshal Dev
2026-08-21 8:34 ` Harshal Dev
2026-08-21 8:34 ` Harshal Dev via OP-TEE
2026-08-26 6:43 ` Harshal Dev
2026-08-26 6:43 ` Harshal Dev via OP-TEE
2026-08-29 14:49 ` Dmitry Baryshkov
2026-08-29 14:49 ` Dmitry Baryshkov via OP-TEE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c7ec8eb-d809-4e1b-9467-4c9105ab00e9@oss.qualcomm.com \
--to=harshal.dev@oss.qualcomm.com \
--cc=amirreza.zarrabi@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=aneelaka@qti.qualcomm.com \
--cc=apurupa@qti.qualcomm.com \
--cc=basantk@qti.qualcomm.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=jens.wiklander@linaro.org \
--cc=jens.wiklander@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=op-tee@lists.trustedfirmware.org \
--cc=sumit.garg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.