From patchwork Sun Feb 27 20:56:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 12762150 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 A8097C433EF for ; Sun, 27 Feb 2022 21:04:41 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=HTa4H4R3XkE8R1rMGEGbKtmDwqwCMRwKc28lHHy0GKM=; b=I+/1CGWOJzD/au ZJ55DnlWGeRytlbauAzPuOQ5ypgzCQmgFlLUEO7VzYMT3ajWgCW4nRnZhX0dmDQ88oK9qVDafGVEC keO5WU2eZzU6uLFgkW5cuGH+OWktP2CojxT5DvS7jL6G+ktVBhnP9dxBjtBgdPnZ5Z9D5WKEbKwEu WgCToHppuGoVVLpIrD5yaaEMqoB+8/VcY3VxxsKzCArxoMYgZSzLbmBJm4NoMCqR1VXc56qPt32UV bgLr1/OHDmXW/hROveSyg7amlmNXAHZYih9Pqb64IKmNGRWt8+vJoD2e8U+Loe6oUlzF/u5s3Rvh8 fdZHXq3wkevlKr4sMzZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOQhG-00AAYo-NK; Sun, 27 Feb 2022 21:03:15 +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 1nOQb2-00A7IU-If for linux-arm-kernel@lists.infradead.org; Sun, 27 Feb 2022 20:56:50 +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 226C41063; Sun, 27 Feb 2022 12:56:48 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB1263F66F; Sun, 27 Feb 2022 12:56:46 -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, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, peter.hilber@opensynergy.com, cristian.marussi@arm.com Subject: [RFC PATCH 16/16] [DEBUG]: firmware: arm_scmi: Add Kconfig to allow SCMI Testing driver coexistence Date: Sun, 27 Feb 2022 20:56:08 +0000 Message-Id: <20220227205608.30812-17-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220227205608.30812-1-cristian.marussi@arm.com> References: <20220227205608.30812-1-cristian.marussi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220227_125648_697117_224A4B8F X-CRM114-Status: GOOD ( 11.60 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org firmware: arm_scmi: Add Kconfig to allow SCMI Testing driver coexistence Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/Kconfig | 6 ++++++ drivers/firmware/arm_scmi/driver.c | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/Kconfig index a3726074c89e..c3fc608d5373 100644 --- a/drivers/firmware/arm_scmi/Kconfig +++ b/drivers/firmware/arm_scmi/Kconfig @@ -160,4 +160,10 @@ config ARM_SCMI_TEST_DRIVER This driver can also be built as a module. If so, the module will be called scmi_test_driver. +config ARM_SCMI_TEST_DRIVER_COEXISTENCE + bool "Allow Coexistence of SCMI standard drivers and test driver" + depends on ARM_SCMI_TEST_DRIVER + help + This enables coexistence for concurrent SCMI drievrs and testing driver. + endmenu diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 8c4706b24368..ff692c458a0b 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -1782,14 +1782,15 @@ 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_TEST_DRIVER) - /* Reject non-testing SCMI drivers */ - if (strncmp(id_table->name, "__scmi_test", strlen("__scmi_test"))) { - pr_warn("SCMI Test driver loaded. Rejecting '%s'/0x%X\n", - id_table->name, id_table->protocol_id); - return -EINVAL; + if (IS_ENABLED(CONFIG_ARM_SCMI_TEST_DRIVER) && + !IS_ENABLED(CONFIG_ARM_SCMI_TEST_DRIVER_COEXISTENCE)) { + /* Reject non-testing SCMI drivers */ + if (strncmp(id_table->name, "__scmi_test", strlen("__scmi_test"))) { + pr_warn("SCMI Test driver loaded. Rejecting driver: '%s'/0x%X\n", + id_table->name, id_table->protocol_id); + return -EBUSY; + } } -#endif /* * Search for the matching protocol rdev list and then search