Merge tag 'mailbox-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox

Pull mailbox updates from Jassi Brar:

 - redo the omap driver from legacy to mailbox api

 - enable bufferless IPI for zynqmp

 - add mhu-v3 driver

 - convert from tasklet to BH workqueue

 - add qcom MSM8974 APCS compatible IDs

* tag 'mailbox-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox: (24 commits)
  dt-bindings: mailbox: qcom-ipcc: Document the SDX75 IPCC
  dt-bindings: mailbox: qcom: Add MSM8974 APCS compatible
  mailbox: Convert from tasklet to BH workqueue
  mailbox: mtk-cmdq: Fix pm_runtime_get_sync() warning in mbox shutdown
  mailbox: mtk-cmdq-mailbox: fix module autoloading
  mailbox: zynqmp: handle SGI for shared IPI
  mailbox: arm_mhuv3: Add driver
  dt-bindings: mailbox: arm,mhuv3: Add bindings
  mailbox: omap: Remove kernel FIFO message queuing
  mailbox: omap: Reverse FIFO busy check logic
  mailbox: omap: Remove mbox_chan_to_omap_mbox()
  mailbox: omap: Use mbox_controller channel list directly
  mailbox: omap: Use function local struct mbox_controller
  mailbox: omap: Merge mailbox child node setup loops
  mailbox: omap: Use devm_pm_runtime_enable() helper
  mailbox: omap: Remove device class
  mailbox: omap: Remove unneeded header omap-mailbox.h
  mailbox: omap: Move fifo size check to point of use
  mailbox: omap: Move omap_mbox_irq_t into driver
  mailbox: omap: Remove unused omap_mbox_request_channel() function
  ...
This commit is contained in:
Linus Torvalds
2024-05-21 10:40:06 -07:00
14 changed files with 1855 additions and 501 deletions

View File

