From patchwork Mon Oct 16 09:04:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne CARRIERE - foss X-Patchwork-Id: 13422762 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 0D4B3C41513 for ; Mon, 16 Oct 2023 09:05:20 +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=8TtKJHskOIJ8lB/8Kyzm6x/LPKQJjXILs3bPjW3xlA4=; b=D4P2KtT4BUuPBc X/T7XZeH0dV7IVXI2U42E/tyJIul0dSV7K593EBb/pknJ6X7J9ZdBlbyv6Eqr7VzlKB7SNIhesofz A3A/NrCWEcpRZoLPQwYyryVIfZiA6q44n4AMOxkxvGWVB5pI1Oz1RLykHrfKzt88hjTzl4XKid7ZD GtD8y6Z+KzpdRJAFJ8uCjoH1jzO7WG/dJj8MhQjqYdwtiT/LQDQ7PNOjnWwUQoAtkwMM6s5E8HDGr l0Kei84Jb4Q71S3CqsaN37zDY+0yIGlQXbAZgoXsvCi/lfFNgGgMeV1OBcuVaM5jNK+zxJFhLt8BM 3cYnKq0IWT+9I2VO7/Dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsJWr-008vcF-1K; Mon, 16 Oct 2023 09:04:49 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsJWi-008vY4-35 for linux-arm-kernel@lists.infradead.org; Mon, 16 Oct 2023 09:04:45 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39G7Lptw006055; Mon, 16 Oct 2023 11:04:34 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=7lvgGf/gfTJBiMBOGFDQ7AdrykrMAbF2dLbJkvuhuzs=; b=z4 NZ/cQoRgZwez6mB+3uxCk6UtVkEB5nhmWKgCrchipJKjClehpPP9rJcXZzupp90R tEPTDrjtmRIdLsw4KiglPXlr7kIQtpZRF8qW1ORKsCxjaD6roaBgZemdQ0vjBqgi wLGsd4eKSJ4RdqXl5NcqdkeKTffe/nX+deQcIrerGVAHf6c4ioymkjH2sHHMnKAH UOdS7dF5cf2CZwo7sA1SdmnSLPpLrY+oes7jfcnuSpDZ5K7YI7pXFn/QheU3uZF3 9bdR+zqr6PW/pIgFDpPJ+tyrrvKcks6TG3225JzeKA23ABZjlFfZLNYQEqHe31TM J9CPtoNUHV0V8za7o9RA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3tqkbe6pcy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Oct 2023 11:04:34 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4407A10005C; Mon, 16 Oct 2023 11:04:34 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 04DD721860F; Mon, 16 Oct 2023 11:04:34 +0200 (CEST) Received: from localhost (10.201.20.20) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 16 Oct 2023 11:04:33 +0200 From: Etienne Carriere To: CC: Jens Wiklander , Sumit Garg , , , Jerome Forissier , Etienne Carriere , Sudeep Holla , Cristian Marussi Subject: [PATCH v11 4/4] firmware: arm_scmi: optee: use optee system invocation Date: Mon, 16 Oct 2023 11:04:28 +0200 Message-ID: <20231016090428.1369071-5-etienne.carriere@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231016090428.1369071-1-etienne.carriere@foss.st.com> References: <20231016090428.1369071-1-etienne.carriere@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.20] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-16_02,2023-10-12_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_020441_288202_C5AACA45 X-CRM114-Status: GOOD ( 12.90 ) 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. Cc: Sudeep Holla Cc: Cristian Marussi Acked-by: Sudeep Holla Reviewed-by: Sumit Garg Signed-off-by: Etienne Carriere --- No change since v10 Changes since v9: - Applied Sumit R-b tag: https://lore.kernel.org/lkml/CAFA6WYMyJrW25sdZRkQHDje72+tLDw4T+bjB6tmVf8XH0De1RQ@mail.gmail.com/ - Added Cc: tags and updated my e-mail address. No change since v8 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;