All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mailbox: Add Marvell MHU driver
@ 2026-11-19 15:29 Paul Cercueil
  2026-11-19 15:29 ` [PATCH 1/3] dt-bindings: mailbox: add Marvell MHU Paul Cercueil
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Paul Cercueil @ 2026-11-19 15:29 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sudeep Holla,
	Cristian Marussi, Thomas Petazzoni, Sunil Kovvuri Goutham,
	linux-kernel, devicetree, arm-scmi, linux-arm-kernel,
	Paul Cercueil

Hi Jassi,

This patchset adds support for the mailbox found in the OcteonTX and
OcteonTX2 based SoCs, which is used for SCMI communication.

This is technically a v5, where the v4 was sent in 2023 [1].
Given that years have passed, and that the original authors left Marvell
AFAIK, I figured out it was just better to restart at v1.

The last patch applies to the SCMI driver, it does not have a direct
dependency on the other two and can go through the ARM tree, if you or
the ARM-SCMI maintainers prefer so.

Cheers,
-Paul

[1]: https://lore.kernel.org/all/4397b39c-084b-954b-956a-5168a3c8958c@linaro.org/T/

George Cherian (3):
  dt-bindings: mailbox: add Marvell MHU
  mailbox: marvell-mhu: add Marvell MHU driver
  scmi: driver: Increase timeout for rx response

 .../bindings/mailbox/marvell,mhu.yaml         |  60 ++++
 MAINTAINERS                                   |   7 +
 .../firmware/arm_scmi/transports/mailbox.c    |   2 +-
 drivers/mailbox/Kconfig                       |  11 +
 drivers/mailbox/Makefile                      |   2 +
 drivers/mailbox/marvell_mhu.c                 | 267 ++++++++++++++++++
 6 files changed, 348 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
 create mode 100644 drivers/mailbox/marvell_mhu.c

-- 
2.47.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] dt-bindings: mailbox: add Marvell MHU
  2026-11-19 15:29 [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil
@ 2026-11-19 15:29 ` Paul Cercueil
  2026-11-19 15:38   ` sashiko-bot
  2026-11-19 15:29 ` [PATCH 2/3] mailbox: marvell-mhu: add Marvell MHU driver Paul Cercueil
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Paul Cercueil @ 2026-11-19 15:29 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sudeep Holla,
	Cristian Marussi, Thomas Petazzoni, Sunil Kovvuri Goutham,
	linux-kernel, devicetree, arm-scmi, linux-arm-kernel,
	George Cherian, Sujeet Baranwal, Paul Cercueil

From: George Cherian <gcherian@marvell.com>

Marvell Message Handling Unit is a mailbox controller present in
Marvell OcteonTx and OcteonTX2 SoC family.

Signed-off-by: George Cherian <gcherian@marvell.com>
Co-developed-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---
 .../bindings/mailbox/marvell,mhu.yaml         | 60 +++++++++++++++++++
 MAINTAINERS                                   |  6 ++
 2 files changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml

diff --git a/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml b/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
new file mode 100644
index 000000000000..228607165f85
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/marvell,mhu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell Message Handling Unit
+
+maintainers:
+  - Sujeet Baranwal <sbaranwal@marvell.com>
+  - George Cherian <gcherian@marvell.com>
+
+description:
+  The Control-Processors Cluster (CPC) provides Arm-platform specification
+  entities for managing the system. One of the CPC processors is the System
+  Control Processor (SCP). The SCP is responsible, among others, for booting
+  the chip, clock and power initialization, controlling power consumption
+  through DVFS, monitoring temperature sensors and controlling AVS. The SCP,
+  as each XCP, contains mailboxes for software-to-software communications.
+  Mailbox writes cause an interrupt to the local XCP core or to the AP.
+  This driver exposes AP-SCP Message Handling Unit to the system, providing
+  the mailbox communication mechanism to the system, with the intention
+  of plugging into the SCMI framework. It is designed to work with Marvell
+  OcteonTX and OcteonTX2-based platforms.
+  The mailbox has no other usage than SCMI communication. In case of
+  configurations running without SCMI support it should be disabled.
+
+properties:
+  compatible:
+    enum:
+      - marvell,octeontx-mhu
+      - marvell,octeontx2-mhu
+      - marvell,cn10-mhu
+
+  reg:
+    maxItems: 1
+
+  "#mbox-cells":
+    description: Index of the channel
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - "#mbox-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    ecam {
+        #address-cells = <3>;
+        #size-cells = <2>;
+            mailbox: mailbox@1c,0 {
+                compatible = "marvell,octeontx2-mhu";
+                reg = <0xe000 0x0 0x0 0 0>;
+                #mbox-cells = <1>;
+            };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 65e8a4b5c90b..b592a62a5c56 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15959,6 +15959,12 @@ R:	Vamsi Attunuru <vattunuru@marvell.com>
 S:	Supported
 F:	drivers/pci/hotplug/octep_hp.c
 