@@ -0,0 +1,224 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mailbox/arm,mhuv3.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: ARM MHUv3 Mailbox Controller
maintainers:
- Sudeep Holla <sudeep.holla@arm.com>
- Cristian Marussi <cristian.marussi@arm.com>
description: |
The Arm Message Handling Unit (MHU) Version 3 is a mailbox controller that
enables unidirectional communications with remote processors through various
possible transport protocols.
The controller can optionally support a varying number of extensions that, in
turn, enable different kinds of transport to be used for communication.
Number, type and characteristics of each supported extension can be discovered
dynamically at runtime.
Given the unidirectional nature of the controller, an MHUv3 mailbox controller
is composed of a MHU Sender (MHUS) containing a PostBox (PBX) block and a MHU
Receiver (MHUR) containing a MailBox (MBX) block, where
PBX is used to
- Configure the MHU
- Send Transfers to the Receiver
- Optionally receive acknowledgment of a Transfer from the Receiver
MBX is used to
- Configure the MHU
- Receive Transfers from the Sender
- Optionally acknowledge Transfers sent by the Sender
Both PBX and MBX need to be present and defined in the DT description if you
need to establish a bidirectional communication, since you will have to
acquire two distinct unidirectional channels, one for each block.
As a consequence both blocks needs to be represented separately and specified
as distinct DT nodes in order to properly describe their resources.
Note that, though, thanks to the runtime discoverability, there is no need to
identify the type of blocks with distinct compatibles.
Following are the MHUv3 possible extensions.
- Doorbell Extension (DBE): DBE defines a type of channel called a Doorbell
Channel (DBCH). DBCH enables a single bit Transfer to be sent from the
Sender to Receiver. The Transfer indicates that an event has occurred.
When DBE is implemented, the number of DBCHs that an implementation of the
MHU can support is between 1 and 128, numbered starting from 0 in ascending
order and discoverable at run-time.
Each DBCH contains 32 individual fields, referred to as flags, each of which
can be used independently. It is possible for the Sender to send multiple
Transfers at once using a single DBCH, so long as each Transfer uses
a different flag in the DBCH.
Optionally, data may be transmitted through an out-of-band shared memory
region, wherein the MHU Doorbell is used strictly as an interrupt generation
mechanism, but this is out of the scope of these bindings.
- FastChannel Extension (FCE): FCE defines a type of channel called a Fast
Channel (FCH). FCH is intended for lower overhead communication between
Sender and Receiver at the expense of determinism. An FCH allows the Sender
to update the channel value at any time, regardless of whether the previous
value has been seen by the Receiver. When the Receiver reads the channel's
content it gets the last value written to the channel.
FCH is considered lossy in nature, and means that the Sender has no way of
knowing if, or when, the Receiver will act on the Transfer.
FCHs are expected to behave as RAM which generates interrupts when writes
occur to the locations within the RAM.
When FCE is implemented, the number of FCHs that an implementation of the
MHU can support is between 1-1024, if the FastChannel word-size is 32-bits,
or between 1-512, when the FastChannel word-size is 64-bits.
FCHs are numbered from 0 in ascending order.
Note that the number of FCHs and the word-size are implementation defined,
not configurable but discoverable at run-time.
Optionally, data may be transmitted through an out-of-band shared memory
region, wherein the MHU FastChannel is used as an interrupt generation
mechanism which carries also a pointer to such out-of-band data, but this
is out of the scope of these bindings.
- FIFO Extension (FE): FE defines a Channel type called a FIFO Channel (FFCH).
FFCH allows a Sender to send
- Multiple Transfers to the Receiver without having to wait for the
previous Transfer to be acknowledged by the Receiver, as long as the
FIFO has room for the Transfer.
- Transfers which require the Receiver to provide acknowledgment.
- Transfers which have in-band payload.
In all cases, the data is guaranteed to be observed by the Receiver in the
same order which the Sender sent it.
When FE is implemented, the number of FFCHs that an implementation of the
MHU can support is between 1 and 64, numbered starting from 0 in ascending
order. The number of FFCHs, their depth (same for all implemented FFCHs) and
the access-granularity are implementation defined, not configurable but
discoverable at run-time.
Optionally, additional data may be transmitted through an out-of-band shared
memory region, wherein the MHU FIFO is used to transmit, in order, a small
part of the payload (like a header) and a reference to the shared memory
area holding the remaining, bigger, chunk of the payload, but this is out of
the scope of these bindings.
properties:
compatible:
const: arm,mhuv3
reg:
maxItems: 1
interrupts:
minItems: 1
maxItems: 74
interrupt-names:
description: |
The MHUv3 controller generates a number of events some of which are used
to generate interrupts; as a consequence it can expose a varying number of
optional PBX/MBX interrupts, representing the events generated during the
operation of the various transport protocols associated with different
extensions. All interrupts of the MHU are level-sensitive.
Some of these optional interrupts are defined per-channel, where the
number of channels effectively available is implementation defined and
run-time discoverable.
In the following names are enumerated using patterns, with per-channel
interrupts implicitly capped at the maximum channels allowed by the
specification for each extension type.
For the sake of simplicity maxItems is anyway capped to a most plausible
number, assuming way less channels would be implemented than actually
possible.
The only mandatory interrupts on the MHU are:
- combined
- mbx-fch-xfer-<N> but only if mbx-fcgrp-xfer-<N> is not implemented.
minItems: 1
maxItems: 74
items:
oneOf:
- const: combined
description: PBX/MBX Combined interrupt
- const: combined-ffch
description: PBX/MBX FIFO Combined interrupt
- pattern: '^ffch-low-tide-[0-9]+$'
description: PBX/MBX FIFO Channel <N> Low Tide interrupt
- pattern: '^ffch-high-tide-[0-9]+$'
description: PBX/MBX FIFO Channel <N> High Tide interrupt
- pattern: '^ffch-flush-[0-9]+$'
description: PBX/MBX FIFO Channel <N> Flush interrupt
- pattern: '^mbx-dbch-xfer-[0-9]+$'
description: MBX Doorbell Channel <N> Transfer interrupt
- pattern: '^mbx-fch-xfer-[0-9]+$'
description: MBX FastChannel <N> Transfer interrupt
- pattern: '^mbx-fchgrp-xfer-[0-9]+$'
description: MBX FastChannel <N> Group Transfer interrupt
- pattern: '^mbx-ffch-xfer-[0-9]+$'
description: MBX FIFO Channel <N> Transfer interrupt
- pattern: '^pbx-dbch-xfer-ack-[0-9]+$'
description: PBX Doorbell Channel <N> Transfer Ack interrupt
- pattern: '^pbx-ffch-xfer-ack-[0-9]+$'
description: PBX FIFO Channel <N> Transfer Ack interrupt
'#mbox-cells':
description: |
The first argument in the consumers 'mboxes' property represents the
extension type, the second is for the channel number while the third
depends on extension type.
Extension types constants are defined in <dt-bindings/arm/mhuv3-dt.h>.
Extension type for DBE is DBE_EXT and the third parameter represents the
doorbell flag number to use.
Extension type for FCE is FCE_EXT, third parameter unused.
Extension type for FE is FE_EXT, third parameter unused.
mboxes = <&mhu DBE_EXT 0 5>; // DBE, Doorbell Channel Window 0, doorbell 5.
mboxes = <&mhu DBE_EXT 7>; // DBE, Doorbell Channel Window 1, doorbell 7.
mboxes = <&mhu FCE_EXT 0 0>; // FCE, FastChannel Window 0.
mboxes = <&mhu FCE_EXT 3 0>; // FCE, FastChannel Window 3.
mboxes = <&mhu FE_EXT 1 0>; // FE, FIFO Channel Window 1.
mboxes = <&mhu FE_EXT 7 0>; // FE, FIFO Channel Window 7.
const: 3
clocks:
maxItems: 1
required:
- compatible
- reg
- interrupts
- interrupt-names
- '#mbox-cells'
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
soc {
#address-cells = <2>;
#size-cells = <2>;
mailbox@2aaa0000 {
compatible = "arm,mhuv3";
#mbox-cells = <3>;
reg = <0 0x2aaa0000 0 0x10000>;
clocks = <&clock 0>;
interrupt-names = "combined", "pbx-dbch-xfer-ack-1",
"ffch-high-tide-0";
interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
};
mailbox@2ab00000 {
compatible = "arm,mhuv3";
#mbox-cells = <3>;
reg = <0 0x2aab0000 0 0x10000>;
clocks = <&clock 0>;
interrupt-names = "combined", "mbx-dbch-xfer-1", "ffch-low-tide-0";
interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
};
};

