From patchwork Tue May 11 00:20:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 12250379 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 60BD0C433B4 for ; Tue, 11 May 2021 10:01:28 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 B4A5761363 for ; Tue, 11 May 2021 10:01:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4A5761363 Authentication-Results: mail.kernel.org; dmarc=fail (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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=WhZTKzge+iELJ3+mwJ+aQC2O2UjrNHZRPacNrPSaQRA=; b=O6jyBFq3J8mUyOWqUhJr7UofFE l57wh+vNbjB4f8pmAVq+XadqBrxu05MCjm3RwZERgVLxxyzBXTyz/ZZaki3tkpulp3qvcmw8pJGjB BraXNB6fSSmUQ6jp2avuA2Da1uqe6sNrwAXsXMH5FfAAU5SFyZTwRYVmBDMJuYcurQ7rZt3gXIBGu Ku8GDI9b2mZe4D0VYtsQtWFy7aUF+wk8dmwTLezkv5z9NXhOdZQq8/FX9Yh+9zH4cx1i6sB6mMCLY AC/LfbMM+DMRGEuOEA3KpLbMYHnZqiL0nJb9loEJa+kOeoWe85W6w8Mf9I97/qtujtRfCz62FJm20 kIaVGRYw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgPBP-00Gnry-R7; Tue, 11 May 2021 10:00:07 +0000 Received: from [2607:7c80:54:e::133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGob-00G0pX-SH for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 01:04:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description:In-Reply-To:References; bh=FCh41QnDzuZx1SoLyt+Ukk7YYsu2IqqxlaWustSRs7g=; b=VI1seXvtTy6ekHNweI5E4xOU3u G/ErUFQRYKbk8PdB7XET1VoNPdQDY7zFnlrVYDfVSuZ4ONO/a57G8TvOKDNfLW04mb+Bw/3RH2TkG mzy6JQKuKBv98dJTeIbDrsiI4bS24d/M37YiSBTag/p/eBvP2F9fATEkdSVAl97JcXEtNkVpHDlKz cP30gyhNbzL0jQCd3KpD9L5ZEkF0T9YC700hmdLbmcw01nSVRGvRncZWB+F/WC5tDriQ/pl5phKRe 7IoSdI3NuoKYerBaO7p40eC6sC3T01/1hbRttvVBaclX3j6+xdiKQ/V9qmW//iyiy3tQoVhNByd0j WiXSJ3/A==; Received: from mx1.opensynergy.com ([217.66.60.4]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGGQ-009DPo-GY for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 00:28:44 +0000 Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id DB4CDA1985; Tue, 11 May 2021 02:22:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:message-id:mime-version:reply-to:subject:subject :to:to; s=srmailgate02; bh=FCh41QnDzuZx1SoLyt+Ukk7YYsu2IqqxlaWus tSRs7g=; b=I0HdMOheNa+7Cq2Nwa31HjKzbuALCcTzteIpWTIS8Gjr2sTFI7/y6 SASr5wZrrxFuOVVirV6IsX9r2qEcq2DptxDA5DzQjmPtRotbRgi5rBNHqCWR9X0b JaVKkj6AXibmQ1gyWQAqzPj3BvAqMrfBEQbsbx5t0Zry5cA5ucCg9zbdFR2tt51D Pk3qdn5b4SopoMSMdKwRfEZT7SHfiD5ic9q/OhHYAYpt2i0Mtx2nEvw+fLXYULU3 McHaUh01BG0aF8ytUUuJjfyUeuF+VIRfAEyfEIb6nKBoqw2d88BSpmZPFwg+NFH3 Y50FeiNSqyooyzYgpK3FsgUrBav+UXvPw== From: Peter Hilber To: , , , CC: Peter Hilber , Rob Herring , , , , , , , , , Vasyl Vavrychuk , Andriy Tryshnivskyy Subject: [RFC PATCH v3 00/12] firmware: arm_scmi: Add virtio transport Date: Tue, 11 May 2021 02:20:28 +0200 Message-ID: <20210511002040.802226-1-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-02.open-synergy.com (10.26.10.22) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_172842_737527_493E8FCA X-CRM114-Status: GOOD ( 13.37 ) /bin/ln: failed to access 'reaver_cache/texts/20210510_172842_737527_493E8FCA': No such file or directory X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_172842_737527_493E8FCA X-CRM114-Status: GOOD ( 11.30 ) 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 This series implements an SCMI virtio driver according to the virtio SCMI device spec [1], after simple preparatory changes to the existing arm-scmi driver. This RFC patch series is intended to give others an understanding of the current development progress. The virtio transport differs in some respects from the existing shared-memory based SCMI transports, and therefore some preparatory steps are necessary. The series is based on v5.13-rc1. Changes in RFC v3: - Fix scmi_xfer buffer management. Use dedicated buffers for actual Tx/Rx. Introduce a message handle, and a drop_message() op for message passing-based transports. - Add service data unit abstraction for transports which use message passing. - The virtio transport doesn't call the core once the channel is not ready any more. - Handle races between core and transport. - Use generic transport init/deinit (Cristian Marussi). - Don't use vqueue->priv field (Viresh Kumar). - Numerous small improvements. The following problems remain: - Polling is not implemented. - When handling races between core and transport, a timeout corner case can keep an scmi_xfer permanently occupied. - We must be sure that the virtio transport option (such as virtio over MMIO) is available when the virtio SCMI device is probed. All other known problems should have been addressed. Test: The series was smoke tested with a v5.4 based kernel, with the Base protocol and Sensor management protocol. The virtio SCMI device used was a proprietary implementation by OpenSynergy. The following was not tested yet: - delayed responses - driver remove - timeouts Changes in RFC v2: - Remove the DT virtio_transport phandle, since the SCMI virtio device may not be known in advance. Instead, use the first suitable probed device. Change due to Rob Herring's comment. Any comments are very welcome. [1] https://github.com/oasis-tcs/virtio-spec/blob/master/virtio-scmi.tex Cristian Marussi (1): firmware: arm_scmi: Add transport init/deinit Igor Skalkin (4): firmware: arm_scmi, smccc, mailbox: Make shmem based transports optional firmware: arm_scmi: Add op to override max message # dt-bindings: arm: Add virtio transport for SCMI firmware: arm_scmi: Add virtio transport Peter Hilber (7): firmware: arm_scmi: Add optional link_supplier() transport op firmware: arm_scmi: Add per-device transport private info firmware: arm_scmi: Add is_scmi_protocol_device() firmware: arm_scmi: Add msg_handle to some transport ops firmware: arm_scmi: Add optional drop_message() transport op firmware: arm_scmi: Add message passing abstractions for transports firmware: arm_scmi: Handle races between core and transport .../devicetree/bindings/arm/arm,scmi.txt | 35 +- MAINTAINERS | 1 + drivers/firmware/Kconfig | 26 +- drivers/firmware/arm_scmi/Makefile | 4 +- drivers/firmware/arm_scmi/bus.c | 5 + drivers/firmware/arm_scmi/common.h | 81 ++- drivers/firmware/arm_scmi/driver.c | 310 +++++++++-- drivers/firmware/arm_scmi/mailbox.c | 7 +- drivers/firmware/arm_scmi/msg.c | 113 ++++ drivers/firmware/arm_scmi/smc.c | 5 +- drivers/firmware/arm_scmi/virtio.c | 524 ++++++++++++++++++ drivers/firmware/smccc/Kconfig | 1 + drivers/mailbox/Kconfig | 1 + include/uapi/linux/virtio_ids.h | 1 + include/uapi/linux/virtio_scmi.h | 25 + 15 files changed, 1065 insertions(+), 74 deletions(-) create mode 100644 drivers/firmware/arm_scmi/msg.c create mode 100644 drivers/firmware/arm_scmi/virtio.c create mode 100644 include/uapi/linux/virtio_scmi.h base-commit: 6efb943b8616ec53a5e444193dccf1af9ad627b5