+MARVELL MHU MAILBOX DRIVER
+M:	Sujeet Baranwal <sbaranwal@marvell.com>
+M:	George Cherian <gcherian@marvell.com>
+S:	Maintained
+F:	Documentation/devicetree/bindings/mailbox/marvell,mhu.yml
+
 MATROX FRAMEBUFFER DRIVER
 L:	linux-fbdev@vger.kernel.org
 S:	Orphan
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] mailbox: marvell-mhu: add Marvell MHU driver
  2026-11-19 15:29 [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil
  2026-11-19 15:29 ` [PATCH 1/3] dt-bindings: mailbox: add Marvell MHU Paul Cercueil
@ 2026-11-19 15:29 ` Paul Cercueil
  2026-11-19 15:49   ` sashiko-bot
  2026-11-19 15:29 ` [PATCH 3/3] scmi: driver: Increase timeout for rx response Paul Cercueil
  2026-11-19 15:54 ` [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil
  3 siblings, 1 reply; 9+ messages in thread
From: Paul Cercueil @ 2026-11-19 15:29 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sudeep Holla,
	Cristian Marussi, Thomas Petazzoni, Sunil Kovvuri Goutham,
	linux-kernel, devicetree, arm-scmi, linux-arm-kernel,
	George Cherian, Sujeet Baranwal, Paul Cercueil

From: George Cherian <gcherian@marvell.com>

Add support for Message Handling Units on Marvell OcteonTx and OcteonTx2
platforms. The module uses mailbox controller interface to provide
communication between SCP and AP using SCMI protocol over a single
shared memory communication channel.

Signed-off-by: George Cherian <gcherian@marvell.com>
Co-developed-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---
 MAINTAINERS                   |   1 +
 drivers/mailbox/Kconfig       |  11 ++
 drivers/mailbox/Makefile      |   2 +
 drivers/mailbox/marvell_mhu.c | 267 ++++++++++++++++++++++++++++++++++
 4 files changed, 281 insertions(+)
 create mode 100644 drivers/mailbox/marvell_mhu.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b592a62a5c56..63042166c0da 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15964,6 +15964,7 @@ M:	Sujeet Baranwal <sbaranwal@marvell.com>
 M:	George Cherian <gcherian@marvell.com>
 S:	Maintained
 F:	Documentation/devicetree/bindings/mailbox/marvell,mhu.yml
+F:	drivers/mailbox/marvell_mhu.c
 
 MATROX FRAMEBUFFER DRIVER
 L:	linux-fbdev@vger.kernel.org
diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
index ab869769e278..ce3b70749a18 100644
--- a/drivers/mailbox/Kconfig
+++ b/drivers/mailbox/Kconfig
@@ -195,6 +195,17 @@ config MAILBOX_TEST
 	  Test client to help with testing new Controller driver
 	  implementations.
 
+config MARVELL_MHU
+	tristate "Marvell Message Handling Unit"
+	depends on (ARM64 || COMPILE_TEST) && 64BIT
+	depends on OF
+	help
+	  This driver adds support for Marvell MHU controller.
+	  The MHU mailbox is used by SCMI for OcteonTX and OcteonTX2
+	  to control various aspects of platform operation like cpufreq
+	  or sensors. The controller supports single channel to SCP.
+	  Say Y here to build this module. If unsure say N.
+
 config POLARFIRE_SOC_MAILBOX
 	tristate "PolarFire SoC (MPFS) Mailbox"
 	depends on HAS_IOMEM
diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile
index 45dc59bb3e7f..83b26e7bbd27 100644
--- a/drivers/mailbox/Makefile
+++ b/drivers/mailbox/Makefile
@@ -49,6 +49,8 @@ obj-$(CONFIG_BCM_PDC_MBOX)	+= bcm-pdc-mailbox.o
 
 obj-$(CONFIG_BCM_FLEXRM_MBOX)	+= bcm-flexrm-mailbox.o
 
+obj-$(CONFIG_MARVELL_MHU)	+= marvell_mhu.o
+
 obj-$(CONFIG_POLARFIRE_SOC_MAILBOX)	+= mailbox-mpfs.o
 
 obj-$(CONFIG_MCHP_SBI_IPC_MBOX)		+= mailbox-mchp-ipc-sbi.o
diff --git a/drivers/mailbox/marvell_mhu.c b/drivers/mailbox/marvell_mhu.c
new file mode 100644
index 000000000000..a037fe104195
--- /dev/null
+++ b/drivers/mailbox/marvell_mhu.c
@@ -0,0 +1,267 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Marvell Message Handling Unit
+ *
+ * Copyright (c) 2023, 2026 Marvell
+ */
+
+#define DRIVER_NAME	"marvell-mhu"
+
+#define pr_fmt(fmt)	DRIVER_NAME ": " fmt
+
+#include <linux/pci.h>
+#include <linux/acpi.h>
+#include <linux/mailbox_controller.h>
+
+#define BAR0		0
+#define SCP_INDEX	0x0
+#define DEV_AP0		0x2
+#define SCP_TO_AP_INTERRUPT	2
+#define INT_VECS_MIN	0
+#define INT_VECS_MAX	3
+
+#define XCPX_DEVY_XCP_MBOX_LINT_OFFSET	0x000E1C00
+#define XCP_TO_DEV_XCP_MBOX_LINT(xcp_core, device_id)  \
+	(XCPX_DEVY_XCP_MBOX_LINT_OFFSET | \
+	((uint64_t)(xcp_core) << 36) | \
+	((uint64_t)(device_id) << 4))
+
+#define AP0_TO_SCP_MBOX_LINT    XCP_TO_DEV_XCP_MBOX_LINT(SCP_INDEX, DEV_AP0)
+
+/*
+ * Doorbell-Register: XCP(0..1)_DEV(0..7)_XCP_MBOX
+ * Communication data from devices to XCP. When written, sets
+ * XCP(0..1)_DEV(0..7)_XCP_MBOX.
+ * PS: it doesn't matter what is written into this register,
+ * Attempting to writing 'anything' would cause an interrupt
+ * to the target!
+ */
+
+#define XCPX_DEVY_XCP_MBOX_OFFSET	0x000E1000
+#define XCP_TO_DEV_XCP_MBOX(xcp_core, device_id) \
+	(XCPX_DEVY_XCP_MBOX_OFFSET | \
+	((uint64_t)(xcp_core) << 36) | \
+	((uint64_t)(device_id) << 4))
+
+/* AP0-to-SCP doorbell */
+#define AP0_TO_SCP_MBOX         XCP_TO_DEV_XCP_MBOX(SCP_INDEX, DEV_AP0)
+
+/*  Register offset: Enable interrupt from SCP to AP */
+#define XCP0_XCP_DEV0_MBOX_RINT_ENA_W1S	0x000D1C40
+#define XCP0_XCP_DEV1_MBOX_RINT_ENA_W1S	0x000D1C50
+#define XCP0_XCP_DEV2_MBOX_RINT_ENA_W1S	0x000D1C60
+#define XCP0_XCP_DEV3_MBOX_RINT_ENA_W1S	0x000D1C70
+
+/* Rx interrupt from SCP to Non-secure AP (linux kernel) */
+#define XCPX_XCP_DEVY_MBOX_RINT_OFFSET 0x000D1C00
+#define XCPX_XCP_DEVY_MBOX_RINT(xcp_core, device_id) \
+	(XCPX_XCP_DEVY_MBOX_RINT_OFFSET | \
+	((uint64_t)(xcp_core) << 36) | \
+	((uint64_t)(device_id) << 4))
+
+/* The interrupt status register */
+#define SCP_TO_AP0_MBOX_RINT  XCPX_XCP_DEVY_MBOX_RINT(SCP_INDEX, DEV_AP0)
+
+#define XCPX_XCP_DEVY_MBOX_RINT_OFFSET	0x000D1C00
+#define XCPX_XCP_DEVY_MBOX_RINT(xcp_core, device_id) \
+	(XCPX_XCP_DEVY_MBOX_RINT_OFFSET | \
+	((uint64_t)(xcp_core) << 36) | \
+	((uint64_t)(device_id) << 4))
+
+#define SCP_TO_AP0_MBOX_RINT  XCPX_XCP_DEVY_MBOX_RINT(SCP_INDEX, DEV_AP0)
+#define SCP_TO_DEV0 XCPX_XCP_DEVY_MBOX_RINT(0, 0)
+#define SCP_TO_DEV1 XCPX_XCP_DEVY_MBOX_RINT(0, 1)
+#define SCP_TO_DEV2 XCPX_XCP_DEVY_MBOX_RINT(0, 2)
+#define SCP_TO_DEV3 XCPX_XCP_DEVY_MBOX_RINT(0, 3)
+
+struct mrvl_mhu {
+	/* SCP link information */
+	void __iomem *base; /* tx_reg, rx_reg */
+
+	struct mbox_controller ctrl;
+	struct mbox_chan chan;
+};
+
+static irqreturn_t mrvl_mhu_rx_interrupt(int irq, void *p)
+{
+	struct mrvl_mhu *mhu = p;
+	u64 val;
+
+	/* Read interrupt status register */
+	val = readq_relaxed(mhu->base + SCP_TO_AP0_MBOX_RINT);
+	if (val) {
+		/* Clear the interrupt : Write on clear */
+		writeq_relaxed(1ul, mhu->base + SCP_TO_AP0_MBOX_RINT);
+		/* Poke mbox */
+		mbox_chan_received_data(&mhu->chan, (void *)&val);
+		return IRQ_HANDLED;
+	}
+
+	return IRQ_NONE;
+}
+
+static int mrvl_mhu_send_data(struct mbox_chan *chan, void *data)
+{
+	const u64 doorbell = 0xff;  /* Arbitrary value, SCP requires a value */
+	struct mrvl_mhu *mhu = chan->con_priv;
+
+	/* signal SCP */
+	iowrite64(doorbell, mhu->base + AP0_TO_SCP_MBOX);
+
+	return 0;
+}
+
+static bool mrvl_mhu_last_tx_done(struct mbox_chan *chan)
+{
+	struct mrvl_mhu *mhu = chan->con_priv;
+	u64 status;
+
+	status = ioread64(mhu->base + XCPX_XCP_DEVY_MBOX_RINT(0, 2));
+
+	return status != 0;
+}
+
+static int mrvl_mhu_startup(struct mbox_chan *chan)
+{
+	struct mrvl_mhu *mhu = chan->con_priv;
+
+	/* Enable interrupts only if there is client for data */
+	writeq_relaxed(1ul, mhu->base + XCP0_XCP_DEV2_MBOX_RINT_ENA_W1S);
+
+	return 0;
+}
+
+/* Define operations related to mbox */
+static const struct mbox_chan_ops mrvl_mhu_chan_ops = {
+	.startup = mrvl_mhu_startup,
+	.send_data = mrvl_mhu_send_data,
+	.last_tx_done = mrvl_mhu_last_tx_done,
+};
+
+static int mrvl_mhu_setup_irq(struct pci_dev *pdev)
+{
+	struct device *dev;
+	struct mrvl_mhu *mhu;
+	int irq, ret, nvec;
+
+	mhu = pci_get_drvdata(pdev);
+	dev = &pdev->dev;
+
+	nvec = pci_alloc_irq_vectors(pdev, INT_VECS_MIN, INT_VECS_MAX, PCI_IRQ_MSIX);
+	if (nvec < 0)
+		return nvec;
+
+	irq = pci_irq_vector(pdev, SCP_TO_AP_INTERRUPT);
+	if (irq < 0) {
+		ret = irq;
+		goto irq_err;
+	}
+
+	ret = devm_request_irq(dev, irq, mrvl_mhu_rx_interrupt,
+			       0, "mvl-mhu", mhu);
+	if (ret)
+		goto irq_err;
+
+	return 0;
+
+irq_err:
+	pci_free_irq_vectors(pdev);
+
+	return ret;
+}
+
+static const struct of_device_id mrvl_mhu_dt_ids[] = {
+	{ .compatible = "marvell,octeontx-mhu" },
+	{ .compatible = "marvell,octeontx2-mhu" },
+	{ .compatible = "marvell,cn10-mhu" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, mrvl_mhu_dt_ids);
+
+#define PCI_DEVICE_ID_CAVIUM_OCTEON_MHU	0xa067
+static const struct pci_device_id mrvl_mhu_ids[] = {
+	{ PCI_VDEVICE(CAVIUM, PCI_DEVICE_ID_CAVIUM_OCTEON_MHU) },
+	{ 0 },
+};
+MODULE_DEVICE_TABLE(pci, mrvl_mhu_ids);
+
+static int mrvl_mhu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+	struct device *dev = &pdev->dev;
+	struct mrvl_mhu *mhu;
+	int ret;
+
+	/* Only support PCI devices with a corresponding OF node. */
+	if (!dev->of_node)
+		return -ENODEV;
+	if (!of_match_node(mrvl_mhu_dt_ids, dev->of_node))
+		return -EINVAL;
+
+	mhu = devm_kzalloc(dev, sizeof(*mhu), GFP_KERNEL);
+	if (!mhu)
+		return -ENOMEM;
+
+	mhu->chan = (struct mbox_chan) {
+		.con_priv = mhu,
+	};
+
+	mhu->ctrl = (struct mbox_controller){
+		.chans = &mhu->chan,
+		.num_chans = 1,
+		.txdone_poll = true,
+		.txpoll_period = 100,
+		.ops = &mrvl_mhu_chan_ops,
+		.dev = dev,
+	};
+
+	pci_set_drvdata(pdev, mhu);
+	ret = pcim_enable_device(pdev);
+	if (ret)
+		return ret;
+
+	ret = pcim_request_region(pdev, BAR0, DRIVER_NAME);
+	if (ret)
+		return ret;
+
+	mhu->base = pcim_iomap(pdev, BAR0, pci_resource_len(pdev, BAR0));
+	if (!mhu->base)
+		return -EINVAL;
+
+	/* Configure IRQ from SCP to AP */
+	ret = mrvl_mhu_setup_irq(pdev);
+	if (ret)
+		return ret;
+
+	ret = mbox_controller_register(&mhu->ctrl);
+	if (ret) {
+		pci_free_irq_vectors(pdev);
+		return ret;
+	}
+
+	return 0;
+}
+
+static void mrvl_mhu_remove(struct pci_dev *pdev)
+{
+	struct mrvl_mhu *mhu = pci_get_drvdata(pdev);
+
+	mbox_controller_unregister(&mhu->ctrl);
+	pci_free_irq_vectors(pdev);
+}
+
+static struct pci_driver mrvl_mhu_driver = {
+	.name = DRIVER_NAME,
+	.id_table = mrvl_mhu_ids,
+	.probe = mrvl_mhu_probe,
+	.remove = mrvl_mhu_remove,
+	.driver = {
+		.name = DRIVER_NAME,
+		.of_match_table = mrvl_mhu_dt_ids,
+	},
+};
+module_pci_driver(mrvl_mhu_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Marvell Message Handling Unit");
+MODULE_AUTHOR("Sujeet Baranwal <sbaranwal@marvell.com>");
+MODULE_AUTHOR("George Cherian <gcherian@marvell.com>");
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] scmi: driver: Increase timeout for rx response
  2026-11-19 15:29 [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil
  2026-11-19 15:29 ` [PATCH 1/3] dt-bindings: mailbox: add Marvell MHU Paul Cercueil
  2026-11-19 15:29 ` [PATCH 2/3] mailbox: marvell-mhu: add Marvell MHU driver Paul Cercueil
@ 2026-11-19 15:29 ` Paul Cercueil
  2026-11-19 15:38   ` sashiko-bot
  2026-11-19 17:32   ` Sudeep Holla
  2026-11-19 15:54 ` [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil
  3 siblings, 2 replies; 9+ messages in thread
From: Paul Cercueil @ 2026-11-19 15:29 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sudeep Holla,
	Cristian Marussi, Thomas Petazzoni, Sunil Kovvuri Goutham,
	linux-kernel, devicetree, arm-scmi, linux-arm-kernel,
	George Cherian, Sujeet Baranwal, Paul Cercueil

From: George Cherian <gcherian@marvell.com>

The timeout is way off on the Marvell CN10K SoC, where the firmware
processor can take more than 200ms to answer.

Signed-off-by: George Cherian <gcherian@marvell.com>
Co-developed-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Sujeet Baranwal <sbaranwal@marvell.com>
Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
---
 drivers/firmware/arm_scmi/transports/mailbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c
index 308736c3ead9..78c38d2644aa 100644
--- a/drivers/firmware/arm_scmi/transports/mailbox.c
+++ b/drivers/firmware/arm_scmi/transports/mailbox.c
@@ -380,7 +380,7 @@ static const struct scmi_transport_ops scmi_mailbox_ops = {
 
 static struct scmi_desc scmi_mailbox_desc = {
 	.ops = &scmi_mailbox_ops,
-	.max_rx_timeout_ms = 30, /* We may increase this if required */
+	.max_rx_timeout_ms = 500, /* We may increase this if required */
 	.max_msg = 20, /* Limited by MBOX_TX_QUEUE_LEN */
 	.max_msg_size = SCMI_SHMEM_MAX_PAYLOAD_SIZE,
 };
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] scmi: driver: Increase timeout for rx response
  2026-11-19 15:29 ` [PATCH 3/3] scmi: driver: Increase timeout for rx response Paul Cercueil
@ 2026-11-19 15:38   ` sashiko-bot
  2026-11-19 17:32   ` Sudeep Holla
  1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-19 15:38 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scmi: global max_rx_timeout_ms increase instead of per-SoC DT
  property
--

commit a587b3cdc57b99607cd614c8d305614227ccea74
Author: George Cherian <gcherian@marvell.com>

scmi: driver: Increase timeout for rx response

This commit increases the default max_rx_timeout_ms in scmi_mailbox_desc
from 30ms to 500ms to accommodate the Marvell CN10K firmware response
time.

> diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c
> index 308736c3ead9c..78c38d2644aa0 100644
> --- a/drivers/firmware/arm_scmi/transports/mailbox.c
> +++ b/drivers/firmware/arm_scmi/transports/mailbox.c
> @@ -380,7 +380,7 @@ static const struct scmi_transport_ops scmi_mailbox_ops = {
>  
>  static struct scmi_desc scmi_mailbox_desc = {
>  	.ops = &scmi_mailbox_ops,
> -	.max_rx_timeout_ms = 30, /* We may increase this if required */
> +	.max_rx_timeout_ms = 500, /* We may increase this if required */
>  	.max_msg = 20, /* Limited by MBOX_TX_QUEUE_LEN */
>  	.max_msg_size = SCMI_SHMEM_MAX_PAYLOAD_SIZE,
>  };

[Severity: Medium]
Should the 500ms timeout for Marvell CN10K be configured via the
"arm,max-rx-timeout-ms" DeviceTree property instead of raising
scmi_mailbox_desc.max_rx_timeout_ms for all mailbox platforms?

scmi_transport_setup() already parses "arm,max-rx-timeout-ms" to override
trans->desc.max_rx_timeout_ms per platform:

drivers/firmware/arm_scmi/driver.c:scmi_transport_setup() {
    ...
	ret = of_property_read_u32(dev->of_node, "arm,max-rx-timeout-ms",
				   &trans->desc.max_rx_timeout_ms);
    ...
}

Raising the default in scmi_mailbox_desc affects every mailbox platform,
increasing the worst-case busy-wait in shmem_tx_prepare() (2 *
cinfo->rx_timeout_ms, called from mailbox_send_message() -> msg_submit()
under spin_lock_irqsave(&chan->lock)) from 60ms to 1000ms with interrupts
disabled when a channel is busy, as well as the worst-case atomic busy-spin
in scmi_wait_for_reply() from 30ms to 500ms.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119152944.276763-1-paul.cercueil@bootlin.com?part=3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] dt-bindings: mailbox: add Marvell MHU
  2026-11-19 15:29 ` [PATCH 1/3] dt-bindings: mailbox: add Marvell MHU Paul Cercueil
@ 2026-11-19 15:38   ` sashiko-bot
  0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-19 15:38 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] dt-bindings: mailbox: marvell,mhu: broken .yml path and order in
  MAINTAINERS