View File

@@ -30,6 +30,7 @@ properties:
- const: syscon
- items:
- enum:
- qcom,msm8974-apcs-kpss-global
- qcom,msm8976-apcs-kpss-global
- const: qcom,msm8994-apcs-kpss-global
- const: syscon

View File

@@ -28,6 +28,7 @@ properties:
- qcom,sa8775p-ipcc
- qcom,sc7280-ipcc
- qcom,sc8280xp-ipcc
- qcom,sdx75-ipcc
- qcom,sm6350-ipcc
- qcom,sm6375-ipcc
- qcom,sm8250-ipcc

View File

@@ -13195,6 +13195,15 @@ F: Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
F: drivers/mailbox/arm_mhuv2.c
F: include/linux/mailbox/arm_mhuv2_message.h
MAILBOX ARM MHUv3
M: Sudeep Holla <sudeep.holla@arm.com>
M: Cristian Marussi <cristian.marussi@arm.com>
L: linux-kernel@vger.kernel.org
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Maintained
F: Documentation/devicetree/bindings/mailbox/arm,mhuv3.yaml
F: drivers/mailbox/arm_mhuv3.c
MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
M: Alejandro Colomar <alx@kernel.org>
L: linux-man@vger.kernel.org

View File

@@ -23,6 +23,18 @@ config ARM_MHU_V2
Say Y here if you want to build the ARM MHUv2 controller driver,
which provides unidirectional mailboxes between processing elements.
config ARM_MHU_V3
tristate "ARM MHUv3 Mailbox"
depends on HAS_IOMEM || COMPILE_TEST
depends on OF
help
Say Y here if you want to build the ARM MHUv3 controller driver,
which provides unidirectional mailboxes between processing elements.
ARM MHUv3 controllers can implement a varying number of extensions
that provides different means of transports: supported extensions
will be discovered and possibly managed at probe-time.
config IMX_MBOX
tristate "i.MX Mailbox"
depends on ARCH_MXC || COMPILE_TEST
@@ -68,15 +80,6 @@ config OMAP2PLUS_MBOX
OMAP2/3; or IPU, IVA HD and DSP in OMAP4/5. Say Y here if you
want to use OMAP2+ Mailbox framework support.
config OMAP_MBOX_KFIFO_SIZE
int "Mailbox kfifo default buffer size (bytes)"
depends on OMAP2PLUS_MBOX
default 256
help
Specify the default size of mailbox's kfifo buffers (bytes).
This can also be changed at runtime (via the mbox_kfifo_size
module parameter).
config ROCKCHIP_MBOX
bool "Rockchip Soc Integrated Mailbox Support"
depends on ARCH_ROCKCHIP || COMPILE_TEST

