Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4546301pxv; Tue, 6 Jul 2021 03:39:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQFD2MEzcPLtZMqplMhg8Lq5bQdOzjqtyNBeXSmgf9jEEHL771JxWlteK7jFmSCbdYmQtX X-Received: by 2002:a17:906:3a53:: with SMTP id a19mr17884126ejf.88.1625567990672; Tue, 06 Jul 2021 03:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625567990; cv=none; d=google.com; s=arc-20160816; b=ulRfDthWwEZRVKKj/KV3i+C7lWxpyneKiqsYhyO+edkXybS/nQypVTHL4XiFPiKdgB frX/fURWDCBWHQ8FJnHgrStfsrhMnvqXOU9tQIPW2O1pRnvFzVI02cd0ewH+HIQr58Q7 h0xLEk+hoWfWx/b6SgIYHa7N8XQzlZfqe3QrnI27aTfJ4+8/pc1TJmsRTfVwo7dG89hV MmNO7B6bZb/JgzuIyf10qStJyzIFHbAOVr3WnEBuwccjEhv4hRERXAhkoUVkJBQMgeYG Y09uD5y1cP50apVGewOldH5B/TeS7UsXxfAMIALY4QE8kgLOTxuFpdhW/2FaMsuySDli blQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:rom:message-id:date:from; bh=M3nO4PapX1YDUFu8+5pfLFaBRwU3m1wfLcyVdpslmCA=; b=r0VLKUn+e2hNbRIlrQSdtWh1ApF/L6scc8Giamtp3ukmMDlzqTLYpgjdghWgblrtAV guwc+X8HmFVN4go94pfiFcw9riAt5+1MusXWv17IKXReC8+ThW80XiZI6uAL2+wS+NTN Xztrb+r3/77ZInVi6WaajcGQxjrqlQdzIEO4J00MVC4ZBnSTiC/ohvbZzuuEYZY9SnQz LW9P/XJOUO/AoSdL57528mlg/j+QZ7WY52du84rbiBou7GzOO0zqnhnAhtQi9MiZL9Le 7ZXA/dSxQz/2gjUke5vy7oR36adRJ0vST8Wk6qcZzLKSSwInl8md0HhG/ktyZlH8VnfJ Ed1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc4si13507588edb.129.2021.07.06.03.39.27; Tue, 06 Jul 2021 03:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231477AbhGFKi7 (ORCPT + 99 others); Tue, 6 Jul 2021 06:38:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231400AbhGFKi6 (ORCPT ); Tue, 6 Jul 2021 06:38:58 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 463E7619AA; Tue, 6 Jul 2021 10:36:20 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m0iR8-00BeiL-2H; Tue, 06 Jul 2021 11:36:18 +0100 From: Marc Zyngier Date: Tue, 06 Jul 2021 11:36:17 +0100 Message-ID: <87czrv91b2.wl-maz@kernel.org> rom: Marc Zyngier To: Sumit Garg Cc: Jens Wiklander , 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 Subject: Re: [PATCH v2 0/7] Asynchronous notifications from secure world In-Reply-To: References: <20210616103649.2662395-1-jens.wiklander@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: sumit.garg@linaro.org, jens.wiklander@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, jerome@forissier.org, etienne.carriere@linaro.org, vincent.guittot@linaro.org, robh+dt@kernel.org, corbet@lwn.net, ardb@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 06 Jul 2021 08:25:26 +0100, Sumit Garg wrote: > > 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 What does "Architecture specific SGI" mean? > think this feature will come automatically enabled for every platform > without the need to reserve a platform specific SPI. That old chestnut again... - How do you discover that the secure side has graced you with a Group-1 SGI (no, you can't use one of the first 8)? for both DT and ACPI? - How do you find which CPUs are targeted by this SGI? All? One? A subset? What is the expected behaviour with CPU hotplug? How can the NS side (Linux) can inform the secure side about the CPUs it wants to use? - Is there any case where you would instead need a level interrupt (which a SGI cannot provide)? In general, cross world SGIs are a really bad idea. Yes, some people like them. I still think they are misguided, and I don't intend to provide a generic request interface for this. M. -- Without deviation from the norm, progress is not possible.