From patchwork Thu Nov 5 21:21:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 11885245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35B21C55ABD for ; Thu, 5 Nov 2020 21:22:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA17620756 for ; Thu, 5 Nov 2020 21:22:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="c09Yk9Lh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA17620756 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=opensynergy.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wZu1Jr7p4Fr7ppCJfqj5YX5sBbWBkPC3cGlAjYqC8UA=; b=c09Yk9Lhgkql59CuSgmpwsvFR sfrW29wjmM43CDQemPiNKRGE8+oohDyu9HQF/O24jcCVGr6Gu7cx2s/9MKRf2m6s5//aKfTRKWkrX hTR4LKmK8pBDzTPft3UwB1lhJybrpwO459+6INp4brCrmtEdQ7jiVKt+PWBU2poIPunmseagTsdqg PZLqnT6e1ozzgalXqYYYI1Yjw93nhz8JeaGd6hJyOsL6ScoMjelfe20Xi0ZZXEkCvVJ+g4HtGH1QS owQO55K4zN6OFSJdGWZif6n+CMaGMW7bdMgKcUuqd/leU0r2gpkuZymEQHPo9SMuBhrETOMUpPu51 i6RBKjZlw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kamhh-0003rG-0n; Thu, 05 Nov 2020 21:21:57 +0000 Received: from plasma4.jpberlin.de ([80.241.57.33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kamhb-0003oU-No for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 21:21:54 +0000 Received: from spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) by plasma.jpberlin.de (Postfix) with ESMTP id A6259AB750; Thu, 5 Nov 2020 22:21:44 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from plasma.jpberlin.de ([80.241.56.68]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id P6g-UD45aW2X; Thu, 5 Nov 2020 22:21:43 +0100 (CET) Received: from webmail.opensynergy.com (unknown [217.66.60.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "*.opensynergy.com", Issuer "Starfield Secure Certificate Authority - G2" (not verified)) (Authenticated sender: opensynergy@jpberlin.de) by plasma.jpberlin.de (Postfix) with ESMTPSA id 3DDA9AB79F; Thu, 5 Nov 2020 22:21:43 +0100 (CET) From: Peter Hilber To: , Subject: [RFC PATCH v2 01/10] firmware: arm_scmi, smccc, mailbox: Make shmem based transports optional Date: Thu, 5 Nov 2020 22:21:07 +0100 Message-ID: <20201105212116.411422-2-peter.hilber@opensynergy.com> In-Reply-To: <20201105212116.411422-1-peter.hilber@opensynergy.com> References: <20201105212116.411422-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-01.open-synergy.com (10.26.10.21) X-MBO-SPAM-Probability: X-Rspamd-Score: -2.31 / 15.00 / 15.00 X-Rspamd-Queue-Id: A6259AB750 X-Rspamd-UID: 33c645 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_162151_928208_BAB123E7 X-CRM114-Status: GOOD ( 20.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , jean-philippe@linaro.org, mikhail.golubev@opensynergy.com, Lorenzo Pieralisi , souvik.chakravarty@arm.com, Igor Skalkin , Jassi Brar , linux-kernel@vger.kernel.org, Rob Herring , Peter Hilber , anton.yakovlev@opensynergy.com, sudeep.holla@arm.com, alex.bennee@linaro.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Igor Skalkin Upon adding the virtio transport in this patch series, SCMI will also work without shared memory based transports. Also, the mailbox transport may not be needed if the smc transport is used. - Compile shmem.c only if a shmem based transport is available. - Remove hard dependency of SCMI on mailbox. Co-developed-by: Peter Hilber Signed-off-by: Peter Hilber Signed-off-by: Igor Skalkin --- drivers/firmware/Kconfig | 9 ++++++++- drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/common.h | 2 ++ drivers/firmware/arm_scmi/driver.c | 2 ++ drivers/firmware/smccc/Kconfig | 1 + drivers/mailbox/Kconfig | 1 + 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index afdbebba628a..bdde51adb267 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -9,7 +9,7 @@ menu "Firmware Drivers" config ARM_SCMI_PROTOCOL tristate "ARM System Control and Management Interface (SCMI) Message Protocol" depends on ARM || ARM64 || COMPILE_TEST - depends on MAILBOX + depends on ARM_SCMI_HAVE_SHMEM help ARM System Control and Management Interface (SCMI) protocol is a set of operating system-independent software interfaces that are @@ -27,6 +27,13 @@ config ARM_SCMI_PROTOCOL This protocol library provides interface for all the client drivers making use of the features offered by the SCMI. +config ARM_SCMI_HAVE_SHMEM + bool + default n + help + This declares whether a shared memory based transport for SCMI is + available. + config ARM_SCMI_POWER_DOMAIN tristate "SCMI power domain driver" depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF) diff --git a/drivers/firmware/arm_scmi/Makefile b/drivers/firmware/arm_scmi/Makefile index bc0d54f8e861..3cc7fa40a464 100644 --- a/drivers/firmware/arm_scmi/Makefile +++ b/drivers/firmware/arm_scmi/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only scmi-bus-y = bus.o scmi-driver-y = driver.o notify.o -scmi-transport-y = shmem.o +scmi-transport-$(CONFIG_ARM_SCMI_HAVE_SHMEM) = shmem.o scmi-transport-$(CONFIG_MAILBOX) += mailbox.o scmi-transport-$(CONFIG_HAVE_ARM_SMCCC_DISCOVERY) += smc.o scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o system.o diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 65063fa948d4..aed192238177 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -242,7 +242,9 @@ struct scmi_desc { int max_msg_size; }; +#ifdef CONFIG_MAILBOX extern const struct scmi_desc scmi_mailbox_desc; +#endif #ifdef CONFIG_HAVE_ARM_SMCCC extern const struct scmi_desc scmi_smc_desc; #endif diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 3dfd8b6a0ebf..9e2f36127793 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -918,7 +918,9 @@ ATTRIBUTE_GROUPS(versions); /* Each compatible listed below must have descriptor associated with it */ static const struct of_device_id scmi_of_match[] = { +#ifdef CONFIG_MAILBOX { .compatible = "arm,scmi", .data = &scmi_mailbox_desc }, +#endif #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY { .compatible = "arm,scmi-smc", .data = &scmi_smc_desc}, #endif diff --git a/drivers/firmware/smccc/Kconfig b/drivers/firmware/smccc/Kconfig index 15e7466179a6..69c4d6cabf62 100644 --- a/drivers/firmware/smccc/Kconfig +++ b/drivers/firmware/smccc/Kconfig @@ -9,6 +9,7 @@ config HAVE_ARM_SMCCC_DISCOVERY bool depends on ARM_PSCI_FW default y + select ARM_SCMI_HAVE_SHMEM help SMCCC v1.0 lacked discoverability and hence PSCI v1.0 was updated to add SMCCC discovery mechanism though the PSCI firmware diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig index 05b1009e2820..5ffe1ab0c869 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig MAILBOX bool "Mailbox Hardware Support" + select ARM_SCMI_HAVE_SHMEM help Mailbox is a framework to control hardware communication between on-chip processors through queued messages and interrupt driven