- [Low] dt-bindings: mailbox: marvell,mhu: indentation and style issues
  in DTS example
--

commit 4caa249d5ea1d3d9950edc33feb82a1fda934ec0
Author: George Cherian <gcherian@marvell.com>

dt-bindings: mailbox: add Marvell MHU

This commit adds the device tree binding schema and MAINTAINERS entry for
the Marvell Message Handling Unit mailbox controller on OcteonTX and
OcteonTX2 SoCs.

> diff --git a/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml b/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
> new file mode 100644
> index 0000000000000..228607165f850
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
> @@ -0,0 +1,60 @@

[ ... ]

> +examples:
> +  - |
> +    ecam {
> +        #address-cells = <3>;
> +        #size-cells = <2>;
> +            mailbox: mailbox@1c,0 {
> +                compatible = "marvell,octeontx2-mhu";
> +                reg = <0xe000 0x0 0x0 0 0>;
> +                #mbox-cells = <1>;
> +            };
> +    };

[Severity: Low]
In this DTS example, the child node mailbox@1c,0 is indented by 8 spaces
relative to ecam instead of 4 spaces, is missing a blank line after
#size-cells = <2>;, and defines an unused mailbox: label.

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 65e8a4b5c90b1..b592a62a5c563 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15959,6 +15959,12 @@ R:	Vamsi Attunuru <vattunuru@marvell.com>
>  S:	Supported
>  F:	drivers/pci/hotplug/octep_hp.c
>  
> +MARVELL MHU MAILBOX DRIVER
> +M:	Sujeet Baranwal <sbaranwal@marvell.com>
> +M:	George Cherian <gcherian@marvell.com>
> +S:	Maintained
> +F:	Documentation/devicetree/bindings/mailbox/marvell,mhu.yml
> +
>  MATROX FRAMEBUFFER DRIVER
>  L:	linux-fbdev@vger.kernel.org
>  S:	Orphan

