Skip to contentSkip to conversation

Xen: ARM: Improved NXP iMX8 platform support

PATCH Superseded John Ernberg 2 participants 6 messages Feb 14, 2024 – Mar 6, 2024 Arm i.MX and Layerscape

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Xen: ARM: Improved NXP iMX8 platform support

The iMX lpuart driver added at 44e17aa60d47 ("xen/arm: Add i.MX lpuart driver") is not enough to boot a Linux based dom0 when certain drivers, such as the watchdog driver, are enabled.

We're also fixing compatibles in imx-lpuart to allow Xen to use the UART on the QXP variant as well.

NOTE:
There's still an open point regarding the watchdog from v1, but I wanted to post this series to show the filtering changes mostly because they also clarify what exists and what we can definitely get away with blocking / ignoring out of all the SMC SIP calls.

v2: (See each path for complete changelog)
- Added SIP call filtering (Julien Grall)
- Replace lpuart compatible instead (Julien Grall)

v1: https://lore.kernel.org/xen-devel/[email protected]

John Ernberg (2):
xen/arm: Add imx8q{m,x} platform glue
xen/drivers: imx-lpuart: Replace iMX8QM compatible with iMX8QXP

 xen/arch/arm/platforms/Makefile |   1 +
 xen/arch/arm/platforms/imx8qm.c | 143 ++++++++++++++++++++++++++++++++
 xen/drivers/char/imx-lpuart.c   |   2 +-
 3 files changed, 145 insertions(+), 1 deletion(-)
 create mode 100644 xen/arch/arm/platforms/imx8qm.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/2 xen/arm: Add imx8q{m,x} platform glue

When using Linux for dom0 there are a bunch of drivers that need to do SMC SIP calls into the firmware to enable certain hardware bits like the watchdog.

Provide a basic platform glue that implements the needed SMC forwarding.

The format of these calls are as follows:
- reg 0: service ID
- reg 1: function ID
remaining regs: args

For now we only allow Dom0 to make these calls as they are all managing hardware. There is no specification for these SIP calls, the IDs and names have been extracted from the upstream linux kernel and the vendor kernel.

Most of the SIP calls are only available for the iMX8M series of SoCs, so they are easy to reject and they need to be revisited when iMX8M series support is added.

From the other calls we can reject CPUFREQ because Dom0 cannot make an informed decision regarding CPU frequency scaling, WAKEUP_SRC is to wake up from suspend, which Xen doesn't support at this time.

This leaves the TIME SIP and the OTP_WRITE SIP, which for now are allowed to Dom0.

NOTE: This code is based on code found in NXP Xen tree located here:
https://github.com/nxp-imx/imx-xen/blob/lf-5.10.y_4.13/xen/arch/arm/platforms/imx8qm.c

[jernberg: Add SIP call filtering]

---

v2:
- Reword the commit message to be a bit clearer
- Include the link previously added as a context note to the commit message (Julien Grall)
- Add Pengs signed off (Julien Grall, Peng Fan)
- Add basic SIP call filter (Julien Grall)
- Expand the commit message a whole bunch because of the changes to the code

---
 xen/arch/arm/platforms/Makefile |   1 +
 xen/arch/arm/platforms/imx8qm.c | 143 ++++++++++++++++++++++++++++++++
 2 files changed, 144 insertions(+)
 create mode 100644 xen/arch/arm/platforms/imx8qm.c
xen/arch/arm/platforms/Makefile +1 -0
index 8632f4115f..bec6e55d1f 100644
@@ -9,5 +9,6 @@ obj-$(CONFIG_ALL_PLAT)   += sunxi.o
 obj-$(CONFIG_ALL64_PLAT) += thunderx.o
 obj-$(CONFIG_ALL64_PLAT) += xgene-storm.o
 obj-$(CONFIG_ALL64_PLAT) += brcm-raspberry-pi.o
+obj-$(CONFIG_ALL64_PLAT) += imx8qm.o
 obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp.o
 obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp-eemi.o
xen/arch/arm/platforms/imx8qm.c new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v2 1/2] xen/arm: Add imx8q{m,x} platform glue

Hi,

Quoted 13 lines · John Ernberg

When using Linux for dom0 there are a bunch of drivers that need to do SMC SIP calls into the firmware to enable certain hardware bits like the watchdog.

Provide a basic platform glue that implements the needed SMC forwarding.

The format of these calls are as follows:
- reg 0: service ID
- reg 1: function ID
remaining regs: args

Quoted 7 lines

For now we only allow Dom0 to make these calls as they are all managing hardware. There is no specification for these SIP calls, the IDs and names have been extracted from the upstream linux kernel and the vendor kernel.

Most of the SIP calls are only available for the iMX8M series of SoCs, so they are easy to reject and they need to be revisited when iMX8M series support is added.

Given that you named your driver *qm and you search for dt compatible *qm, *qxp, does it really make sense to add SIP calls for iMX8M?

Quoted 61 lines

From the other calls we can reject CPUFREQ because Dom0 cannot make an informed decision regarding CPU frequency scaling, WAKEUP_SRC is to wake up from suspend, which Xen doesn't support at this time.

This leaves the TIME SIP and the OTP_WRITE SIP, which for now are allowed to Dom0.

NOTE: This code is based on code found in NXP Xen tree located here:
https://github.com/nxp-imx/imx-xen/blob/lf-5.10.y_4.13/xen/arch/arm/platforms/imx8qm.c

[jernberg: Add SIP call filtering]

---

v2:
- Reword the commit message to be a bit clearer
- Include the link previously added as a context note to the commit message (Julien Grall)
- Add Pengs signed off (Julien Grall, Peng Fan)
- Add basic SIP call filter (Julien Grall)
- Expand the commit message a whole bunch because of the changes to the code

---
 xen/arch/arm/platforms/Makefile |   1 +
 xen/arch/arm/platforms/imx8qm.c | 143 ++++++++++++++++++++++++++++++++
 2 files changed, 144 insertions(+)
 create mode 100644 xen/arch/arm/platforms/imx8qm.c
xen/arch/arm/platforms/Makefile +1 -0
index 8632f4115f..bec6e55d1f 100644
@@ -9,5 +9,6 @@ obj-$(CONFIG_ALL_PLAT)   += sunxi.o
 obj-$(CONFIG_ALL64_PLAT) += thunderx.o
 obj-$(CONFIG_ALL64_PLAT) += xgene-storm.o
 obj-$(CONFIG_ALL64_PLAT) += brcm-raspberry-pi.o
+obj-$(CONFIG_ALL64_PLAT) += imx8qm.o
 obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp.o
 obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp-eemi.o
xen/arch/arm/platforms/imx8qm.c new file +15 -0
new file mode 100644
index 0000000000..4515c75935
@@ -0,0 +1,143 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * xen/arch/arm/platforms/imx8qm.c
+ *
+ * i.MX 8QM setup
+ *
+ * Copyright (c) 2016 Freescale Inc.
+ * Copyright 2018-2019 NXP
+ *
+ *
+ * Peng Fan <[email protected]>
+ */
+
+#include <xen/sched.h>
+#include <asm/platform.h>

xen/arch/arm/platforms/imx8qm.c line 25

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+#include <asm/smccc.h>
+
+static const char * const imx8qm_dt_compat[] __initconst =
+{
+    "fsl,imx8qm",
+    "fsl,imx8qxp",
+    NULL
+};
+
+#define IMX_SIP_GPC          0xC2000000

NIT: A matter of personal opinion but all the Arm64 SIP services starts with 0xc2000000, so you could just define a function id i.e. 1, 2, ... and use a macro similar to EEMI_FID(fid). This is just a suggestion.

xen/arch/arm/platforms/imx8qm.c line 33

Quoted 8 lines
xen/arch/arm/platforms/imx8qm.c new file +8 -0
+#define IMX_SIP_CPUFREQ      0xC2000001
+#define IMX_SIP_TIME         0xC2000002
+#define IMX_SIP_DDR_DVFS     0xC2000004
+#define IMX_SIP_SRC          0xC2000005
+#define IMX_SIP_GET_SOC_INFO 0xC2000006
+#define IMX_SIP_NOC          0xC2000008
+#define IMX_SIP_WAKEUP_SRC   0xC2000009
+#define IMX_SIP_OTP_WRITE    0xC200000B

Looking at ATF, for QM,QXP there are also:
BUILDINFO 0xC2000003
OTP_READ 0xC200000A
SET_TEMP 0xC200000C

Quoted 16 lines
xen/arch/arm/platforms/imx8qm.c new file +16 -0
+
+#define IMX_SIP_TIME_F_RTC_SET_TIME     0x00
+#define IMX_SIP_TIME_F_WDOG_START       0x01
+#define IMX_SIP_TIME_F_WDOG_STOP        0x02
+#define IMX_SIP_TIME_F_WDOG_SET_ACT     0x03
+#define IMX_SIP_TIME_F_WDOG_PING        0x04
+#define IMX_SIP_TIME_F_WDOG_SET_TIMEOUT 0x05
+#define IMX_SIP_TIME_F_WDOG_GET_STAT    0x06
+#define IMX_SIP_TIME_F_WDOG_SET_PRETIME 0x07
+
+static bool imx8qm_is_sip_time_call_ok(uint32_t function_id)
+{
+    switch ( function_id )
+    {
+    case IMX_SIP_TIME_F_RTC_SET_TIME:
+        return true;

xen/arch/arm/platforms/imx8qm.c line 59

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+    case IMX_SIP_TIME_F_WDOG_START:
+    case IMX_SIP_TIME_F_WDOG_STOP:
+    case IMX_SIP_TIME_F_WDOG_SET_ACT:
+    case IMX_SIP_TIME_F_WDOG_PING:
+    case IMX_SIP_TIME_F_WDOG_SET_TIMEOUT:
+    case IMX_SIP_TIME_F_WDOG_GET_STAT:
+    case IMX_SIP_TIME_F_WDOG_SET_PRETIME:
+        return true;
+    default:
+        printk(XENLOG_WARNING "imx8qm: smc: time: Unknown function id %x\n", function_id);

80 chars limit, move argument list to the next line

xen/arch/arm/platforms/imx8qm.c line 66

Quoted 7 lines
xen/arch/arm/platforms/imx8qm.c new file +7 -0
+        return false;
+    }
+}
+
+static bool imx8qm_smc(struct cpu_user_regs *regs)
+{
+    uint32_t service_id = get_user_reg(regs, 0);

In SMCCC naming convention, W0 is called function identifier. Instead you call X1 function_id which is a bit misleading.

xen/arch/arm/platforms/imx8qm.c line 72

Quoted 6 lines
xen/arch/arm/platforms/imx8qm.c new file +6 -0
+    uint32_t function_id = get_user_reg(regs, 1);
+    struct arm_smccc_res res;
+
+    if ( !cpus_have_const_cap(ARM_SMCCC_1_1) )
+    {
+        printk_once(XENLOG_WARNING "no SMCCC 1.1 support. Disabling firmware calls\n");

80 chars limit, move string to the next line

Quoted 4 lines
xen/arch/arm/platforms/imx8qm.c new file +4 -0
+
+        return false;
+    }
+

xen/arch/arm/platforms/imx8qm.c line 86

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+    /* Only hardware domain may use the SIP calls */
+    if ( !is_hardware_domain(current->domain) )
+    {
+        gprintk(XENLOG_WARNING, "imx8qm: smc: No access\n");
+        return false;
+    }
+
+    switch ( service_id )
+    {
+    case IMX_SIP_GPC: /* Only available on imx8m series */

If we decide to keep iMX8M FIDs, I think adding comments on top of a case would result in a more readable code.

Quoted 12 lines
xen/arch/arm/platforms/imx8qm.c new file +12 -0
+        return false;
+    case IMX_SIP_CPUFREQ: /* Dom0 can't take any informed descision here */
+        return false;
+    case IMX_SIP_TIME:
+        if ( imx8qm_is_sip_time_call_ok(function_id) )
+            goto allow_call;
+        return false;
+    case IMX_SIP_DDR_DVFS: /* Only available on imx8m series */
+        return false;
+    case IMX_SIP_SRC: /* Only available on imx8m series */
+        return false;
+    case IMX_SIP_GET_SOC_INFO: /* Only available on imx8m series */

xen/arch/arm/platforms/imx8qm.c line 108

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+        return false;
+    case IMX_SIP_NOC: /* Only available on imx8m series */
+        return false;
+    case IMX_SIP_WAKEUP_SRC: /* Xen doesn't have suspend support */
+        return false;
+    case IMX_SIP_OTP_WRITE:
+        /* function_id is the fuse number, no sensible check possible */
+        goto allow_call;
+    default:
+        printk(XENLOG_WARNING "imx8qm: smc: Unknown service id %x\n", service_id);

80 chars limit, move argument list to the next line

xen/arch/arm/platforms/imx8qm.c line 112

Quoted 4 lines
xen/arch/arm/platforms/imx8qm.c new file +4 -0
+        return false;
+    }
+
+allow_call:

labels need to be indented with one space

Quoted 9 lines
xen/arch/arm/platforms/imx8qm.c new file +9 -0
+    arm_smccc_1_1_smc(service_id,
+                      function_id,
+                      get_user_reg(regs, 2),
+                      get_user_reg(regs, 3),
+                      get_user_reg(regs, 4),
+                      get_user_reg(regs, 5),
+                      get_user_reg(regs, 6),
+                      get_user_reg(regs, 7),
+                      &res);

xen/arch/arm/platforms/imx8qm.c line 131

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+
+    set_user_reg(regs, 0, res.a0);
+    set_user_reg(regs, 1, res.a1);
+    set_user_reg(regs, 2, res.a2);
+    set_user_reg(regs, 3, res.a3);
+
+    return true;
+}
+
+PLATFORM_START(imx8qm, "i.MX 8")

