From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BEE9ECAAD5 for ; Mon, 5 Sep 2022 06:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236271AbiIEGvG (ORCPT ); Mon, 5 Sep 2022 02:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbiIEGvF (ORCPT ); Mon, 5 Sep 2022 02:51:05 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71DA4371AF for ; Sun, 4 Sep 2022 23:51:03 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id bt10so11801542lfb.1 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=BgRdnZ9ZIiJL9Qk8uAs4lVqMRn5iDh3WbZfyawiVsarDaCHlbZjMaXfbo24OISsaoQ 7d4DCP+mwnllqrfBhkGTAjmOQ6K34GabeN2atJgogh9Tx9L9sXo5k4USj6rXUcVxlcU0 z9nMOV8n1PZBvKAlXPOzPR8oETG7UDULTKdG6qGMXGA4YW4S3XAN2v0z6mKfqHIybMEX ug8qvydyzz4IU6jlZe1gaxgB+DfyH05Koy2P8pcVacxsQFnv7HsiiPa7gTkAHcsLrER9 NMLp8amkfNupvc6xWZ+Y2qM/lf20LHPoFkWgg6zz3kAnJQ/QSEufsBC6DDycqzi52eXM AO8Q== X-Gm-Message-State: ACgBeo25dSCDvfHdMrl8FgHJEg2ehC3TUJlmfMZDCGBqqJAGApW8yzcK A143GiOjKCENs5mngqYDJjFiaw+GCpsJjxz5H2aK+Q== X-Google-Smtp-Source: AA6agR6mgPO8b5a8qN6Hwu+o7a0FkP+RxxtCU71emjql8vwfRr1sKKPmvZKgBtd1GpvHcMIgHHfbiz5NC+pZmkXZatc= 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" Precedence: bulk List-ID: X-Mailing-List: devicetree@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