From patchwork Wed Aug 18 10:18:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 498885 Delivered-To: patches@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp521226jab; Wed, 18 Aug 2021 03:19:06 -0700 (PDT) X-Received: by 2002:a19:c787:: with SMTP id x129mr5700929lff.490.1629281945878; Wed, 18 Aug 2021 03:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629281945; cv=none; d=google.com; s=arc-20160816; b=P9yMtYxY+5dQqabLsk5Bwxxk4BAHkL4vE3DM8WlgySXa1uvucncS5kI4DxGkpX12l9 myy0gIom0ixTZCTO0RTcGU7/YUQ0Clj8G5ItR9EYAUhoUBik1x1mhcijThRZgversZRe NXWu1iwVDSsp2yKZKe6EGnOmnuwKi2lvcHEfdVcUEZbzE0O7dgXvOk2Shr9E2pRJyvB7 bBJOIYRvPC3QFrQ8ldKLNv6Q/PQOJh6ykZbjSbbXvPt5j/DHdm6uw07wqnblXjyeSN0y Q1H/JZgteUeqbtoaOhtthMPmyXB9e2qiO1w+rClmB5XcJGVzWHAJwwzUdJZyPrROSqZW vbLQ== 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=rHBrWaWim5usRXgaQc82lkSp0WhXjJF3AlpJqDKSRoY=; b=cnVQ2kvRTI+flnaVqe0DdvdK46ek4xKyUwxX+oLXJ2qGyIcToDiU4draxU+5NhEKpZ ZCDYYdf/oEuRnBbvM8R0N1q+eO7Wjg1O458GwlqtMApIYMEHeJHGGqkpvznyJtoiyZnR Ki7aGyU3Aza6/6R5rDEBsjjw6xQdlG1Z2LMfigth5JpJuHDEwfjCUupwTjtkxi3yOkJ4 VxmK4POglmtZeWjiEj1MjOIzq52UVbnRhHqLoaQyP8Tjd1vZi9qv0bnwR/tWscL0DTb7 o2RXUGX5CL70xH9eQjWoUUHIgX9vZ0FFSHxKqAbQvbDSq/idmoP79JjuerJMYj4dQbcM ts8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GDnV57ya; 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 u24sor1254055lfq.113.2021.08.18.03.19.05 for (Google Transport Security); Wed, 18 Aug 2021 03:19:05 -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=GDnV57ya; 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=rHBrWaWim5usRXgaQc82lkSp0WhXjJF3AlpJqDKSRoY=; b=GDnV57ya+XOUfwuB+AthU31Le+ZY/IfqyOmuCLkVjM+9R78nZb3Dv5kpSDiS8I1hH2 RJo0LBY3PBhCQCIa3qIWl+7jmpfnOSibSiuqdm4zGZ4xk1MIbrFSlVPGgCUEPHfs8td4 ee7EJaW3QVSbHcdIqbVvyYgh1PAE7ZaqGp4ZyT39TgtJGeYw4nWZMNutwtgnW3H6/AFL dtLsgiqCBxPMjrSNBkgDfuTI+eHKybfm0t2kUgO/amW98oODQA/1HRHuNn2N1kkltk+O qaTkaBchJy/GvFaeuPn2OVDdupw95u7YdGLAs5BHOiI4+DRpFGUcjcdOWVvazt4857wR pDzg== 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=rHBrWaWim5usRXgaQc82lkSp0WhXjJF3AlpJqDKSRoY=; b=n1acsaJFReRpYXyGLXGilWiKOCQtXk0GnwL9QupWYxehwD0+b/SWAhL+GfdzFkNTTZ qzoNMbqHWNf7koGpSpSQsVFdcWU29LsduhHEzO9lOXTfyt+LNF0AD2SP/7h2ZD5Nmg5k gHpc56egMbUKxMJDMvmvGWSIyYZ24YBN8Y+xYzcsL8QjBLTych3Dq1vdv+pcBbw3Pt7L UQoWOH0hX0LS+vYCAwz8/+YrWb3qd9BeZqgHRwK+c6YCJD1iY5co0eFZPtEXvehZ1PFw r+T13ql/RPWC9e6moFr6EVoDqDvSgUnSi+VozoDKKjv+nRr0KO3E88faNELNcuDFXAyk NIZA== X-Gm-Message-State: AOAM530SRA//yM932FX9yC7r1FLcOSZzrtAgXQ8Ubp//J2NsMrYeF9aO ssUBODF6lm8ft6cEO7uBIdjzfUxJ X-Google-Smtp-Source: ABdhPJwSv3BebV09GBYhVLGn/Bal3GHoGVdLYigqOg+XWj0wJyAnN5sif8OZ80tEZJcbyYZ5WRg9aA== X-Received: by 2002:a19:c517:: with SMTP id w23mr5963508lfe.219.1629281945441; Wed, 18 Aug 2021 03:19:05 -0700 (PDT) Return-Path: Received: from jade.urgonet (h-94-254-48-165.A175.priv.bahnhof.se. [94.254.48.165]) by smtp.gmail.com with ESMTPSA id l27sm451160lfp.245.2021.08.18.03.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 03:19:05 -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 v4 0/6] Asynchronous notifications from secure world Date: Wed, 18 Aug 2021 12:18:43 +0200 Message-Id: <20210818101849.602257-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. 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 | 29 +++ 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, 528 insertions(+), 124 deletions(-) create mode 100644 drivers/tee/optee/notif.c -- 2.31.1