[Severity: Low]
Should this F: entry end in .yaml instead of .yml to match the file created
by this commit?  Because the path does not exist, scripts/get_maintainer.pl
will not match the binding file and --self-test=patterns reports a broken
file pattern.  Also, MARVELL MHU MAILBOX DRIVER is placed after MARVELL
OCTEON HOTPLUG DRIVER rather than in alphabetical order between MARVELL
MACCHIATOBIN SUPPORT and MARVELL MV643XX ETHERNET DRIVER.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119152944.276763-1-paul.cercueil@bootlin.com?part=1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] mailbox: marvell-mhu: add Marvell MHU driver
  2026-11-19 15:29 ` [PATCH 2/3] mailbox: marvell-mhu: add Marvell MHU driver Paul Cercueil
@ 2026-11-19 15:49   ` sashiko-bot
  0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-19 15:49 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] mailbox: marvell-mhu: manual pci_free_irq_vectors() conflicts
  with devres
- [High] mailbox: marvell-mhu: missing shutdown op causes NULL deref in
  IRQ
- [Medium] mailbox: marvell-mhu: missing PCI dependency in Kconfig
- [Medium] mailbox: marvell-mhu: wrong register and polarity in
  mrvl_mhu_last_tx_done()
- [Low] mailbox: marvell-mhu: duplicate and unused register macro
  definitions