View File

@@ -9,6 +9,8 @@ obj-$(CONFIG_ARM_MHU) += arm_mhu.o arm_mhu_db.o
obj-$(CONFIG_ARM_MHU_V2) += arm_mhuv2.o
obj-$(CONFIG_ARM_MHU_V3) += arm_mhuv3.o
obj-$(CONFIG_IMX_MBOX) += imx-mailbox.o
obj-$(CONFIG_ARMADA_37XX_RWTM_MBOX) += armada-37xx-rwtm-mailbox.o

1103
drivers/mailbox/arm_mhuv3.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -43,6 +43,7 @@
#include <linux/dma-direction.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
#include <linux/workqueue.h>
#define PDC_SUCCESS 0
@@ -293,8 +294,8 @@ struct pdc_state {
unsigned int pdc_irq;
/* tasklet for deferred processing after DMA rx interrupt */
struct tasklet_struct rx_tasklet;
/* work for deferred processing after DMA rx interrupt */
struct work_struct rx_work;
/* Number of bytes of receive status prior to each rx frame */
u32 rx_status_len;
@@ -952,18 +953,18 @@ static irqreturn_t pdc_irq_handler(int irq, void *data)
iowrite32(intstatus, pdcs->pdc_reg_vbase + PDC_INTSTATUS_OFFSET);
/* Wakeup IRQ thread */
tasklet_schedule(&pdcs->rx_tasklet);
queue_work(system_bh_wq, &pdcs->rx_work);
return IRQ_HANDLED;
}
/**
* pdc_tasklet_cb() - Tasklet callback that runs the deferred processing after
* pdc_work_cb() - Work callback that runs the deferred processing after
* a DMA receive interrupt. Reenables the receive interrupt.
* @t: Pointer to the Altera sSGDMA channel structure
*/
static void pdc_tasklet_cb(struct tasklet_struct *t)
static void pdc_work_cb(struct work_struct *t)
{
struct pdc_state *pdcs = from_tasklet(pdcs, t, rx_tasklet);
struct pdc_state *pdcs = from_work(pdcs, t, rx_work);
pdc_receive(pdcs);
@@ -1577,8 +1578,8 @@ static int pdc_probe(struct platform_device *pdev)
pdc_hw_init(pdcs);
/* Init tasklet for deferred DMA rx processing */
tasklet_setup(&pdcs->rx_tasklet, pdc_tasklet_cb);
/* Init work for deferred DMA rx processing */
INIT_WORK(&pdcs->rx_work, pdc_work_cb);
err = pdc_interrupts_init(pdcs);
if (err)
@@ -1595,7 +1596,7 @@ static int pdc_probe(struct platform_device *pdev)
return PDC_SUCCESS;
cleanup_buf_pool:
tasklet_kill(&pdcs->rx_tasklet);
cancel_work_sync(&pdcs->rx_work);
dma_pool_destroy(pdcs->rx_buf_pool);
cleanup_ring_pool:
@@ -1611,7 +1612,7 @@ static void pdc_remove(struct platform_device *pdev)
pdc_free_debugfs();
tasklet_kill(&pdcs->rx_tasklet);
cancel_work_sync(&pdcs->rx_work);
pdc_hw_disable(pdcs);

View File

@@ -21,6 +21,7 @@
#include <linux/pm_runtime.h>
#include <linux/suspend.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include "mailbox.h"
@@ -80,7 +81,7 @@ struct imx_mu_con_priv {
char irq_desc[IMX_MU_CHAN_NAME_SIZE];
enum imx_mu_chan_type type;
struct mbox_chan *chan;
struct tasklet_struct txdb_tasklet;
struct work_struct txdb_work;
};
struct imx_mu_priv {
@@ -232,7 +233,7 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
break;
case IMX_MU_TYPE_TXDB:
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
tasklet_schedule(&cp->txdb_tasklet);
queue_work(system_bh_wq, &cp->txdb_work);
break;
case IMX_MU_TYPE_TXDB_V2:
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
@@ -420,7 +421,7 @@ static int imx_mu_seco_tx(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp,
}
/* Simulate hack for mbox framework */
tasklet_schedule(&cp->txdb_tasklet);
queue_work(system_bh_wq, &cp->txdb_work);
break;
default:
@@ -484,9 +485,9 @@ exit:
return err;
}
static void imx_mu_txdb_tasklet(unsigned long data)
static void imx_mu_txdb_work(struct work_struct *t)
{
struct imx_mu_con_priv *cp = (struct imx_mu_con_priv *)data;
struct imx_mu_con_priv *cp = from_work(cp, t, txdb_work);
mbox_chan_txdone(cp->chan, 0);
}
@@ -570,8 +571,7 @@ static int imx_mu_startup(struct mbox_chan *chan)
if (cp->type == IMX_MU_TYPE_TXDB) {
/* Tx doorbell don't have ACK support */
tasklet_init(&cp->txdb_tasklet, imx_mu_txdb_tasklet,
(unsigned long)cp);
INIT_WORK(&cp->txdb_work, imx_mu_txdb_work);
return 0;
}
@@ -615,7 +615,7 @@ static void imx_mu_shutdown(struct mbox_chan *chan)
}
if (cp->type == IMX_MU_TYPE_TXDB) {
tasklet_kill(&cp->txdb_tasklet);
cancel_work_sync(&cp->txdb_work);
pm_runtime_put_sync(priv->dev);
return;
}

