From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F674459AF4 for ; Wed, 22 Jul 2026 23:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784763816; cv=none; b=oBFhUiwOONJUD2mwXTb/HK0Zgir5zxxsqoEfPgF9VSenSZZQrHFIhra6jCTx98F1UoYLdeRKOjJarv/+csGHqWjDg0lCmmV3EiW9cu1KATEQpc5pEZzO36i+qKIoj5WRoORMrmKlC9SSlV7fzgjaybBL7GwU0nGehuSnIQQNwXA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784763816; c=relaxed/simple; bh=BNZuPLsbwVrBkfBs2VW6qnKvSIvcr1UzWHt6KNeYgUg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gFfjFwyqptlest6a4A41WyTPEWx/fUIAhHIG0LbbCigNoIQzB+oEj9ZCzpjinCPWKFjIYj9dYoejl3UB8fk+rOfjSaLFXkY1JjZfITaJkI5crzo57UUo+UlJ6pNXJ8U4NCdlIMJegQHoonEbFXtHuinrUOdk1bm/z+ubuhgrSTk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=amEbmXcX; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=e1SRnUYZ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="amEbmXcX"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="e1SRnUYZ" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66MMo0j02255030 for ; Wed, 22 Jul 2026 23:43:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= VM4Q4+Q9bC+Ys9BdhS6aCA8dDkeyBz8iQ9iFH0DgBog=; b=amEbmXcXztApiHxv z/8OJhQa9dzm6pbO69cDOtL3eNHidf7vPXHHD7XMi7dVA6zfI4nqBetmCFJTs6gR YptKHvPwK+QS3AERXai3GO0Kv2HEQlX50z16HXGiVKKGUOsnfnLBsVan5TnZJm1e KCqJ3JfwOTfIL4Rhx7iaIDA2yqhExKHykRjLJf3wy2nexY/9nQIrS3jOyHhfBb7/ ynM6dZXkp3sHxqqOi/C1/FPQYO2QaNwTHmUMg/nI6iDR6aYEvOOde9ieT2PxN5cj s1bZXAnM5rOE+21FH2bdVM1AIt5NFwHoMj8T8iBLF6fYbXaOWqEiinHYHRE5H6Qg 7WaAeQ== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fjuu7b689-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 22 Jul 2026 23:43:34 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-84885a4fcabso37501b3a.3 for ; Wed, 22 Jul 2026 16:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784763813; x=1785368613; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VM4Q4+Q9bC+Ys9BdhS6aCA8dDkeyBz8iQ9iFH0DgBog=; b=e1SRnUYZVRXn3etO9XaKgDJJzfLX7aYv2FEB2HmsMQDSEHCPPJ5//UJbzUzInXg7Hz 1tb8NmIrKuHOXE/Mc8RJpy1d5SCDz4UHLhpL8BRb46HZgFiq4tCFJ+ZAp4rg2505t4Tw hC/flwjYwpYzXgcxPn2c1xW/28Qt7K7sJuk7DVDHBeffZyTJdnWZpL4iwMLJvK+ITRoF KzaP9CPdLhJBNjng5V14ls4DyjjkKV/mlMnari1+kK5u5FID3G7NFOLX7WFTXYvzIVYY NI3W+KlA19ehC00dYohjSCfxP30tdUXyKDHJ2GzSLx182O7p5Vn4xL297k46ZfkxNB3c 9asw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784763813; x=1785368613; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VM4Q4+Q9bC+Ys9BdhS6aCA8dDkeyBz8iQ9iFH0DgBog=; b=nPRxDl3iI3gujYA6eNPVaat06MSG+T/c1EY0zh/808v5RxdYgTMULQeU9U7CrQJ9cW WQu0ZEXENNap0k4RNom+C+XoIaBoQhSWMbeb2Ty/2C8kQIeMSwWl35tf4H2wO2L8cKku yDENaWfYSH0ezpe5syvL4Jxh4fc9VpgGjbbZG0aRjM7fv1R+h8rUTLkVL/owspp8H5z4 4BYgkD1gyr+sEriQS6lPi03mULDb5kSRIWZjxvScYc5wkj8sdQ0BSeHA8kVFNzkSF8xx lDd6hSOQxRpnZcwKwEOqsT+SVbbCDpEklBOxP2K06WziiqUMa9HYvORSZQTaozDCr7P5 bxcg== X-Forwarded-Encrypted: i=1; AHgh+Rr4tlrwe37eu1XutRc/+qMlpkP7Sf2qM9QtV6yDC1IFvGPcPHhyXmQuSVdiofKjBXBr8yzzFvXaLZ9n4IM=@vger.kernel.org X-Gm-Message-State: AOJu0YyqxzMlw8SfbmIikPFjNPE2hTeUls/1HHidAumslbgIf+jaQfAa K0oXhZaWsgYZBRICpc32ODa4iQpDnrin7RJVPpXZ4nTbihQ5/J/RLm3kJ4wzoFMBoOMS0xRe4Lc 4oHt6ZwnjqejTp86MXdKXTMiI4JzFGihLp7Hhw189Pngg3HrouN2toZrsW68XqFTT9g== X-Gm-Gg: AR+sD13rlTcI62+XU0FBG3Jx9fRU2xYw7RkK3Zj8+seLTCUX/RO+1a0KcOrVbkACtsN SJUw5t28+kerrxDOPHLPtr/lR0XyzDoh/ZynD3CC7wc77bTsdx87v2zu6NwGvAxgL0jzzFs082b Vkp5gyXXy35eaFU3ouZLvRtGH7Y3yKLfhKRUIjzSZ6+xji4DganqVdBGO6xewO4c5AEO1DdcfJe 0gtCJBt0xmI0IAeCMsVLl4m2JRTNUjS94yI7FmwldNmOnLCDAWt7xq7S/+FYUktb+y8XEnNP/zx lllrrNjJC3kqCFY5nCnJC+fKW107XgeH1aN+OV6OMK3uv6ujf5KNWlQEcDF+OFT+OHrTJuD3Qg6 d6eugYG8E0nex34cIbOIIw7MYjhV0Iz+LDuU= X-Received: by 2002:a05:6a00:1c88:b0:84e:4d6:78fe with SMTP id d2e1a72fcca58-84e2b83206fmr921256b3a.3.1784763813503; Wed, 22 Jul 2026 16:43:33 -0700 (PDT) X-Received: by 2002:a05:6a00:1c88:b0:84e:4d6:78fe with SMTP id d2e1a72fcca58-84e2b83206fmr921226b3a.3.1784763813044; Wed, 22 Jul 2026 16:43:33 -0700 (PDT) Received: from [192.168.1.86] ([206.83.113.113]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84e23f7138asm923512b3a.32.2026.07.22.16.43.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jul 2026 16:43:32 -0700 (PDT) Message-ID: <4da5a8eb-3d22-4aa6-9fc2-31143aad384a@oss.qualcomm.com> Date: Thu, 23 Jul 2026 09:43:25 +1000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] tee: remove dead select from kconfig To: Harshal Dev , Arnd Bergmann , Julian Braha , Bartosz Golaszewski Cc: Sumit Garg , Geert Uytterhoeven , amirreza.zarrabi@oss.qualcomm.org, op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Elliot Berman , jenswi@kernel.org References: <20260715092539.18384-1-julianbraha@gmail.com> <6600d003-709e-4186-98c4-a9ac263d7d6b@oss.qualcomm.com> Content-Language: en-US From: Amirreza Zarrabi In-Reply-To: <6600d003-709e-4186-98c4-a9ac263d7d6b@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: jzdT56e4ZEhow9okjhD1s66o6S8hjJI1 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIyMDIzMyBTYWx0ZWRfXx9Bf/5anX/Ak /KVnsoRqvnbt8rwjXGAjgKbW9C58MMCzxsbb241F5s3EgLTzZtI55YQHoYHtJrnV0iDdXghI9fh riCTHEJquIWLbitbO1uTi79RuUshFNI= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIyMDIzMyBTYWx0ZWRfX9vVBfdHlnbc7 UK6VL4CH6Q/Q6VzYbo4xHtuVzo13MOL4w1+yE9Ju7/xtM09ymc5wuJymRvz3QcEKhdj/vp4d4HF BpA2MnwTCdXjBh03B8EOo78xrTB3dwNXWB/QOdJ78kpMdfu0SxNbCKhWJgvlOAiv1uplkuI4hT3 nn2yRFgmQWnW0DH2EP4VYcH2N029w9XmgzXdAqhj+qGFvS3gQoxCoKrq2jsyP/ZVzZczPjoupHW QqrzIMBgJut3xvU/FWcLy6QUrOIlOmnwU4/lLV4ye92IKIRTC4+cMDZOxWy4sRcyqPyv6nLtzFH CD0N+tLuqL3k1JisayfjqaJ975thQqn6HkKyLyXD8pGketf/r0cmiVqT8FL0OZeeVoDyTRTUpR9 rXY3g98CMZlKVsY5N/4K17nV2CO+/wVqkq/h+RRkJCsJF0x/r6uWhhPfKXdh3DeQgxyZYOisvND JepHdwfrUZQUAaMWQvQ== X-Proofpoint-GUID: jzdT56e4ZEhow9okjhD1s66o6S8hjJI1 X-Authority-Analysis: v=2.4 cv=JuTBas4C c=1 sm=1 tr=0 ts=6a6155a6 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=+pqzwZzB1FLV8+kquSSWdw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=cTKkiFmBdYaFWAhAJ_8A:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-22_05,2026-07-22_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 adultscore=0 phishscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607220233 Hi, On 7/20/2026 3:55 PM, Harshal Dev wrote: > 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. > Thanks Arnd, and thanks Harshal. The stubs and their no-op behavior were intentional. They were added so callers could use the SHMBridge helpers without having to distinguish between the TZMEM modes. When SHMBridge is not enabled by QTEE, creating or deleting a bridge is expected to be a no-op and normal memory can still be used. The problematic case is when SHMBridge support is compiled out while QTEE has it enabled. The compile-time stubs still return success, even though the memory was not registered as an SHMbridge. This is not a valid configuration for qcomtee, or for other clients sharing memory with QTEE. I agree that Arnd's second proposal is the cleaner approach. QCOM_TZMEM_MODE_SHMBRIDGE can become a regular bool, while retaining the generic allocation behavior as the runtime fallback. qcomtee can then select it, ensuring that runtime detection is always available without making SHMBridge a requirement on every platform. With this user can not make wrong configuration choice using QCOM_TZMEM_MODE_GENERIC and we can drop the stubs. Regards, Amir > Regards, > Harshal >> I've added a few more people to Cc that may know the correct >> answer here. >> >> Arnd >