--

commit d88d0044b75f722104999e16b9dd2c9f50a997d0
Author: George Cherian <gcherian@marvell.com>

mailbox: marvell-mhu: add Marvell MHU driver

This commit adds a PCI mailbox controller driver for the Marvell Message
Handling Unit on OcteonTX and OcteonTX2 platforms.

> diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig
> index ab869769e2789..ce3b70749a182 100644
> --- a/drivers/mailbox/Kconfig
> +++ b/drivers/mailbox/Kconfig
> @@ -195,6 +195,17 @@ config MAILBOX_TEST
>  	  Test client to help with testing new Controller driver
>  	  implementations.
>  
> +config MARVELL_MHU
> +	tristate "Marvell Message Handling Unit"
> +	depends on (ARM64 || COMPILE_TEST) && 64BIT
> +	depends on OF
> +	help

[Severity: Medium]
Should MARVELL_MHU also depend on PCI?  Without CONFIG_PCI, building this
driver fails because module_pci_driver() is only defined under CONFIG_PCI
and pcim_request_region() and pcim_iomap() have no !CONFIG_PCI stubs.

[ ... ]

> diff --git a/drivers/mailbox/marvell_mhu.c b/drivers/mailbox/marvell_mhu.c
> new file mode 100644
> index 0000000000000..a037fe104195b
> --- /dev/null
> +++ b/drivers/mailbox/marvell_mhu.c

