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.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 22FE9C07E96 for ; Tue, 6 Jul 2021 07:28:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DEF176198E for ; Tue, 6 Jul 2021 07:28:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEF176198E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0EerBCiUObIqoTC1L9hvVNCC+SaDJxkIT3uU6QI1/oE=; b=djMS7mB1zK7Ef+ 1cqZdFoFtbOUzbjAr8LRYLCXvkwK7duLF5ll8PoXfCpQo9xZcYueRSIP5k3gWRwUyIlglzp5tRI9K 2UzCaKWF6pUOGs+vUni2cztG+zeKfQHv9gh5GuvLSh/prcKrRRq8jlcKtnnGB8mwaPbc2pZEUIhwn hlRo0M0n+4X2FwYWWJmh5cuk6Iq+3zca44mErGbgptTqbj0yG61pNiIiHpiG1CTj3op9Z83Jfh2yd rHjvdMG9MuotkDoag1vTLCtGZ7vcGEpZKefKPksFQiONvIQZeF/V6SNZnyny5j4XAK1czEt7rIZ80 HEgiZc6xo7GdoIAgNHmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0fSi-00AgHA-MY; Tue, 06 Jul 2021 07:25:44 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0fSe-00AgGT-DY for linux-arm-kernel@lists.infradead.org; Tue, 06 Jul 2021 07:25:42 +0000 Received: by mail-lj1-x22d.google.com with SMTP id a6so27853178ljq.3 for ; Tue, 06 Jul 2021 00:25:38 -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=ndcjPWzLytA9EiSTNxRzOW+kiGQuYtUPnN/uOvlJ539vg44+dWo+XCrsYMzzp4KtHP z2EBQEj2TCX8UzUNA7AvTZ5sjlSqy2sXNYKRoySSR53Bg57enanH/KnwaN8j2GlmgF2v /Hikw3UXjQBY3KdXLhegyUxxjVqgzqc3z5XcwyHTEueiVvuvhcK8hZsfHvYcglMb3Scu TIA23C8c6oa0rjE84k9CI8I3GpchE9uvjSrYLkmTCxQFP5aP4FkDdsiIP6eoCU4+Sq/m r0P39SBhcpczbrEpyhDC8L+61KWyXXrQeTRgWTP41Um5feZxdx2+t6nfuHOcy/pk0BHf VuTw== X-Gm-Message-State: AOAM530ieBKwYPkVW/yt3QXIGrWupbACDErsmQnmcE3qiNflZAVOrKL8 zATi4NFgPE3pXrI1mca0hXomakwTNCYiAMrwKOyEcA== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210706_002540_535460_124E5849 X-CRM114-Status: GOOD ( 33.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel