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: 12395747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40656C4338F for ; Fri, 23 Jul 2021 09:47:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D79C60725 for ; Fri, 23 Jul 2021 09:47:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0D79C60725 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Iex6qD7GHSZ9MfF2GZfERUn30JKvdLFjk1o0N7Zvj7c=; b=lTS4DO33//FOMU V0VQjwCKry+170Mx/9TRMVIHsMjZBa2TWVhnshupTdONdV931i9mxJNEYlhF8hbIS0n/vC5blV5Eb AkrcI8TQ48mjhGhaXp7+VBO++C/FrQ/5sIjuIleZNi0GS+8X4Cuwt/55e82QOhG2/AZdbvfy5TvyJ JfPSVSJVKZNGRyr2MJvg+49OcgaTt41VF1TssO2vr/M6U74qKCgDOrMJHtCd0DqC34S3/NJid+9Vw DKmbrRlNwSvonD65ITJ+OZ3OdH5vK1nVLWbq9pLCT1D2/KBMTnzEdUSkNFSRAr1+EeDskPOmRobr9 /Yy6g7l6fm597PEe/VGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6rjQ-0049Dp-NU; Fri, 23 Jul 2021 09:44:36 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6rjM-0049CN-AX for linux-arm-kernel@lists.infradead.org; Fri, 23 Jul 2021 09:44:33 +0000 Received: by mail-lj1-x22e.google.com with SMTP id n10so997010ljq.3 for ; Fri, 23 Jul 2021 02:44:31 -0700 (PDT) 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=KjvxSvMZH2LsJIGFrjmFgzKIpUpETFNVyM9U7/kmL2TXopPKgH8bJ27leDF/xYqrAu GBUGJrQ0lScO6QyvB47XwLOhMHuzPg2gZ94w1PdYDPnZd1iWNg/cXmLQ6Bdn86/BULvW yaTpum9qcgLZOajFvo1u1U6l/fubEd9fDfzVgv/9gnpv8ionT6WEUh118dEmwAfpdVLK O9vTNkrTm7N7HpsVTN1js49vDnP+rhdZjdu/3svESUcjBStW+kq9emiZApckhls5/raS GomQfHBcPYORfCPQjQgAI8vS0n6Uz56K9i0I1itrbjtbrLJ9LqAKWF1nr/ib9yLOlAvM b9Mg== X-Gm-Message-State: AOAM531lsRUTuTphoLQ+AEMcy/6QIKY4GAnz1s2pF5qe8E18V1LAxQjq oBN3uo30FoA3gmiPZ3zZDWooeA== 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210723_024432_466370_046C40A3 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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