Skip to contentSkip to conversation

xen/arm: Add support for S32CC platforms and LINFlexD UART

PATCH Superseded Andrei Cherechesu (OSS) 5 participants 23 messages Dec 18, 2024 – Dec 19, 2024

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover xen/arm: Add support for S32CC platforms and LINFlexD UART

From: Andrei Cherechesu <[email protected]>

Targeting: Xen 4.20
This v3 version of this patch series finishes the work left to support NXP S32G3 Processors [0], part of the NXP S32CC Family. The LINFlexD UART support patches have been merged in v2. Platforms using S32G3 Processors are not affected by the TLBI by VA erratum (discussed in v2), and are security supported without a workaround needed in Xen or guests. The workaround needed for S32G2/S32R45 will be addressed in future series.

The 1st patch introduces a generic mechanism for forwarding SCMI over SMC calls to firmware running at EL3, selected via CONFIG_SCMI_SMC. The 2nd patch refactors the SiP SMC handling in vSMC mechanism, to rely firstly on platform_smc() if implemented, then on the previously introduced generic SCMI handling/forwarding mechanism if enabled.

The 3rd patch adds S32G3 platform config to enable the required drivers for S32G3-based platforms.

The 4th, 5th and 6th patches modify the CHANGELOG.md, SUPPORT.md and MAINTAINERS files, respectively, to add mentions about LINFlexD UART support, S32G3 Processors support, and the new SCMI-SMC layer introduced.

[0] https://www.nxp.com/products/S32G3

v2->v3:
- linflex-uart (Patch [v2,1/8] and [v2,2/8], now dropped):
- Patches merged in v2, no longer re-submitted
- SCMI-SMC handling layer (Patch [v2,3/8], now [v3,1/6]):
- Changed occurrences of calls coming from "Dom0", to "hwdom" or "hardware domain"
- Made initialization part of initcall chain instead of presmp_initcall
- Changed occurrences related to "Dom0 DT", to "Host DT"
- Made scmi_support and scmi_smc_id variables __ro_after_init
- Used current->domain to print domain ID (with %pd formatter)
- Dropped usage of local string var smc_id_prop to store "arm,smc-id"
- Added usage of XENLOG_* levels to all prints
- Changed print in scmi_check_smccc_ver() to XENLOG_WARNING
- If scmi_check_smccc_ver() fails, initialization fails silently (only printing a warning regarding no SMCCC support) since it's optional
- Made scmi_is_valid_smc_id() private to the driver and used it in scmi_handle_smc() instead of requiring usage by its callers
- Created a 'firmware' folder in xen/arch/arm, to store the SCMI related code, and moved the SCMI-SMC layer implementation there
- Handling SiP as SCMI SMC (Patch [v2,4/8] now [v3,2/6]):
- Dropped implementation-specific details in commit message and code comments
- S32G3 platform config (Patch [v2,5/8] now [v3,3/6]):
- As motivated at the beginning of this cover letter, changed the config name and description from S32CC to S32G3
- Dropped the s32cc.c dummy platform code and the CONFIG_S32CC_PLATFORM used to enable its compilation
- Dropped Stefano's "Reviewed-by", since patch had non-trivial changes. Please re-approve.
- CHANGELOG.md (Patch [v2,6/8] now [v3,4/6]):
- Changed 'dom0' to 'hwdom'
- Changed S32CC to S32G3, as motivated at the beginning of the cover letter
- Rephrased to drop the 'Add' word since the entries are already part of the 'Added' category
- Dropped Stefano's and Oleksii's "Acked-by", since patch had non-trivial changes. Please re-approve.
- SUPPORT.md (Patch [v2,7/8] now [v3,5/6]):
- Changed 'dom0' to 'hwdom'
- Changed 'Dom0 DT' to 'Host DT'
- MAINTAINERS (Patch [v2,8/8] now [v3,6/6]):
- Dropped linflex-uart.c driver from ARM Architecture list
- Dropped s32cc.c platform file since it's been dropped from Patch [v3,3/6]
- Changed S32CC to S32G3, as motivated at the beginning of the cover letter
- Dropped Stefano's "Acked-by", since patch had non-trivial changes. Please re-approve.

v1->v2:
- linflex-uart:
- Addressed coding style comments from Julien:
- spaces vs. tabs
- indentation
- license issue
- comments format
- code reusage
- misplaced loop exit
- Made the pointer to struct linflex_uart const in most functions since it's not modified
- Added support for customizable baud rate through console options, parsing what Xen gets in its bootargs. other parameters following <baud> are discarded for the moment.
- SCMI SMC handling:
- Added a generic scmi-smc layer (enabled by CONFIG_SCMI_SMC) to enable forwarding SCMI requests over SMC to EL3 FW if issued by Dom0. If the SCMI firmware node is not found in Dom0's DT during initialization, it fails silently as it's not mandatory.
- Changed the handling for SiP SMCs in vsmc.c to firstly try the platform_smc() callback if implemented, then try to handle the SiP SMC as SCMI if enabled and SMC ID matches.
- S32CC Platform support:
- Added dependency on CONFIG_SCMI_SMC
- Removed the S32CC platform-specific forwarding to EL3 mechanism.
- Dropped unused headers
- CHANGELOG.md:
- Added mentions about S32CC support and SCMI-SMC layer.
- SUPPORT.md:
- Added SCMI over SMC forwarding to EL3 feature for Arm as supported.
- MAINTAINERS:
- Added myself as maintainer for S32CC platforms and NXP S32 Linux Team as reviewer list.

Andrei Cherechesu (6):
xen/arm: firmware: Add SCMI over SMC calls handling layer xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls xen/arm: platforms: Add NXP S32G3 Processors config CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions SUPPORT.md: Describe SCMI-SMC layer feature
MAINTAINERS: Add myself as maintainer for NXP S32G3

 CHANGELOG.md                                 |   3 +
 MAINTAINERS                                  |   6 +
 SUPPORT.md                                   |   8 +
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 ++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 166 +++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  46 +++++
 xen/arch/arm/platforms/Kconfig               |   8 +
 xen/arch/arm/vsmc.c                          |  16 +-
 11 files changed, 269 insertions(+), 1 deletion(-)
 create mode 100644 xen/arch/arm/firmware/Kconfig
 create mode 100644 xen/arch/arm/firmware/Makefile
 create mode 100644 xen/arch/arm/firmware/scmi-smc.c
 create mode 100644 xen/arch/arm/include/asm/firmware/scmi-smc.h
Signature · 1 line
2.45.2
#1 lore raw

PATCH v3 1/6 xen/arm: firmware: Add SCMI over SMC calls handling layer

From: Andrei Cherechesu <[email protected]>

