Skip to contentSkip to conversation

XEN booting on i.MX8M platform

RFC PATCH In review Amit Singh Tomar 3 participants 11 messages Jun 7, 2019 – Aug 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover XEN booting on i.MX8M platform

This series tries to enable XEN booting on i.MX 8MQuad Applications Processors[1].

Patch-set includes driver for UART controller found on i.MX8MQ SoC and debug code for earlyprintk support.

Mainline dts binding that are used for platform discover has GPC as root interrupt parent is not yet supported in XEN, therefore following changes is needed to boot XEN on this platform.

arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -1
index 6d635ba..7eac1786 100644
@@ -13,7 +13,7 @@
 #include "imx8mq-pinfunc.h"
 
 / {
-       interrupt-parent = <&gpc>;
+       interrupt-parent = <&gic>;
 
        #address-cells = <2>;
        #size-cells = <2>;

It has been tested on nitrogen8m board[2] by booting dom0 with RAMFS.

[1]:https://www.nxp.com/support/developer-resources/evaluation-and-development-boards/i.mx-evaluation-and-development-boards/evaluation-kit-for-the-i.mx-8m-applications-processor:MCIMX8M-EVK [2]:https://boundarydevices.com/product/nitrogen8m/

Amit Singh Tomar (2):
xen/arm: Add i.MX8MQ SoCs earlyprintk support
xen/arm: Add UART driver for i.MX8MQ SoC

 xen/arch/arm/arm64/debug-imx8mq.inc |  54 +++++++
 xen/drivers/char/Kconfig            |   8 +
 xen/drivers/char/Makefile           |   1 +
 xen/drivers/char/imx8mq-uart.c      | 306 ++++++++++++++++++++++++++++++++++++
 4 files changed, 369 insertions(+)
 create mode 100644 xen/arch/arm/arm64/debug-imx8mq.inc
 create mode 100644 xen/drivers/char/imx8mq-uart.c
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

RFC PATCH 1/2 xen/arm: Add i.MX8MQ SoCs earlyprintk support

This patch adds earlyprintk support for i.MX8MQ SoC based boards.

As with most of other debug code for other platforms, uart is initialized by bootloaders(for instance u-boot[1]).

[1]:https://github.com/u-boot/u-boot/blob/master/drivers/serial/serial_mxc.c#L141

---
 xen/arch/arm/arm64/debug-imx8mq.inc | 54 +++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 xen/arch/arm/arm64/debug-imx8mq.inc
xen/arch/arm/arm64/debug-imx8mq.inc new file +54 -0
new file mode 100644
index 0000000..ec331dc
@@ -0,0 +1,54 @@
+/*
+ * xen/arch/arm/arm64/debug-imx8mq.inc
+ *
+ * IMX8MQ specific debug code.
+ *
+ * Copyright (c) 2019, Amit Singh Tomar <[email protected]>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms and conditions of the GNU General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define UTXD            0x40
+#define UTS             0xb4
+#define UTS_TXEMPTY     3<<1
+
+.macro early_uart_init xb, c
+/* Uart has already been initialized by bootloader Firmware, for instance by TF-A */
+.endm
+
+/*
+ * IMX8MQ UART wait UART to be ready to transmit
+ * xb: register which contains the UART base address
+ * c: scratch register
+ */
+.macro early_uart_ready xb c
+1:
+        ldr    w\c, [\xb, #UTS]        /* UART Test Register */
+        tbz    w\c, #UTS_TXEMPTY, 1b       /* Check TXEMPTY bit */
+.endm
+
+/*
+ * IMX8MQ UART transmit character
+ * xb: register which contains the UART base address
+ * wt: register which contains the character to transmit
+ */
+.macro early_uart_transmit xb wt
+	str    \wt, [\xb, #UTXD]
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

RFC PATCH 2/2 xen/arm: Add UART driver for i.MX8MQ SoC

In reply to Amit Singh Tomar

This patch adds driver for UART controller found on i.MX8MQ SoC and it has been tested on nitrogen8m board.

Controller register defination and some other references has drawn from Linux kernel driver[1] v5.2.

[1]:https://github.com/torvalds/linux/blob/master/drivers/tty/serial/imx.c

---
 xen/drivers/char/Kconfig       |   8 ++
 xen/drivers/char/Makefile      |   1 +
 xen/drivers/char/imx8mq-uart.c | 306 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 315 insertions(+)
 create mode 100644 xen/drivers/char/imx8mq-uart.c
xen/drivers/char/Kconfig +8 -0
index b572305..f822af5 100644
@@ -12,6 +12,14 @@ config HAS_CADENCE_UART
 	  This selects the Xilinx Zynq Cadence UART. If you have a Xilinx Zynq
 	  based board, say Y.
 
+config HAS_IMX8MQ
+        bool "i.MX8MQ UART "
+        default y
+        depends on ARM_64
+        help
+          This selects the NXP i.MX UART. If you have a NXP i.MX8MQ
+          based board, say Y.
+
 config HAS_MVEBU
 	bool "Marvell MVEBU UART driver"
 	default y
xen/drivers/char/Makefile +1 -0
index 7c646d7..aa1bb29 100644
@@ -1,6 +1,7 @@
 obj-y += console.o
 obj-$(CONFIG_HAS_NS16550) += ns16550.o
 obj-$(CONFIG_HAS_CADENCE_UART) += cadence-uart.o
+obj-$(CONFIG_HAS_IMX8MQ) += imx8mq-uart.o
 obj-$(CONFIG_HAS_PL011) += pl011.o
 obj-$(CONFIG_HAS_EXYNOS4210) += exynos4210-uart.o
 obj-$(CONFIG_HAS_MESON) += meson-uart.o
xen/drivers/char/imx8mq-uart.c new file +306 -0

306 lines not on this page · raw message

Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw
Quoted 1 line · Amit Tomer

Hi,

Hi,

Quoted 8 lines · Amit Singh Tomar
Quoted 6 lines

This series tries to enable XEN booting on i.MX 8MQuad Applications Processors[1].

Patch-set includes driver for UART controller found on i.MX8MQ SoC and debug code for earlyprintk support.

Gentle Ping.

This is in my long list of patches to review and work to do. Any help to reduce the list will mean I can reach your series quicker...

I have seen multiple threads from you pointing at issues on the IMX.8. Have they been resolved? Is this series enough to get Xen and Dom0 booting on the NXP platform?

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#5 lore raw

Hi,

Sorry for the late reply.

Quoted 3 lines

I have seen multiple threads from you pointing at issues on the IMX.8. Have they been resolved? Is this series enough to get Xen and Dom0 booting on the NXP platform?

Yeah, most of issues are resolved now and mainline DTS is used to bring XEN on this i.MX8 platform.

Though there is small change that comment out GPC (which is used root interrupt parent) and instead use GIC
is done in DTS.

The patches has been tested booting DOM0 with ramfs.

Thanks,
-Amit

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

Hi,

I have CCed one person from Donerworks. IIRC they have been using the IMX8 in the past.

Quoted 10 lines · Amit Tomer
Quoted 3 lines

I have seen multiple threads from you pointing at issues on the IMX.8. Have they been resolved? Is this series enough to get Xen and Dom0 booting on the NXP platform?

Yeah, most of issues are resolved now and mainline DTS is used to bring XEN on this i.MX8 platform.

Though there is small change that comment out GPC (which is used root interrupt parent) and instead use GIC
is done in DTS.

What are the consequences to change the interrupt parent?

Quoted 2 lines

The patches has been tested booting DOM0 with ramfs.

I don't think this is enough to claim support for Xen on the I.MX8M platform.
What I don't want to end up is having yet another UART driver to maintain in Xen but the platform is still unusable.

You should at least be able to boot multiple domains and use a fully fledge distro (yocto, Debian...) from a mass storage (and possibly network).

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw
Quoted 6 lines · Julien Grall

CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Hi,

I have CCed one person from Donerworks. IIRC they have been using the IMX8 in the past.

Amit,

Have you checked out the NXP Xen fork?

https://source.codeaurora.org/external/imx/imx-xen/

While the work there hasn't been upstreamed yet, the support for the iMX8QM
(QuadMax) is fairly complete. There are some important differences between the iMX8M and that SoC beyond those you've noted (no A72 cluster, no SMMU, and no System Control Unit (SCU)), but it might solve some of the issues you've been running into or avoid yet unknown issues when you attempt to boot a guest domain.

Nate

Quoted 27 lines · Amit Tomer
Quoted 10 lines
Quoted 3 lines

I have seen multiple threads from you pointing at issues on the IMX.8. Have they been resolved? Is this series enough to get Xen and Dom0 booting on the NXP platform?

Yeah, most of issues are resolved now and mainline DTS is used to bring XEN on this i.MX8 platform.

Though there is small change that comment out GPC (which is used root interrupt parent) and instead use GIC
is done in DTS.

What are the consequences to change the interrupt parent?

Quoted 2 lines

The patches has been tested booting DOM0 with ramfs.

I don't think this is enough to claim support for Xen on the I.MX8M platform. What I don't want to end up is having yet another UART driver to maintain in Xen but the platform is still unusable.

You should at least be able to boot multiple domains and use a fully fledge distro (yocto, Debian...) from a mass storage (and possibly network).

Cheers,

Quoted 8 lines

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#8 lore raw

Hi Nate , Hi Julien,

Quoted 5 lines

Amit,

Have you checked out the NXP Xen fork?

Quoted 7 lines

https://source.codeaurora.org/external/imx/imx-xen/

While the work there hasn't been upstreamed yet, the support for the iMX8QM
(QuadMax) is fairly complete. There are some important differences between the iMX8M and that SoC beyond those you've noted (no A72 cluster, no SMMU, and no System Control Unit (SCU)), but it might solve some of the issues you've been running into or avoid yet unknown issues when you attempt to boot a guest domain.

I looked around the work done for iMX8QM but the UART IP used on i.MX8MQ is completely different than
that used on i.MXQM.

The initial agenda of this series is to get particular uart driver(used on i.IMX8MQ) in first and then
start booting domUs.

Thanks,
-Amit

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#9 lore raw
In reply to Julien Grall

Hi

Quoted 2 lines

What are the consequences to change the interrupt parent?

I am not entirely sure about it at the moment but looks like it controllers power domain
for various devices like GPU, VPU and OTG etc.

So, we may not be able to support these devices for XEN domains ?

Also, this IP is not present on other i.MX8 platforms, for instance iMX8QM.

Quoted 10 lines
Quoted 2 lines

The patches has been tested booting DOM0 with ramfs.

I don't think this is enough to claim support for Xen on the I.MX8M platform. What I don't want to end up is having yet another UART driver to maintain in Xen but the platform is still unusable.

You should at least be able to boot multiple domains and use a fully fledge distro (yocto, Debian...) from a mass storage (and possibly network).

Yeah, I can understand this and would try to work on it (but not sure when can I have access
to H/W).

Thanks,
Amit

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw
Quoted 1 line · Amit Tomer

Hi

Hi,

Quoted 7 lines
Quoted 1 line

What are the consequences to change the interrupt parent?

I am not entirely sure about it at the moment but looks like it controllers power domain
for various devices like GPU, VPU and OTG etc.

So, we may not be able to support these devices for XEN domains ?

I haven't used the platform so I can't for sure know what can happen here. The risk is if all the power domains are turned off at boot, then Dom0 would not be able to turn them on. Therefore all the devices you listed may be unusable.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel