Skip to contentSkip to conversation

Xilinx ZynqMP IPI Mailbox Controller Driver

PATCH Superseded Wendy Liang 5 participants 11 messages Jan 4, 2018 – Oct 9, 2018

Subsystems (3)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v3 cover Xilinx ZynqMP IPI Mailbox Controller Driver

Introduce mailbox controller driver for ZynqMP IPI(Inter-processor interrupt) IP core.

There is previous discussion on the DT bindings:
https://patchwork.kernel.org/patch/10012755/

v3:
- add NULL entry to of_device_id of IPI controller

v2:
- change SPDX-License-Identifier license text style in .c file
- replace xlnx-ipi-ids with xlnx,ipi-ids

Wendy Liang (2):
mailbox: ZynqMP IPI mailbox controller
dt-bindings: mailbox: Add Xilinx IPI Mailbox

 .../bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt   | 104 ++++
 drivers/mailbox/Kconfig                            |   8 +
 drivers/mailbox/Makefile                           |   2 +
 drivers/mailbox/zynqmp-ipi-mailbox.c               | 635 +++++++++++++++++++++
 include/linux/mailbox/zynqmp-ipi-message.h         |  24 +
 5 files changed, 773 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt
 create mode 100644 drivers/mailbox/zynqmp-ipi-mailbox.c
 create mode 100644 include/linux/mailbox/zynqmp-ipi-message.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/2 mailbox: ZynqMP IPI mailbox controller

This patch is to introduce ZynqMP IPI mailbox controller driver to use the ZynqMP IPI block as mailboxes.

---
 drivers/mailbox/Kconfig                    |   8 +
 drivers/mailbox/Makefile                   |   2 +
 drivers/mailbox/zynqmp-ipi-mailbox.c       | 635 +++++++++++++++++++++++++++++
 include/linux/mailbox/zynqmp-ipi-message.h |  24 ++
 4 files changed, 669 insertions(+)
 create mode 100644 drivers/mailbox/zynqmp-ipi-mailbox.c
 create mode 100644 include/linux/mailbox/zynqmp-ipi-message.h
drivers/mailbox/Kconfig +8 -0
index ba2f152..876614a 100644
@@ -171,4 +171,12 @@ config BCM_FLEXRM_MBOX
 	  Mailbox implementation of the Broadcom FlexRM ring manager,
 	  which provides access to various offload engines on Broadcom
 	  SoCs. Say Y here if you want to use the Broadcom FlexRM.
+
+config ZYNQMP_IPI_MBOX
+	tristate "Xilinx ZynqMP IPI Mailbox"
+	depends on ARCH_ZYNQMP && OF
+	help
+	  Mailbox implementation for Xilinx ZynqMP IPI. It is used to send
+	  notification or short message between processors with Xilinx
+	  ZynqMP IPI.
 endif
drivers/mailbox/Makefile +2 -0
index 4896f8d..155f72f 100644
@@ -36,3 +36,5 @@ obj-$(CONFIG_BCM_FLEXRM_MBOX)	+= bcm-flexrm-mailbox.o
 obj-$(CONFIG_QCOM_APCS_IPC)	+= qcom-apcs-ipc-mailbox.o
 
 obj-$(CONFIG_TEGRA_HSP_MBOX)	+= tegra-hsp.o
+
+obj-$(CONFIG_ZYNQMP_IPI_MBOX)	+= zynqmp-ipi-mailbox.o
drivers/mailbox/zynqmp-ipi-mailbox.c new file +635 -0

635 lines not on this page · raw message

include/linux/mailbox/zynqmp-ipi-message.h new file +24 -0
new file mode 100644
index 0000000..173c41d
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *  Copyright (C) 2017 Xilinx Inc.
+ *
+ */
+
+#ifndef _LINUX_ZYNQMP_IPI_MESSAGE_H_
+#define _LINUX_ZYNQMP_IPI_MESSAGE_H_
+
+/**
+ * struct zynqmp_ipi_message - ZynqMP IPI message structure
+ * @len:  Length of the request message
+ * @data: Request message pointer
+ *
+ * This is the structure for data used in mbox_send_message
+ * the maximum length of data buffer is fixed to 12 bytes.
+ * Client is supposed to be aware of this.
+ */
+struct zynqmp_ipi_message {
+	size_t len;
+	u8 *data;
+};
+
+#endif /* _LINUX_ZYNQMP_IPI_MESSAGE_H_ */
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/2 dt-bindings: mailbox: Add Xilinx IPI Mailbox