Introduce the SCMI-SMC layer to have some basic degree of awareness about SCMI calls that are based on the ARM System Control and Management Interface (SCMI) specification (DEN0056E).

The SCMI specification includes various protocols for managing system-level resources, such as: clocks, pins, reset, system power, power domains, performance domains, etc. The clients are named "SCMI agents" and the server is named "SCMI platform".

Only support the shared-memory based transport with SMCs as the doorbell mechanism for notifying the platform. Also, this implementation only handles the "arm,scmi-smc" compatible, requiring the following properties:
- "arm,smc-id" (unique SMC ID)
- "shmem" (one or more phandles pointing to shmem zones for each channel)

The initialization is done as initcall, since we need SMCs, and PSCI should already probe EL3 FW for SMCCC support. If no "arm,scmi-smc" compatible node is found in the host DT, the initialization fails silently, as it's not mandatory. Otherwise, we get the 'arm,smc-id' DT property from the node, to know the SCMI SMC ID we handle. The 'shmem' memory ranges are not validated, as the SMC calls are only passed through to EL3 FW if coming from the hardware domain.

Create a new 'firmware' folder to keep the SCMI code separate from the generic ARM code.

---
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 ++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 166 +++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  46 +++++
 6 files changed, 229 insertions(+)
 create mode 100644 xen/arch/arm/firmware/Kconfig
 create mode 100644 xen/arch/arm/firmware/Makefile
 create mode 100644 xen/arch/arm/firmware/scmi-smc.c
 create mode 100644 xen/arch/arm/include/asm/firmware/scmi-smc.h
xen/arch/arm/Kconfig +2 -0
index 604aba4996..23dc7162a7 100644
@@ -271,6 +271,8 @@ config PARTIAL_EMULATION
 	  not been emulated to their complete functionality. Enabling this might
 	  result in unwanted/non-spec compliant behavior.
 
+source "arch/arm/firmware/Kconfig"
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
xen/arch/arm/Makefile +1 -0
index e4ad1ce851..8c696c2011 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
 obj-y += platforms/
 endif
+obj-y += firmware/
 obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
xen/arch/arm/firmware/Kconfig new file +13 -0
new file mode 100644
index 0000000000..817da745fd
@@ -0,0 +1,13 @@
+menu "Firmware Drivers"
+
+config SCMI_SMC
+	bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
+	default y
+	help
+	  This option enables basic awareness for SCMI calls using SMC as
+	  doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
+	  compatible only). The value of "arm,smc-id" DT property from SCMI
+	  firmware node is used to trap and forward corresponding SCMI SMCs
+	  to firmware running at EL3, for calls coming from the hardware domain.
+
+endmenu
xen/arch/arm/firmware/Makefile new file +1 -0
new file mode 100644
index 0000000000..a5e4542666
@@ -0,0 +1 @@
+obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
xen/arch/arm/firmware/scmi-smc.c new file +166 -0

166 lines not on this page · raw message

xen/arch/arm/include/asm/firmware/scmi-smc.h new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.45.2
#2 lore raw

Re: [PATCH v3 1/6] xen/arm: firmware: Add SCMI over SMC calls handling layer

Quoted 119 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Introduce the SCMI-SMC layer to have some basic degree of awareness about SCMI calls that are based on the ARM System Control and Management Interface (SCMI) specification (DEN0056E).

The SCMI specification includes various protocols for managing system-level resources, such as: clocks, pins, reset, system power, power domains, performance domains, etc. The clients are named "SCMI agents" and the server is named "SCMI platform".

Only support the shared-memory based transport with SMCs as the doorbell mechanism for notifying the platform. Also, this implementation only handles the "arm,scmi-smc" compatible, requiring the following properties:
- "arm,smc-id" (unique SMC ID)
- "shmem" (one or more phandles pointing to shmem zones for each channel)

The initialization is done as initcall, since we need SMCs, and PSCI should already probe EL3 FW for SMCCC support. If no "arm,scmi-smc" compatible node is found in the host DT, the initialization fails silently, as it's not mandatory. Otherwise, we get the 'arm,smc-id' DT property from the node, to know the SCMI SMC ID we handle. The 'shmem' memory ranges are not validated, as the SMC calls are only passed through to EL3 FW if coming from the hardware domain.

Create a new 'firmware' folder to keep the SCMI code separate from the generic ARM code.

---
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 ++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 166 +++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  46 +++++
 6 files changed, 229 insertions(+)
 create mode 100644 xen/arch/arm/firmware/Kconfig
 create mode 100644 xen/arch/arm/firmware/Makefile
 create mode 100644 xen/arch/arm/firmware/scmi-smc.c
 create mode 100644 xen/arch/arm/include/asm/firmware/scmi-smc.h
xen/arch/arm/Kconfig +2 -0
index 604aba4996..23dc7162a7 100644
@@ -271,6 +271,8 @@ config PARTIAL_EMULATION
          not been emulated to their complete functionality. Enabling this might
          result in unwanted/non-spec compliant behavior.
 
+source "arch/arm/firmware/Kconfig"
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
xen/arch/arm/Makefile +1 -0
index e4ad1ce851..8c696c2011 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
 obj-y += platforms/
 endif
+obj-y += firmware/
 obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
xen/arch/arm/firmware/Kconfig new file +13 -0
new file mode 100644
index 0000000000..817da745fd
@@ -0,0 +1,13 @@
+menu "Firmware Drivers"
+
+config SCMI_SMC
+       bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
+       default y
+       help
+         This option enables basic awareness for SCMI calls using SMC as
+         doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
+         compatible only). The value of "arm,smc-id" DT property from SCMI
+         firmware node is used to trap and forward corresponding SCMI SMCs
+         to firmware running at EL3, for calls coming from the hardware domain.
+
+endmenu
xen/arch/arm/firmware/Makefile new file +1 -0
new file mode 100644
index 0000000000..a5e4542666
@@ -0,0 +1 @@
+obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
xen/arch/arm/firmware/scmi-smc.c new file +14 -0
new file mode 100644
index 0000000000..62657308d6
@@ -0,0 +1,166 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * xen/arch/arm/firmware/scmi-smc.c
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <[email protected]>
+ * Copyright 2024 NXP
+ */
+
+#include <xen/acpi.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>

xen/arch/arm/firmware/scmi-smc.c line 24

Quoted 10 lines
xen/arch/arm/firmware/scmi-smc.c new file +10 -0
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/firmware/scmi-smc.h>
+
+#define SCMI_SMC_ID_PROP   "arm,smc-id"
+
+static bool __ro_after_init scmi_support;

I don't understand the need for this variable. IMO it's useless, given that in next patch you do:

...
if ( scmi_is_enabled() )

    return scmi_handle_smc(regs);

