Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp245289iob; Mon, 2 May 2022 18:22:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1E3LLfjV388mXNeFlQfdd4X5pI0VvW2t1vid+OgqhtQDh4UOat1nC/ErKDHZhrV7BhGUD X-Received: by 2002:a17:902:f24c:b0:15c:b564:e4cc with SMTP id j12-20020a170902f24c00b0015cb564e4ccmr14167280plc.137.1651540942072; Mon, 02 May 2022 18:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651540942; cv=none; d=google.com; s=arc-20160816; b=OdUwbuqjRtN81fY9Mk/8Yxb1/kYx+Z3KjNpvGuIKJs5sEfFEFiUplo7Z5DoXWdFJb4 iK3E+VJ2aCmO6Q04+xBa5du9+QBxC3OqH3qqg0znSLDnfXX88nIzn5074Weg7/ZoMsRX maB3TWUT+MJ0A11+0KIBxkHrCx+VzSw1wmx3a4X4lI9CXZQHY4gFaqZTlUZsnPOWhuzE XREihuRtYzf5Ssbe0oRkARn21IReZIYEAImrlLnHHKy+Ihqm9CObESXr1rErvX8+6uNK YuYBOmy1erkC55fYis1sdVVBd1ZxDlXmd3vDF8dttPbcG+FYYTNaLQlZE3q8+mGRzLXv HZJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=oDMoQF12XjygHfdcnyMVnoAhjn6HpP+ZouLeoX4ZblI=; b=Vxuoer44/y1qwwfAbeO+HgEsOzksnq47/YDiD+GtZlHzi7wLElgIuh9NztC84qmX/V BWvgX7D9UjDXy2up81Pcjlr9C0K3SrVkF1w7Xkbhp6Apygug6HpTh0mlNZ5xcv6zBaCl akh2KtkcBBlqxXVSUqFnmTloh7HJV6jwUdPnKdttDG0lFh81Vuhla0slIKPLo2GlMbLU hMTqpsdvaThrCIJ4UBohG4XNgh0C0BDnC3BqeXw89LsEaJfSsMynSX6WQWq3v3k+++Ub pOlxkFXABDPDKqrP1xYhjnYY6bGV0YKkkMAHhJhplBgHwTdh4duIE0HkWlD/Ub6Lien0 r3Qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h4-20020a655184000000b003ab8abd9630si14890763pgq.376.2022.05.02.18.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 75F814BFC6; Mon, 2 May 2022 18:01:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240544AbiEBJGG (ORCPT + 99 others); Mon, 2 May 2022 05:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239442AbiEBJGD (ORCPT ); Mon, 2 May 2022 05:06:03 -0400 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32CBD1D0CE for ; Mon, 2 May 2022 02:02:34 -0700 (PDT) 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 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.35.1