From patchwork Thu Aug 26 12:30:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 502853 Delivered-To: patches@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp162424ejj; Thu, 26 Aug 2021 05:30:40 -0700 (PDT) X-Received: by 2002:a05:651c:2006:: with SMTP id s6mr2778436ljo.171.1629981040392; Thu, 26 Aug 2021 05:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629981040; cv=none; d=google.com; s=arc-20160816; b=UCM1F70iSJrThKM+Cn9L2MDZKWOZE5mje8rpegU1XyodrFaEdEB/y4R8BHgz2xuvwz vq6d0FTx6gKC4RNr9J+O33OY3xP406+wxoIKFI9tym+w1AzziXl60zGlvRkhPS2DvKQ+ nzZasnLLJfYk1yWb4TnSWZxP3rzjmq9C5YzcZDAJTsR3staxiNfbSl40xo1+/bAy4kNQ LYeRCoxYgxoItSYZRBsTxR8SSnIzeFWiMrZ7xrPLfDOowDQS9zk/UqD76ocJ8e9Y8lDr gNskMVDtfIjL+jirHCBTIei3gZu3NE9iVJEmxwB5nfz6/d2FMJXUYTTH/pA/fSPYQrRJ QULw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=phwK6HApLhy3x/6hExSzTZ7ylEqvksp6SGMj/MzgDCA=; b=d2c/Epn8XsIsA5Zrs/k2wL1G7bRrYt0EoL9JFr+wyg6m/FAlCoiNPmnRgMEAgR7Dki IJ3k3LrZGjX4gpSu0JBAcyUSNepT2gvyh+cABBPEg3ITlCh+i+Wo4zqRzLbf8iaTKSy4 cxgTODrFWpeMnSc77VOv6Tuu3MXbTdrGE3edOB2uP8Z8Gtn5C8Ypf+RUwxRPgXIj+5qe aQ63NtXf8/N7VHBgZyFFHdZUoosPb/2gEsd8JDs67+hO9x97NDjI2R9Lu8Q/QBYj3CNE vDpczRBd2H6vtulZgc3kdz6zIH4pSQ9ftmOiZsi3WnA0nqf61FlGn5Qkbyw8RCVjCfpd +x9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tzP45EWP; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a1sor1471834ljb.3.2021.08.26.05.30.40 for (Google Transport Security); Thu, 26 Aug 2021 05:30:40 -0700 (PDT) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tzP45EWP; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=phwK6HApLhy3x/6hExSzTZ7ylEqvksp6SGMj/MzgDCA=; b=tzP45EWP9X1pw46yUJS9KMtpNLka8QQPWnUvXAqr2pvOJwQVd2+4wPYsOMIQhbF2Ha jvM0cW+7Mby5WK+nZMt1RqnIB31Tb34UM6fFs0cDUKdRSA8qeTBY8WEfha1BSQ6i3Yis Ny5dzlAm61y9JIcRNV2v6ar5JnWmpQRGTTFbKItrD4h3/tBYcMMHVNtfJI6C9muVObBU P6rMrnvHJsyL/lcIQWlIu2jYwPHtIDoFmZ1E6cU0leR69asJhRRTvygvFWzorAtNwEPu nvuoCPduYHp9FdqlibZPrKJhnQdL4ijNy1dNWtffktOuO4bLNWvtXbv63C8IwNvEeBvw ub2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=phwK6HApLhy3x/6hExSzTZ7ylEqvksp6SGMj/MzgDCA=; b=LvPUpQMnn0ik2bs8exQjhsSDRBGJliFbMyDgMkbxPGGAazjOFvs7H/+wOxU0IniJQB 45B7kD1L1HEa1I7ECT8CERBhpMRZ+A7B3ErwwU7n+6UDimpNqHUrjrjnXtd1LG58stSo aciF2/C2JUFQ5chAa4Ktdg0bf182RpY1leUQb38jTgUzESb6iHVcoi146Mtyoaf8Vi8O XiUsExoosWuc+txtt4b/GlqlEVXxBdSwhWTOu64pVDZlUwhnsfqQcHTzWe7BZYSBxFuK oOKpFBYojWp5gMUigotkC8NypW02FCic/mXSg6+bzHpI+PlRpECxRXm0XKUHH/zuLQ03 e6dw== X-Gm-Message-State: AOAM530JSEMf0Y3d+acgSbhLO0dQq8F0vADa+dvTrQc3QzVTbioewXJI DOalxoHG4J0FLKj15iSaQq9fXhiL X-Google-Smtp-Source: ABdhPJyrmUgDM1afmYmZ3eE3unD9fi176XSiNwF3ztwgvgdohetnFDFbK/kSfRL6hOFTU2zISOEMHg== X-Received: by 2002:a2e:a595:: with SMTP id m21mr2790949ljp.399.1629981040078; Thu, 26 Aug 2021 05:30:40 -0700 (PDT) Return-Path: Received: from jade.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j21sm332283ljh.87.2021.08.26.05.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 05:30:39 -0700 (PDT) From: Jens Wiklander To: 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 Cc: Jerome Forissier , Etienne Carriere , Sumit Garg , Vincent Guittot , Rob Herring , Jonathan Corbet , Ard Biesheuvel , Marc Zyngier , Jens Wiklander Subject: [PATCH v5 0/6] Asynchronous notifications from secure world Date: Thu, 26 Aug 2021 14:30:26 +0200 Message-Id: <20210826123032.1732926-1-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 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 edge-triggered interrupt is used to notify the driver that there are asynchronous notifications pending. The documentation and DT bindings patches are now well reviewed, but the patches with code would do with some more attention. v4->v5: * Rebased on v5.14-rc7 * Updated documentation to clarify that one interrupt may represent multiple notifications as requested. * Applied Marc's and Rob's tags v3->v4: * Clarfied the expected type of interrypt is edge-triggered, both in the normal documentation and in the DT bindings as requested. v2->v3: * Rebased on v5.14-rc2 which made the patch "dt-bindings: arm: Convert optee binding to json-schema" from the V2 patch set obsolete. * Applied Ard's Acked-by on "optee: add asynchronous notifications" v1->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 (6): docs: staging/tee.rst: add a section on OP-TEE notifications 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 .../arm/firmware/linaro,optee-tz.yaml | 7 + Documentation/staging/tee.rst | 30 +++ 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 +++ 13 files changed, 529 insertions(+), 124 deletions(-) create mode 100644 drivers/tee/optee/notif.c -- 2.31.1