return false;

which could simply be changed to:
...
return scmi_handle_smc(regs);

and the variable, functions for it, etc. could be removed which would simplify the code.

[...]

xen/arch/arm/firmware/scmi-smc.c line 151

Quoted 1 line
xen/arch/arm/firmware/scmi-smc.c new file +1 -0
+err:

CODING_STYLE: this should be indented with one space.

~Michal

#3 lore raw

Re: [PATCH v3 1/6] xen/arm: firmware: Add SCMI over SMC calls handling layer

Hi Michal,

Thank you for the review.

Quoted 138 lines · Michal Orzel
Quoted 118 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Introduce the SCMI-SMC layer to have some basic degree of awareness about SCMI calls that are based on the ARM System Control and Management Interface (SCMI) specification (DEN0056E).

The SCMI specification includes various protocols for managing system-level resources, such as: clocks, pins, reset, system power, power domains, performance domains, etc. The clients are named "SCMI agents" and the server is named "SCMI platform".

Only support the shared-memory based transport with SMCs as the doorbell mechanism for notifying the platform. Also, this implementation only handles the "arm,scmi-smc" compatible, requiring the following properties:
- "arm,smc-id" (unique SMC ID)
- "shmem" (one or more phandles pointing to shmem zones for each channel)

The initialization is done as initcall, since we need SMCs, and PSCI should already probe EL3 FW for SMCCC support. If no "arm,scmi-smc" compatible node is found in the host DT, the initialization fails silently, as it's not mandatory. Otherwise, we get the 'arm,smc-id' DT property from the node, to know the SCMI SMC ID we handle. The 'shmem' memory ranges are not validated, as the SMC calls are only passed through to EL3 FW if coming from the hardware domain.

Create a new 'firmware' folder to keep the SCMI code separate from the generic ARM code.

---
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 ++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 166 +++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  46 +++++
 6 files changed, 229 insertions(+)
 create mode 100644 xen/arch/arm/firmware/Kconfig
 create mode 100644 xen/arch/arm/firmware/Makefile
 create mode 100644 xen/arch/arm/firmware/scmi-smc.c
 create mode 100644 xen/arch/arm/include/asm/firmware/scmi-smc.h
xen/arch/arm/Kconfig +2 -0
index 604aba4996..23dc7162a7 100644
@@ -271,6 +271,8 @@ config PARTIAL_EMULATION
          not been emulated to their complete functionality. Enabling this might
          result in unwanted/non-spec compliant behavior.
 
+source "arch/arm/firmware/Kconfig"
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
xen/arch/arm/Makefile +1 -0
index e4ad1ce851..8c696c2011 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
 obj-y += platforms/
 endif
+obj-y += firmware/
 obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
xen/arch/arm/firmware/Kconfig new file +13 -0
new file mode 100644
index 0000000000..817da745fd
@@ -0,0 +1,13 @@
+menu "Firmware Drivers"
+
+config SCMI_SMC
+       bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
+       default y
+       help
+         This option enables basic awareness for SCMI calls using SMC as
+         doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
+         compatible only). The value of "arm,smc-id" DT property from SCMI
+         firmware node is used to trap and forward corresponding SCMI SMCs
+         to firmware running at EL3, for calls coming from the hardware domain.
+
+endmenu
xen/arch/arm/firmware/Makefile new file +1 -0
new file mode 100644
index 0000000000..a5e4542666
@@ -0,0 +1 @@
+obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
xen/arch/arm/firmware/scmi-smc.c new file +14 -0
new file mode 100644
index 0000000000..62657308d6
@@ -0,0 +1,166 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * xen/arch/arm/firmware/scmi-smc.c
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <[email protected]>
+ * Copyright 2024 NXP
+ */
+
+#include <xen/acpi.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>

xen/arch/arm/firmware/scmi-smc.c line 24

Quoted 10 lines
xen/arch/arm/firmware/scmi-smc.c new file +10 -0
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/firmware/scmi-smc.h>
+
+#define SCMI_SMC_ID_PROP   "arm,smc-id"
+
+static bool __ro_after_init scmi_support;

I don't understand the need for this variable. IMO it's useless, given that in next patch you do:

...
if ( scmi_is_enabled() )

    return scmi_handle_smc(regs);

return false;

Quoted 7 lines

which could simply be changed to:
...
return scmi_handle_smc(regs);

and the variable, functions for it, etc. could be removed which would simplify the code.

[...]

Well, I agree that the code would maybe be simpler, but that means we would call scmi_handle_smc() both when SCMI-SMC layer is initialized and when it is not.

That then means that if scmi_handle_smc() returns false, we won't know in the caller if the SCMI-SMC layer is not initialized at all or if it is initialized, but the SMC request is invalid (it does not have the SMC ID we expect). Do we need to, though?

But even if we're not exporting the internal status of the SCMI layer (enabled/disabled), the driver itself needs to have an internal state to to know if it's been correctly initialized or not, right? Otherwise, how would we know internally if we can actually handle a SCMI request or not?

Well, we could manage to base this mechanism entirely on the scmi_smc_id variable (i.e., if scmi_smc_id is not 0, then we know the SCMI-SMC layer is initialized). This could work as long as this handler is not called in a situation where the ID of the SMC we're trapping could actually be 0. And it currently would be not, since FID == 0 is reserved for Arm Architecture SMCs.

So, I agree that it makes the code simpler in some sense, but it will add some underlying assumptions and make it less explicit.

I'm happy to implement your suggested changes. But I need to know that I understood correctly your comments and that you agree with the implications I've stated above.

Quoted 3 lines

xen/arch/arm/firmware/scmi-smc.c line 151

Quoted 2 lines
xen/arch/arm/firmware/scmi-smc.c new file +1 -0
+err:

CODING_STYLE: this should be indented with one space.

Will fix.

Quoted 3 lines

~Michal

Regards,
Andrei Cherechesu

#4 lore raw

Re: [PATCH v3 1/6] xen/arm: firmware: Add SCMI over SMC calls handling layer

Quoted 157 lines · Andrei Cherechesu

Hi Michal,

Thank you for the review.

Quoted 138 lines · Michal Orzel
Quoted 118 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Introduce the SCMI-SMC layer to have some basic degree of awareness about SCMI calls that are based on the ARM System Control and Management Interface (SCMI) specification (DEN0056E).

The SCMI specification includes various protocols for managing system-level resources, such as: clocks, pins, reset, system power, power domains, performance domains, etc. The clients are named "SCMI agents" and the server is named "SCMI platform".

Only support the shared-memory based transport with SMCs as the doorbell mechanism for notifying the platform. Also, this implementation only handles the "arm,scmi-smc" compatible, requiring the following properties:
- "arm,smc-id" (unique SMC ID)
- "shmem" (one or more phandles pointing to shmem zones for each channel)

