Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1983556rdf; Mon, 6 Nov 2023 00:39:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqs6oKv3GEFAwyZ9Eg6RAOhrTEsI2qP3fZc19yl+wYLKaovOP8R86FOAprzHBXhqL4vp0V X-Received: by 2002:a17:903:228b:b0:1cc:474a:ddc9 with SMTP id b11-20020a170903228b00b001cc474addc9mr20196156plh.28.1699259976120; Mon, 06 Nov 2023 00:39:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699259976; cv=none; d=google.com; s=arc-20160816; b=pUji3W02zKItg0cIu3mkwy59sGMqYl7HUoZO4buIVWIUEtAdWxsyiT3Y9bVY9gS1H8 blJZlSIC4HyGskRWmIFUSxbTTipkIzOl70n9poUBM2gvHRjd7uLYvC9H+t3aCaB8jtG0 e3RhKuZEnYayXi2ZMFECEEp9T7w4Cx3cr6gaFVQUjO9Q6naTKx8XSCt2BMXHVmAeyTi0 JDUkDhvWuqSnGeb3MbrJnrb+taOD5VtWcaMFrUgCtnJvuxkOxxCpaa+kQ7xEuXHusfas 2QaGW08+65qp6s4lyHp9q+Lasb1yDcjkP9ZFRUAGvBbYavZy2EyNGlV3swG3e3xbeuOI fgLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ekM2xd9y+bSacCYNAL46JwG0PKe1oiGDrHb1EaKbOfE=; fh=/6UCzSgYXw0IlQE5AO3ljdrf39y/wLGW4/NWK0cH3EY=; b=i7zEIX+T7iWXsG5F+xTJ8kvEGu/94tvdciefs9kddepgzJ2xzI4AbncB1w3zuqxaye IlS4FT/OtWcQYFmcOz+WhhhWFpqbf26Rq5yo51Z/SjgLeIVxsgGFq83RpoqrUrdC7NmX zWnmDyAH5xlUt6NTiN2A0mufU48W3Y7o9b9gbTFxhckdQzlSnlXHIlqWszwK53oqU8wk tacQ1aXuJQebrMWR6XhOINqYUXXtNW43t1xPy+OhQ92cwLGjgxJBzCPO+PM0q6pNmQlt n9m/HGMBoXn59Op/jgykxbL7aXRwzvyoQb4BEx9x+qHn+iq7OKw6nveQ+UOY3zT81CnI +Tvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dGBtmdTN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ix18-20020a170902f81200b001c60d1de681si7401155plb.108.2023.11.06.00.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 00:39:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dGBtmdTN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id AF4C1802FD1A; Mon, 6 Nov 2023 00:39:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231269AbjKFIj3 (ORCPT + 99 others); Mon, 6 Nov 2023 03:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230431AbjKFIjZ (ORCPT ); Mon, 6 Nov 2023 03:39:25 -0500 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F624134 for ; Mon, 6 Nov 2023 00:39:22 -0800 (PST) Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-66cfd874520so27183066d6.2 for ; Mon, 06 Nov 2023 00:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699259961; x=1699864761; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ekM2xd9y+bSacCYNAL46JwG0PKe1oiGDrHb1EaKbOfE=; b=dGBtmdTNaZd0CZ9Z9n3NOi25/jaV5s7TV5Cz9z5B3DKrZc1YkBbrctWH22X8TLqif7 bfWY5Vj9e+mVQXrkmnJMM3QxsSBz396CSX6Chaw26fwKs3Kec6IS71RKCPpdZqE4U48g 2MZ7T/0fy9FSqxHnsAjBpwfMNSuv0lJLJLa9ArvNy2sSJuWs8QMYRJaWMKAq+FWuFMQJ e/0Weq44MUsee+9fQ+sigqFkvVAq66gYThVHfAHJBCS+5AGfDI7D8mlDKRjdClwmBk5y DcdPFFjdAwou9wresVAfp382yJhhw8qGw8/Fflt2GenBg7JTViEwWPL/H0K+gdCdSqqy lcPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699259961; x=1699864761; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ekM2xd9y+bSacCYNAL46JwG0PKe1oiGDrHb1EaKbOfE=; b=o8ljsYtMjYnJN9kTuoXUIUEkFAaKQyYMXP5ZDaLooh4szPR+4ozWwYKjfM66m5MGQb uV6slj8zQsOA33sacaULYgbRqgIeiK+wGCjDlQsVfI/uw3v/2gtKD6iTjwR6xg9AB0wt QSKiRXDlJpeWSBzEe7qXX8/NzQ5hqhHakJZgkZ+drRnbVdeFjZdc/EZ/nDIHJhxYVUm2 6PK2iiMSgJgC19xKt2+0ZvYm1lusJTnp/4TOaD1TgS2GCFH3RwfwSVCvA3n7Mq3xe6fC bq2b1VbYHXnp+CAWF8iRdQ35nNUk9qgr2ug333cUOTdO79UUCwRJ0/rmBhA8BlFM8HMN mrHA== X-Gm-Message-State: AOJu0YxTWK/igZQuX5Y9a+axfzbTBkoqG+1fcHO9JZiDWii+nHbrs/9w i1X7mAe7nwDo0MkGcfFbxTfiGKmH3+oqJhmYwIOk3g== X-Received: by 2002:a05:6214:c81:b0:66d:a1d3:fd94 with SMTP id r1-20020a0562140c8100b0066da1d3fd94mr35036679qvr.19.1699259961423; Mon, 06 Nov 2023 00:39:21 -0800 (PST) MIME-Version: 1.0 References: <20231026080409.4149616-1-jens.wiklander@linaro.org> <20231102115925.GA1233092@rayden> <20231102131624.GB1233092@rayden> In-Reply-To: From: Jens Wiklander Date: Mon, 6 Nov 2023 09:39:09 +0100 Message-ID: Subject: Re: [PATCH 0/2] OP-TEE FF-A notifications To: Sumit Garg Cc: linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, Jerome Forissier , Sudeep Holla , Marc Bonnici , Olivier Deprez , Lorenzo Pieralisi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 00:39:35 -0800 (PST) On Fri, Nov 3, 2023 at 9:53=E2=80=AFAM Sumit Garg w= rote: > > On Fri, 3 Nov 2023 at 13:32, Jens Wiklander w= rote: > > > > On Thu, Nov 2, 2023 at 3:05=E2=80=AFPM Sumit Garg wrote: > > > > > > On Thu, 2 Nov 2023 at 18:46, Jens Wiklander wrote: > > > > > > > > On Thu, Nov 02, 2023 at 05:46:55PM +0530, Sumit Garg wrote: > > > > > On Thu, 2 Nov 2023 at 17:29, Jens Wiklander wrote: > > > > > > > > > > > > Hi Sumit, > > > > > > > > > > > > On Mon, Oct 30, 2023 at 11:32:47AM +0530, Sumit Garg wrote: > > > > > > > Hi Jens, > > > > > > > > > > > > > > On Thu, 26 Oct 2023 at 13:34, Jens Wiklander wrote: > > > > > > > > > > > > > > > > Hi all, > > > > > > > > > > > > > > > > This patchset adds support for using FF-A notifications as = a delivery > > > > > > > > mechanism of asynchronous notifications from OP-TEE running= in the secure > > > > > > > > world. Support for asynchronous notifications via the SMC A= BI was added in > > > > > > > > [1], here we add the counterpart needed when using the the = FF-A ABI. > > > > > > > > > > > > > > > > Support for FF-A notifications is added with [2] and this p= atch set is based > > > > > > > > on Sudeeps tree at [3]. > > > > > > > > > > > > > > It's good to see FF-A notifications support coming through. T= he good > > > > > > > aspect here is that FF-A uses a common secure world SGI for > > > > > > > notifications and doesn't have to deal with platform specific= reserved > > > > > > > SPI for notifications. > > > > > > > > > > > > > > From OP-TEE point of view I think most of the secure SGI dona= tion base > > > > > > > would be common, so can we switch the SMC ABI to use this don= ated > > > > > > > secure world SGI for notifications too? > > > > > > > > > > > > The SMC ABI driver picks up the interrupt used for notification= from > > > > > > device-tree, so there's a chance that it just works if a donate= d SGI is > > > > > > supplied instead. We'll need some changes in the secure world s= ide of > > > > > > OP-TEE, but they wouldn't affect the ABI. > > > > > > > > > > AFAIK, a secure world donated SGIs doesn't support IRQ mapping vi= a DT. > > > > > The FF-A driver explicitly creates that mapping here [1]. > > > > > > > > That looks a lot like what platform_get_irq() does via of_irq_get()= . > > > > > > > > > > There is GIC_SPI or GIC_PPI but nothing like GIC_SGI in DT bindings [= 1]. > > > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.gi= t/tree/include/dt-bindings/interrupt-controller/arm-gic.h > > > > > > > > Moreover > > > > > it's better to detect it via an SMC call rather than hard coded v= ia DT > > > > > as FF-A driver does. > > > > > > > > Typo? I guess you mean that you prefer that way the FF-A driver doe= s it > > > > rather than having it set in the DT. > > > > > > Yeah sorry about that. We shouldn't use DT if OP-TEE features are dis= coverable. > > > > > > > > > > > Assuming that you only care about "arm,gic-v3". The SGI will likely > > > > always be the same so it shouldn't be too hard to keep the correct > > > > configuration in DT. > > > > > > See above, DT looks like it does not support SGI. > > > > You're right. > > > > > > > > > > > > > > > > > > > So the ABI should dynamically detect if there is a donated SGI th= en > > > > > use it otherwise fallback to SPI/PPI detection via DT. This would= make > > > > > the notifications feature platform agnostic and we can drop legac= y DT > > > > > methods from optee-os entirely but still need to maintain them in= the > > > > > kernel for backwards compatibility. > > > > > > > > We care about compatibility in both directions so we'd need to keep= it > > > > in OP-TEE too, but perhaps under a config flag. > > > > > > Isn't it just supported on Qemu right now in OP-TEE? I hope dropping = a > > > feature won't be a problem there compared with the maintenance burden= . > > > > I'd rather not remove this since I believe it can support more > > configurations (different interrupt controllers), but feel free to > > propose a patch with the new ABI. > > Having a second thought here, I think adding further ABIs (redundant > ABIs become maintenance burden overtime) don't make sense until we see > real users of notifications. Have you been able to discover real users > of this asynchronous notifications feature in OP-TEE? No, not upstream. There have been questions about a feature like this from time to time in the past and I guess non-trivial interrupt handling will soon need it. Cheers, Jens > > -Sumit > > > > > Cheers, > > Jens > > > > > > > > -Sumit > > > > > > > > > > > Thanks, > > > > Jens > > > > > > > > > > > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/= linux.git/tree/drivers/firmware/arm_ffa/driver.c?h=3Dffa-updates-6.7#n1283 > > > > > [2] https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/= linux.git/tree/drivers/firmware/arm_ffa/driver.c?h=3Dffa-updates-6.7#n1275 > > > > > > > > > > -Sumit > > > > > > > > > > > > > > > > > Cheers, > > > > > > Jens > > > > > > > > > > > > > > > > > > > > -Sumit > > > > > > > > > > > > > > > > > > > > > > > [1] https://lore.kernel.org/lkml/20211103090255.998070-1-je= ns.wiklander@linaro.org/ > > > > > > > > [2] https://lore.kernel.org/linux-arm-kernel/20231005-ffa_v= 1-1_notif-v4-0-cddd3237809c@arm.com/ > > > > > > > > [3] https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.= holla/linux.git/tag/?h=3Dffa-updates-6.7 > > > > > > > > commit bcefd1bf63b1 ("firmware: arm_ffa: Upgrade the dr= iver version to v1.1") > > > > > > > > > > > > > > > > Thanks, > > > > > > > > Jens > > > > > > > > > > > > > > > > Jens Wiklander (2): > > > > > > > > optee: provide optee_do_bottom_half() as a common functio= n > > > > > > > > optee: ffa_abi: add asynchronous notifications > > > > > > > > > > > > > > > > drivers/tee/optee/call.c | 31 ++++++++++- > > > > > > > > drivers/tee/optee/ffa_abi.c | 91 +++++++++++++++++++= +++++++++++- > > > > > > > > drivers/tee/optee/optee_ffa.h | 28 ++++++++-- > > > > > > > > drivers/tee/optee/optee_private.h | 9 ++- > > > > > > > > drivers/tee/optee/smc_abi.c | 36 ++---------- > > > > > > > > 5 files changed, 153 insertions(+), 42 deletions(-) > > > > > > > > > > > > > > > > > > > > > > > > base-commit: bcefd1bf63b1ec9bb08067021cf47f0fad96f395 > > > > > > > > -- > > > > > > > > 2.34.1 > > > > > > > >