From patchwork Fri Jan 13 21:11:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 13101646 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 BF159C3DA78 for ; Fri, 13 Jan 2023 21:19:12 +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=x00469nu9Z+pQr2/9O1txtYW1fL7tO8pDszTg54mrDg=; b=m82oWXfFdfmyEy utbXvcHAXlG074aQU3dKsuhU1yZFCMAzxjyL/lE9kn8NeB7KyZ+tOTBw3L0hk90gUs6xbnIBzfGB4 S5UV8TJuw9BVWKDiSTFTe3/LhcAsmAO7X4iOyRMy2vEWOi4I/k9zXkqHsc6qrBTBHIoKq4lPiBQou 4S9g7HgVzKX596KoIxfB2mGaQosc6NejfJ4yq/iHFEqObBNLW1ALFWYOvSjzUba2AfuS4n5u2papl bfOX4c83wDWi+bBU6oAu4pf/Fz9oLoN/gayooerL7ymG6ut9ZyCbqxCxhXv22Wyxv5d2zLyst4qQs xghL7HY3BWbJcROYGo7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGRR7-004Xqu-UZ; Fri, 13 Jan 2023 21:18:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGRLy-004Ux2-LW for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2023 21:12:48 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 56450176B; Fri, 13 Jan 2023 13:13:28 -0800 (PST) Received: from e120937-lin.. (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 623113F587; Fri, 13 Jan 2023 13:12:44 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, wleavitt@marvell.com, peter.hilber@opensynergy.com, nicola.mazzucato@arm.com, tarek.el-sherbiny@arm.com, quic_kshivnan@quicinc.com, cristian.marussi@arm.com Subject: [PATCH v7 16/17] firmware: arm_scmi: Add Raw mode coexistence support Date: Fri, 13 Jan 2023 21:11:34 +0000 Message-Id: <20230113211135.2530064-17-cristian.marussi@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113211135.2530064-1-cristian.marussi@arm.com> References: <20230113211135.2530064-1-cristian.marussi@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230113_131246_853292_00ED86AB X-CRM114-Status: GOOD ( 17.84 ) 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 When Raw support is enabled and configured in coexistence mode the normal SCMI drivers are allowed to register with the SCMI core and operate as usual alongside the Raw operations. SCMI Normal and Raw messages will be kept segregated from each other, but only at the transaction level: any further possible interference at the protocol layer will have instead to be handled by the user to attain reliable results while using Raw transactions. Signed-off-by: Cristian Marussi --- v5 --> v6 - fix error path for RAW Coex on scmi_probe --- drivers/firmware/arm_scmi/Kconfig | 10 ++++++++++ drivers/firmware/arm_scmi/bus.c | 3 ++- drivers/firmware/arm_scmi/driver.c | 11 ++++++++++- drivers/firmware/arm_scmi/raw_mode.c | 5 ++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/Kconfig index 3b4f9e92b1e3..ea0f5083ac47 100644 --- a/drivers/firmware/arm_scmi/Kconfig +++ b/drivers/firmware/arm_scmi/Kconfig @@ -45,6 +45,16 @@ config ARM_SCMI_RAW_MODE_SUPPORT order to avoid unexpected interactions with the SCMI Raw message flow. If unsure say N. +config ARM_SCMI_RAW_MODE_SUPPORT_COEX + bool "Allow SCMI Raw mode coexistence with normal SCMI stack" + depends on ARM_SCMI_RAW_MODE_SUPPORT + help + Allow SCMI Raw transmission mode to coexist with normal SCMI stack. + + This will allow regular SCMI drivers to register with the core and + operate normally, thing which could make an SCMI test suite using the + SCMI Raw mode support unreliable. If unsure, say N. + config ARM_SCMI_HAVE_TRANSPORT bool help diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 8601d75f5b9b..68cc4b4290c1 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -59,7 +59,8 @@ static int scmi_protocol_device_request(const struct scmi_device_id *id_table) pr_debug("Requesting SCMI device (%s) for protocol %x\n", id_table->name, id_table->protocol_id); - if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) { + if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT) && + !IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX)) { pr_warn("SCMI Raw mode active. Rejecting '%s'/0x%02X\n", id_table->name, id_table->protocol_id); return -EINVAL; diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 7c7baae85686..e3e264b27b22 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2708,10 +2708,19 @@ static int scmi_probe(struct platform_device *pdev) dev_err(dev, "Failed to initialize SCMI RAW Mode !\n"); ret = PTR_ERR(info->raw); + } + + if (!IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX)) { + if (!ret) + return ret; + /* + * Bail out if we failed to init raw mode and + * RAW_MODE_SUPPORT_COEX was not configured. + */ goto clear_dev_req_notifier; } - return 0; + dev_info(dev, "SCMI RAW Mode COEX enabled !\n"); } } diff --git a/drivers/firmware/arm_scmi/raw_mode.c b/drivers/firmware/arm_scmi/raw_mode.c index a9a8b250d070..b2dff852e4b4 100644 --- a/drivers/firmware/arm_scmi/raw_mode.c +++ b/drivers/firmware/arm_scmi/raw_mode.c @@ -26,7 +26,10 @@ * In order to avoid possible interferences between the SCMI Raw transactions * originated from a test-suite and the normal operations of the SCMI drivers, * when Raw mode is enabled, by default, all the regular SCMI drivers are - * inhibited. + * inhibited, unless CONFIG_ARM_SCMI_RAW_MODE_SUPPORT_COEX is enabled: in this + * latter case the regular SCMI stack drivers will be loaded as usual and it is + * up to the user of this interface to take care of manually inhibiting the + * regular SCMI drivers in order to avoid interferences during the test runs. * * The exposed API is as follows. *