The initialization is done as initcall, since we need SMCs, and PSCI should already probe EL3 FW for SMCCC support. If no "arm,scmi-smc" compatible node is found in the host DT, the initialization fails silently, as it's not mandatory. Otherwise, we get the 'arm,smc-id' DT property from the node, to know the SCMI SMC ID we handle. The 'shmem' memory ranges are not validated, as the SMC calls are only passed through to EL3 FW if coming from the hardware domain.

Create a new 'firmware' folder to keep the SCMI code separate from the generic ARM code.

---
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 ++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 166 +++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  46 +++++
 6 files changed, 229 insertions(+)
 create mode 100644 xen/arch/arm/firmware/Kconfig
 create mode 100644 xen/arch/arm/firmware/Makefile
 create mode 100644 xen/arch/arm/firmware/scmi-smc.c
 create mode 100644 xen/arch/arm/include/asm/firmware/scmi-smc.h
xen/arch/arm/Kconfig +2 -0
index 604aba4996..23dc7162a7 100644
@@ -271,6 +271,8 @@ config PARTIAL_EMULATION
          not been emulated to their complete functionality. Enabling this might
          result in unwanted/non-spec compliant behavior.
 
+source "arch/arm/firmware/Kconfig"
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
xen/arch/arm/Makefile +1 -0
index e4ad1ce851..8c696c2011 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
 obj-y += platforms/
 endif
+obj-y += firmware/
 obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
xen/arch/arm/firmware/Kconfig new file +13 -0
new file mode 100644
index 0000000000..817da745fd
@@ -0,0 +1,13 @@
+menu "Firmware Drivers"
+
+config SCMI_SMC
+       bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
+       default y
+       help
+         This option enables basic awareness for SCMI calls using SMC as
+         doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
+         compatible only). The value of "arm,smc-id" DT property from SCMI
+         firmware node is used to trap and forward corresponding SCMI SMCs
+         to firmware running at EL3, for calls coming from the hardware domain.
+
+endmenu
xen/arch/arm/firmware/Makefile new file +1 -0
new file mode 100644
index 0000000000..a5e4542666
@@ -0,0 +1 @@
+obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
xen/arch/arm/firmware/scmi-smc.c new file +14 -0
new file mode 100644
index 0000000000..62657308d6
@@ -0,0 +1,166 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * xen/arch/arm/firmware/scmi-smc.c
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <[email protected]>
+ * Copyright 2024 NXP
+ */
+
+#include <xen/acpi.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>

xen/arch/arm/firmware/scmi-smc.c line 24

Quoted 10 lines
xen/arch/arm/firmware/scmi-smc.c new file +10 -0
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/firmware/scmi-smc.h>
+
+#define SCMI_SMC_ID_PROP   "arm,smc-id"
+
+static bool __ro_after_init scmi_support;

I don't understand the need for this variable. IMO it's useless, given that in next patch you do:

...
if ( scmi_is_enabled() )

    return scmi_handle_smc(regs);

return false;

Quoted 7 lines

which could simply be changed to:
...
return scmi_handle_smc(regs);

and the variable, functions for it, etc. could be removed which would simplify the code.

[...]

Well, I agree that the code would maybe be simpler, but that means we would call scmi_handle_smc() both when SCMI-SMC layer is initialized and when it is not.

Quoted 5 lines

That then means that if scmi_handle_smc() returns false, we won't know in the caller if the SCMI-SMC layer is not initialized at all or if it is initialized, but the SMC request is invalid (it does not have the SMC ID we expect). Do we need to, though?

Let me explain more:
scmi_handle_smc() is called from within handle_sip() that can result true/false. If SCMI is disabled, we need to return false. If SCMI is enabled but request is invalid we need to return false as well. If SCMI is enabled but not initialized we also need to return false. I suggest to drop scmi_is_enabled() as exported function and only use scmi_handle_smc() as global like I did in my example. Now, this solves the part where SCMI is disabled since you have a stub returning false and also the part where SCMI request is invalid. However, this does not solve the part where SCMI is enabled but layer not initialized. To fix it, you simply need to check inside scmi_handle_smc() if it's initialized. That's much simpler than requiring to use another global function which is not nice.

Diff below:

xen/arch/arm/firmware/scmi-smc.c +3 -6
index 62657308d61d..b3f34bdbb89b 100644
@@ -24,12 +24,6 @@
 static bool __ro_after_init scmi_support;
 static uint32_t __ro_after_init scmi_smc_id;
 
