Skip to content

mailbox: apple: peek_data cleanup and implementation

Hector Martin dmaengine linux-arm-kernel linux-doc linux-sunxi lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7mailbox: zynq: Remove unused zynqmp_ipi_peek_datadrivers/mailbox/zynqmp-ipi-mailbox.c+0 -410 replies
2/7mailbox: sun6i: Unexport unused sun6i_msgbox_peek_datadrivers/mailbox/sun6i-msgbox.c+0 -11 reply
3/7mailbox: ti-msgmgr Remove unused ti_msgmgr_queue_peek_datadrivers/mailbox/ti-msgmgr.c+0 -280 replies
4/7mailbox: altera: Remove unused altera_mbox_peek_datadrivers/mailbox/mailbox-altera.c+0 -80 replies
5/7mailbox: Rename peek_data to poll_data and fix documentationDocumentation/driver-api/mailbox.rst drivers/dma/bcm-sba-raid.c drivers/mailbox/bcm-flexrm-mailbox.c +3 more+20 -230 replies
6/7mailbox: apple: Implement flush() operationdrivers/mailbox/apple-mailbox.c+27 -00 replies
7/7mailbox: apple: Implement poll_data() operationdrivers/mailbox/apple-mailbox.c+34 -30 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchSamuel Holland
1/7
2/7A-b
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] mailbox: apple: peek_data cleanup and implementation

Cc: Anup Patel <[email protected]>
Cc: Vinod Koul <[email protected]> (maintainer:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM)
Cc: Sven Peter <[email protected]> (maintainer:ARM/APPLE MACHINE SUPPORT)
Cc: Alyssa Rosenzweig <[email protected]> (reviewer:ARM/APPLE MACHINE SUPPORT)
To: Jassi Brar <[email protected]> (maintainer:MAILBOX API)
Cc: Mun Yew Tham <[email protected]> (maintainer:ALTERA MAILBOX DRIVER)
Cc: Chen-Yu Tsai <[email protected]> (maintainer:ARM/Allwinner sunXi SoC support)
Cc: Jernej Skrabec <[email protected]> (maintainer:ARM/Allwinner sunXi SoC support)
Cc: Samuel Holland <[email protected]> (maintainer:ARM/Allwinner sunXi SoC support)
Cc: Michal Simek <[email protected]> (supporter:ARM/ZYNQ ARCHITECTURE)
Cc: Arnd Bergmann <[email protected]>
Cc: [email protected] (open list:DOCUMENTATION)
Cc: [email protected] (open list)
Cc: [email protected] (open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM)
Cc: [email protected] (moderated list:ARM/APPLE MACHINE SUPPORT)
Cc: [email protected] (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(-)
Signature · 1 line
2.35.1