[ ... ]

> +/*  Register offset: Enable interrupt from SCP to AP */
> +#define XCP0_XCP_DEV0_MBOX_RINT_ENA_W1S	0x000D1C40
> +#define XCP0_XCP_DEV1_MBOX_RINT_ENA_W1S	0x000D1C50
> +#define XCP0_XCP_DEV2_MBOX_RINT_ENA_W1S	0x000D1C60
> +#define XCP0_XCP_DEV3_MBOX_RINT_ENA_W1S	0x000D1C70
> +
> +/* Rx interrupt from SCP to Non-secure AP (linux kernel) */
> +#define XCPX_XCP_DEVY_MBOX_RINT_OFFSET 0x000D1C00
> +#define XCPX_XCP_DEVY_MBOX_RINT(xcp_core, device_id) \
> +	(XCPX_XCP_DEVY_MBOX_RINT_OFFSET | \
> +	((uint64_t)(xcp_core) << 36) | \
> +	((uint64_t)(device_id) << 4))
> +
> +/* The interrupt status register */
> +#define SCP_TO_AP0_MBOX_RINT  XCPX_XCP_DEVY_MBOX_RINT(SCP_INDEX, DEV_AP0)
> +
> +#define XCPX_XCP_DEVY_MBOX_RINT_OFFSET	0x000D1C00
> +#define XCPX_XCP_DEVY_MBOX_RINT(xcp_core, device_id) \
> +	(XCPX_XCP_DEVY_MBOX_RINT_OFFSET | \
> +	((uint64_t)(xcp_core) << 36) | \
> +	((uint64_t)(device_id) << 4))
> +
> +#define SCP_TO_AP0_MBOX_RINT  XCPX_XCP_DEVY_MBOX_RINT(SCP_INDEX, DEV_AP0)
> +#define SCP_TO_DEV0 XCPX_XCP_DEVY_MBOX_RINT(0, 0)
> +#define SCP_TO_DEV1 XCPX_XCP_DEVY_MBOX_RINT(0, 1)
> +#define SCP_TO_DEV2 XCPX_XCP_DEVY_MBOX_RINT(0, 2)
> +#define SCP_TO_DEV3 XCPX_XCP_DEVY_MBOX_RINT(0, 3)