-/* Check if SCMI layer correctly initialized and can be used. */
-bool scmi_is_enabled(void)
-{
-    return scmi_support;
-}
-
 /*
  * Check if provided SMC Function Identifier matches the one known by the SCMI
  * layer, as read from DT prop 'arm,smc-id' during initialiation.
@@ -52,6 +46,9 @@ bool scmi_handle_smc(struct cpu_user_regs *regs)
     uint32_t fid = (uint32_t)get_user_reg(regs, 0);
     struct arm_smccc_res res;
 
+    if ( !scmi_support )
+        return false;
+
     if ( !scmi_is_valid_smc_id(fid) )
         return false;
 
xen/arch/arm/include/asm/firmware/scmi-smc.h +0 -6
index 57cc9eef8676..58730a8037c5 100644
@@ -17,16 +17,10 @@
 
 #ifdef CONFIG_SCMI_SMC
 
-bool scmi_is_enabled(void);
 bool scmi_handle_smc(struct cpu_user_regs *regs);
 
 #else
 
-static inline bool scmi_is_enabled(void)
-{
-    return false;
-}
-
 static inline bool scmi_handle_smc(struct cpu_user_regs *regs)
 {
     return false;
xen/arch/arm/vsmc.c +1 -4
index c4d225c45cd3..62d8117a120c 100644
@@ -232,10 +232,7 @@ static bool handle_sip(struct cpu_user_regs *regs)
     if ( platform_smc(regs) )
         return true;
 
-    if ( scmi_is_enabled() )
-        return scmi_handle_smc(regs);
-
-    return false;
+    return scmi_handle_smc(regs);
 }
 
 /*

~Michal

#5 lore raw

Re: [PATCH v3 1/6] xen/arm: firmware: Add SCMI over SMC calls handling layer

Hi Michal,

Quoted 160 lines · Michal Orzel
Quoted 153 lines · Andrei Cherechesu

Hi Michal,

Thank you for the review.

Quoted 136 lines · Michal Orzel
Quoted 117 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Introduce the SCMI-SMC layer to have some basic degree of awareness about SCMI calls that are based on the ARM System Control and Management Interface (SCMI) specification (DEN0056E).

The SCMI specification includes various protocols for managing system-level resources, such as: clocks, pins, reset, system power, power domains, performance domains, etc. The clients are named "SCMI agents" and the server is named "SCMI platform".

Only support the shared-memory based transport with SMCs as the doorbell mechanism for notifying the platform. Also, this implementation only handles the "arm,scmi-smc" compatible, requiring the following properties:
- "arm,smc-id" (unique SMC ID)
- "shmem" (one or more phandles pointing to shmem zones for each channel)

The initialization is done as initcall, since we need SMCs, and PSCI should already probe EL3 FW for SMCCC support. If no "arm,scmi-smc" compatible node is found in the host DT, the initialization fails silently, as it's not mandatory. Otherwise, we get the 'arm,smc-id' DT property from the node, to know the SCMI SMC ID we handle. The 'shmem' memory ranges are not validated, as the SMC calls are only passed through to EL3 FW if coming from the hardware domain.

Create a new 'firmware' folder to keep the SCMI code separate from the generic ARM code.

---
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 ++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 166 +++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  46 +++++
 6 files changed, 229 insertions(+)
 create mode 100644 xen/arch/arm/firmware/Kconfig
 create mode 100644 xen/arch/arm/firmware/Makefile
 create mode 100644 xen/arch/arm/firmware/scmi-smc.c
 create mode 100644 xen/arch/arm/include/asm/firmware/scmi-smc.h
xen/arch/arm/Kconfig +2 -0
index 604aba4996..23dc7162a7 100644
@@ -271,6 +271,8 @@ config PARTIAL_EMULATION
          not been emulated to their complete functionality. Enabling this might
          result in unwanted/non-spec compliant behavior.
 
+source "arch/arm/firmware/Kconfig"
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
xen/arch/arm/Makefile +1 -0
index e4ad1ce851..8c696c2011 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
 obj-y += platforms/
 endif
+obj-y += firmware/
 obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
xen/arch/arm/firmware/Kconfig new file +13 -0
new file mode 100644
index 0000000000..817da745fd
@@ -0,0 +1,13 @@
+menu "Firmware Drivers"
+
+config SCMI_SMC
+       bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
+       default y
+       help
+         This option enables basic awareness for SCMI calls using SMC as
+         doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
+         compatible only). The value of "arm,smc-id" DT property from SCMI
+         firmware node is used to trap and forward corresponding SCMI SMCs
+         to firmware running at EL3, for calls coming from the hardware domain.
+
+endmenu
xen/arch/arm/firmware/Makefile new file +1 -0
new file mode 100644
index 0000000000..a5e4542666
@@ -0,0 +1 @@
+obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
xen/arch/arm/firmware/scmi-smc.c new file +14 -0
new file mode 100644
index 0000000000..62657308d6
@@ -0,0 +1,166 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * xen/arch/arm/firmware/scmi-smc.c
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <[email protected]>
+ * Copyright 2024 NXP
+ */
+
+#include <xen/acpi.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>

xen/arch/arm/firmware/scmi-smc.c line 24

Quoted 10 lines
xen/arch/arm/firmware/scmi-smc.c new file +10 -0
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/firmware/scmi-smc.h>
+
+#define SCMI_SMC_ID_PROP   "arm,smc-id"
+
+static bool __ro_after_init scmi_support;

I don't understand the need for this variable. IMO it's useless, given that in next patch you do:

...
if ( scmi_is_enabled() )

    return scmi_handle_smc(regs);

return false;

Quoted 7 lines

which could simply be changed to:
...
return scmi_handle_smc(regs);

and the variable, functions for it, etc. could be removed which would simplify the code.

[...]

Well, I agree that the code would maybe be simpler, but that means we would call scmi_handle_smc() both when SCMI-SMC layer is initialized and when it is not.

Quoted 5 lines

That then means that if scmi_handle_smc() returns false, we won't know in the caller if the SCMI-SMC layer is not initialized at all or if it is initialized, but the SMC request is invalid (it does not have the SMC ID we expect). Do we need to, though?

Quoted 5 lines

Let me explain more:
scmi_handle_smc() is called from within handle_sip() that can result true/false. If SCMI is disabled, we need to return false. If SCMI is enabled but request is invalid we need to return false as well. If SCMI is enabled but not initialized we also need to return false.

Right, that's what I expressed my concern about too: that we're grouping up all of these cases under a single return code of the same function. I'm fine with that, though.

Quoted 7 lines

I suggest to drop scmi_is_enabled() as exported
function and only use scmi_handle_smc() as global like I did in my example. Now, this solves the part where SCMI is disabled since you have a stub returning false and also the part where SCMI request is invalid. However, this does not solve the part where SCMI is enabled but layer not initialized. To fix it, you simply need to check inside scmi_handle_smc() if it's initialized. That's much simpler than requiring to use another global function which is not nice.

Got it, my understanding was that you suggested to completely drop the scmi_support variable and its associated function (scmi_is_enabled()), and decide internally whether the SCMI layer is initialized based on another mechanism. That's why I suggested scmi_smc_id != 0 as mechanism and said that it simplifies the code, but requires maybe some non-trivial assumptions (if scmi_smc_id == 0 => SCMI not initialized yet).
...

Quoted 56 lines

Diff below:

xen/arch/arm/firmware/scmi-smc.c +3 -6
index 62657308d61d..b3f34bdbb89b 100644
@@ -24,12 +24,6 @@
 static bool __ro_after_init scmi_support;
 static uint32_t __ro_after_init scmi_smc_id;
 
