From patchwork Mon May 2 09:02:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834007 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 133F9C433F5 for ; Mon, 2 May 2022 09:03:56 +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: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=oZiNdM1Y8CTBTgdKomTiMyxV01ha+SjJ1qukEU8LGoo=; b=p8x18pLxjmmp35 onDBqkHVOGq/EMgMAKV4URiVcz3ISEdMRtzOAUIc4FR1Urh/WhAj4DufbQEbNO70k4HFre8axr+da b24X6ung6dhNceVSFMu6Z1J4QcGEy2yenm1/jPvt/79KuYiOxoH2DUDeZJkyalfxXI32WVYj4T/ec HNahkDnaZmxC267qUqkVaIAt63Ys025EEcsH1oNF2AhxcB8q61csVg6vCK0Dv347oyUAUVTzfMZwR NGTWFMcS2VTHb+UuhuYH227BnDjtNgd94d7GC/gpbtjKOpnPLGbmbZYC3b9nxvSZEs92OOx+7Smqx PcAcGQzT7dlJEL/ne77A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRx5-000VC5-J3; Mon, 02 May 2022 09:02:43 +0000 Received: from marcansoft.com ([2a01:298:fe:f::2] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRwx-000VAJ-Hd for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:02:41 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 607AE419BC; Mon, 2 May 2022 09:02:28 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 0/7] mailbox: apple: peek_data cleanup and implementation Date: Mon, 2 May 2022 18:02:18 +0900 Message-Id: <20220502090225.26478-1-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020235_801761_B01E68A8 X-CRM114-Status: GOOD ( 21.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 Cc: Anup Patel Cc: Vinod Koul (maintainer:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM) Cc: Sven Peter (maintainer:ARM/APPLE MACHINE SUPPORT) Cc: Alyssa Rosenzweig (reviewer:ARM/APPLE MACHINE SUPPORT) To: Jassi Brar (maintainer:MAILBOX API) Cc: Mun Yew Tham (maintainer:ALTERA MAILBOX DRIVER) Cc: Chen-Yu Tsai (maintainer:ARM/Allwinner sunXi SoC support) Cc: Jernej Skrabec (maintainer:ARM/Allwinner sunXi SoC support) Cc: Samuel Holland (maintainer:ARM/Allwinner sunXi SoC support) Cc: Michal Simek (supporter:ARM/ZYNQ ARCHITECTURE) Cc: Arnd Bergmann Cc: linux-doc@vger.kernel.org (open list:DOCUMENTATION) Cc: linux-kernel@vger.kernel.org (open list) Cc: dmaengine@vger.kernel.org (open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM) Cc: linux-arm-kernel@lists.infradead.org (moderated list:ARM/APPLE MACHINE SUPPORT) Cc: linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support) Hi all, We had to implement atomic mailbox operations for apple-mailbox, and along the way we ran into a mailbox API issue. This series attempts to clean up the problem first, and then adds the apple implementation. The mailbox API has a `peek_data` operation. Its intent and documentation is rather ambiguous; at first glance and based on the name, it seems like it should only check for whether data is currently pending in the controller, without actually delivering it to the consumer. However, this interpretation is not useful for anything: the function can be called from atomic context, but without a way to actually *poll* for data from atomic context, there is no use in just checking for whether data is available. A more useful operation would be one that actually *polls* for incoming data and delivers it to the consumer, synchronously and from atomic context. This is what we need for apple-mailbox (in particular because the upcoming SMC driver needs to be able to talk to the mailbox from atomic context, for reboot/shutdown requests and possibly panic stuff). Over time, various drivers have implemented this with "peek" semantics... and none of them have any users. Which isn't surprising, given how these sematics aren't terribly useful :-) There is, however, one driver that has instead interpreted this as a poll operation: bcm-flexrm-mailbox. And, in fact, that is the only mailbox with a consumer that actually uses the peek_data op. So, it seems pretty clear that we should rename this to poll_data and fix the documentation. Since the existing "peek" semantics implementations are unused, we can just remove them. That leaves just bcm-flexrm-mailbox (producer) and bcm-sba-raid (consumer) to fix up along with the rename. This series does that, then implements the missing ops for apple-mailbox. Merge notes: it would be helpful if we could merge this via the SoC tree, or otherwise I can provide a git branch so you can pull the changes directly, and then we can merge it into SoC as well. The upcoming SMC driver needs poll_data, and that will allow us to merge that with the proper dependencies without waiting for a merge cycle in between. Hector Martin (7): mailbox: zynq: Remove unused zynqmp_ipi_peek_data mailbox: sun6i: Unexport unused sun6i_msgbox_peek_data mailbox: ti-msgmgr Remove unused ti_msgmgr_queue_peek_data mailbox: altera: Remove unused altera_mbox_peek_data mailbox: Rename peek_data to poll_data and fix documentation mailbox: apple: Implement flush() operation mailbox: apple: Implement poll_data() operation Documentation/driver-api/mailbox.rst | 2 +- drivers/dma/bcm-sba-raid.c | 4 +- drivers/mailbox/apple-mailbox.c | 64 ++++++++++++++++++++++++++-- drivers/mailbox/bcm-flexrm-mailbox.c | 4 +- drivers/mailbox/mailbox-altera.c | 8 ---- drivers/mailbox/mailbox.c | 25 +++++------ drivers/mailbox/sun6i-msgbox.c | 1 - drivers/mailbox/ti-msgmgr.c | 28 ------------ drivers/mailbox/zynqmp-ipi-mailbox.c | 41 ------------------ include/linux/mailbox_client.h | 2 +- include/linux/mailbox_controller.h | 6 +-- 11 files changed, 81 insertions(+), 104 deletions(-)