[Severity: Low]
This isn't a bug, but XCPX_XCP_DEVY_MBOX_RINT_OFFSET,
XCPX_XCP_DEVY_MBOX_RINT, and SCP_TO_AP0_MBOX_RINT are defined twice here,
and XCP0_XCP_DEV0/1/3_MBOX_RINT_ENA_W1S and SCP_TO_DEV0..3 are unused.

> +
> +struct mrvl_mhu {
> +	/* SCP link information */
> +	void __iomem *base; /* tx_reg, rx_reg */
> +
> +	struct mbox_controller ctrl;
> +	struct mbox_chan chan;
> +};
> +
> +static irqreturn_t mrvl_mhu_rx_interrupt(int irq, void *p)
> +{
> +	struct mrvl_mhu *mhu = p;
> +	u64 val;
> +
> +	/* Read interrupt status register */
> +	val = readq_relaxed(mhu->base + SCP_TO_AP0_MBOX_RINT);
> +	if (val) {
> +		/* Clear the interrupt : Write on clear */
> +		writeq_relaxed(1ul, mhu->base + SCP_TO_AP0_MBOX_RINT);
> +		/* Poke mbox */
> +		mbox_chan_received_data(&mhu->chan, (void *)&val);
> +		return IRQ_HANDLED;
> +	}
> +
> +	return IRQ_NONE;
> +}
> +
> +static int mrvl_mhu_send_data(struct mbox_chan *chan, void *data)
> +{
> +	const u64 doorbell = 0xff;  /* Arbitrary value, SCP requires a value */
> +	struct mrvl_mhu *mhu = chan->con_priv;
> +
> +	/* signal SCP */
> +	iowrite64(doorbell, mhu->base + AP0_TO_SCP_MBOX);
> +
> +	return 0;
> +}
> +
> +static bool mrvl_mhu_last_tx_done(struct mbox_chan *chan)
> +{
> +	struct mrvl_mhu *mhu = chan->con_priv;
> +	u64 status;
> +
> +	status = ioread64(mhu->base + XCPX_XCP_DEVY_MBOX_RINT(0, 2));
> +
> +	return status != 0;
> +}

[Severity: Medium]
Does mrvl_mhu_last_tx_done() check the wrong register and polarity?

XCPX_XCP_DEVY_MBOX_RINT(0, 2) is SCP_TO_AP0_MBOX_RINT, the SCP-to-AP0 RX
interrupt status register, which mrvl_mhu_rx_interrupt() immediately clears
to 0 in hardirq context when an RX interrupt fires.  Consequently, any
client relying on the controller's txdone_poll = true will read 0 and time
out.  Meanwhile, the AP0-to-SCP TX interrupt status macro
AP0_TO_SCP_MBOX_LINT defined earlier in this file is unused, and its status
bit is cleared to 0 when the SCP consumes the doorbell (status == 0).

> +
> +static int mrvl_mhu_startup(struct mbox_chan *chan)
> +{
> +	struct mrvl_mhu *mhu = chan->con_priv;
> +
> +	/* Enable interrupts only if there is client for data */
> +	writeq_relaxed(1ul, mhu->base + XCP0_XCP_DEV2_MBOX_RINT_ENA_W1S);
> +
> +	return 0;
> +}
> +
> +/* Define operations related to mbox */
> +static const struct mbox_chan_ops mrvl_mhu_chan_ops = {
> +	.startup = mrvl_mhu_startup,
> +	.send_data = mrvl_mhu_send_data,
> +	.last_tx_done = mrvl_mhu_last_tx_done,
> +};

[Severity: High]
Can an SCP interrupt after mbox_free_channel() cause a NULL pointer
dereference in mrvl_mhu_rx_interrupt() -> mbox_chan_received_data()?

mrvl_mhu_startup() enables the hardware interrupt via
XCP0_XCP_DEV2_MBOX_RINT_ENA_W1S, but mrvl_mhu_chan_ops provides no
.shutdown callback to disable it when a client releases the channel (or if
the interrupt was already left enabled before a client binds).  Once
mbox_free_channel() sets chan->cl = NULL, an incoming interrupt calls
mbox_chan_received_data(&mhu->chan, ...), which unconditionally
dereferences chan->cl->rx_callback.  In addition, mrvl_mhu_rx_interrupt()
clears SCP_TO_AP0_MBOX_RINT before mbox_chan_received_data() finishes
processing the shared memory payload.

[ ... ]