In reply to Wendy Liang

Xilinx ZynqMP IPI(Inter Processor Interrupt) is a hardware block in ZynqMP SoC used for the communication between various processor systems.

---
 .../bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt   | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +104 -0
new file mode 100644
index 0000000..5e270a3
@@ -0,0 +1,104 @@
+Xilinx IPI Mailbox Controller
+========================================
+
+The Xilinx IPI(Inter Processor Interrupt) mailbox controller is to manage
+messaging between two Xilinx Zynq UltraScale+ MPSoC IPI agents. Each IPI
+agent owns registers used for notification and buffers for message.
+
+               +-------------------------------------+
+               | Xilinx ZynqMP IPI Controller        |
+               +-------------------------------------+
+    +--------------------------------------------------+
+ATF                    |                     |
+                       |                     |
+                       |                     |
+    +--------------------------+             |
+                       |                     |
+                       |                     |
+    +--------------------------------------------------+
+            +------------------------------------------+
+            |  +----------------+   +----------------+ |
+Hardware    |  |  IPI Agent     |   |  IPI Buffers   | |
+            |  |  Registers     |   |                | |
+            |  |                |   |                | |
+            |  +----------------+   +----------------+ |
+            |                                          |
+            | Xilinx IPI Agent Block                   |
+            +------------------------------------------+
+
+
+Controller Device Node:
+===========================
+Required properties:
+--------------------
+- compatible:		Shall be: "xlnx,zynqmp-ipi-mailbox"
+- reg:			IPI buffers address ranges
+- reg-names:		Names of the reg resources. It should have:
+			* local_request_region
+			  - IPI request msg buffer written by local and read
+			    by remote
+			* local_response_region
+			  - IPI response msg buffer written by local and read
+			    by remote
+			* remote_request_region
+			  - IPI request msg buffer written by remote and read
+			    by local
+			* remote_response_region
+			  - IPI response msg buffer written by remote and read
+			    by local
+- #mbox-cells:		Shall be 1. It contains:
+			* tx(0) or rx(1) channel
+- xlnx,ipi-ids:		Xilinx IPI agent IDs of the two peers of the
+			Xilinx IPI communication channel.
+- interrupt-parent:	Phandle for the interrupt controller
+- interrupts:		Interrupt information corresponding to the
+			interrupt-names property.
+
+Optional properties:
+--------------------
+- method:              The method of accessing the IPI agent registers.
+                       Permitted values are: "smc" and "hvc". Default is
+                       "smc".
+
+Example:
+===========================
+	/* APU<->RPU0 IPI mailbox controller */
+	ipi_mailbox_rpu0: mailbox at ff90400 {
+		compatible = "xlnx,zynqmp-ipi-mailbox";
+		reg = <0x0 0xff990400 0x0 0x20>,
+		      <0x0 0xff990420 0x0 0x20>,
+		      <0x0 0xff990080 0x0 0x20>,
+		      <0x0 0xff9900a0 0x0 0x20>;
+		reg-names = "local_request_region", "local_response_region",
+			    "remote_request_region", "remote_response_region";
+		#mbox-cells = <1>;
+		xlnx-ipi-ids = <0 1>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 29 4>;
+	};
+	/* APU<->RPU1 IPI mailbox controller */
+	ipi_mailbox_rpu1: mailbox at ff990440 {
+		compatible = "xlnx,zynqmp-ipi-mailbox";
+		reg = <0x0 0xff990440 0x0 0x20>,
+		      <0x0 0xff990460 0x0 0x20>,
+		      <0x0 0xff990280 0x0 0x20>,
+		      <0x0 0xff9902a0 0x0 0x20>;
+		reg-names = "local_request_region", "local_response_region",
+			    "remote_request_region", "remote_response_region";
+		#mbox-cells = <1>;
+		xlnx-ipi-ids = <0 2>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 29 4>;
+	};
+	rpu0 {
+		...
+		mboxes = <&ipi_mailbox_rpu0 0>,
+			 <&ipi_mailbox_rpu0 1>;
+		mbox-names = "tx", "rx";
+	};
+	rpu1 {
+		...
+		mboxes = <&ipi_mailbox_rpu1 0>,
+			 <&ipi_mailbox_rpu1 1>;
+		mbox-names = "tx", "rx";
+	};
Signature · 1 line
2.7.4
maintainer
#3 lore raw

Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 9 lines · Wendy Liang

