From patchwork Tue May 16 12:51:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 13243127 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 D47EBC77B7A for ; Tue, 16 May 2023 12:54:45 +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:References:In-Reply-To: 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: List-Owner; bh=5iOls1SRgSLM+6nksX0/r64usHMJY9ZvBcbrErHX30Y=; b=BkefPp7jOKTfr1 7mSbxZWkgAQRz0KBMJ2iip/YmEBeDO78RPRgQ8yoO4WNwTDRO8KLKQ7L7RFSvogFfP6srQWYH/3zX E2LZ16aUc4bsK4vfEIOqEf5CBPoH+7Xds1knCBiH5sH2TuJU1Z5hBcO+MXu5w/M2RUEb/sJvfykWK NHNMQhFpJTJmViUP3sQPvNFRbP5Dqs/Bu6Vi/EBWGTdBxJi/ZJZXKyewawMmaRmt1mb7NpeYyKKIK 4XKe1Qg94x1jIhnQ1aD9xlMIhkT8MMVQ7Xediial8MOXLT+mfqMx+yuy6H8Pch6W3RPfaYhO5FxlL anWmnYwmVy1fVtgYkKSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyuC3-005nIJ-2n; Tue, 16 May 2023 12:54:19 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyuBy-005nEq-1F for linux-arm-kernel@lists.infradead.org; Tue, 16 May 2023 12:54:15 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f4ad71b00eso45516585e9.2 for ; Tue, 16 May 2023 05:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684241652; x=1686833652; 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=7B0ppPlpnqNlvLrDWw6A691nD5+RAL8Y7RlKrfxQcUs=; b=i8DkuUNO7jqjnmiTGpWShOI4F0dtKSFavowIVOFBQrBm5+jxryTOBAS8rlEesuGMuy Qil9RJA8Lfy+5jM+359EgQtVOYhrrusDTtOdtYLYuPcWl7wC4WJv87bE5WczG86Mpmsa jE3AUTGKfvtldAqz53Zx9pWEuGZdP4tsvoE+B2htbfcQS1egDBkBKz4YehQRJBapA6Jc rdrIvOyYpZJyftD0L5JxenLTaB/rrMcHeZW1H7D7kfLj81+/V/bXnCKF/RCU7Wt/NQlh dOc1Dr46Swod5TiQLagjJk9D4Xqrp2yqOW2z5jaFnmUddGH/PmRGx4AABMvrE4XJoXhj wRfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684241652; x=1686833652; 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=7B0ppPlpnqNlvLrDWw6A691nD5+RAL8Y7RlKrfxQcUs=; b=EhGn2nZDQ27Df5edBlPh6TC48zz0kWjQ7nGPUwrvqS8KP94Pm0uKVJwmpM/9HMpXUX PPAUPHox9IDHhwvMfbUnrwAzJo9HmmvfGvZPkyTz112EAsBbGFifbrZAMii3RyE6mMaH 2gZOK39qeBEL/z9mEVl+9m2equSwSWvjf1D5mj+b2Qrt01009FY/uUgdg84g8sOELKre acMnCQYjTsgcSDcVy8IN0eY7xv3IzltEAvXzQS7uPBkGEy+uZ3wuOHRVbWYN/J3c8HP8 /81s+vx5NgT83Kws/OqvZi5h27e//bhnrwHcVJ5ECSUXKhe2TtQtcKzbxTVUsTl/0h6U 5KEg== X-Gm-Message-State: AC+VfDwWwqVUe+wkvIoWGNUXBJHaWXa3sBxoEB8gty9cwBPR0JwWbWWC 0n6QsntphwPQY3AwTPUslydCRA== X-Google-Smtp-Source: ACHHUZ50KLhm96H8lf/YBH4BlkA2lKLNNueGedVaZlua9xQGiWfUfsr0vxjrKcq0uJq9oJPYm6tnmw== X-Received: by 2002:a5d:4684:0:b0:309:3698:7feb with SMTP id u4-20020a5d4684000000b0030936987febmr1024123wrq.46.1684241652102; Tue, 16 May 2023 05:54:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 05:54:11 -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 4/4] firmware: arm_scmi: optee: use optee system invocation Date: Tue, 16 May 2023 14:51:11 +0200 Message-Id: <20230516125111.2690204-5-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230516125111.2690204-1-etienne.carriere@linaro.org> References: <20230516125111.2690204-1-etienne.carriere@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_055414_423872_6112BC15 X-CRM114-Status: GOOD ( 13.44 ) 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 Changes SCMI optee transport to call tee_client_system_session() to request optee driver to provision an entry context in OP-TEE for processing OP-TEE messages. This prevents possible deadlock in case OP-TEE threads are all consumed while these may be waiting for a clock or regulator to be enable which SCMI OP-TEE service which requires a free thread context to execute. Acked-by: Sudeep Holla Signed-off-by: Etienne Carriere Reviewed-by: Sumit Garg --- No change since v7 No change since v6 Changes since v5: - Applied Sudeep's review tag Changes since v4: - Updated to new API function tee_client_system_session() introduced in patch v5 2/3. No change since v3 Changes since v2: - Fixed syntax issues (missing ';' chars), reported by kernel test robot. Changes since v1: - Updated to use new tee API functions tee_client_request_system_context() and tee_client_release_system_context(). --- drivers/firmware/arm_scmi/optee.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/firmware/arm_scmi/optee.c b/drivers/firmware/arm_scmi/optee.c index e123de6e8c67..25bfb465484d 100644 --- a/drivers/firmware/arm_scmi/optee.c +++ b/drivers/firmware/arm_scmi/optee.c @@ -440,6 +440,10 @@ static int scmi_optee_chan_setup(struct scmi_chan_info *cinfo, struct device *de if (ret) goto err_free_shm; + ret = tee_client_system_session(scmi_optee_private->tee_ctx, channel->tee_session); + if (ret) + dev_warn(dev, "Could not switch to system session, do best effort\n"); + ret = get_channel(channel); if (ret) goto err_close_sess;