tee: remove TZMEM_MODE_GENERIC
PATCH v3 1/1 tee: remove TZMEM_MODE_GENERIC
'select' does not work on config options in a 'choice', so currently it is possible to enable QCOMTEE without QCOM_TZMEM_MODE_SHMBRIDGE, even though this is needed at runtime.
There are no users of the generic allocator option, QCOM_TZMEM_MODE_GENERIC, so let's remove it. Then, we can remove the containing choice..endchoice, which allows the 'select' to work as intended.
---
Changes since v2:
- add back stubs for when CONFIG_QCOM_TZMEM_MODE_GENERIC=n
- updated help text accordingly
Link:
https://lore.kernel.org/all/[email protected]/
Changes since v1:
- remove TZMEM_MODE_GENERIC instead of removing the dead select
Link:
https://lore.kernel.org/all/[email protected]/
--- drivers/firmware/qcom/Kconfig | 26 +++++--------------------- drivers/firmware/qcom/qcom_tzmem.c | 4 ++-- 2 files changed, 7 insertions(+), 23 deletions(-)
drivers/firmware/qcom/Kconfig +5 -21
@@ -34,33 +34,17 @@ config QCOM_TZMEM tristate select GENERIC_ALLOCATOR -choice - prompt "TrustZone interface memory allocator mode" - depends on QCOM_TZMEM - default QCOM_TZMEM_MODE_GENERIC - help - Selects the mode of the memory allocator providing memory buffers of - suitable format for sharing with the TrustZone. If in doubt, select - 'Generic'. - -config QCOM_TZMEM_MODE_GENERIC - bool "Generic" - help - Use the generic allocator mode. The memory is page-aligned, non-cachable - and physically contiguous. - config QCOM_TZMEM_MODE_SHMBRIDGE - bool "SHM Bridge" + bool "TrustZone interface memory allocator: SHM Bridge" + depends on QCOM_TZMEM help - Use Qualcomm Shared Memory Bridge. The memory has the same alignment as - in the 'Generic' allocator but is also explicitly marked as an SHM Bridge - buffer. + Use Qualcomm Shared Memory Bridge as memory allocator. The memory has the + same alignment as in the 'Generic' allocator, which is used when this option + is disabled, but is also explicitly marked as an SHM Bridge buffer. With this selected, all buffers passed to the TrustZone must be allocated using the TZMem allocator or else the TrustZone will refuse to use them. -endchoice - config QCOM_QSEECOM bool "Qualcomm QSEECOM interface driver" depends on QCOM_SCM=y
drivers/firmware/qcom/qcom_tzmem.c +2 -2
@@ -50,7 +50,7 @@ static struct device *qcom_tzmem_dev; static RADIX_TREE(qcom_tzmem_chunks, GFP_ATOMIC);static DEFINE_SPINLOCK (qcom_tzmem_chunks_lock); -#if IS_ENABLED (CONFIG_QCOM_TZMEM_MODE_GENERIC ) +#ifndef CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE static int qcom_tzmem_init (void ) {
@@ -67,7 +67,7 @@ static void qcom_tzmem_cleanup_area(struct qcom_tzmem_area *area) } -#elif IS_ENABLED(CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE) +#else #include <linux/firmware/qcom/qcom_scm.h> #include <linux/of.h>
Signature · 1 line
2.55.0
Quoted 11 lines · Julian Braha
'select' does not work on config options in a 'choice', so currently it is possible to enable QCOMTEE without
QCOM_TZMEM_MODE_SHMBRIDGE, even though this is needed at runtime.There are no users of the generic allocator option,
QCOM_TZMEM_MODE_GENERIC, so let's remove it. Then, we can remove the containing choice..endchoice, which allows the 'select' to work as intended.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Julian Braha <[email protected]>
Quoted 2 lines
Changes since v1:
- removeTZMEM_MODE_GENERICinstead of removing the dead select
Looks good now.
Quoted 11 lines · Julian Braha
'select' does not work on config options in a 'choice', so currently it is possible to enable QCOMTEE without
QCOM_TZMEM_MODE_SHMBRIDGE, even though this is needed at runtime.There are no users of the generic allocator option,
QCOM_TZMEM_MODE_GENERIC, so let's remove it. Then, we can remove the containing choice..endchoice, which allows the 'select' to work as intended.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Julian Braha <[email protected]>
One small nit below but I would only send v4 if there are other things to be addressed.
A note to the maintainers: We would like to turn selecting a choice symbol into a hard error in 7.4, so please consider picking this up for 7.3-rc1.
Quoted 66 lines
---
Changes since v2:
- add back stubs for whenCONFIG_QCOM_TZMEM_MODE_GENERIC=n
- updated help text accordinglyLink:
https://lore.kernel.org/all/[email protected]/Changes since v1:
- removeTZMEM_MODE_GENERICinstead of removing the dead selectLink:
https://lore.kernel.org/all/[email protected]/--- drivers/firmware/qcom/Kconfig | 26 +++++--------------------- drivers/firmware/qcom/qcom_tzmem.c | 4 ++-- 2 files changed, 7 insertions(+), 23 deletions(-)drivers/firmware/qcom/Kconfig +5
-21@@ -34,33 +34,17 @@ config QCOM_TZMEM tristate select GENERIC_ALLOCATOR -choice - prompt "TrustZone interface memory allocator mode" - depends on QCOM_TZMEM - default QCOM_TZMEM_MODE_GENERIC - help - Selects the mode of the memory allocator providing memory buffers of - suitable format for sharing with the TrustZone. If in doubt, select - 'Generic'. - -config QCOM_TZMEM_MODE_GENERIC - bool "Generic" - help - Use the generic allocator mode. The memory is page-aligned, non-cachable - and physically contiguous. - config QCOM_TZMEM_MODE_SHMBRIDGE - bool "SHM Bridge" + bool "TrustZone interface memory allocator: SHM Bridge" + depends on QCOM_TZMEM help - Use Qualcomm Shared Memory Bridge. The memory has the same alignment as - in the 'Generic' allocator but is also explicitly marked as an SHM Bridge - buffer. + Use Qualcomm Shared Memory Bridge as memory allocator. The memory has the + same alignment as in the 'Generic' allocator, which is used when this option + is disabled, but is also explicitly marked as an SHM Bridge buffer. With this selected, all buffers passed to the TrustZone must be allocated using the TZMem allocator or else the TrustZone will refuse to use them. -endchoice - config QCOM_QSEECOM bool "Qualcomm QSEECOM interface driver" depends on QCOM_SCM=ydrivers/firmware/qcom/qcom_tzmem.c +0
-0
drivers/firmware/qcom/qcom_tzmem.c static struct device *qcom_tzmem_dev; · line 53
Quoted 5 lines
drivers/firmware/qcom/qcom_tzmem.c +1
-1@@ -50,7 +50,7 @@ static struct device *qcom_tzmem_dev; static RADIX_TREE(qcom_tzmem_chunks, GFP_ATOMIC);static DEFINE_SPINLOCK (qcom_tzmem_chunks_lock); -#if IS_ENABLED (CONFIG_QCOM_TZMEM_MODE_GENERIC ) +#ifndef CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE
I realize you likely did this to keep the diff small but I think negative conditional checks are harder to read than positive ones, so I would consider making this an '#ifdef' and flipping the branches.
Quoted 14 lines
drivers/firmware/qcom/qcom_tzmem.c +1
-1static int qcom_tzmem_init (void ) {@@ -67,7 +67,7 @@ static void qcom_tzmem_cleanup_area(struct qcom_tzmem_area *area) } -#elif IS_ENABLED(CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE) +#else #include <linux/firmware/qcom/qcom_scm.h> #include <linux/of.h> Signature · 1 line
2.55.0
Signature · 2 lines
Cheers, Nathan
Hi folks,
Quoted 12 lines · Nathan Chancellor
Quoted 11 lines · Julian Braha
'select' does not work on config options in a 'choice', so currently it is possible to enable QCOMTEE without
QCOM_TZMEM_MODE_SHMBRIDGE, even though this is needed at runtime.There are no users of the generic allocator option,
QCOM_TZMEM_MODE_GENERIC, so let's remove it. Then, we can remove the containing choice..endchoice, which allows the 'select' to work as intended.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Julian Braha <[email protected]>
...
Quoted 3 lines
A note to the maintainers: We would like to turn selecting a choice symbol into a hard error in 7.4, so please consider picking this up for 7.3-rc1.
I would like to pick up
for 7.4 but this was the only patch that did not make 7.3-rc1. Could I take it via the Kconfig tree with an ack or be given a shared branch so that I can pull it in before I take the above patch?
Quoted 3 lines
Quoted 3 lines
drivers/firmware/qcom/Kconfig | 26 +++++--------------------- drivers/firmware/qcom/qcom_tzmem.c | 4 ++-- 2 files changed, 7 insertions(+), 23 deletions(-)
Signature · 2 lines
Cheers, Nathan
Quoted 21 lines · Nathan Chancellor
Hi folks,
Quoted 12 lines · Nathan Chancellor
Quoted 11 lines · Julian Braha
'select' does not work on config options in a 'choice', so currently it is possible to enable QCOMTEE without
QCOM_TZMEM_MODE_SHMBRIDGE, even though this is needed at runtime.There are no users of the generic allocator option,
QCOM_TZMEM_MODE_GENERIC, so let's remove it. Then, we can remove the containing choice..endchoice, which allows the 'select' to work as intended.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Julian Braha <[email protected]>...
Quoted 3 lines
A note to the maintainers: We would like to turn selecting a choice symbol into a hard error in 7.4, so please consider picking this up for 7.3-rc1.
Quoted 7 lines
I would like to pick up
for 7.4 but this was the only patch that did not make 7.3-rc1. Could I take it via the
Kconfigtree with an ack or be given a shared branch so that I can pull it in before I take the above patch?
I have picked this up via the Kbuild tree as
35abc3cd8ab6 ("tee: remove TZMEM_MODE_GENERIC")
to allow me to pick up the above patch. If you would like to pull it in, I have added a stable tag.
The following changes since commit cee9395acd8043be0644b25c34bfa86623f2b935:
Linux 7.3-rc1 (2026-08-30 13:34:40 -0700)
are available in the Git repository at:
[email protected]:pub/scm/linux/kernel/git/kbuild/linux.git tags/kbuild-tzmem-kconfig-7.4
for you to fetch changes up to 35abc3cd8ab65dd7d07d4fc48a0d7048ce47d055:
tee: remove TZMEM_MODE_GENERIC (2026-09-17 16:34:13 -0700)
----------------------------------------------------------------
Stable tag for "tee: remove TZMEM_MODE_GENERIC"
Apply "tee: remove TZMEM_MODE_GENERIC" so that the Kbuild tree can turn on a warning about selecting a choice configuration option.
----------------------------------------------------------------
Julian Braha (1):
tee: remove TZMEM_MODE_GENERIC
drivers/firmware/qcom/Kconfig | 26 +++++--------------------- drivers/firmware/qcom/qcom_tzmem.c | 4 ++-- 2 files changed, 7 insertions(+), 23 deletions(-)
Signature · 2 lines
Cheers, Nathan
Quoted 4 lines · Julian Braha
'select' does not work on config options in a 'choice', so currently it is possible to enable QCOMTEE without
QCOM_TZMEM_MODE_SHMBRIDGE, even though this is needed at runtime.
Quoted 8 lines
There are no users of the generic allocator option,
QCOM_TZMEM_MODE_GENERIC, so let's remove it. Then, we can remove the containing choice..endchoice, which allows the 'select' to work as intended.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Julian Braha <[email protected]>---