Xilinx ZynqMP IPI(Inter Processor Interrupt) is a hardware block in ZynqMP SoC used for the communication between various processor systems.

---
 .../bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt   | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt

Please add acks and reviewed-by's when posting new versions.

#4 lore raw

RE: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 20 lines

-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Friday, January 05, 2018 7:32 AM
To: Jiaying Liang <[email protected]>
Cc: jassisinghbrar at gmail.com; michal.simek at xilinx.com; mark.rutland at arm.com; linux-arm-kernel at lists.infradead.org; devicetree at vger.kernel.org; linux-kernel at vger.kernel.org; Jiaying Liang <[email protected]>
Subject: Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 7 lines · Wendy Liang

Xilinx ZynqMP IPI(Inter Processor Interrupt) is a hardware block in ZynqMP SoC used for the communication between various processor systems.

---
 .../bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt   | 104
Quoted 6 lines

+++++++++++++++++++++

Quoted 3 lines
 1 file changed, 104 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt

Please add acks and reviewed-by's when posting new versions.

[Wendy] Thanks, will add this in the next version.

maintainer
#5 lore raw

Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

In reply to Wendy Liang
Quoted 55 lines · Wendy Liang

Xilinx ZynqMP IPI(Inter Processor Interrupt) is a hardware block in ZynqMP SoC used for the communication between various processor systems.

---
 .../bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt   | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +38 -0
new file mode 100644
index 0000000..5e270a3
@@ -0,0 +1,104 @@
+Xilinx IPI Mailbox Controller
+========================================
+
+The Xilinx IPI(Inter Processor Interrupt) mailbox controller is to manage
+messaging between two Xilinx Zynq UltraScale+ MPSoC IPI agents. Each IPI
+agent owns registers used for notification and buffers for message.
+
+               +-------------------------------------+
+               | Xilinx ZynqMP IPI Controller        |
+               +-------------------------------------+
+    +--------------------------------------------------+
+ATF                    |                     |
+                       |                     |
+                       |                     |
+    +--------------------------+             |
+                       |                     |
+                       |                     |
+    +--------------------------------------------------+
+            +------------------------------------------+
+            |  +----------------+   +----------------+ |
+Hardware    |  |  IPI Agent     |   |  IPI Buffers   | |
+            |  |  Registers     |   |                | |
+            |  |                |   |                | |
+            |  +----------------+   +----------------+ |
+            |                                          |
+            | Xilinx IPI Agent Block                   |
+            +------------------------------------------+
+
+
+Controller Device Node:
+===========================
+Required properties:
+--------------------
+- compatible:          Shall be: "xlnx,zynqmp-ipi-mailbox"
+- reg:                 IPI buffers address ranges
+- reg-names:           Names of the reg resources. It should have:
+                       * local_request_region
+                         - IPI request msg buffer written by local and read

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 48

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +10 -0
+                           by remote
+                       * local_response_region
+                         - IPI response msg buffer written by local and read
+                           by remote
+                       * remote_request_region
+                         - IPI request msg buffer written by remote and read
+                           by local
+                       * remote_response_region
+                         - IPI response msg buffer written by remote and read
+                           by local

shmem is option and external to the controller. It should be passed via client's binding.
Please have a look at Sudeep's proposed patch
https://www.spinics.net/lists/arm-kernel/msg626120.html

Quoted 4 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +4 -0
+- #mbox-cells:         Shall be 1. It contains:
+                       * tx(0) or rx(1) channel
+- xlnx,ipi-ids:                Xilinx IPI agent IDs of the two peers of the
+                       Xilinx IPI communication channel.

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 62

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +10 -0
+- interrupt-parent:    Phandle for the interrupt controller
+- interrupts:          Interrupt information corresponding to the
+                       interrupt-names property.
+
+Optional properties:
+--------------------
+- method:              The method of accessing the IPI agent registers.
+                       Permitted values are: "smc" and "hvc". Default is
+                       "smc".
+

Andre almost implemented the generic driver. Can you please have a look at https://www.spinics.net/lists/arm-kernel/msg595416.html
and see if you can just finish it off?

Thanks

#6 lore raw

RE: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 85 lines