Shouldn't it be i.MX 8Q{M,XP} ?

~Michal

#3 lore raw

Re: [PATCH v2 1/2] xen/arm: Add imx8q{m,x} platform glue

Hi Michal,

Quoted 20 lines · Michal Orzel

Hi,

Quoted 17 lines · John Ernberg

When using Linux for dom0 there are a bunch of drivers that need to do SMC SIP calls into the firmware to enable certain hardware bits like the watchdog.

Provide a basic platform glue that implements the needed SMC forwarding.

The format of these calls are as follows:
- reg 0: service ID
- reg 1: function ID
remaining regs: args

For now we only allow Dom0 to make these calls as they are all managing hardware. There is no specification for these SIP calls, the IDs and names have been extracted from the upstream linux kernel and the vendor kernel.

Quoted 5 lines
Quoted 3 lines

Most of the SIP calls are only available for the iMX8M series of SoCs, so they are easy to reject and they need to be revisited when iMX8M series support is added.

Given that you named your driver *qm and you search for dt compatible *qm, *qxp, does it really make sense to add SIP calls for iMX8M?

The idea was to be explicit about why it makes no sense to support those SIPs on a qm/qxp implementation.

I can take it out if that's not argument enough to have them.

Quoted 67 lines
Quoted 67 lines

From the other calls we can reject CPUFREQ because Dom0 cannot make an
informed decision regarding CPU frequency scaling, WAKEUP_SRC is to wake up from suspend, which Xen doesn't support at this time.

This leaves the TIME SIP and the OTP_WRITE SIP, which for now are allowed to Dom0.

NOTE: This code is based on code found in NXP Xen tree located here:
https://github.com/nxp-imx/imx-xen/blob/lf-5.10.y_4.13/xen/arch/arm/platforms/imx8qm.c

[jernberg: Add SIP call filtering]

---

v2:
- Reword the commit message to be a bit clearer
- Include the link previously added as a context note to the commit message (Julien Grall)
- Add Pengs signed off (Julien Grall, Peng Fan)
- Add basic SIP call filter (Julien Grall)
- Expand the commit message a whole bunch because of the changes to the code

---
  xen/arch/arm/platforms/Makefile |   1 +
  xen/arch/arm/platforms/imx8qm.c | 143 ++++++++++++++++++++++++++++++++
  2 files changed, 144 insertions(+)

create mode 100644 xen/arch/arm/platforms/imx8qm.c

xen/arch/arm/platforms/Makefile +1 -0
index 8632f4115f..bec6e55d1f 100644
@@ -9,5 +9,6 @@ obj-$(CONFIG_ALL_PLAT)   += sunxi.o
  obj-$(CONFIG_ALL64_PLAT) += thunderx.o
  obj-$(CONFIG_ALL64_PLAT) += xgene-storm.o
  obj-$(CONFIG_ALL64_PLAT) += brcm-raspberry-pi.o