View File

@@ -465,7 +465,7 @@ static void cmdq_mbox_shutdown(struct mbox_chan *chan)
struct cmdq_task *task, *tmp;
unsigned long flags;
WARN_ON(pm_runtime_get_sync(cmdq->mbox.dev));
WARN_ON(pm_runtime_get_sync(cmdq->mbox.dev) < 0);
spin_lock_irqsave(&thread->chan->lock, flags);
if (list_empty(&thread->task_busy_list))
@@ -765,6 +765,7 @@ static const struct of_device_id cmdq_of_ids[] = {
{.compatible = "mediatek,mt8195-gce", .data = (void *)&gce_plat_mt8195},
{}
};
MODULE_DEVICE_TABLE(of, cmdq_of_ids);
static struct platform_driver cmdq_drv = {
.probe = cmdq_probe,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/*
* This header provides constants for the defined MHUv3 types.
*/
#ifndef _DT_BINDINGS_ARM_MHUV3_DT_H
#define _DT_BINDINGS_ARM_MHUV3_DT_H
#define DBE_EXT 0
#define FCE_EXT 1
#define FE_EXT 2
#endif /* _DT_BINDINGS_ARM_MHUV3_DT_H */

View File

@@ -10,17 +10,4 @@ typedef uintptr_t mbox_msg_t;
#define omap_mbox_message(data) (u32)(mbox_msg_t)(data)
typedef int __bitwise omap_mbox_irq_t;
#define IRQ_TX ((__force omap_mbox_irq_t) 1)
#define IRQ_RX ((__force omap_mbox_irq_t) 2)
struct mbox_chan;
struct mbox_client;
struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl,
const char *chan_name);
void omap_mbox_enable_irq(struct mbox_chan *chan, omap_mbox_irq_t irq);
void omap_mbox_disable_irq(struct mbox_chan *chan, omap_mbox_irq_t irq);
#endif /* OMAP_MAILBOX_H */