-----Original Message-----
From: Jassi Brar [mailto:jassisinghbrar at gmail.com]
Sent: Tuesday, January 09, 2018 12:00 AM
To: Jiaying Liang <[email protected]>
Cc: Michal Simek <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; linux-arm- kernel at lists.infradead.org; Devicetree List <[email protected]>; Linux Kernel Mailing List <[email protected]>; Jiaying Liang <[email protected]>
Subject: Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 7 lines · Wendy Liang

Xilinx ZynqMP IPI(Inter Processor Interrupt) is a hardware block in ZynqMP SoC used for the communication between various processor systems.

---
 .../bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt   | 104

+++++++++++++++++++++

Quoted 8 lines
 1 file changed, 104 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt

diff --git a/Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.tx t b/Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-

mailbox.tx

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-

Quoted 5 lines

t
new file mode 100644
index 0000000..5e270a3

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- new file +0 -0

mailbo

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- line 6

Quoted 8 lines

+++ x.txt

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- new file +6 -0
@@ -0,0 +1,104 @@
+Xilinx IPI Mailbox Controller
+========================================
+
+The Xilinx IPI(Inter Processor Interrupt) mailbox controller is to
+manage messaging between two Xilinx Zynq UltraScale+ MPSoC IPI
+agents. Each IPI agent owns registers used for notification and buffers for

message.

Quoted 39 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- new file +39 -0
+
+               +-------------------------------------+
+               | Xilinx ZynqMP IPI Controller        |
+               +-------------------------------------+
+    +--------------------------------------------------+
+ATF                    |                     |
+                       |                     |
+                       |                     |
+    +--------------------------+             |
+                       |                     |
+                       |                     |
+    +--------------------------------------------------+
+            +------------------------------------------+
+            |  +----------------+   +----------------+ |
+Hardware    |  |  IPI Agent     |   |  IPI Buffers   | |
+            |  |  Registers     |   |                | |
+            |  |                |   |                | |
+            |  +----------------+   +----------------+ |
+            |                                          |
+            | Xilinx IPI Agent Block                   |
+            +------------------------------------------+
+
+
+Controller Device Node:
+===========================
+Required properties:
+--------------------
+- compatible:          Shall be: "xlnx,zynqmp-ipi-mailbox"
+- reg:                 IPI buffers address ranges
+- reg-names:           Names of the reg resources. It should have:
+                       * local_request_region
+                         - IPI request msg buffer written by local and read
+                           by remote
+                       * local_response_region
+                         - IPI response msg buffer written by local and read
+                           by remote
+                       * remote_request_region
+                         - IPI request msg buffer written by remote and read
+                           by local
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- line 48

Quoted 4 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- new file +3 -0
+                       * remote_response_region
+                         - IPI response msg buffer written by remote and read
+                           by local

shmem is option and external to the controller. It should be passed via client's binding.
Please have a look at Sudeep's proposed patch
https://www.spinics.net/lists/arm-kernel/msg626120.html

[Wendy] thanks for the link, but those 'buffers" are registers in the hardware but not memory. It looks like a bit hacky to access them as memory.

Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- new file +9 -0
+- #mbox-cells:         Shall be 1. It contains:
+                       * tx(0) or rx(1) channel
+- xlnx,ipi-ids:                Xilinx IPI agent IDs of the two peers of the
+                       Xilinx IPI communication channel.
+- interrupt-parent:    Phandle for the interrupt controller
+- interrupts:          Interrupt information corresponding to the
+                       interrupt-names property.
+
+Optional properties:
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- line 62

Quoted 5 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi- new file +5 -0
+--------------------
+- method:              The method of accessing the IPI agent registers.
+                       Permitted values are: "smc" and "hvc". Default is
+                       "smc".
+

Andre almost implemented the generic driver. Can you please have a look at
https://www.spinics.net/lists/arm-kernel/msg595416.html
and see if you can just finish it off?

[Wendy] This mailbox controller is about to use Xilinx IPI hardware as mailbox. We use it to send notification/short request to firmware (usually running on another core on SoC), and also to receive notification/short request from firmware. Interrupt is used in the receiving direction. It looks different to the usage of mailbox driver from the link. Is there a plan to extend the ARM SMC mailbox driver to both trigger firmware actions and receive request from firmware?

Thanks,
Wendy

Quoted 2 lines

Thanks