+obj-$(CONFIG_ALL64_PLAT) += imx8qm.o
  obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp.o
  obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp-eemi.o
xen/arch/arm/platforms/imx8qm.c new file +20 -0
new file mode 100644
index 0000000000..4515c75935
@@ -0,0 +1,143 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * xen/arch/arm/platforms/imx8qm.c
+ *
+ * i.MX 8QM setup
+ *
+ * Copyright (c) 2016 Freescale Inc.
+ * Copyright 2018-2019 NXP
+ *
+ *
+ * Peng Fan <[email protected]>
+ */
+
+#include <xen/sched.h>
+#include <asm/platform.h>
+#include <asm/smccc.h>
+
+static const char * const imx8qm_dt_compat[] __initconst =
+{
+    "fsl,imx8qm",
Quoted 8 lines

xen/arch/arm/platforms/imx8qm.c line 25

Quoted 5 lines
xen/arch/arm/platforms/imx8qm.c new file +5 -0
+    "fsl,imx8qxp",
+    NULL
+};
+
+#define IMX_SIP_GPC          0xC2000000

NIT: A matter of personal opinion but all the Arm64 SIP services starts with 0xc2000000, so you could just define a function id i.e. 1, 2, ... and use a macro similar to EEMI_FID(fid). This is just a suggestion.

Ack.

Quoted 13 lines

xen/arch/arm/platforms/imx8qm.c line 33

Quoted 9 lines
xen/arch/arm/platforms/imx8qm.c new file +8 -0
+#define IMX_SIP_CPUFREQ      0xC2000001
+#define IMX_SIP_TIME         0xC2000002
+#define IMX_SIP_DDR_DVFS     0xC2000004
+#define IMX_SIP_SRC          0xC2000005
+#define IMX_SIP_GET_SOC_INFO 0xC2000006
+#define IMX_SIP_NOC          0xC2000008
+#define IMX_SIP_WAKEUP_SRC   0xC2000009
+#define IMX_SIP_OTP_WRITE    0xC200000B

Looking at ATF, for QM,QXP there are also:
BUILDINFO 0xC2000003
OTP_READ 0xC200000A
SET_TEMP 0xC200000C

I can't find them in the current Linux code, perhaps deprecated. I can add them and deny them if it makes sense.

