From patchwork Mon Mar 20 16:28:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 13181573 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 AD7C7C76195 for ; Mon, 20 Mar 2023 16:29:18 +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=DMt5VrpWfKv6HNt8s15Zb9pGd7dHRJ/sh53EdqopaSE=; b=HOsqA0rfC5Cq50 AT/tJP8xFfMt1pN72gvKmC5KwF19ip79M65UMoTU8ZfMf8pUoMUnK25prwx/Cwn/Ef8j8MwXLNq5A 9cOVfZfV4jwG6gAuraBk8TtacuynejxY5hJAaCq/lY61QTQGQ/PU8LHVoPhPoRMJz5lNyLwRpkQoS 1GJN4jCfvlJ6xgOIkADP8kUmawxexv/9epNlF9VujXUoyg592Ng7MWa3+8bT/SR/CIFj0EmgsIa3y VGE6hAcs3ckgUNwNnOFzYPVxcLjW14WqDk9qSsRzpHqLMMJs2aiq7LqxM9+SRs1Kys2WVYUSsRbNe H+QUYhIzER8sRKJNb6SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1peIMz-009lf3-1k; Mon, 20 Mar 2023 16:28:25 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1peIMq-009lal-22 for linux-arm-kernel@lists.infradead.org; Mon, 20 Mar 2023 16:28:17 +0000 Received: by mail-ed1-x52a.google.com with SMTP id y4so49093444edo.2 for ; Mon, 20 Mar 2023 09:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679329693; 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=5VruUI//IRhqNmoD8Q5azVtaM6cIQmuR0hWrVWNp3gY=; b=j3GTB6zHSKFYXwDQR3E75kyaRy94kg9SJlGrDtLjgfeNNL7C8a2zIQZMBiwZzaBOvq A1oKUQGCLqHpSxoFOgQw9zITYp9gl02CN4IW+PAogO2SoRMuw3oedfXd+Cy127sMqQTQ lDxV/2E+ahZe4v1wUuqxnbVhWvUmXQF0k423ZD4GKDrh+Sf7nKyiH1+Sjx6O1AjYs/AL uk8FC7STV5uZ5glOfJkSoevW2AscX9m0mK5pl7hR9u8LKSBbrjI7HVtngg42YmTKRgLk 5E++zMI29aqhLBI+RF9FGUZW5m3cbkP/KwJ+4wnmv3e9VJzmDP0PITYiozSWQPJ7TB8L nIkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679329693; 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=5VruUI//IRhqNmoD8Q5azVtaM6cIQmuR0hWrVWNp3gY=; b=KlMUB+R06V8OJIFgnrxwf6KVrHHuhrlGPUvLBtOxb00dMWGoqG9/ZxRdLf7DiRYAYK dzJnUjuj5CvsnfMt+aQYkMGac/HdsjG+WwPa1D7fklsykdFkgYMayq5e98uGfCEG1aqW WTren7W/bzRZVyyqrVYopChBKEqSNsHhO8Iw1Mj8RpJ/zRNldJsgfbvzii5eMvszq3kZ 58hxdDsfHqldD1yKDFiyBAhnEA88KYF6loVdh8LA5CrnFQxlbX8QWVfJ0DSxXmmSVAwi fabC4w3EtWyC4osb1/LFNY18hkHATm26Pkl2yoRf11VSDGpk71H1iA4uoZUQNn1uaagW 6/Nw== X-Gm-Message-State: AO0yUKXyuNev4f4t5Si3Xh3vTEvNafg5P4WXOFjWilLfYRuIMdRod96Y 7Nk96FqTwxv2OJ1qcmEjqBdwpw== X-Google-Smtp-Source: AK7set9Iv6t2+PyYJsM6ejBSCEG9d1L/0eAS+5joUH5SJA6dhXKXvwsVY0nnH2B8M0poXUoHdOlTxA== X-Received: by 2002:a17:906:7fc9:b0:8ab:4c4:d0f6 with SMTP id r9-20020a1709067fc900b008ab04c4d0f6mr8657609ejs.56.1679329692978; Mon, 20 Mar 2023 09:28:12 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:104a:5611:7bcb:e0c2:1993:f82b]) by smtp.gmail.com with ESMTPSA id b17-20020a17090630d100b009300424a2fdsm4646335ejb.144.2023.03.20.09.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 09:28:12 -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 , Etienne Carriere Subject: [PATCH v5 4/4] firmware: arm_scmi: optee: use optee system invocation Date: Mon, 20 Mar 2023 17:28:01 +0100 Message-Id: <20230320162801.2811542-4-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230320162801.2811542-1-etienne.carriere@linaro.org> References: <20230320162801.2811542-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-20230320_092816_670438_D154DF99 X-CRM114-Status: GOOD ( 13.47 ) 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. Signed-off-by: Etienne Carriere Acked-by: Sudeep Holla --- 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 2a7aeab40e54..22a755160c2f 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;