> +	pci_set_drvdata(pdev, mhu);
> +	ret = pcim_enable_device(pdev);
> +	if (ret)
> +		return ret;
> +
> +	ret = pcim_request_region(pdev, BAR0, DRIVER_NAME);
> +	if (ret)
> +		return ret;
> +
> +	mhu->base = pcim_iomap(pdev, BAR0, pci_resource_len(pdev, BAR0));
> +	if (!mhu->base)
> +		return -EINVAL;
> +
> +	/* Configure IRQ from SCP to AP */
> +	ret = mrvl_mhu_setup_irq(pdev);
> +	if (ret)
> +		return ret;
> +
> +	ret = mbox_controller_register(&mhu->ctrl);
> +	if (ret) {
> +		pci_free_irq_vectors(pdev);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void mrvl_mhu_remove(struct pci_dev *pdev)
> +{
> +	struct mrvl_mhu *mhu = pci_get_drvdata(pdev);
> +
> +	mbox_controller_unregister(&mhu->ctrl);
> +	pci_free_irq_vectors(pdev);
> +}

[Severity: High]
Does calling pci_free_irq_vectors() here tear down the MSI-X IRQ descriptor
while the devm_request_irq() handler is still registered?

Because mrvl_mhu_probe() calls pcim_enable_device(), pci_alloc_irq_vectors()
is already managed by devres (via pcim_msi_release()).  Calling
pci_free_irq_vectors() manually in mrvl_mhu_remove() and on the
mbox_controller_register() failure path frees the IRQ descriptors before
devres runs devm_irq_release(), which triggers a warning when removing the
populated procfs IRQ directory, causes free_irq() to fail to find the
descriptor and leak struct irqaction, and then runs pci_free_irq_vectors()
a second time during devres teardown.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119152944.276763-1-paul.cercueil@bootlin.com?part=2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] mailbox: Add Marvell MHU driver
  2026-11-19 15:29 [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil
                   ` (2 preceding siblings ...)
  2026-11-19 15:29 ` [PATCH 3/3] scmi: driver: Increase timeout for rx response Paul Cercueil
@ 2026-11-19 15:54 ` Paul Cercueil
  3 siblings, 0 replies; 9+ messages in thread
From: Paul Cercueil @ 2026-11-19 15:54 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Sudeep Holla,
	Cristian Marussi, Thomas Petazzoni, Sunil Kovvuri Goutham,
	linux-kernel, devicetree, arm-scmi, linux-arm-kernel

FYI Sashiko found issues in all patches. I'll send a v2 tomorrow or next week.

Cheers,
-Paul

Le jeudi 19 novembre 2026 à 16:29 +0100, Paul Cercueil a écrit :
> Hi Jassi,
> 
> This patchset adds support for the mailbox found in the OcteonTX and
> OcteonTX2 based SoCs, which is used for SCMI communication.
> 
> This is technically a v5, where the v4 was sent in 2023 [1].
> Given that years have passed, and that the original authors left Marvell
> AFAIK, I figured out it was just better to restart at v1.
> 
> The last patch applies to the SCMI driver, it does not have a direct
> dependency on the other two and can go through the ARM tree, if you or
> the ARM-SCMI maintainers prefer so.
> 
> Cheers,
> -Paul
> 
> [1]:
> https://lore.kernel.org/all/4397b39c-084b-954b-956a-5168a3c8958c@linaro.org/T/
> 
> George Cherian (3):
>   dt-bindings: mailbox: add Marvell MHU
>   mailbox: marvell-mhu: add Marvell MHU driver
>   scmi: driver: Increase timeout for rx response
> 
>  .../bindings/mailbox/marvell,mhu.yaml         |  60 ++++
>  MAINTAINERS                                   |   7 +
>  .../firmware/arm_scmi/transports/mailbox.c    |   2 +-
>  drivers/mailbox/Kconfig                       |  11 +
>  drivers/mailbox/Makefile                      |   2 +
>  drivers/mailbox/marvell_mhu.c                 | 267 ++++++++++++++++++
>  6 files changed, 348 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/mailbox/marvell,mhu.yaml
>  create mode 100644 drivers/mailbox/marvell_mhu.c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] scmi: driver: Increase timeout for rx response
  2026-11-19 15:29 ` [PATCH 3/3] scmi: driver: Increase timeout for rx response Paul Cercueil
  2026-11-19 15:38   ` sashiko-bot
@ 2026-11-19 17:32   ` Sudeep Holla
  1 sibling, 0 replies; 9+ messages in thread
From: Sudeep Holla @ 2026-11-19 17:32 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Jassi Brar, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Cristian Marussi, Thomas Petazzoni, Sunil Kovvuri Goutham,
	linux-kernel, devicetree, arm-scmi, linux-arm-kernel,
	George Cherian, Sujeet Baranwal

On Thu, Nov 19, 2026 at 04:29:44PM +0100, Paul Cercueil wrote:
> From: George Cherian <gcherian@marvell.com>
> 
> The timeout is way off on the Marvell CN10K SoC, where the firmware
> processor can take more than 200ms to answer.
> 

NACK, why can't you just use arm,max-rx-timeout-ms in your DT ?

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-19 17:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 15:29 [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil
2026-11-19 15:29 ` [PATCH 1/3] dt-bindings: mailbox: add Marvell MHU Paul Cercueil
2026-11-19 15:38   ` sashiko-bot
2026-11-19 15:29 ` [PATCH 2/3] mailbox: marvell-mhu: add Marvell MHU driver Paul Cercueil
2026-11-19 15:49   ` sashiko-bot
2026-11-19 15:29 ` [PATCH 3/3] scmi: driver: Increase timeout for rx response Paul Cercueil
2026-11-19 15:38   ` sashiko-bot
2026-11-19 17:32   ` Sudeep Holla
2026-11-19 15:54 ` [PATCH 0/3] mailbox: Add Marvell MHU driver Paul Cercueil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.