-/* Check if SCMI layer correctly initialized and can be used. */
-bool scmi_is_enabled(void)
-{
-    return scmi_support;
-}
-
 /*
  * Check if provided SMC Function Identifier matches the one known by the SCMI
  * layer, as read from DT prop 'arm,smc-id' during initialiation.
@@ -52,6 +46,9 @@ bool scmi_handle_smc(struct cpu_user_regs *regs)
     uint32_t fid = (uint32_t)get_user_reg(regs, 0);
     struct arm_smccc_res res;
 
+    if ( !scmi_support )
+        return false;
+
     if ( !scmi_is_valid_smc_id(fid) )
         return false;
 
xen/arch/arm/include/asm/firmware/scmi-smc.h +0 -6
index 57cc9eef8676..58730a8037c5 100644
@@ -17,16 +17,10 @@
 
 #ifdef CONFIG_SCMI_SMC
 
-bool scmi_is_enabled(void);
 bool scmi_handle_smc(struct cpu_user_regs *regs);
 
 #else
 
-static inline bool scmi_is_enabled(void)
-{
-    return false;
-}
-
 static inline bool scmi_handle_smc(struct cpu_user_regs *regs)
 {
     return false;
xen/arch/arm/vsmc.c +0 -0
index c4d225c45cd3..62d8117a120c 100644
@@ -232,10 +232,7 @@ static bool handle_sip(struct cpu_user_regs *regs)
     if ( platform_smc(regs) )

xen/arch/arm/vsmc.c static bool handle_sip(struct cpu_user_regs *regs) · line 238

Quoted 10 lines
xen/arch/arm/vsmc.c +1 -4
         return true;
 
-    if ( scmi_is_enabled() )
-        return scmi_handle_smc(regs);
-
-    return false;
+    return scmi_handle_smc(regs);
 }
 
 /*

...
I understand now that your suggestions were not that restrictive :).

Thank you for the clarification!
v4 is on the way.

Quoted 2 lines

~Michal

Regards,
Andrei Cherechesu

#6 lore raw

Re: [PATCH v3 1/6] xen/arm: firmware: Add SCMI over SMC calls handling layer

In reply to Andrei Cherechesu (OSS)
Quoted 8 lines · Andrei Cherechesu (OSS)
xen/arch/arm/firmware/scmi-smc.c new file +3 -0
new file mode 100644
index 0000000000..62657308d6
+bool scmi_handle_smc(struct cpu_user_regs *regs)
+{
+    uint32_t fid = (uint32_t)get_user_reg(regs, 0);

xen/arch/arm/firmware/scmi-smc.c line 62

Quoted 10 lines
xen/arch/arm/firmware/scmi-smc.c new file +10 -0
+    struct arm_smccc_res res;
+
+    if ( !scmi_is_valid_smc_id(fid) )
+        return false;
+
+    /* Only the hardware domain should use SCMI calls */
+    if ( !is_hardware_domain(current->domain) )
+    {
+        gprintk(XENLOG_ERR, "SCMI: Unprivileged %pd cannot use SCMI.\n",
+                current->domain);

Minor points.

gprintk() already renders current at the start of the line, so you don't need the extra %pd.

I'd suggest simply XENLOG_WARNING "SCMI: Unprivileged access attempt\n".

A double "SCMI", and trailing punctuation is not useful in the log.

However, I'd also suggest using gdprintk() because this is guest trigger-able and not interesting to see in a release build.

xen/arch/arm/include/asm/firmware/scmi-smc.h line 16

Quoted 10 lines
xen/arch/arm/include/asm/firmware/scmi-smc.h new file +5 -0
new file mode 100644
index 0000000000..57cc9eef86
+#ifndef __ASM_SCMI_SMC_H__
+#define __ASM_SCMI_SMC_H__
+
+#include <xen/types.h>
+#include <asm/regs.h>

You can remove the include of asm/regs.h, and simply declare:

struct cpu_user_regs;

here.  Nothing in this file needs to deference the pointer.

~Andrew

#7 lore raw

PATCH v3 2/6 xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls

In reply to Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Change the handling of SiP SMC calls to be more generic, instead of directly relying on the platform_smc() callback implementation.

Try to handle the SiP SMC first through the platform_smc() callback (if implemented). If not handled, check if the SCMI layer is available and try to handle it as SCMI message.

---
 xen/arch/arm/vsmc.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
xen/arch/arm/vsmc.c +15 -1
index f679cced7f..c4d225c45c 100644
@@ -20,6 +20,7 @@
 #include <asm/traps.h>
 #include <asm/vpsci.h>
 #include <asm/platform.h>
+#include <asm/firmware/scmi-smc.h>
 
 /* Number of functions currently supported by Hypervisor Service. */
 #define XEN_SMCCC_FUNCTION_COUNT 3
@@ -224,6 +225,19 @@ static bool handle_sssc(struct cpu_user_regs *regs)
     }
 }
 