maintainer
#7 lore raw

Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 27 lines · Jiaying Liang
Quoted 19 lines

From: Jassi Brar [mailto:jassisinghbrar at gmail.com]

Quoted 17 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +17 -0
+
+Controller Device Node:
+===========================
+Required properties:
+--------------------
+- compatible:          Shall be: "xlnx,zynqmp-ipi-mailbox"
+- reg:                 IPI buffers address ranges
+- reg-names:           Names of the reg resources. It should have:
+                       * local_request_region
+                         - IPI request msg buffer written by local and read
+                           by remote
+                       * local_response_region
+                         - IPI response msg buffer written by local and read
+                           by remote
+                       * remote_request_region
+                         - IPI request msg buffer written by remote and read
+                           by local
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 48

Quoted 4 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +3 -0
+                       * remote_response_region
+                         - IPI response msg buffer written by remote and read
+                           by local

shmem is option and external to the controller. It should be passed via client's binding.
Please have a look at Sudeep's proposed patch
https://www.spinics.net/lists/arm-kernel/msg626120.html

Quoted 3 lines

[Wendy] thanks for the link, but those 'buffers" are registers in the hardware but not memory.

No, that is for memory, not registers.
Please have a more careful look at the patch.

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

+- #mbox-cells: Shall be 1. It contains:

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +8 -0
+                       * tx(0) or rx(1) channel
+- xlnx,ipi-ids:                Xilinx IPI agent IDs of the two peers of the
+                       Xilinx IPI communication channel.
+- interrupt-parent:    Phandle for the interrupt controller
+- interrupts:          Interrupt information corresponding to the
+                       interrupt-names property.
+
+Optional properties:
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 62

Quoted 5 lines
+--------------------
+- method:              The method of accessing the IPI agent registers.
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +3 -0
+                       Permitted values are: "smc" and "hvc". Default is
+                       "smc".
+

Andre almost implemented the generic driver. Can you please have a look at
https://www.spinics.net/lists/arm-kernel/msg595416.html
and see if you can just finish it off?

Quoted 2 lines

[Wendy] This mailbox controller is about to use Xilinx IPI hardware as mailbox.

I couldn't find anything specific to Xilinx h/w zynqmp_ipi_fw_call() is same as arm_smc_send_data() in Andre's driver (though it needs to pass on [R2,R7] as I suggested in reply to him).

Quoted 3 lines

We use it to send notification/short request to firmware (usually running on another core on SoC),

So does Andre's driver. Which is precise and generic, so I much prefer that.

Quoted 4 lines

and also to receive notification/short request from firmware. Interrupt is used in the receiving direction. It looks different to the usage of mailbox driver from the link.

Yes, there is some difference. But nothing related to your h/w. Andre's driver assume synchronous transmits where the response is filled in the regs upon return.
What kind of calls do you make to your remote firmware? I would expect them to be 'fast'.

Quoted 3 lines

Is there a plan to extend the ARM SMC mailbox driver
to both trigger firmware actions and receive request from firmware?

Sure if we have a genuine requirement we can support RX path as well.

Thanks.

#8 lore raw

Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 28 lines · Jassi Brar
Quoted 27 lines · Jiaying Liang
Quoted 27 lines

From: Jassi Brar [mailto:jassisinghbrar at gmail.com]

Quoted 11 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +10 -0
+
+Controller Device Node:
+===========================
+Required properties:
+--------------------
+- compatible:          Shall be: "xlnx,zynqmp-ipi-mailbox"
+- reg:                 IPI buffers address ranges
+- reg-names:           Names of the reg resources. It should have:
+                       * local_request_region
+                         - IPI request msg buffer written by local and read

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 48

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +10 -0
+                           by remote
+                       * local_response_region
+                         - IPI response msg buffer written by local and read
+                           by remote
+                       * remote_request_region
+                         - IPI request msg buffer written by remote and read
+                           by local
+                       * remote_response_region
+                         - IPI response msg buffer written by remote and read
+                           by local

shmem is option and external to the controller. It should be passed via client's binding.
Please have a look at Sudeep's proposed patch
https://www.spinics.net/lists/arm-kernel/msg626120.html

Quoted 5 lines
Quoted 3 lines

[Wendy] thanks for the link, but those 'buffers" are registers in the hardware but not memory.

No, that is for memory, not registers.
Please have a more careful look at the patch.

Sorry for very late response.

