Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2733202rwb; Sun, 4 Sep 2022 23:57:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5iQiH2sztxVt3fkZPWzcFkrab3qICD8JtWzj17Af9sTz46gLpPX5SlNxI96/rbdKt/zvqI X-Received: by 2002:a05:6402:5384:b0:431:6d84:b451 with SMTP id ew4-20020a056402538400b004316d84b451mr41905472edb.46.1662361079325; Sun, 04 Sep 2022 23:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662361079; cv=none; d=google.com; s=arc-20160816; b=uXWx8Jjv61xn9kerM4Fg7m9JrSBxMqUKBO8zzIntdshYUrHi5zOLzmvbulnaq9OJ2m MNOV/xkRXkoHjfoDdUsGz/6YbCruBogSyIhMLT3RVqRJVCSOANTcYcAPXQue15lMqIGx g1tCzbljfXdZXqILUy28ZJJoObkXJQkpcG8MBiVvzehkhMKTwItKTnCIt/HUe1t2P4Gp jDMpHg2mhzedczzADNX71ZStI2qHrJGEsP08oSaPePTkUljEcyDcjGTEAmo9p7v16s03 oYlRbbgFvUaQ1CyYlQV60NI6jWuFG7pIzxB4Y/CJ0eD1Z4xS94zKzGZtmmpL0IIJLF5u r6+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7l1Ke7T6M+oZvtuxdITH0Qf+JbsLNo5gUL5ZqA0qy+Y=; b=jbNvC0JgKAMeuAFFjxkrEi7WpmcTqdExEUOVFf0CMVfzgcAh5VJIvDt7Keb0BMrKTl td7oe1494HaEuKZfSg7KmWT1WTkqfjZMtuYh/5c1GW/FJPEDT6IhhdZpPlKxpPYflse4 g0iL8zzXM7DT8FuxQgKF9XS4SXB+kc2L3ntkVzHJ4Ah+RQGV8kD4gaT/Ny/X0oYISVnS KD1pI6DzREDoQIlXH6Pdgt989PBTXBEyBaFaEZI0kQ2b7TX5MpUAUMsFCXOXsdDiGMuv idrJNn+Uip/ReYsTHvst5WxLIPPIHwufqfOqU874ftX03U7HPnmx93dEsV6yy3o+8i8O gFtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oV31RxlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a170906040800b00730ce22906asi5850727eja.876.2022.09.04.23.57.34; Sun, 04 Sep 2022 23:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oV31RxlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236395AbiIEGvI (ORCPT + 99 others); Mon, 5 Sep 2022 02:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236195AbiIEGvF (ORCPT ); Mon, 5 Sep 2022 02:51:05 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71BFB2F025 for ; Sun, 4 Sep 2022 23:51:03 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id p7so11788871lfu.3 for ; Sun, 04 Sep 2022 23:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=7l1Ke7T6M+oZvtuxdITH0Qf+JbsLNo5gUL5ZqA0qy+Y=; b=oV31RxlKuOTqexYDOvpxYXg7TBDxHrnLEFY+R1VNIIdDPLKabg29Ons+XPT4mT7Crm wxifLo8pLdwG7KsbbWfpvKm5gJrIMjcVPyDEoWM7M0aUPB4VM05NUwhdRFi1zb/v7owO QvgXv7bsSjDZpmpq18+gY4kFIEW66Y70dA/4pvTky7pdsi1J9tbNEUDAYzPkJjpqd0BO Kw0kxz6u9Epjq8pryosYXKIqXVJAM5UAYWYUuRWdvfHiy7PwMGXbWHnVLKr2mwDW7oqX Et1jbwLYKYbw3qP0jd+zVPG80Yq8JVdqG3URN5to74xfxFKDcDZFZpnh7sZjYvlLWQSa +vwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=7l1Ke7T6M+oZvtuxdITH0Qf+JbsLNo5gUL5ZqA0qy+Y=; b=SNgIvxokxNnNRjmKaBPaFFr3qYmZwKZ/YfNz4ZbAZ0dJUdvjDpNBq3R5T91t0GKA8t wvBR+uR2NGlOfpvNVkrnOBEo5HA9XP8+Jrz7kHZ4+nHwQDj9peCCi/ZyEim8ziVln4BQ 2rvoRhd19HkkXAbMtqrPdXTzhV9MgDME1Qk8QBnRlb6nzUeeJxAgaD2crZBTEZog0w28 EAyyl6VYfmeG/pQMyb/eCZH3cWj6PlHgu5PsU2ToIihelef+ah1yAnrUtcrVOqh9CCMs Lxu+St6UYO1Smu3v77MVgXQsZzvCwOwp7Gtoy8NftWQRhTk55hcckfuWTw0GYX7tPw1K AJwQ== X-Gm-Message-State: ACgBeo2h2BRR9U24HeYJizDGTAG7pw98bBIMMXLQnJCiWwxlbw0gON4H t5Gfs3f5g19aMcrJrbDQsxWNPqKfhBAmfvCgN2Sm6A== X-Received: by 2002:a05:6512:537:b0:494:8359:4ad with SMTP id o23-20020a056512053700b00494835904admr8089979lfc.409.1662360661770; Sun, 04 Sep 2022 23:51:01 -0700 (PDT) MIME-Version: 1.0 References: <20220723224949.1089973-1-luzmaximilian@gmail.com> <312ede16-f0a9-9b9e-a0d6-fb6e37d9f1bb@gmail.com> In-Reply-To: <312ede16-f0a9-9b9e-a0d6-fb6e37d9f1bb@gmail.com> From: Sumit Garg Date: Mon, 5 Sep 2022 12:20:50 +0530 Message-ID: Subject: Re: [PATCH 0/4] firmware: Add support for Qualcomm UEFI Secure Application To: Maximilian Luz Cc: Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Steev Klimaszewski , Shawn Guo , Sudeep Holla , Cristian Marussi , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, linux-efi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla , Andy Gross , Bjorn Andersson , Ard Biesheuvel , OP-TEE TrustedFirmware , Jens Wiklander , Ilias Apalodimas Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + TEE ML On Fri, 2 Sept 2022 at 18:48, Maximilian Luz wrote: > > Hi, > > On 9/2/22 09:26, Sumit Garg wrote: > > Hi Maximilian, > > > > On 02/08/22 18:52, Maximilian Luz wrote: > > [...] > > >> Thanks for this information! So as far as I understand it, this is currently an > >> interface to user-space only, i.e. does not allow in-kernel drivers for apps? > > > > The Linux TEE framework already provides an in-kernel interface to TEE as well via TEE bus [1]. There are already multiple kernel drivers [2] [3] [4] [5] [6] [7] using it. So an EFI driver can be an addition to that. > > > > Now coming on to TEE implementations, the drivers I mentioned are based on OP-TEE where devices are queried/enumerated during OP-TEE probe here [8]. So in similar manner QTEE smcinvoke driver should be able to register devices on the TEE bus. > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/staging/tee.rst#n56 > > > > [2] drivers/char/tpm/tpm_ftpm_tee.c > > > > [3] drivers/char/hw_random/optee-rng.c > > > > [4] drivers/firmware/arm_scmi/optee.c > > > > [5] security/keys/trusted-keys/trusted_tee.c > > > > [6] drivers/firmware/broadcom/tee_bnxt_fw.c > > > > [7] drivers/rtc/rtc-optee.c > > > > [8] drivers/tee/optee/device.c > > Thanks for those links! > > I think it would indeed be good if we could make it work via that > interface and I guess that should generally be possible. As far as I can > see, the biggest problem might be that the current firmware doesn't seem > to use UUIDs, so I guess we might need to emulate them somehow. > Okay, so I had a brief look at your driver to get an idea how QTEE identifies its trusted/secure applications. AFAIU, it uses constant strings as follows: #define QCTEE_UEFISEC_APP_NAME "qcom.tz.uefisecapp" I think we should be able to extend the TEE bus concept to accept constant strings as device IDs as well. So if a driver wants to support both OP-TEE and QTEE based apps then it can put corresponding identifiers (UUID or a constant string) in the TEE device match ID table. This way we should be able to support other TEE implementations as I think any other identifier apart from UUID can be represented as a constant string. If anyone else has any better then feel free to discuss. -Sumit > It would be great if someone with some actual knowledge of the firmware > used on those devices could have a look at this and provide some > insights. > > My plan for now is to hold off on the UEFI variable driver until we have > a (proper) TEE driver, which unfortunately might be a bit out of my > depth. I'm happy to help out in any way I can though. > > Regards, > Max