From patchwork Tue May 16 12:51:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 13243123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C846CC77B75 for ; Tue, 16 May 2023 12:54:31 +0000 (UTC) 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=TMOSKdzPxENrmXFlxUGXIUKEUM+APeaYya4BM0f/Y/4=; b=JsSYnfB203B6o9 3NTcKVcxGMkQmJy+jmrk0avOlGF8TVZmVVSbDaaisQ3wIb5pJFOjDwJ/MLFwtzVK1dJ/cdYhjnHyc +43E+LOEpOl2iJrbxaf1NADZ9WQ4v2XRNNXKAhRA8pUP0MlT4W7m2x8Mh8Dk1BGk/In1/dpuLTvVg BoPYx60/HW2qV3kK/5Pp44vkRFuwtV4jv+BlM1o+Z/ohDFGMWslANWzitoSVfZthVAME4X/8zFRG8 IZzyOJNdM+lRkLn1QWUfIE9zWZuA+K7NALyeqwOV+l3GwN8XRrF1WvSVJ9XNREmJhD0m5lfHC7sJ2 MmxHnVdsyxAPaWgAmp2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyuBv-005nEG-1F; Tue, 16 May 2023 12:54:11 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyuBs-005nCg-2z for linux-arm-kernel@lists.infradead.org; Tue, 16 May 2023 12:54:10 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-306f2b42a86so9312227f8f.3 for ; Tue, 16 May 2023 05:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684241647; x=1686833647; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=291lIgk0Dkec8nzfiMqr4Pnou0+BFHlG8Ki/DRM6Hgw=; b=yReW3lle5yvtwsa0LRvS1OxUj3R8Rnw3n1LoJZlI3q5RQglqn28P1Ykh7NHwJS+MqQ dT2kSbiwK8/okZ4Lhrd+Kd1f5SMxFvTKDaZjsYDMYzTr8s68+G8f3Q8GP0MGrVb+7Iy4 uM0juq3NSc9LsxZdRIoqyZw/y75AojRJoX2atcPXsXkAmL+1P36JeJjGc/Wwr++xd5UP c3gTYrKlZ1wyIGL6lnlAfLr70NcPp8JNKKc0+NJ0BoraEPkadRw9ZcQ3LH84tQ+BKnoA iMH9n6L0NXZqqwTFhKO5jeZERDQeJTcOjWnVUH+nf180KwxX9d4Gg09gmDflQ/1kxgO/ JOBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684241647; x=1686833647; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=291lIgk0Dkec8nzfiMqr4Pnou0+BFHlG8Ki/DRM6Hgw=; b=VaebKWgsG37qpIJJ5H/UgCQrgxaCMz/wehaScCrAHkwsOAey8ooxFxKGimO0hhWzyL 4b+fbJnYYGHfhHomCaEVf7oNOSfgs3AfkuEP4CUeaBCvxehQhwff1X0I0JWRfymyhK5d H8jPeuHDJVbXrvFv4N1Lh6f4aNj0U6+UYE/mL626UduHb+b0vzj+lLghLJ6AXLXk95ZZ 5KE1nUh7sjKBg4g+sMCcLEpO9DW8Z2OeOGO91PB5YWmB1k2EHZlpfrKjzMl0dYJSmK8+ hd/Ryw5vBYCEGivWHAmKVSa7gEHQ4NfxHuppKFCm81QG1Qj5QxuJmHCz0r8ppUnQU4tR 7qeg== X-Gm-Message-State: AC+VfDwjdDFg1ls4ULhwKDjqTKEovc84TRikQS+B2jN54oCnBSYq7LYl CgG/0WAou6dDkbPuoyrfL0Xquw== X-Google-Smtp-Source: ACHHUZ65zltyG5HO3mPAj3A711rK62JGGMfllVGVO2u3+tpXEEGYXPp3GMiFb4tLCKKKGjRTbHEHbA== X-Received: by 2002:a5d:4b91:0:b0:306:2a1a:d265 with SMTP id b17-20020a5d4b91000000b003062a1ad265mr25410731wrt.58.1684241646883; Tue, 16 May 2023 05:54:06 -0700 (PDT) Received: from lmecxl1178.lme.st.com (87-88-164-239.abo.bbox.fr. [87.88.164.239]) by smtp.gmail.com with ESMTPSA id r18-20020a056000015200b003047d5b8817sm2521963wrx.80.2023.05.16.05.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 05:54:06 -0700 (PDT) From: Etienne Carriere To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org, Sumit Garg , Jens Wiklander , Sudeep Holla , Cristian Marussi , Vincent Guittot , Etienne Carriere Subject: [PATCH v8 0/4] tee: introduce TEE system session Date: Tue, 16 May 2023 14:51:07 +0200 Message-Id: <20230516125111.2690204-1-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_055408_966865_7D8CD7FF X-CRM114-Status: GOOD ( 13.79 ) 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 This series introduces TEE system sessions for TEE service sessions that require TEE to provision resources to prevent deadlock when clients call the TEE. This deadlock situation can happen when a TEE service is used by low level system resources as for example when Linux kernel uses SCMI service embedded in TEE for clock, reset, regulator, etc... controls. This case is detailled in patch 3/4: > This feature is needed to prevent a system deadlock when several TEE > client applications invoke TEE, consuming all TEE thread contexts > available in the secure world. The deadlock can happen in the OP-TEE > driver for example if all these TEE threads issue an RPC call from TEE > to Linux OS to access an eMMC RPMB partition (TEE secure storage) which > device clock or regulator controller is accessed through an OP-TEE SCMI > services. In that case, Linux SCMI driver must reach OP-TEE SCMI > service without waiting until one of the consumed TEE threads is freed. Etienne Carriere (4): tee: optee: system call property tee: system session tee: optee: support tracking system threads firmware: arm_scmi: optee: use optee system invocation drivers/firmware/arm_scmi/optee.c | 4 + drivers/tee/optee/call.c | 155 +++++++++++++++++++++++++++--- drivers/tee/optee/core.c | 5 +- drivers/tee/optee/ffa_abi.c | 13 +-- drivers/tee/optee/optee_private.h | 39 +++++++- drivers/tee/optee/smc_abi.c | 31 ++++-- drivers/tee/tee_core.c | 8 ++ include/linux/tee_drv.h | 16 +++ 8 files changed, 235 insertions(+), 36 deletions(-) --- No change since v7 Changes since v6: - Added this cover letter missing in previous patch series revisions.