Those are not the normal memory but device memories, they are 32bytes fixed request buffers and response buffers per channel. They come
from the IPI hardware block.

The mailbox framework API "mbox_send_message()" allows users to send message to the mailbox. in this case, just not clear on why we cannot have the buffer in the
controller? These memories are not for sharing data, but just for short notification
messages.

Quoted 34 lines
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines

+- #mbox-cells: Shall be 1. It contains:

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +8 -0
+                       * tx(0) or rx(1) channel
+- xlnx,ipi-ids:                Xilinx IPI agent IDs of the two peers of the
+                       Xilinx IPI communication channel.
+- interrupt-parent:    Phandle for the interrupt controller
+- interrupts:          Interrupt information corresponding to the
+                       interrupt-names property.
+
+Optional properties:
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 62

Quoted 5 lines
+--------------------
+- method:              The method of accessing the IPI agent registers.
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +3 -0
+                       Permitted values are: "smc" and "hvc". Default is
+                       "smc".
+

Andre almost implemented the generic driver. Can you please have a look at
https://www.spinics.net/lists/arm-kernel/msg595416.html
and see if you can just finish it off?

Quoted 2 lines

[Wendy] This mailbox controller is about to use Xilinx IPI hardware as mailbox.

I couldn't find anything specific to Xilinx h/w zynqmp_ipi_fw_call() is same as arm_smc_send_data() in Andre's driver (though it needs to pass on [R2,R7] as I suggested in reply to him).

Quoted 3 lines

We use it to send notification/short request to firmware (usually running on another core on SoC),

So does Andre's driver. Which is precise and generic, so I much prefer that.

Quoted 4 lines

and also to receive notification/short request from firmware. Interrupt is used in the receiving direction. It looks different to the usage of mailbox driver from the link.

Quoted 5 lines

Yes, there is some difference. But nothing related to your h/w. Andre's driver assume synchronous transmits where the response is filled in the regs upon return.
What kind of calls do you make to your remote firmware? I would expect them to be 'fast'.

The reason to have this mailbox driver is because, we have an hardware block for IPI, this hardware block has registers and buffers and we want to to use Linux
kernel mailbox framework APIs such as mbox_send_message() and rx_callback in client drivers to send notification or short request to other processors and receive
response and request.

The reason to use SMC calls to access the registers is because we have the case that both the ATF and Linux kernel drive will need to access the same registers.

I have looked at the arm_smc patch, it looks like it is for synchronous request, and only
allow 32bit message. In our case, we need to:
* besides synchronous request, we also need to handle asynchronous request. The driver will monitor the interrupt to see if there is a message
from the other core.
If yes, it will notify the client from rx_callback.
* put 32bytes short message to the mailbox.

Thanks,
Wendy

Quoted 7 lines
Quoted 4 lines

Is there a plan to extend the ARM SMC mailbox driver
to both trigger firmware actions and receive request from firmware?

Sure if we have a genuine requirement we can support RX path as well.

Thanks.

#9 lore raw

Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

Quoted 110 lines · Wendy Liang
Quoted 28 lines · Jassi Brar
Quoted 27 lines · Jiaying Liang
Quoted 27 lines

From: Jassi Brar [mailto:jassisinghbrar at gmail.com]

Quoted 11 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +10 -0
+
+Controller Device Node:
+===========================
+Required properties:
+--------------------
+- compatible:          Shall be: "xlnx,zynqmp-ipi-mailbox"
+- reg:                 IPI buffers address ranges
+- reg-names:           Names of the reg resources. It should have:
+                       * local_request_region
+                         - IPI request msg buffer written by local and read

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 48

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +10 -0
+                           by remote
+                       * local_response_region
+                         - IPI response msg buffer written by local and read
+                           by remote
+                       * remote_request_region
+                         - IPI request msg buffer written by remote and read
+                           by local
+                       * remote_response_region
+                         - IPI response msg buffer written by remote and read
+                           by local

shmem is option and external to the controller. It should be passed via client's binding.
Please have a look at Sudeep's proposed patch
https://www.spinics.net/lists/arm-kernel/msg626120.html

Quoted 5 lines
Quoted 3 lines

[Wendy] thanks for the link, but those 'buffers" are registers in the hardware but not memory.

No, that is for memory, not registers.
Please have a more careful look at the patch.

Sorry for very late response.

