Message ID | 20230130094157.1082712-2-etienne.carriere@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;n2h9z4@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; Mon, 30 Jan 2023 01:42:11 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id m16-20020a05600c3b1000b003dc4050c94aso4857550wms.4 for <linux-kernel@vger.kernel.org>; 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 <etienne.carriere@linaro.org> To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Jens Wiklander <jens.wiklander@linaro.org>, Sumit Garg <sumit.garg@linaro.org>, Sudeep Holla <sudeep.holla@arm.com>, Cristian Marussi <cristian.marussi@arm.com>, Etienne Carriere <etienne.carriere@linaro.org> 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
[1/2] tee: system invocation
|
|
Commit Message
Etienne Carriere
Jan. 30, 2023, 9:41 a.m. UTC
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 <etienne.carriere@linaro.org>
---
drivers/firmware/arm_scmi/optee.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Mon, Jan 30, 2023 at 10:41:57AM +0100, Etienne Carriere wrote: > 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 <etienne.carriere@linaro.org> > --- > 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; LGTM. I suppose you'll sync-up with Sudeep for how to queue this whole series. Thanks, Cristian
On Fri, Feb 03, 2023 at 02:36:26PM +0000, Cristian Marussi wrote: > On Mon, Jan 30, 2023 at 10:41:57AM +0100, Etienne Carriere wrote: > > 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 <etienne.carriere@linaro.org> > > --- > > 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; > > LGTM. > > I suppose you'll sync-up with Sudeep for how to queue this whole series. > I thought I had responded to this but not. Anyways since TEE changes are significant than SCMI, you can route it via TEE tree. In that case, Acked-by: Sudeep Holla <sudeep.holla@arm.com> Let me know if that was not your plan.
Hello Sudeep, On Fri, 3 Feb 2023 at 18:04, Sudeep Holla <sudeep.holla@arm.com> wrote: > > On Fri, Feb 03, 2023 at 02:36:26PM +0000, Cristian Marussi wrote: > > On Mon, Jan 30, 2023 at 10:41:57AM +0100, Etienne Carriere wrote: > > > 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 <etienne.carriere@linaro.org> > > > --- > > > 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; > > > > LGTM. > > > > I suppose you'll sync-up with Sudeep for how to queue this whole series. > > > > I thought I had responded to this but not. Anyways since TEE changes are > significant than SCMI, you can route it via TEE tree. In that case, > > Acked-by: Sudeep Holla <sudeep.holla@arm.com> > > Let me know if that was not your plan. That's fine. Thanks. I'll ask Jens to apply it next to the optee commit. Regards, Etienne > > -- > Regards, > Sudeep
On Mon, 30 Jan 2023 at 15:12, Etienne Carriere <etienne.carriere@linaro.org> wrote: > > 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 <etienne.carriere@linaro.org> > --- > 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; > + As per the other thread for patch #1, this feature will only be available with OP-TEE supporting TEE_GEN_CAP_REG_MEM. Can we add a corresponding conditional check here? -Sumit > agent = devm_kzalloc(dev, sizeof(*agent), GFP_KERNEL); > if (!agent) { > ret = -ENOMEM; > -- > 2.25.1 >
On Tue, Feb 7, 2023 at 10:59 AM Sumit Garg <sumit.garg@linaro.org> wrote: > > On Mon, 30 Jan 2023 at 15:12, Etienne Carriere > <etienne.carriere@linaro.org> wrote: > > > > 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 <etienne.carriere@linaro.org> > > --- > > 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; > > + > > As per the other thread for patch #1, this feature will only be > available with OP-TEE supporting TEE_GEN_CAP_REG_MEM. Can we add a > corresponding conditional check here? What would be gained by that? If a system thread isn't available or already is busy we're supposed to fall back to normal threads. Cheers, Jens > > -Sumit > > > agent = devm_kzalloc(dev, sizeof(*agent), GFP_KERNEL); > > if (!agent) { > > ret = -ENOMEM; > > -- > > 2.25.1 > >
On Tue, 7 Feb 2023 at 16:09, Jens Wiklander <jens.wiklander@linaro.org> wrote: > > On Tue, Feb 7, 2023 at 10:59 AM Sumit Garg <sumit.garg@linaro.org> wrote: > > > > On Mon, 30 Jan 2023 at 15:12, Etienne Carriere > > <etienne.carriere@linaro.org> wrote: > > > > > > 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 <etienne.carriere@linaro.org> > > > --- > > > 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; > > > + > > > > As per the other thread for patch #1, this feature will only be > > available with OP-TEE supporting TEE_GEN_CAP_REG_MEM. Can we add a > > corresponding conditional check here? > > What would be gained by that? If a system thread isn't available or > already is busy we're supposed to fall back to normal threads. > Just to make the dependency explicit and probably warn users that the system is missing a required capability. Earlier I went through a similar dependency issue report for trusted keys driver. I ended with a dependency fix [1] to make it easier while debugging when something doesn't work as intended. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/security/keys/trusted-keys/trusted_tee.c#n223 -Sumit > Cheers, > Jens > > > > > -Sumit > > > > > agent = devm_kzalloc(dev, sizeof(*agent), GFP_KERNEL); > > > if (!agent) { > > > ret = -ENOMEM; > > > -- > > > 2.25.1 > > >
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;