Quoted 20 lines
Quoted 20 lines
xen/arch/arm/platforms/imx8qm.c new file +19 -0
+
+#define IMX_SIP_TIME_F_RTC_SET_TIME     0x00
+#define IMX_SIP_TIME_F_WDOG_START       0x01
+#define IMX_SIP_TIME_F_WDOG_STOP        0x02
+#define IMX_SIP_TIME_F_WDOG_SET_ACT     0x03
+#define IMX_SIP_TIME_F_WDOG_PING        0x04
+#define IMX_SIP_TIME_F_WDOG_SET_TIMEOUT 0x05
+#define IMX_SIP_TIME_F_WDOG_GET_STAT    0x06
+#define IMX_SIP_TIME_F_WDOG_SET_PRETIME 0x07
+
+static bool imx8qm_is_sip_time_call_ok(uint32_t function_id)
+{
+    switch ( function_id )
+    {
+    case IMX_SIP_TIME_F_RTC_SET_TIME:
+        return true;
+    case IMX_SIP_TIME_F_WDOG_START:
+    case IMX_SIP_TIME_F_WDOG_STOP:
+    case IMX_SIP_TIME_F_WDOG_SET_ACT:
Quoted 8 lines

xen/arch/arm/platforms/imx8qm.c line 59

Quoted 7 lines
xen/arch/arm/platforms/imx8qm.c new file +7 -0
+    case IMX_SIP_TIME_F_WDOG_PING:
+    case IMX_SIP_TIME_F_WDOG_SET_TIMEOUT:
+    case IMX_SIP_TIME_F_WDOG_GET_STAT:
+    case IMX_SIP_TIME_F_WDOG_SET_PRETIME:
+        return true;
+    default:
+        printk(XENLOG_WARNING "imx8qm: smc: time: Unknown function id %x\n", function_id);

80 chars limit, move argument list to the next line

Ack. I forgot to check the coding standard on line length.

Quoted 10 lines

xen/arch/arm/platforms/imx8qm.c line 66

Quoted 8 lines
xen/arch/arm/platforms/imx8qm.c new file +7 -0
+        return false;
+    }
+}
+
+static bool imx8qm_smc(struct cpu_user_regs *regs)
+{
+    uint32_t service_id = get_user_reg(regs, 0);

In SMCCC naming convention, W0 is called function identifier. Instead you call X1 function_id which is a bit misleading.

Ack. Will use function_id and subfunction_id instead.

Quoted 8 lines

xen/arch/arm/platforms/imx8qm.c line 72

Quoted 7 lines
xen/arch/arm/platforms/imx8qm.c new file +6 -0
+    uint32_t function_id = get_user_reg(regs, 1);
+    struct arm_smccc_res res;
+
+    if ( !cpus_have_const_cap(ARM_SMCCC_1_1) )
+    {
+        printk_once(XENLOG_WARNING "no SMCCC 1.1 support. Disabling firmware calls\n");

80 chars limit, move string to the next line

Ack.

Quoted 39 lines
Quoted 5 lines
xen/arch/arm/platforms/imx8qm.c new file +4 -0
+
+        return false;
+    }
+

xen/arch/arm/platforms/imx8qm.c line 86

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+    /* Only hardware domain may use the SIP calls */
+    if ( !is_hardware_domain(current->domain) )
+    {
+        gprintk(XENLOG_WARNING, "imx8qm: smc: No access\n");
+        return false;
+    }
+
+    switch ( service_id )
+    {
+    case IMX_SIP_GPC: /* Only available on imx8m series */

If we decide to keep iMX8M FIDs, I think adding comments on top of a case would result in a more readable code.

Quoted 12 lines
xen/arch/arm/platforms/imx8qm.c new file +12 -0
+        return false;
+    case IMX_SIP_CPUFREQ: /* Dom0 can't take any informed descision here */
+        return false;
+    case IMX_SIP_TIME:
+        if ( imx8qm_is_sip_time_call_ok(function_id) )
+            goto allow_call;
+        return false;
+    case IMX_SIP_DDR_DVFS: /* Only available on imx8m series */
+        return false;
+    case IMX_SIP_SRC: /* Only available on imx8m series */
+        return false;
+    case IMX_SIP_GET_SOC_INFO: /* Only available on imx8m series */

xen/arch/arm/platforms/imx8qm.c line 108

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+        return false;
+    case IMX_SIP_NOC: /* Only available on imx8m series */
+        return false;
+    case IMX_SIP_WAKEUP_SRC: /* Xen doesn't have suspend support */
+        return false;
+    case IMX_SIP_OTP_WRITE:
+        /* function_id is the fuse number, no sensible check possible */
+        goto allow_call;
+    default:
+        printk(XENLOG_WARNING "imx8qm: smc: Unknown service id %x\n", service_id);
Quoted 1 line

80 chars limit, move argument list to the next line

Ack

Quoted 6 lines

xen/arch/arm/platforms/imx8qm.c line 112

Quoted 5 lines
xen/arch/arm/platforms/imx8qm.c new file +4 -0
+        return false;
+    }
+
+allow_call:

labels need to be indented with one space

Ack. Missed that clause in the indentation chapter.

Quoted 13 lines
Quoted 13 lines
xen/arch/arm/platforms/imx8qm.c new file +12 -0
+    arm_smccc_1_1_smc(service_id,
+                      function_id,
+                      get_user_reg(regs, 2),
+                      get_user_reg(regs, 3),
+                      get_user_reg(regs, 4),
+                      get_user_reg(regs, 5),
+                      get_user_reg(regs, 6),
+                      get_user_reg(regs, 7),
+                      &res);
+
+    set_user_reg(regs, 0, res.a0);
+    set_user_reg(regs, 1, res.a1);
Quoted 8 lines

xen/arch/arm/platforms/imx8qm.c line 131

Quoted 7 lines
xen/arch/arm/platforms/imx8qm.c new file +7 -0
+    set_user_reg(regs, 2, res.a2);
+    set_user_reg(regs, 3, res.a3);
+
+    return true;
+}
+
+PLATFORM_START(imx8qm, "i.MX 8")

Shouldn't it be i.MX 8Q{M,XP} ?

Ack.

