From patchwork Mon Jan 30 09:41:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 50204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2093253wrn; Mon, 30 Jan 2023 01:52:49 -0800 (PST) X-Google-Smtp-Source: AK7set9vywfOylpD4RyDzLSnAB8dqJKVInyPeTGjlAYxTn/DorFJqJ3TCh6eg6BqEoMrcO1Q2f8J X-Received: by 2002:aa7:de07:0:b0:4a2:1812:e062 with SMTP id h7-20020aa7de07000000b004a21812e062mr12843137edv.18.1675072369505; Mon, 30 Jan 2023 01:52:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675072369; cv=none; d=google.com; s=arc-20160816; b=hEEDzV8dE/yddMS7V8HUTs2J7X8j4wkGLkhLcUPdOYRWF4B9JDOX3LxQ9VVYIgfCsA LeD/k+OW+tauL/3/M9z2+2YcAEqgI6AUL6oFB80kSUAY8tAxgdZcVHOUTrugnPFGWUWw i0QVeF+yy8K7voPTUoahA6CFkyPynTA35Tb7RLPFzGt8o4fUUZ9YEMyk3A5CAo/QUIsk xR1+bBV/OX3k7fRBtKbGQvXdy+PamfXELTPHPWVAh/Lb2y9/uM4PYM99Q8v39OgPbAmp Jg/7lRU/sXNq+fLUN0whMVrrFhlGzI1uthmnBT1hyvYb1lWPl9SXKYDRdFT2UFgnhhBy 7T7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=A/fX6lK4kyxqMY7Pp3GDtdcgmqukLTrE8ke8XBHGOTA=; b=Aj5Wgk8Rx+SjQzYOa6R5TkMz0slk1EiIzreuBvflfYlIF/mmSh2hOzAMMdy1nIkMma KAjzkQ7pFvAQAFcyUC6kJXxyPuOLmXbW3w/Jy2TXKXXX9AGn8m5Dcn8WT23y74GuEywF r+6GFUOAE5uwS+AT7MbHL2VwqKijfJeM5y1HihZLnfksZTEviefgG2TD5IU+lhAnoLDl NG5qBoXbznkhAheWvnU0PnbhYhhqMbUsuRBAWZn2pz7jR05IRZk+SBYOiCPk4rAsGsYv O7SaMhbhHkMzEAFi5kbK1omKhG3Uha1Vo8ZEq9s5SgcihpRg/d/yL8lhC53LmbhYs3WA msMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ju53Vfro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka6-20020a170907920600b0087bd4e90784si10157995ejb.850.2023.01.30.01.52.25; Mon, 30 Jan 2023 01:52:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ju53Vfro; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234539AbjA3JmS (ORCPT + 99 others); Mon, 30 Jan 2023 04:42:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235507AbjA3JmM (ORCPT ); Mon, 30 Jan 2023 04:42:12 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491AA5589 for ; Mon, 30 Jan 2023 01:42:10 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso1581944wms.0 for ; Mon, 30 Jan 2023 01:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=A/fX6lK4kyxqMY7Pp3GDtdcgmqukLTrE8ke8XBHGOTA=; b=ju53VfroPlDppWOtB93M8K7Bqn1MGhyRPaPLLDed3/0mTJGYkaXIGQhCi4OW1Aiu+n aUbvQgFJJPHorz6OJMqr6SQWxAp/BsKQFAIDwBNgcxRpJMV8gS5uceWOS9/y3nXAPidd Mjq99Er6rI67wnQvnFXercYS0fBeYVoIVO7MWtDt/6U0oyOVfQeSSg9OfVQaGqDUW8S+ hU/qtPT+St+FS9nyrHax/BnCpMKqA/oRZ9D65oIiC8dhRvvynUtUvPQ1Jx9di1ANWZTK tKnoqwL7j/T9kWZUjqeG6DA1sOYU/ZO3BuRPozQjm0KOMkyJ+hCVvqKk0wFTZBcK1ejY DY8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=A/fX6lK4kyxqMY7Pp3GDtdcgmqukLTrE8ke8XBHGOTA=; b=wiry00rpnYReqBxbJfSR0s3gnTJmfIiByzxzEqLVZWzcTm1Cr1iujlAe0sUzvqGD4H NBsUfqER/CB7VCEI2kPwX0CCHrL0tyOognFTV3bS6RSTEJmxYZRp30S4rgL/K7A5u2y0 B+OpOyaBVn/HYi8Xza8opu5UyKKDJliizlIM0LPuC6vmx+55fm3nut7M71K/8VtKWD8a T18jYnoptwT3NHoU1C6LUGjOJkz6u1Fip1q7mATV8+fa/+ugAk2vTC9s3N2OoXVBLVjL MA4QUW2QLO/FU2dHZ8gngH8QIZ9IPYTg3fs+RVxDFFvkrHLB6xjrDWDIKBAgj6W3GHz2 GCDg== X-Gm-Message-State: AFqh2kpXHBWulh9MMIKPXmIEcdDKe5eyfCwj3aAwsUOiGMBQTBBP6Wew 1xfZQ8IuiBsrqu1/Ywk7bgyfaZSbYp/Dco23 X-Received: by 2002:a05:600c:3c92:b0:3d5:365b:773e with SMTP id bg18-20020a05600c3c9200b003d5365b773emr50188850wmb.39.1675071728384; Mon, 30 Jan 2023 01:42:08 -0800 (PST) Received: from lmecxl1178.lme.st.com ([80.215.193.251]) by smtp.gmail.com with ESMTPSA id i27-20020a05600c4b1b00b003dc54d9aeeasm3865606wmp.36.2023.01.30.01.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 01:42:07 -0800 (PST) From: Etienne Carriere To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Jens Wiklander , Sumit Garg , Sudeep Holla , Cristian Marussi , Etienne Carriere Subject: [PATCH 1/2] tee: system invocation Date: Mon, 30 Jan 2023 10:41:56 +0100 Message-Id: <20230130094157.1082712-1-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756440684994835873?= X-GMAIL-MSGID: =?utf-8?q?1756440684994835873?= Adds TEE context flag sys_service to be enabled for invocation contexts that should used TEE provisioned system resources. OP-TEE SMC ABI entry rely this information to use a dedicated entry function to request allocation of a system thread from a dedicated system context pool. This feature is needed when a TEE invocation cannot afford to wait for a free TEE thread when all TEE threads context are used and suspended as these may be suspended waiting for a system service, as an SCMI clock or voltage regulator, to be enabled. An example is when OP-TEE invokes a Linux OS remove service (RPC) to access an eMMC RPMB partition and the eMMC device is supplied by an OP-TEE SCMI regulator. Signed-off-by: Etienne Carriere --- drivers/tee/optee/optee_smc.h | 14 +++++++++++--- drivers/tee/optee/smc_abi.c | 6 +++++- include/linux/tee_drv.h | 4 ++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/tee/optee/optee_smc.h b/drivers/tee/optee/optee_smc.h index 73b5e7760d10..7c7eedf183c5 100644 --- a/drivers/tee/optee/optee_smc.h +++ b/drivers/tee/optee/optee_smc.h @@ -108,7 +108,8 @@ struct optee_smc_call_get_os_revision_result { * Call with struct optee_msg_arg as argument * * When called with OPTEE_SMC_CALL_WITH_RPC_ARG or - * OPTEE_SMC_CALL_WITH_REGD_ARG in a0 there is one RPC struct optee_msg_arg + * OPTEE_SMC_CALL_WITH_REGD_ARG or OPTEE_SMC_FUNCID_CALL_SYSTEM_WITH_REGD_ARG + * in a0 there is one RPC struct optee_msg_arg * following after the first struct optee_msg_arg. The RPC struct * optee_msg_arg has reserved space for the number of RPC parameters as * returned by OPTEE_SMC_EXCHANGE_CAPABILITIES. @@ -130,8 +131,8 @@ struct optee_smc_call_get_os_revision_result { * a4-6 Not used * a7 Hypervisor Client ID register * - * Call register usage, OPTEE_SMC_CALL_WITH_REGD_ARG: - * a0 SMC Function ID, OPTEE_SMC_CALL_WITH_REGD_ARG + * Call register usage, OPTEE_SMC_CALL_WITH_REGD_ARG and OPTEE_SMC_FUNCID_CALL_SYSTEM_WITH_REGD_ARG: + * a0 SMC Function ID, OPTEE_SMC_CALL_WITH_REGD_ARG or OPTEE_SMC_FUNCID_CALL_SYSTEM_WITH_REGD_ARG * a1 Upper 32 bits of a 64-bit shared memory cookie * a2 Lower 32 bits of a 64-bit shared memory cookie * a3 Offset of the struct optee_msg_arg in the shared memory with the @@ -175,6 +176,8 @@ struct optee_smc_call_get_os_revision_result { OPTEE_SMC_STD_CALL_VAL(OPTEE_SMC_FUNCID_CALL_WITH_RPC_ARG) #define OPTEE_SMC_CALL_WITH_REGD_ARG \ OPTEE_SMC_STD_CALL_VAL(OPTEE_SMC_FUNCID_CALL_WITH_REGD_ARG) +#define OPTEE_SMC_CALL_SYSTEM_WITH_REGD_ARG \ + OPTEE_SMC_STD_CALL_VAL(OPTEE_SMC_FUNCID_CALL_SYSTEM_WITH_REGD_ARG) /* * Get Shared Memory Config @@ -254,6 +257,8 @@ struct optee_smc_get_shm_config_result { #define OPTEE_SMC_SEC_CAP_ASYNC_NOTIF BIT(5) /* Secure world supports pre-allocating RPC arg struct */ #define OPTEE_SMC_SEC_CAP_RPC_ARG BIT(6) +/* Secure world provisions thread for system service invocation */ +#define OPTEE_SMC_SEC_CAP_SYSTEM_THREAD BIT(7) #define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES 9 #define OPTEE_SMC_EXCHANGE_CAPABILITIES \ @@ -426,6 +431,9 @@ struct optee_smc_disable_shm_cache_result { /* See OPTEE_SMC_CALL_WITH_REGD_ARG above */ #define OPTEE_SMC_FUNCID_CALL_WITH_REGD_ARG 19 +/* See OPTEE_SMC_CALL_SYSTEM_WITH_REGD_ARG above */ +#define OPTEE_SMC_FUNCID_CALL_SYSTEM_WITH_REGD_ARG 20 + /* * Resume from RPC (for example after processing a foreign interrupt) * diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c index a1c1fa1a9c28..513038a138f6 100644 --- a/drivers/tee/optee/smc_abi.c +++ b/drivers/tee/optee/smc_abi.c @@ -889,7 +889,11 @@ static int optee_smc_do_call_with_arg(struct tee_context *ctx, } if (rpc_arg && tee_shm_is_dynamic(shm)) { - param.a0 = OPTEE_SMC_CALL_WITH_REGD_ARG; + if (ctx->sys_service && + (optee->smc.sec_caps & OPTEE_SMC_SEC_CAP_SYSTEM_THREAD)) + param.a0 = OPTEE_SMC_CALL_SYSTEM_WITH_REGD_ARG; + else + param.a0 = OPTEE_SMC_CALL_WITH_REGD_ARG; reg_pair_from_64(¶m.a1, ¶m.a2, (u_long)shm); param.a3 = offs; } else { diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index 17eb1c5205d3..1ff292ba7679 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -47,6 +47,9 @@ struct tee_shm_pool; * non-blocking in nature. * @cap_memref_null: flag indicating if the TEE Client support shared * memory buffer with a NULL pointer. + * @sys_service: flag set by the TEE Client to indicate that it is part of + * a system service and that the TEE may use resources reserved + * for this. */ struct tee_context { struct tee_device *teedev; @@ -55,6 +58,7 @@ struct tee_context { bool releasing; bool supp_nowait; bool cap_memref_null; + bool sys_service; }; struct tee_param_memref { From patchwork Mon Jan 30 09:41:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 50205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2093364wrn; Mon, 30 Jan 2023 01:53:09 -0800 (PST) X-Google-Smtp-Source: AK7set8j3sbt6iokOtx7N2rL5XdExEvmqj+XnZt8Txd/UG5l24sSYYw28IJBl/am9wFz+cbb3upi X-Received: by 2002:a05:6402:14d4:b0:4a2:1d3e:93c7 with SMTP id f20-20020a05640214d400b004a21d3e93c7mr9578524edx.13.1675072389101; Mon, 30 Jan 2023 01:53:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675072389; cv=none; d=google.com; s=arc-20160816; b=sqT+FF7NWEReeiod5lDrIQ1X7k+a4XWERHBmJ7ss5qj5slePtluk4NBZ6yP7XWwaUJ erS+UnixSafPwYUv786MD3PVibAZo8fROEDjtiKD/llinsRiuSW/pbL/kNxhekqXO8o6 f8gX50b1gNBOK5M4dhlhqrycC4V6JyFXan7zYy2w2jEJR+DViEYvLA0J6gMntzNMDBbZ VV696I9Q8WHF6R1H+SM6N0LD2Qjdrh5L4VKGntJrzw3hNaMA44ZoG1k1LqR8YrfBE264 x64F1oEUGbvpS4TzWQ854llywmk561iDJsGy6IIUcVtoe0sHp7x2ztNxFP3MWf/zhiTk S2EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0t96y3FkXLiiInAiF7GMyUM6Gu9zpGQXe2nbijo00u8=; b=mlNUu3Ii8PiqrwIqGYBRTkKC4P70c1l/b8ZZv3B3AHWxGGFIyUqFHeb6pxDNRe2D88 ft7ptSrjhSurChwhJk34kMVhXrwa7fvZjb69GsjlsTV4fCEB0XJkNAE9D5a89QQL3n1j 86YBhybvqlQQO5orqmnR2SfwsldbRTg3LUG+TOLAKhigek6jXiiNP5+8QOskYgBKLpMi VWKefF7C0es1/tks4QnapOZrs4zZpsdOV3n3LIhSnX6DhJ1hsct4lWI1TYp8s0zNLhXq yXEkV58wnjdqKwVseLOqw6btmhPm7ki45bR+DrgkPghOe9xX0t9SBvF2cFlWQaH07kER W+tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ybsShXm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15-20020a170907910f00b008896128ee84si1829913ejq.480.2023.01.30.01.52.45; Mon, 30 Jan 2023 01:53:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ybsShXm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235604AbjA3JmU (ORCPT + 99 others); Mon, 30 Jan 2023 04:42:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235725AbjA3JmN (ORCPT ); Mon, 30 Jan 2023 04:42:13 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40A195FD9 for ; Mon, 30 Jan 2023 01:42:11 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso4857550wms.4 for ; Mon, 30 Jan 2023 01:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0t96y3FkXLiiInAiF7GMyUM6Gu9zpGQXe2nbijo00u8=; b=ybsShXm5tTFAPukgpSLb+cbxoAvhAgJCNnyXmTkKCJ37DAqqHf/XjSI0FbLgeK12w6 HZPRA/1JQiCBoKbAuXfluzsutzTcA/vkCzQC1w/ru5ZQ2WRPdornAJ2a+UNJ/mdgwHER rwu1hbj403wQ+qTpY8TNhv0KyZk5fQPmGRhwwESfxwkrcsRkAJtjJpyqRtm9ZpQ68H3I jADislAuT59q4au3Tclzf3OCxWclBO6hAAJ4Acsw1i4icQVLemj2+AjvPQxj6WMJOn3c nrZt86VmC2toRWTFJtTRKoY2E+E1faQu2UMGQTOG41OnJmYBxg00pzYLnPaf2HLrR4Ri P3JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0t96y3FkXLiiInAiF7GMyUM6Gu9zpGQXe2nbijo00u8=; b=EWJidWVLKOxl/1H/OJvRsV0nTel9Kd83fqo6LmhjQClBFmthkBx8H5FKl0ph0SyAXV SuFnJ0Wat0ieOGzSHUDAX72lodSEleoZCe3mUzHVPz6BxXE065CoRPRT2ZWlysrWcX+H f58psXMI1qD/o8+oNjHi9bhN5x4d3Xo7jxr8HwQQx9zg4F6IjqVZZJYlO8x9F2KLhKds PvGUFFjmcJgmEqPcqQNQa8lGFaFaWawlnLk1ZQ9xG2Cr8iR/mmZBPWv1RD/l9ZSvlBGI FgGOmAr0t2BL+f7oPR1xOsgC4jJWgnLDf6kpwgd3l00nd0s61cftZqRSJh6R3a97Z1jP rWNg== X-Gm-Message-State: AFqh2kqY/TGVjY/CnQcTsm6noFlqEjO+/loTymVuUOkjke3ECvI65VbJ XLQuQrnqCDIdvOZM8RXlIJ32ng3BR962tUFH X-Received: by 2002:a05:600c:444b:b0:3da:fd06:a6f1 with SMTP id v11-20020a05600c444b00b003dafd06a6f1mr47372661wmn.31.1675071729531; Mon, 30 Jan 2023 01:42:09 -0800 (PST) Received: from lmecxl1178.lme.st.com ([80.215.193.251]) by smtp.gmail.com with ESMTPSA id i27-20020a05600c4b1b00b003dc54d9aeeasm3865606wmp.36.2023.01.30.01.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 01:42:09 -0800 (PST) From: Etienne Carriere To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Jens Wiklander , Sumit Garg , Sudeep Holla , Cristian Marussi , Etienne Carriere Subject: [PATCH 2/2] firmware: arm_scmi: optee: use optee system invocation Date: Mon, 30 Jan 2023 10:41:57 +0100 Message-Id: <20230130094157.1082712-2-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230130094157.1082712-1-etienne.carriere@linaro.org> References: <20230130094157.1082712-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756440705314971942?= X-GMAIL-MSGID: =?utf-8?q?1756440705314971942?= Changes SCMI optee transport to enable sys_service capability of its tee context to leverage provisioned system resources in OP-TEE preventing possible deadlock. Such deadlock could happen when many Linux clients invoke OP-TEE are are all suspended waiting for an OP-TEE RPC request access an SCMI resource through the SCMI OP-TEE PTA service. Signed-off-by: Etienne Carriere Acked-by: Sudeep Holla --- drivers/firmware/arm_scmi/optee.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/firmware/arm_scmi/optee.c b/drivers/firmware/arm_scmi/optee.c index 2a7aeab40e54..91840345e946 100644 --- a/drivers/firmware/arm_scmi/optee.c +++ b/drivers/firmware/arm_scmi/optee.c @@ -559,6 +559,9 @@ static int scmi_optee_service_probe(struct device *dev) if (IS_ERR(tee_ctx)) return -ENODEV; + /* SCMI agent can used TEE system service resources */ + tee_ctx->sys_service = true; + agent = devm_kzalloc(dev, sizeof(*agent), GFP_KERNEL); if (!agent) { ret = -ENOMEM;