Those are not the normal memory but device memories, they are 32bytes fixed request buffers and response buffers per channel. They come
from the IPI hardware block.

The mailbox framework API "mbox_send_message()" allows users to send message to the mailbox. in this case, just not clear on why we cannot have the buffer in the
controller? These memories are not for sharing data, but just for short notification
messages.

Quoted 34 lines
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines

+- #mbox-cells: Shall be 1. It contains:

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +8 -0
+                       * tx(0) or rx(1) channel
+- xlnx,ipi-ids:                Xilinx IPI agent IDs of the two peers of the
+                       Xilinx IPI communication channel.
+- interrupt-parent:    Phandle for the interrupt controller
+- interrupts:          Interrupt information corresponding to the
+                       interrupt-names property.
+
+Optional properties:
Quoted 8 lines

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 62

Quoted 5 lines
+--------------------
+- method:              The method of accessing the IPI agent registers.
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +3 -0
+                       Permitted values are: "smc" and "hvc". Default is
+                       "smc".
+

Andre almost implemented the generic driver. Can you please have a look at
https://www.spinics.net/lists/arm-kernel/msg595416.html
and see if you can just finish it off?

Quoted 2 lines

[Wendy] This mailbox controller is about to use Xilinx IPI hardware as mailbox.

I couldn't find anything specific to Xilinx h/w zynqmp_ipi_fw_call() is same as arm_smc_send_data() in Andre's driver (though it needs to pass on [R2,R7] as I suggested in reply to him).

Quoted 3 lines

We use it to send notification/short request to firmware (usually running on another core on SoC),

So does Andre's driver. Which is precise and generic, so I much prefer that.

Quoted 4 lines

and also to receive notification/short request from firmware. Interrupt is used in the receiving direction. It looks different to the usage of mailbox driver from the link.

Quoted 5 lines

Yes, there is some difference. But nothing related to your h/w. Andre's driver assume synchronous transmits where the response is filled in the regs upon return.
What kind of calls do you make to your remote firmware? I would expect them to be 'fast'.

The reason to have this mailbox driver is because, we have an hardware block for IPI, this hardware block has registers and buffers and we want to to use Linux
kernel mailbox framework APIs such as mbox_send_message() and rx_callback in client drivers to send notification or short request to other processors and receive
response and request.

The reason to use SMC calls to access the registers is because we have the case that both the ATF and Linux kernel drive will need to access the same registers.

I have looked at the arm_smc patch, it looks like it is for synchronous request, and only
allow 32bit message. In our case, we need to:
* besides synchronous request, we also need to handle asynchronous request. The driver will monitor the interrupt to see if there is a message
from the other core.
If yes, it will notify the client from rx_callback.
* put 32bytes short message to the mailbox.

Quoted 2 lines

Thanks,
Wendy

Hi Jassi,

Ping.
I posted some questions on another email to the ARM SMC mailbox driver. But no response yet.
There are some issues with the latest ARM SMC mailbox driver I have seen so far.

* The message length is very limited. In our case, in order to send or receive message from our mailbox hardware,
we will need to extend the message length, in our case it is 32bytes. Here is what I am thinking about:
* Opt 1: pass pointer from kernel to ATF to allow ATF to
read/write to the pointer.

     * Opt 2: define ARM-SMC message as
        struct arm_smc_msg {
                u32 len;
                void *msg;
                void *resp;
         };
         When sends to the message, use multiple SMC calls to copy the

message content to the SMCC parameters.
Also use multiple SMC calls to get the response from SMCC parameters.
* Opt3: even if our driver is using SMCC to send and receive
messages, but those SMCC calls will be specific to our hardware. Instead of using a generic ARM-SMC mailbox driver, we have our vendor specific mailbox driver in Linux kernel.

How do you think about the above options?

Thanks,
Wendy

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Is there a plan to extend the ARM SMC mailbox driver
to both trigger firmware actions and receive request from firmware?

Sure if we have a genuine requirement we can support RX path as well.

Thanks.

#10 lore raw

Re: [PATCH v3 2/2] dt-bindings: mailbox: Add Xilinx IPI Mailbox

In reply to Wendy Liang
Quoted 99 lines · Wendy Liang

Xilinx ZynqMP IPI(Inter Processor Interrupt) is a hardware block in ZynqMP SoC used for the communication between various processor systems.

---
 .../bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt   | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +82 -0
