Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3471201pxb; Wed, 13 Oct 2021 06:45:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfBBlNB+OjFwQVJJO+mqZlZoH7dVCYImmwvViwtO3fBZ5xl+PajrGlVNHyDRdsbJunY3g2 X-Received: by 2002:a17:90a:1d6:: with SMTP id 22mr13534691pjd.39.1634132701275; Wed, 13 Oct 2021 06:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634132701; cv=none; d=google.com; s=arc-20160816; b=nWqk2/P2wuofb5S8d7mjvcIPKNSMoOnQ0APr4fKZIG34Qh4UUKRsw+Y3KvHapWyKia bRciyVpNdOOvIligEUE5tiQ8F6uoC0rZsctB+kATPKGDphpmgR22gxa08FVezRVnUpaZ PWzewq9xmvrGTDwkM7d9+PDLqTHQoJK6A4uy+JcsG+YDyKH6OLDQQE6puySQCH/JwmQT R9Mp+sb4rBhmjeYq1gCOkhBcj1jXz5ZsIhwglbWzWCbTuOjb1PfFujGBqg3CVrf6Z4sE /BnSsQ3Xjx4GR9OU/VRE083BZyDBEZvrSi4dkodghBuIg5+PMMCdPsRMONxdsUzQ3N5Y sdiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=i+Y0xyyI1wLmc3f9TlGqhucUogMT+qFqaRbraqD/TSo=; b=0Ri1rXpTDRK2gov7gegLRC3C+fpy+oppRxTpQD/8r5s6/eosRMKBUJNu6BNq5Kdql1 f1j5V/VfIDyt93yJTpVcwHWus0wzCJqbNC+vd/HVZpKl4asq3DiM99SzqnsSnDDW83Ch dO4/IrCqKTpEoG9/vMR552atdRXojRt5KT1XE3SF2X6hg+LxcWC+Ur57tfsjbYeRcEs/ I7cF6hODqFYvmnOZX/371EHuKIoQzSUBfMzr62AY7P/VuFlc9sHNK9PTI9fPkTREF8HO Yo20BO5aOIBNRrK3GgWPZ/dl9ztomX7HJsSk5DF7c/7wWYWO82ZVsg9LtTowpRrnLH2o qJ1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v0LSbR00; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si20642571pgv.160.2021.10.13.06.44.47; Wed, 13 Oct 2021 06:45:01 -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; dkim=pass header.i=@linaro.org header.s=google header.b=v0LSbR00; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235351AbhJMNpJ (ORCPT + 99 others); Wed, 13 Oct 2021 09:45:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbhJMNpJ (ORCPT ); Wed, 13 Oct 2021 09:45:09 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC90C061570 for ; Wed, 13 Oct 2021 06:43:05 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id t2so8565917wrb.8 for ; Wed, 13 Oct 2021 06:43:05 -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=i+Y0xyyI1wLmc3f9TlGqhucUogMT+qFqaRbraqD/TSo=; b=v0LSbR00mJZeqwHdD2h5ESrF3UnP8I0vyl7OIhpMgahKvzTvI/9e4nVBnrxMCszkKL p9luteX+Yn5bWVI8RphvikmshhL3NwKYW+P8QPzUoFwv+k2MxUJkyF7BtMswP+PeJqn0 7fZHSnwxRQRQZtNbSNSQsXnLd+kYmxgDMo9iMvLRQb33DpntYwM5EJpbcIuzKUTkngda SHN6DNmhk8wzdC6i8lb/k3J/I8i8v11EPggq34p1qq+VLL3wNs0ZK3DRomTc9Qq66fa2 0ElEXF0WwPCs6pHMFfb8V8UNWE9Tp9zCzbHrN2vz2BK3WlI4AFntaLL+/XWeL3e+vCrH JxAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i+Y0xyyI1wLmc3f9TlGqhucUogMT+qFqaRbraqD/TSo=; b=H+69zHg8Vr/Mr+hfgPk4se+9nE11dfdIoccVXNGMFtqZ0BqcZDvVrv1pqjNZc0ytpO CVywA1KP2/bMUayOcBJftjl/QJNpBBe+a3K79a98JRy6cUvm0NuI3bFN8CyOUgcP5sXl ZxtI/Wp8cksqm83q4RVo6pkyASSWxgLFrM7irFCPGoANdkelch8NIee60WRo7VMnvZSF ciQP+1B5VzIpb1a83iGc2dWLG44krJviCkc4wQQcRe/TBCoEBGSHWT5ivrgLtDAUzp8S AtgA58/Wb5lr9hwzp35qu/9rxYMPSMPOcrR67WHlgk4ua5ihpZa8suLlYfmHRnKimsBX Mb2w== X-Gm-Message-State: AOAM532k0PNNkGiO33/vXcFAdlEAZ2f87xxzuRyzZzWQePpjQgeL+Lx6 7n4C631JKqRoTJu50gDfKqL79uRTtOgTS3MKefnpYw== X-Received: by 2002:a5d:6d86:: with SMTP id l6mr4282849wrs.96.1634132584493; Wed, 13 Oct 2021 06:43:04 -0700 (PDT) MIME-Version: 1.0 References: <20211006071546.2540920-1-jens.wiklander@linaro.org> <20211006071546.2540920-6-jens.wiklander@linaro.org> In-Reply-To: From: Jens Wiklander Date: Wed, 13 Oct 2021 15:42:53 +0200 Message-ID: Subject: Re: [PATCH v6 5/6] optee: separate notification functions To: Sumit Garg 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-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 9:15 AM Sumit Garg wrote: > > On Wed, 6 Oct 2021 at 12:46, Jens Wiklander wrote: > > > > Renames struct optee_wait_queue to struct optee_notif and all related > > functions to optee_notif_*(). > > > > The implementation is changed to allow sending a notification from an > > atomic state, that is from the top half of an interrupt handler. > > > > Waiting for keys is currently only used when secure world is waiting for > > a mutex or condition variable. The old implementation could handle any > > 32-bit key while this new implementation is restricted to only 8 bits or > > the maximum value 255. A upper value is needed since a bitmap is > > allocated to allow an interrupt handler to only set a bit in case the > > waiter hasn't had the time yet to allocate and register a completion. > > > > The keys are currently only representing secure world threads which > > number usually are never even close to 255 so it should be safe for now. > > In future ABI updates the maximum value of the key will be communicated > > while the driver is initializing. > > > > Signed-off-by: Jens Wiklander > > --- > > drivers/tee/optee/Makefile | 1 + > > drivers/tee/optee/core.c | 12 ++- > > drivers/tee/optee/notif.c | 125 ++++++++++++++++++++++++++++++ > > drivers/tee/optee/optee_private.h | 19 +++-- > > drivers/tee/optee/optee_rpc_cmd.h | 31 ++++---- > > drivers/tee/optee/rpc.c | 73 ++--------------- > > 6 files changed, 170 insertions(+), 91 deletions(-) > > create mode 100644 drivers/tee/optee/notif.c > > > > Apart from minor nit below: > > Reviewed-by: Sumit Garg > > > diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile > > index 3aa33ea9e6a6..df55e4ad5370 100644 > > --- a/drivers/tee/optee/Makefile > > +++ b/drivers/tee/optee/Makefile > > @@ -2,6 +2,7 @@ > > obj-$(CONFIG_OPTEE) += optee.o > > optee-objs += core.o > > optee-objs += call.o > > +optee-objs += notif.o > > optee-objs += rpc.o > > optee-objs += supp.o > > optee-objs += shm_pool.o > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c > > index 5ce13b099d7d..8531184f98f4 100644 > > --- a/drivers/tee/optee/core.c > > +++ b/drivers/tee/optee/core.c > > @@ -592,6 +592,7 @@ static int optee_remove(struct platform_device *pdev) > > */ > > optee_disable_shm_cache(optee); > > > > + optee_notif_uninit(optee); > > /* > > * The two devices have to be unregistered before we can free the > > * other resources. > > @@ -602,7 +603,6 @@ static int optee_remove(struct platform_device *pdev) > > tee_shm_pool_free(optee->pool); > > if (optee->memremaped_shm) > > memunmap(optee->memremaped_shm); > > - optee_wait_queue_exit(&optee->wait_queue); > > optee_supp_uninit(&optee->supp); > > mutex_destroy(&optee->call_queue.mutex); > > > > @@ -712,11 +712,17 @@ static int optee_probe(struct platform_device *pdev) > > > > mutex_init(&optee->call_queue.mutex); > > INIT_LIST_HEAD(&optee->call_queue.waiters); > > - optee_wait_queue_init(&optee->wait_queue); > > optee_supp_init(&optee->supp); > > optee->memremaped_shm = memremaped_shm; > > optee->pool = pool; > > > > + platform_set_drvdata(pdev, optee); > > + rc = optee_notif_init(optee, 255); > > nit: Can you use a macro here instead of a constant with a proper > comment similar to the one in commit description? OK, I'll fix. Thanks, Jens