From patchwork Fri Jul 23 09:44:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 484592 Delivered-To: patches@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1161630jao; Fri, 23 Jul 2021 02:44:31 -0700 (PDT) X-Received: by 2002:a2e:88da:: with SMTP id a26mr2740121ljk.223.1627033470913; Fri, 23 Jul 2021 02:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627033470; cv=none; d=google.com; s=arc-20160816; b=eRQKAtiPfzMdTj5xLBVNG5l/QJY2M2yvAvb0rPn1+tQEoqQd/5kcrJDh3lxb7yoVXv XoyNxBNX+v8E0XvL5OmK/tyU3QaPobt/lrQmWY//sHolxX69JS0j76LiMp4uKyU7FV2c nAYKyo6Nio/HP/GX5Ln+P/ULMLSp8T9BpAjOC9AdpmPGjGHYlTCQenETolVp9mh0kpjx x8P2ovLl6wzlX8fSPzCsosKj/XsQLV0KpKi3GV9Um3TuGpEX4t6I64M1tYKg1AmTP9yR JBx+XCHzq4TeKChyYpIgrpaB0OzCLTGEV9t40FFrclIkkOhHLVYuaQdyQxB1vUFzYsg1 U0jA== 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=69jIFrc5Dv4sZ7Sebk4h84MxIXo7scSCzzsjBWeKzJc=; b=w3HliWV7mzmqlWnhntVqQJwPd5yXJjmKQiLhKv2WWDxlTGdYW/UZNmqZa81WIwVWjX Rg/KWw0CxZxcwOXxEZc2hOH+lypo8WcYFdEkt+fcti9Be2/vS5YCvNYCOnR6xyqbCxqv ghypkfRss4SKveEscyzcXi7bKKpsJgaye+FKGUoubuI9W1grUqgF5MpmLXmzLZ9BNEMt JDwVloqaCqfRIBRHKqtlEIIL3/aUJPMojaLZ1Bpp0pvgE/lFThMJIn4uyGLXHIS3JTaI E3/RBC6blr168LTWejCJSV1HAKbOwk6eYELHS1rqmW8IeTQ5NmDOjpUO9WGDPGqU7szp Wa0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iCTaBkn8; 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 j22sor3972716ljq.39.2021.07.23.02.44.30 for (Google Transport Security); Fri, 23 Jul 2021 02:44:30 -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=iCTaBkn8; 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=69jIFrc5Dv4sZ7Sebk4h84MxIXo7scSCzzsjBWeKzJc=; b=iCTaBkn8Wq/y2QDYfWs0tpGbwl3wK0Smw2sYp7+mTg+YBR4aXfc+m4ikRdNrlBl0Lh dA4u+C3d6esT3X8o3/y08Ez598/S+GT1RzHcK751GikQZYnWLwtz60yH/RETvQrbG0er lQvWyp12oQaVqC6R2v+30vS6+91I4GIYNPmJ2jfDglJ4N0hP0Yp0Uv6uoe1Y6Il1v2ZO 8IKbbGGNhe2prb3PBHviMLYWn9IXV1eSt5+GGznfePvz/TL+a+NcpldA855fKVT4fvBG eW41vRyQO4h/mt6bUMgUOoCQRw7X24snUeBogJ094lo5pxRnsE/u6I7tGUVMg+nJI+1p +p3A== 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=69jIFrc5Dv4sZ7Sebk4h84MxIXo7scSCzzsjBWeKzJc=; b=b9f8X7mFnVqP3+3pLJaaSt3rWuWjCQiutTAM/6e19ot9JZY7ANQ5dVbuJ6qinDD35/ klbex+ChIc1Nujt8zUd+s0Iv+0HRg//XjYb02OtiVLRR+AkNUDom1p/6S8yQ6IycnANg vD9Rnz5jk1DHE2QTc+amZTpVYwlSHHwkckN+jP/jEG8fi0O0hZ5oR/yJuV8LAKAHelGm aM27+xIFG7onR/C9QVazRwClPC6JeGXGs3JQQnP1dzGLp8dur3rtr/fl7bEe/Kvtl9DA BmrCwbMLX/I/QIm27b0WGiCQqMWy5v7l0x3WqbtR50miKdtE2Fv+T2AfTPu3gPXj+hfQ TEKw== X-Gm-Message-State: AOAM530khrHtf1LMhMfuU6/w5PjRdU3Lfv/tjFQBR2kegQHcLD3kyCfJ M7efylMUr6FpELAIFSKCCXsPMakv X-Google-Smtp-Source: ABdhPJw89Ne0hTG4LO+wqfJGEsMvU7CNMyUkADS6cr0fy3AXG3aXIaCPSQws85V/t6u4l/fufUk38A== X-Received: by 2002:a2e:b4b4:: with SMTP id q20mr2777859ljm.155.1627033470502; Fri, 23 Jul 2021 02:44:30 -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 f2sm403808ljq.131.2021.07.23.02.44.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jul 2021 02:44:30 -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 v3 0/6] Asynchronous notifications from secure world Date: Fri, 23 Jul 2021 11:44:16 +0200 Message-Id: <20210723094422.2150313-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 interrupt is used to notify the driver that there are asynchronous notifications pending. 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 | 4 + Documentation/staging/tee.rst | 27 +++ 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, 523 insertions(+), 124 deletions(-) create mode 100644 drivers/tee/optee/notif.c -- 2.31.1