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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E07AC07E96 for ; Tue, 6 Jul 2021 07:25:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63D9C61993 for ; Tue, 6 Jul 2021 07:25:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230242AbhGFH2S (ORCPT ); Tue, 6 Jul 2021 03:28:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbhGFH2R (ORCPT ); Tue, 6 Jul 2021 03:28:17 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45CBDC06175F for ; Tue, 6 Jul 2021 00:25:39 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id t30so7831928ljo.5 for ; Tue, 06 Jul 2021 00:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=v5VNmThjm4DmH+LnsaR0B3iwZoVfeb1fZ3oywOwn7G8=; b=cVGcrT9zB5JzTP0aE9nAkyAmZxivH9ZNxMEDzFbar62SLEYX7QeCRPEtCcuzB+zt76 2WvL2z/tIUIDzTaL1iUq/x48nsuhSoxZTg9vDc9ybquiT4NBmQbPJP5YpueXbFyHx03M APlLoefqRDNQii2urEZRAy1AhwsxOdaFu2Tqbdx3EmGNnsKfseEzD+FnOQAXXKn0Ojif yVwS3JDB4ZTTxJP8/Q+1yCXnMKeAfNZzmMdY9PkPtLGIIsgFUYnp1/15SoOirApg81SE VD7qYJ1Nb9b6VuRlDJTCO1mmkv/ZEnUOnqH6Vkjppsk4Ub0yfTo0TzjUjbd1A6q+H+tw J3YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v5VNmThjm4DmH+LnsaR0B3iwZoVfeb1fZ3oywOwn7G8=; b=Xdyb7ylmqNK9Kc7aK42eg+AdF9sgegl6KYklvh9SuhOmJyLUfBbWIF7p8wHYmj7lzo WFtUZQwVS0qkbc0jahe8eXw+RuRs4ffHiHG0aihSTBUJT60QUXM9ToyV/Q7bc01BM9RV miu0TrsYnJb+WlK4QmmbEZjmKjVnO3wYb2y6USiG0IC7qaXlz34KW3IxWDmlZz+DYXBV pLMkyq94WG86X5XMy/FAIuNUnLhuA8YnNKC0Fhory1QSGqUr2yMhkx2Orrtcuph+QyEn rvA/uQO1hc8l8SaiTjhCJy+wPuymB9dxRTwUbfERKPo7Oh27DmoxmBB6qbMEgSmWjDvQ +6OQ== X-Gm-Message-State: AOAM53000rW7GQBqiuIGkDlg2orka4ODPqYcrsyvgsQC6Kf1JMC9MsFe lUgb+/MngsFip4WPCozA2mmQO2iJbQafjwz9d3wIfQ== X-Google-Smtp-Source: ABdhPJzBqENHysNuz9woqwFmjD9B+KAL6Oj7Tqd92ssm66C+8dzfCqg5FMbGILRpUR9/vpr05KVEHQ/454HYf1iVLo0= X-Received: by 2002:a2e:9059:: with SMTP id n25mr14700116ljg.314.1625556337523; Tue, 06 Jul 2021 00:25:37 -0700 (PDT) MIME-Version: 1.0 References: <20210616103649.2662395-1-jens.wiklander@linaro.org> In-Reply-To: From: Sumit Garg Date: Tue, 6 Jul 2021 12:55:26 +0530 Message-ID: Subject: Re: [PATCH v2 0/7] Asynchronous notifications from secure world To: Jens Wiklander Cc: Linux Kernel Mailing List , linux-arm-kernel , OP-TEE TrustedFirmware , Devicetree List , Linux Doc Mailing List , Jerome Forissier , Etienne Carriere , Vincent Guittot , Rob Herring , Jonathan Corbet , Ard Biesheuvel , Marc Zyngier Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Thu, 17 Jun 2021 at 11:40, Jens Wiklander wrote: > > Hi Sumit, > > On Thu, Jun 17, 2021 at 6:33 AM Sumit Garg wrote: > > > > Hi Jens, > > > > On Wed, 16 Jun 2021 at 16:07, Jens Wiklander wrote: > > > > > > Hi all, > > > > > > This adds support for asynchronous notifications from OP-TEE in secure > > > world to the OP-TEE driver. This allows a design with a top half and bottom > > > half type of driver where the top half runs in secure interrupt context and > > > a notifications tells normal world to schedule a yielding call to do the > > > bottom half processing. > > > > > > An interrupt is used to notify the driver that there are asynchronous > > > notifications pending. > > > > > > > It looks like a nice feature. I would like to get hands on with this. > > Can I test this feature on Qemu? > > Absolutely, you can get this into the normal OP-TEE development repo setup with: > repo init -u https://github.com/OP-TEE/manifest.git -m default.xml > repo sync > Update optee_os with > https://github.com/jenswi-linaro/optee_os/tree/async_notif_v2 > Update linux with https://github.com/jenswi-linaro/linux-1/tree/async_notif_v2 > cd build > make all -j... > make run-only > > If you type anything at the secure console you'll notice how it > changes behaviour once the Linux kernel has booted. > Thanks for sharing instructions as I now got some time to test and deep dive into this feature. It looks like a pretty useful feature to realize interrupt support in the secure world in its true sense. This feature works for me as per your instructions. I could recognise it's requirement from the time while I was playing with secure timer interrupt support for OP-TEE RNG driver on Developerbox. In that case I had to strip down the secure interrupt handler to a minimum that would just collect entropy and dump into the secure buffer. But with asynchronous notifications support, I could add more functionality like entropy health tests in the bottom half instead of doing those health tests while retrieving entropy from the secure world. Given that, have you explored the possibility to leverage SGI rather than a platform specific SPI for notifying the normal world? If it's possible to leverage Architecture specific SGI for this purpose then I think this feature will come automatically enabled for every platform without the need to reserve a platform specific SPI. -Sumit > Cheers, > Jens > > > > > -Sumit > > > > > v2: > > > * Added documentation > > > * Converted optee bindings to json-schema and added interrupt property > > > * Configure notification interrupt from DT instead of getting it > > > from secure world, suggested by Ard Biesheuvel . > > > > > > Thanks, > > > Jens > > > > > > Jens Wiklander (7): > > > docs: staging/tee.rst: add a section on OP-TEE notifications > > > dt-bindings: arm: Convert optee binding to json-schema > > > dt-bindings: arm: optee: add interrupt property > > > tee: fix put order in teedev_close_context() > > > tee: add tee_dev_open_helper() primitive > > > optee: separate notification functions > > > optee: add asynchronous notifications > > > > > > .../bindings/arm/firmware/linaro,optee-tz.txt | 31 --- > > > .../arm/firmware/linaro,optee-tz.yaml | 57 +++++ > > > Documentation/staging/tee.rst | 27 +++ > > > drivers/tee/optee/Makefile | 1 + > > > drivers/tee/optee/call.c | 27 +++ > > > drivers/tee/optee/core.c | 87 +++++-- > > > drivers/tee/optee/notif.c | 226 ++++++++++++++++++ > > > drivers/tee/optee/optee_msg.h | 9 + > > > drivers/tee/optee/optee_private.h | 23 +- > > > drivers/tee/optee/optee_rpc_cmd.h | 31 +-- > > > drivers/tee/optee/optee_smc.h | 75 +++++- > > > drivers/tee/optee/rpc.c | 73 +----- > > > drivers/tee/tee_core.c | 37 ++- > > > include/linux/tee_drv.h | 27 +++ > > > 14 files changed, 576 insertions(+), 155 deletions(-) > > > delete mode 100644 Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.txt > > > create mode 100644 Documentation/devicetree/bindings/arm/firmware/linaro,optee-tz.yaml > > > create mode 100644 drivers/tee/optee/notif.c > > > > > > -- > > > 2.31.1 > > >