mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harshal Dev <harshal.dev@oss.qualcomm.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Julian Braha <julianbraha@gmail.com>,
	Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>,
	Bartosz Golaszewski <brgl@kernel.org>
Cc: Sumit Garg <sumit.garg@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	amirreza.zarrabi@oss.qualcomm.org,
	op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org,
	Bjorn Andersson <andersson@kernel.org>,
	Elliot Berman <quic_eberman@quicinc.com>,
	jenswi@kernel.org
Subject: Re: [PATCH] tee: remove dead select from kconfig
Date: Mon, 20 Jul 2026 11:25:50 +0530	[thread overview]
Message-ID: <6600d003-709e-4186-98c4-a9ac263d7d6b@oss.qualcomm.com> (raw)
In-Reply-To: <a3b7a752-8cc4-492a-bb62-43121b852c41@app.fastmail.com>

Hi,

On 7/15/2026 3:38 PM, Arnd Bergmann wrote:
> On Wed, Jul 15, 2026, at 11:25, Julian Braha wrote:
>> 'select' does not work on config options in a 'choice', so currently it is
>> possible to enable QCOMTEE without QCOM_TZMEM_MODE_SHMBRIDGE.
>>
>> This patch removes the select.
>>
>> I've compile-tested this and found that it builds fine without
>> QCOM_TZMEM_MODE_SHMBRIDGE, but I don't have the hardware to runtime test.
>> Please advise if it would be better to make QCOM_TZMEM_MODE_SHMBRIDGE a
>> dependency.
>>
>> This dead select was found by kconfirm, a static analysis tool for Kconfig.
> 
> Right, clearly something is wrong here.
> 
>> @@ -5,7 +5,6 @@ config QCOMTEE
>>  	depends on ARCH_QCOM || COMPILE_TEST
>>  	depends on !CPU_BIG_ENDIAN
>>  	select QCOM_SCM
>> -	select QCOM_TZMEM_MODE_SHMBRIDGE
>>  	help
> 
> From the implementation, my guess would be that QCOMTEE actually
> requires QCOM_TZMEM_MODE_SHMBRIDGE and it only links successfully
> because of the stub helpers added in 8aa1e3a6f0ff ("firmware:
> qcom: tzmem: export shm_bridge create/delete").

This is correct. QCOMTEE can build without TZMEM_MODE_SHMBRIDGE, but will not
work without this config. TrustZone will just refuse the memory shared without
this config enabled. So it is a hard dependency.

> 
> If that is the case, we probably need a 'depends on
> QCOM_TZMEM_MODE_SHMBRIDGE' here, and can remove the stub
> functions.
> 
> It is also possible that the 'choice' itself is wrong, and
> this should be detected at runtime. It is a rather odd Kconfig
> option, as it sounds like only one of the two is correct on
> a given hardware. The CONFIG_QCOM_TZMEM_MODE_SHMBRIDGE variant
> contains runtime hardware detection, so it should actually
> be safe to enable that anywhere. If this is true, we could
> just turn the choice into a 'bool' symbol and remove the
> generic case.
>

So when TZMEM_MODE_SHMBRIDGE isn't enabled, and instead TZMEM_MODE_GENERIC
is used, the driver just becomes a generic memory allocator, so the clients
cannot share this memory with QTEE. I couldn't find any existing clients
of TZMEM that aren't using it in MODE_SHMBRIDGE, in other words it seems that
we don't have any users for MODE_GENERIC.

In that case, it appears to be a better choice to make this a bool.
Either MODE_SHMBRIDGE or not.
But since @Bartoz is the maintainer, I would let him provide his comments
on this.

Regards,
Harshal 
> I've added a few more people to Cc that may know the correct
> answer here.
> 
>      Arnd


  reply	other threads:[~2026-07-20  5:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  9:25 Julian Braha
2026-07-15 10:08 ` Arnd Bergmann
2026-07-20  5:55   ` Harshal Dev [this message]
2026-07-22 23:43     ` Amirreza Zarrabi

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=6600d003-709e-4186-98c4-a9ac263d7d6b@oss.qualcomm.com \
    --to=harshal.dev@oss.qualcomm.com \
    --cc=amirreza.zarrabi@oss.qualcomm.com \
    --cc=amirreza.zarrabi@oss.qualcomm.org \
    --cc=andersson@kernel.org \
    --cc=arnd@arndb.de \
    --cc=brgl@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=jenswi@kernel.org \
    --cc=julianbraha@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=quic_eberman@quicinc.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®