new file mode 100644
index 0000000..5e270a3
@@ -0,0 +1,104 @@
+Xilinx IPI Mailbox Controller
+========================================
+
+The Xilinx IPI(Inter Processor Interrupt) mailbox controller is to manage
+messaging between two Xilinx Zynq UltraScale+ MPSoC IPI agents. Each IPI
+agent owns registers used for notification and buffers for message.
+
+               +-------------------------------------+
+               | Xilinx ZynqMP IPI Controller        |
+               +-------------------------------------+
+    +--------------------------------------------------+
+ATF                    |                     |
+                       |                     |
+                       |                     |
+    +--------------------------+             |
+                       |                     |
+                       |                     |
+    +--------------------------------------------------+
+            +------------------------------------------+
+            |  +----------------+   +----------------+ |
+Hardware    |  |  IPI Agent     |   |  IPI Buffers   | |
+            |  |  Registers     |   |                | |
+            |  |                |   |                | |
+            |  +----------------+   +----------------+ |
+            |                                          |
+            | Xilinx IPI Agent Block                   |
+            +------------------------------------------+
+
+
+Controller Device Node:
+===========================
+Required properties:
+--------------------
+- compatible:          Shall be: "xlnx,zynqmp-ipi-mailbox"
+- reg:                 IPI buffers address ranges
+- reg-names:           Names of the reg resources. It should have:
+                       * local_request_region
+                         - IPI request msg buffer written by local and read
+                           by remote
+                       * local_response_region
+                         - IPI response msg buffer written by local and read
+                           by remote
+                       * remote_request_region
+                         - IPI request msg buffer written by remote and read
+                           by local
+                       * remote_response_region
+                         - IPI response msg buffer written by remote and read
+                           by local
+- #mbox-cells:         Shall be 1. It contains:
+                       * tx(0) or rx(1) channel
+- xlnx,ipi-ids:                Xilinx IPI agent IDs of the two peers of the
+                       Xilinx IPI communication channel.
+- interrupt-parent:    Phandle for the interrupt controller
+- interrupts:          Interrupt information corresponding to the
+                       interrupt-names property.
+
+Optional properties:
+--------------------
+- method:              The method of accessing the IPI agent registers.
+                       Permitted values are: "smc" and "hvc". Default is
+                       "smc".
+
+Example:
+===========================
+       /* APU<->RPU0 IPI mailbox controller */
+       ipi_mailbox_rpu0: mailbox at ff90400 {
+               compatible = "xlnx,zynqmp-ipi-mailbox";
+               reg = <0x0 0xff990400 0x0 0x20>,
+                     <0x0 0xff990420 0x0 0x20>,
+                     <0x0 0xff990080 0x0 0x20>,
+                     <0x0 0xff9900a0 0x0 0x20>;
+               reg-names = "local_request_region", "local_response_region",
+                           "remote_request_region", "remote_response_region";
+               #mbox-cells = <1>;
+               xlnx-ipi-ids = <0 1>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 29 4>;
+       };
+       /* APU<->RPU1 IPI mailbox controller */
+       ipi_mailbox_rpu1: mailbox at ff990440 {
+               compatible = "xlnx,zynqmp-ipi-mailbox";
+               reg = <0x0 0xff990440 0x0 0x20>,

Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt line 92

Quoted 10 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +10 -0
+                     <0x0 0xff990460 0x0 0x20>,
+                     <0x0 0xff990280 0x0 0x20>,
+                     <0x0 0xff9902a0 0x0 0x20>;
+               reg-names = "local_request_region", "local_response_region",
+                           "remote_request_region", "remote_response_region";
+               #mbox-cells = <1>;
+               xlnx-ipi-ids = <0 2>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 29 4>;
+       };

The Xilinx IPI hardware one IPI agent contains multiple IPI mailboxes. Please make ipi mailbox as subnodes to the IPI agent device node.

Quoted 15 lines
Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt new file +12 -1
+       rpu0 {
+               ...
+               mboxes = <&ipi_mailbox_rpu0 0>,
+                        <&ipi_mailbox_rpu0 1>;
+               mbox-names = "tx", "rx";
+       };
+       rpu1 {
+               ...
+               mboxes = <&ipi_mailbox_rpu1 0>,
+                        <&ipi_mailbox_rpu1 1>;
+               mbox-names = "tx", "rx";
+       };
--

2.7.4