+/* Secure Calls defined by the Silicon Provider (SiP) */
+static bool handle_sip(struct cpu_user_regs *regs)
+{
+    /* Firstly, let each platform define custom handling for these SMCs */
+    if ( platform_smc(regs) )
+        return true;
+
+    if ( scmi_is_enabled() )
+        return scmi_handle_smc(regs);
+
+    return false;
+}
+
 /*
  * vsmccc_handle_call() - handle SMC/HVC call according to ARM SMCCC.
  * returns true if that was valid SMCCC call (even if function number
@@ -288,7 +302,7 @@ static bool vsmccc_handle_call(struct cpu_user_regs *regs)
             handled = handle_sssc(regs);
             break;
         case ARM_SMCCC_OWNER_SIP:
-            handled = platform_smc(regs);
+            handled = handle_sip(regs);
             break;
         case ARM_SMCCC_OWNER_TRUSTED_APP ... ARM_SMCCC_OWNER_TRUSTED_APP_END:
         case ARM_SMCCC_OWNER_TRUSTED_OS ... ARM_SMCCC_OWNER_TRUSTED_OS_END:
Signature · 1 line
2.45.2
#8 lore raw

PATCH v3 3/6 xen/arm: platforms: Add NXP S32G3 Processors config

In reply to Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Platforms based on NXP S32G3 processors use the NXP LINFlexD UART driver for console by default, and rely on Dom0 having access to SCMI services for system-level resources from firmware at EL3.

---
 xen/arch/arm/platforms/Kconfig | 8 ++++++++
 1 file changed, 8 insertions(+)
xen/arch/arm/platforms/Kconfig +8 -0
index 02322c259c..6dbf6ec87b 100644
@@ -37,6 +37,14 @@ config MPSOC
 	help
 	Enable all the required drivers for Xilinx Ultrascale+ MPSoC
 
+config S32G3
+	bool "NXP S32G3 Processors support"
+	depends on ARM_64
+	select HAS_LINFLEX
+	select SCMI_SMC
+	help
+	Enable all the required drivers for NXP S32G3 Processors Family
+
 config NO_PLAT
 	bool "No Platforms"
 	help
Signature · 1 line
2.45.2
Reviewed-by on v3 3/6
#9 lore raw

Re: [PATCH v3 3/6] xen/arm: platforms: Add NXP S32G3 Processors config

Hi Andrei,

Quoted 10 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Platforms based on NXP S32G3 processors use the NXP LINFlexD UART driver for console by default, and rely on Dom0 having access to SCMI services for system-level resources from firmware at EL3.

Cheers
Bertrand

Quoted 26 lines

---
xen/arch/arm/platforms/Kconfig | 8 ++++++++

1 file changed, 8 insertions(+)
xen/arch/arm/platforms/Kconfig +0 -0
index 02322c259c..6dbf6ec87b 100644
@@ -37,6 +37,14 @@ config MPSOC

help
Enable all the required drivers for Xilinx Ultrascale+ MPSoC

xen/arch/arm/platforms/Kconfig +8 -0
+config S32G3
+ bool "NXP S32G3 Processors support"
+ depends on ARM_64
+ select HAS_LINFLEX
+ select SCMI_SMC
+ help
+ Enable all the required drivers for NXP S32G3 Processors Family
+

config NO_PLAT
bool "No Platforms"
help

Signature · 1 line
2.45.2
#10 lore raw

Re: [PATCH v3 3/6] xen/arm: platforms: Add NXP S32G3 Processors config

In reply to Andrei Cherechesu (OSS)
Quoted 5 lines · Andrei Cherechesu (OSS)
xen/arch/arm/platforms/Kconfig +0 -0
index 02322c259c..6dbf6ec87b 100644

xen/arch/arm/platforms/Kconfig config MPSOC · line 46

Quoted 10 lines
xen/arch/arm/platforms/Kconfig +7 -0
@@ -37,6 +37,14 @@ config MPSOC
 	help
 	Enable all the required drivers for Xilinx Ultrascale+ MPSoC
 
+config S32G3
+	bool "NXP S32G3 Processors support"
+	depends on ARM_64
+	select HAS_LINFLEX
+	select SCMI_SMC
+	help
+	Enable all the required drivers for NXP S32G3 Processors Family

Minor point.  Help text should be intended by 1 tab and 2 spaces.  The surrounding examples are wrong.

This can probably be fixed on commit if the series doesn't need a resend.

~Andrew

#11 lore raw

Re: [PATCH v3 3/6] xen/arm: platforms: Add NXP S32G3 Processors config

Hi Andrew,

Quoted 22 lines · Andrew Cooper
Quoted 8 lines · Andrei Cherechesu (OSS)
xen/arch/arm/platforms/Kconfig +0 -0
index 02322c259c..6dbf6ec87b 100644
@@ -37,6 +37,14 @@ config MPSOC

help
Enable all the required drivers for Xilinx Ultrascale+ MPSoC

Quoted 7 lines

+config S32G3
+ bool "NXP S32G3 Processors support"
+ depends on ARM_64
+ select HAS_LINFLEX
+ select SCMI_SMC
+ help
+ Enable all the required drivers for NXP S32G3 Processors Family

Minor point. Help text should be intended by 1 tab and 2 spaces. The surrounding examples are wrong.

Quoted 1 line

This can probably be fixed on commit if the series doesn't need a resend.

All entries in this file are actually wrong.
I did not mention it due to this fact and I thought of pushing one change to fix them all instead once this would have been commited.

Cheers
Bertrand

Quoted 2 lines

~Andrew

#12 lore raw

Re: [PATCH v3 3/6] xen/arm: platforms: Add NXP S32G3 Processors config

Hi Bertrand, Andrew,

Quoted 23 lines · Bertrand Marquis

Hi Andrew,

Quoted 21 lines · Andrew Cooper
Quoted 8 lines · Andrei Cherechesu (OSS)
xen/arch/arm/platforms/Kconfig +0 -0
index 02322c259c..6dbf6ec87b 100644
@@ -37,6 +37,14 @@ config MPSOC

help
Enable all the required drivers for Xilinx Ultrascale+ MPSoC

Quoted 7 lines

+config S32G3
+ bool "NXP S32G3 Processors support"
+ depends on ARM_64
+ select HAS_LINFLEX
+ select SCMI_SMC
+ help
+ Enable all the required drivers for NXP S32G3 Processors Family

Minor point. Help text should be intended by 1 tab and 2 spaces. The surrounding examples are wrong.

Quoted 4 lines
Quoted 1 line

This can probably be fixed on commit if the series doesn't need a resend.

All entries in this file are actually wrong.
I did not mention it due to this fact and I thought of pushing one change to fix them all instead once this would have been commited.

So, do you want me do address this individually in v4 (which I will send anyway for other reasons), or would it be preferable that you make a separate patch to fix them all afterwards?

Quoted 5 lines

Cheers
Bertrand

Quoted 1 line

~Andrew

Regards,
Andrei Cherechesu

#13 lore raw

Re: [PATCH v3 3/6] xen/arm: platforms: Add NXP S32G3 Processors config

Hi Andrei,

Quoted 28 lines · Andrei Cherechesu

Hi Bertrand, Andrew,

Quoted 23 lines · Bertrand Marquis

Hi Andrew,

Quoted 21 lines · Andrew Cooper
Quoted 8 lines · Andrei Cherechesu (OSS)
xen/arch/arm/platforms/Kconfig +0 -0
index 02322c259c..6dbf6ec87b 100644
@@ -37,6 +37,14 @@ config MPSOC

help
Enable all the required drivers for Xilinx Ultrascale+ MPSoC

Quoted 7 lines

+config S32G3
+ bool "NXP S32G3 Processors support"
+ depends on ARM_64
+ select HAS_LINFLEX
+ select SCMI_SMC
+ help
+ Enable all the required drivers for NXP S32G3 Processors Family

Minor point. Help text should be intended by 1 tab and 2 spaces. The surrounding examples are wrong.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

This can probably be fixed on commit if the series doesn't need a resend.

All entries in this file are actually wrong.
I did not mention it due to this fact and I thought of pushing one change to fix them all instead once this would have been commited.

So, do you want me do address this individually in v4 (which I will send anyway for other reasons), or would it be preferable that you make a separate patch to fix them all afterwards?

Do not address this one, I will handle it with an independent patch after the release.

Cheers
Bertrand

Quoted 9 lines
Quoted 6 lines

Cheers
Bertrand

Quoted 1 line

~Andrew

Regards,
Andrei Cherechesu

#14 lore raw

PATCH v3 4/6 CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions

In reply to Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)
CHANGELOG.md +3 -0
index 15f681459f..bda43b1efb 100644
@@ -16,6 +16,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
  - On Arm:
    - Experimental support for Armv8-R.
+   - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
+   - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
+     forwarding the calls to EL3 FW if coming from hwdom.
  - On x86:
    - xl suspend/resume subcommands.
 
Signature · 1 line
2.45.2
Reviewed-by on v3 4/6
#15 lore raw

Re: [PATCH v3 4/6] CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions

Hi Andrei,

Quoted 5 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Cheers
Bertrand

Quoted 22 lines

---
CHANGELOG.md | 3 +++

1 file changed, 3 insertions(+)
CHANGELOG.md +3 -0
index 15f681459f..bda43b1efb 100644
@@ -16,6 +16,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
 - On Arm:
   - Experimental support for Armv8-R.
+   - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
+   - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
+     forwarding the calls to EL3 FW if coming from hwdom.
 - On x86:
   - xl suspend/resume subcommands.
 
Signature · 1 line
2.45.2
Acked-by on v3 4/6
#16 lore raw

Re: [PATCH v3 4/6] CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions

In reply to Andrei Cherechesu (OSS)
Quoted 3 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

~ Oleksii

Quoted 18 lines
---
  CHANGELOG.md | 3 +++
  1 file changed, 3 insertions(+)
CHANGELOG.md +3 -0
index 15f681459f..bda43b1efb 100644
@@ -16,6 +16,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  ### Added
   - On Arm:
     - Experimental support for Armv8-R.
+   - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
+   - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
+     forwarding the calls to EL3 FW if coming from hwdom.
   - On x86:
     - xl suspend/resume subcommands.
 
#17 lore raw

PATCH v3 5/6 SUPPORT.md: Describe SCMI-SMC layer feature

In reply to Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Describe the layer which enables SCMI over SMC calls forwarding to EL3 FW if issued by the Hardware domain. If the SCMI firmware node is not found in the Host DT during initialization, it fails silently as it's not mandatory.

The SCMI SMCs trapping at EL2 now lets hwdom perform SCMI ops for interacting with system-level resources almost as if it would be running natively.

---
 SUPPORT.md | 8 ++++++++
 1 file changed, 8 insertions(+)
SUPPORT.md +8 -0
index 82239d0294..1f7867bd32 100644
@@ -928,6 +928,14 @@ Add/Remove device tree nodes using a device tree overlay binary (.dtbo).
 
     Status: Tech Preview
 
+### Arm: SCMI over SMC calls forwarding to EL3 Firmware
+
+Enable SCMI calls using SMC as doorbell mechanism and Shared Memory for
+transport ("arm,scmi-smc" compatible only) to reach EL3 Firmware if issued
+by hwdom. Some platforms use SCMI for access to system-level resources.
+
+    Status: Supported
+
 ## Virtual Hardware, QEMU
 
 This section describes supported devices available in HVM mode using a
Signature · 1 line
2.45.2
Reviewed-by on v3 5/6
#18 lore raw

Re: [PATCH v3 5/6] SUPPORT.md: Describe SCMI-SMC layer feature

Hi Andrei,

Quoted 9 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Describe the layer which enables SCMI over SMC calls forwarding to EL3 FW if issued by the Hardware domain. If the SCMI firmware node is not found in the Host DT during initialization, it fails silently as it's not mandatory.

Quoted 5 lines

The SCMI SMCs trapping at EL2 now lets hwdom perform SCMI ops for interacting with system-level resources almost as if it would be running natively.

Cheers
Bertrand

Quoted 27 lines

---
SUPPORT.md | 8 ++++++++

1 file changed, 8 insertions(+)
SUPPORT.md +8 -0
index 82239d0294..1f7867bd32 100644
@@ -928,6 +928,14 @@ Add/Remove device tree nodes using a device tree overlay binary (.dtbo).
 
    Status: Tech Preview
 
+### Arm: SCMI over SMC calls forwarding to EL3 Firmware
+
+Enable SCMI calls using SMC as doorbell mechanism and Shared Memory for
+transport ("arm,scmi-smc" compatible only) to reach EL3 Firmware if issued
+by hwdom. Some platforms use SCMI for access to system-level resources.
+
+    Status: Supported
+
 ## Virtual Hardware, QEMU
 

This section describes supported devices available in HVM mode using a

Signature · 1 line
2.45.2
Acked-by
#19 lore raw

Re: [PATCH v3 5/6] SUPPORT.md: Describe SCMI-SMC layer feature

Quoted 13 lines · Bertrand Marquis

Hi Andrei,

Quoted 9 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Describe the layer which enables SCMI over SMC calls forwarding to EL3 FW if issued by the Hardware domain. If the SCMI firmware node is not found in the Host DT during initialization, it fails silently as it's not mandatory.

Quoted 7 lines
Quoted 5 lines

The SCMI SMCs trapping at EL2 now lets hwdom perform SCMI ops for interacting with system-level resources almost as if it would be running natively.

~Michal

#20 lore raw

PATCH v3 6/6 MAINTAINERS: Add myself as maintainer for NXP S32G3

In reply to Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Add myself as maintainer for NXP S32G3 SoCs Family, and the S32 Linux Team as relevant reviewers list.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 34ad49bc39..392f780f76 100644
@@ -426,6 +426,12 @@ L:	[email protected]
 T:	git https://xenbits.xenproject.org/git-http/mini-os.git
 F:	config/MiniOS.mk
 
+NXP S32G3 PROCESSORS FAMILY SUPPORT
+M:	Andrei Cherechesu <[email protected]>
+L:	NXP S32 Linux Team <[email protected]>
+F:	xen/arch/arm/include/asm/linflex-uart.h
+F:	xen/drivers/char/linflex-uart.c
+
 OCAML TOOLS
 M:	Christian Lindig <[email protected]>
 M:	David Scott <[email protected]>
Signature · 1 line
2.45.2
Acked-by on v3 6/6
#21 lore raw

Re: [PATCH v3 6/6] MAINTAINERS: Add myself as maintainer for NXP S32G3

Hi Andrei,

Quoted 8 lines · Andrei Cherechesu (OSS)

From: Andrei Cherechesu <[email protected]>

Add myself as maintainer for NXP S32G3 SoCs Family, and the S32 Linux Team as relevant reviewers list.

Cheers
Bertrand

Quoted 25 lines

---
MAINTAINERS | 6 ++++++

1 file changed, 6 insertions(+)
MAINTAINERS +0 -0
index 34ad49bc39..392f780f76 100644
@@ -426,6 +426,12 @@ L: [email protected]

T: git https://xenbits.xenproject.org/git-http/mini-os.git
F: config/MiniOS.mk

MAINTAINERS +6 -0
+NXP S32G3 PROCESSORS FAMILY SUPPORT
+M: Andrei Cherechesu <[email protected]>
+L: NXP S32 Linux Team <[email protected]>
+F: xen/arch/arm/include/asm/linflex-uart.h
+F: xen/drivers/char/linflex-uart.c
+

OCAML TOOLS
M: Christian Lindig <[email protected]>
M: David Scott <[email protected]>

Signature · 1 line
2.45.2
Acked-by
#22 lore raw

Re: [PATCH v3 6/6] MAINTAINERS: Add myself as maintainer for NXP S32G3

Quoted 6 lines · Bertrand Marquis

Hi Andrei,

Quoted 2 lines · Andrei Cherechesu (OSS)
Quoted 8 lines
Quoted 6 lines

From: Andrei Cherechesu <[email protected]>

Add myself as maintainer for NXP S32G3 SoCs Family, and the S32 Linux Team as relevant reviewers list.

~Michal