Quoted 2 lines

~Michal

Thanks! // John Ernberg

#4 lore raw

Re: [PATCH v2 1/2] xen/arm: Add imx8q{m,x} platform glue

Hi Michal,

Quoted 38 lines · John Ernberg

Hi Michal,

Quoted 23 lines · Michal Orzel

Hi,

Quoted 20 lines · John Ernberg

When using Linux for dom0 there are a bunch of drivers that need to do SMC
SIP calls into the firmware to enable certain hardware bits like the watchdog.

Provide a basic platform glue that implements the needed SMC forwarding.

The format of these calls are as follows:
  - reg 0: service ID
  - reg 1: function ID
  remaining regs: args

For now we only allow Dom0 to make these calls as they are all managing hardware. There is no specification for these SIP calls, the IDs and names
have been extracted from the upstream linux kernel and the vendor kernel.

Quoted 7 lines
Quoted 4 lines

Most of the SIP calls are only available for the iMX8M series of SoCs, so
they are easy to reject and they need to be revisited when iMX8M series support is added.

Given that you named your driver *qm and you search for dt compatible *qm, *qxp, does it really
make sense to add SIP calls for iMX8M?

The idea was to be explicit about why it makes no sense to support those SIPs on a qm/qxp implementation.

I can take it out if that's not argument enough to have them.

[ ... ]

Quoted 12 lines
Quoted 8 lines

xen/arch/arm/platforms/imx8qm.c line 33

Quoted 4 lines
xen/arch/arm/platforms/imx8qm.c new file +4 -0
+#define IMX_SIP_GET_SOC_INFO 0xC2000006
+#define IMX_SIP_NOC          0xC2000008
+#define IMX_SIP_WAKEUP_SRC   0xC2000009
+#define IMX_SIP_OTP_WRITE    0xC200000B

Looking at ATF, for QM,QXP there are also:
BUILDINFO 0xC2000003
OTP_READ  0xC200000A
SET_TEMP  0xC200000C

I can't find them in the current Linux code, perhaps deprecated. I can add them and deny them if it makes sense.

Quoted 1 line
Quoted 10 lines
Quoted 10 lines

xen/arch/arm/platforms/imx8qm.c line 43

Quoted 10 lines
xen/arch/arm/platforms/imx8qm.c new file +10 -0
+
+#define IMX_SIP_TIME_F_RTC_SET_TIME     0x00
+#define IMX_SIP_TIME_F_WDOG_START       0x01
+#define IMX_SIP_TIME_F_WDOG_STOP        0x02
+#define IMX_SIP_TIME_F_WDOG_SET_ACT     0x03
+#define IMX_SIP_TIME_F_WDOG_PING        0x04
+#define IMX_SIP_TIME_F_WDOG_SET_TIMEOUT 0x05
+#define IMX_SIP_TIME_F_WDOG_GET_STAT    0x06
+#define IMX_SIP_TIME_F_WDOG_SET_PRETIME 0x07
+

Ping.

Thanks! // John Ernberg

#5 lore raw

PATCH v2 2/2 xen/drivers: imx-lpuart: Replace iMX8QM compatible with iMX8QXP

In reply to John Ernberg

Allow the uart to probe also with iMX8QXP. The ip-block is the same as in the QM.

Since the fsl,imx8qm-lpuart compatible in Linux exists in name only and is not used in the driver any iMX8QM device tree that can boot Linux must set fsl,imx8qxp-lpuart compatible as well as the QM one.

Thus we replace the compatible rather than adding just another one.

---

v2:
- Replace the compatible rather than adding to the list (Julien Grall)
- Reword commit message to reflect the above.
- Collect Julien's ack

---
 xen/drivers/char/imx-lpuart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/char/imx-lpuart.c +1 -1
index 77f70c2719..7a9c2e3878 100644
@@ -256,7 +256,7 @@ static int __init imx_lpuart_init(struct dt_device_node *dev,
 
 static const struct dt_device_match imx_lpuart_dt_compat[] __initconst =
 {
-    DT_MATCH_COMPATIBLE("fsl,imx8qm-lpuart"),
+    DT_MATCH_COMPATIBLE("fsl,imx8qxp-lpuart"),
     { /* sentinel */ },
 };
 
Signature · 1 line
2.43.0