Skip to contentSkip to conversation

xen/arm: arm32: Add support to identify the Cortex-R52 processor

PATCH In review Ayan Kumar Halder 3 participants 12 messages Jun 20, 2023 – Jun 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: arm32: Add support to identify the Cortex-R52 processor

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

---
 xen/arch/arm/Kconfig         |  7 +++++++
 xen/arch/arm/arm32/Makefile  |  1 +
 xen/arch/arm/arm32/proc-v8.S | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+)
 create mode 100644 xen/arch/arm/arm32/proc-v8.S
xen/arch/arm/Kconfig +7 -0
index 61e581b8c2..c45753a2dd 100644
@@ -3,6 +3,13 @@ config ARM_32
 	depends on "$(ARCH)" = "arm32"
 	select ARCH_MAP_DOMAIN_PAGE
 
+config AARCH32_V8R
+	bool "AArch32 Arm V8R Support (UNSUPPORTED)" if UNSUPPORTED
+	def_bool n
+	depends on ARM_32
+	help
+	  This option enables Armv8-R profile for AArch32.
+
 config ARM_64
 	def_bool y
 	depends on !ARM_32
xen/arch/arm/arm32/Makefile +1 -0
index 520fb42054..2ab808a7a8 100644
@@ -8,6 +8,7 @@ obj-y += head.o
 obj-y += insn.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-y += proc-v7.o proc-caxx.o
+obj-$(CONFIG_AARCH32_V8R) += proc-v8.o
 obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
xen/arch/arm/arm32/proc-v8.S new file +32 -0
new file mode 100644
index 0000000000..c5a566b165
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/arm32/proc-v8.S
+ *
+ * AArch32 V8R specific initialization
+ *
+ * Copyright (C) 2023, Advanced Micro Devices, Inc. All Rights Reserved.
+ */
+
+#include <asm/arm32/processor.h>
+#include <asm/sysregs.h>
+
+cr52_init:
+        mov pc, lr
+
+        .section ".proc.info", #alloc
+        .type __v8_cr52_proc_info, #object
+__v8_cr52_proc_info:
+        .long 0x410F0000             /* Cortex-R52 */
+        .long 0xFF0F0000             /* Mask */
+        .long cr52_init
+        .size __v8_cr52_proc_info, . - __v8_cr52_proc_info
+
+        .section ".proc.info", #alloc
+        .type __v8_cr52_proc_info, #object
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 12 lines · Ayan Kumar Halder

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

xen/arch/arm/arm32/proc-v8.S

Quoted 44 lines
---
  xen/arch/arm/Kconfig         |  7 +++++++
  xen/arch/arm/arm32/Makefile  |  1 +
  xen/arch/arm/arm32/proc-v8.S | 32 ++++++++++++++++++++++++++++++++
  3 files changed, 40 insertions(+)

create mode 100644 xen/arch/arm/arm32/proc-v8.S

xen/arch/arm/Kconfig +7 -0
index 61e581b8c2..c45753a2dd 100644
@@ -3,6 +3,13 @@ config ARM_32
  	depends on "$(ARCH)" = "arm32"
  	select ARCH_MAP_DOMAIN_PAGE
 
+config AARCH32_V8R
+	bool "AArch32 Arm V8R Support (UNSUPPORTED)" if UNSUPPORTED
+	def_bool n
+	depends on ARM_32
+	help
+	  This option enables Armv8-R profile for AArch32.
+
  config ARM_64
  	def_bool y
  	depends on !ARM_32
xen/arch/arm/arm32/Makefile +1 -0
index 520fb42054..2ab808a7a8 100644
@@ -8,6 +8,7 @@ obj-y += head.o
  obj-y += insn.o
  obj-$(CONFIG_LIVEPATCH) += livepatch.o
  obj-y += proc-v7.o proc-caxx.o
+obj-$(CONFIG_AARCH32_V8R) += proc-v8.o
  obj-y += smpboot.o
  obj-y += traps.o
  obj-y += vfp.o
xen/arch/arm/arm32/proc-v8.S new file +0 -0
new file mode 100644
index 0000000000..c5a566b165

Below you say the file will contain v8r specific initialization. So please rename it to proc-v8r.S.

Cheers,

Signature · 1 line
Julien Grall
#2 lore raw
Quoted 1 line · Julien Grall

Hi,

Hi Julien,

Quoted 14 lines · Ayan Kumar Halder
Quoted 12 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 6 lines
Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

My aim is to extract the non-dependent changes and send them for review.

Quoted 38 lines
Quoted 38 lines

---
  xen/arch/arm/Kconfig         |  7 +++++++ xen/arch/arm/arm32/Makefile  |  1 + xen/arch/arm/arm32/proc-v8.S | 32 ++++++++++++++++++++++++++++++++

  3 files changed, 40 insertions(+)

  create mode 100644 xen/arch/arm/arm32/proc-v8.S

xen/arch/arm/Kconfig +0 -0
index 61e581b8c2..c45753a2dd 100644
@@ -3,6 +3,13 @@ config ARM_32

      depends on "$(ARCH)" = "arm32"
      select ARCH_MAP_DOMAIN_PAGE
  +config AARCH32_V8R
+    bool "AArch32 Arm V8R Support (UNSUPPORTED)" if UNSUPPORTED +    def_bool n
+    depends on ARM_32
+    help
+      This option enables Armv8-R profile for AArch32. +
  config ARM_64
      def_bool y
      depends on !ARM_32

xen/arch/arm/arm32/Makefile +0 -0
index 520fb42054..2ab808a7a8 100644
@@ -8,6 +8,7 @@ obj-y += head.o

  obj-y += insn.o
  obj-$(CONFIG_LIVEPATCH) += livepatch.o
  obj-y += proc-v7.o proc-caxx.o
+obj-$(CONFIG_AARCH32_V8R) += proc-v8.o
  obj-y += smpboot.o
  obj-y += traps.o

Quoted 8 lines

xen/arch/arm/arm32/proc-v8.S

Quoted 6 lines

  obj-y += vfp.o

xen/arch/arm/arm32/proc-v8.S new file +0 -0
new file mode 100644
index 0000000000..c5a566b165

Below you say the file will contain v8r specific initialization. So please rename it to proc-v8r.S.

Ack.

- Ayan

Quoted 3 lines

Cheers,

#3 lore raw

Hi Ayan,

Quoted 23 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall

Hi,

Hi Julien,

Quoted 19 lines · Ayan Kumar Halder
Quoted 16 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Quoted 7 lines
Quoted 1 line

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

My aim is to extract the non-dependent changes and send them for review.

I can review the patch. But I am not willing to merge it as it gives the false impression that Xen would boot on Cortex-R52.

In fact, I think this patch should only be merged once we have all the MPU merged.

IMHO, patches are independent are rework (e.g. code split...) that would help the MPU.

Cheers,

Signature · 1 line
Julien Grall
#4 lore raw
Quoted 1 line · Julien Grall

Hi Ayan,

Hi Julien,

Quoted 31 lines · Ayan Kumar Halder
Quoted 29 lines · Julien Grall
Quoted 1 line

Hi,

Hi Julien,

Quoted 14 lines · Ayan Kumar Halder
Quoted 12 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 6 lines
Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

Quoted 7 lines
Quoted 1 line

My aim is to extract the non-dependent changes and send them for review.

I can review the patch. But I am not willing to merge it as it gives the false impression that Xen would boot on Cortex-R52.

In fact, I think this patch should only be merged once we have all the MPU merged.

IMHO, patches are independent are rework (e.g. code split...) that would help the MPU.

Yes, that's exactly what I intend to do. I will send out the patches (similar to this) which will not be impacted by the MPU changes.

So, that both as an author/reviewer, it helps to restrict MPU serie to only MPU specific changes.

Can you suggest some change to the commit message, so that we can commit it (without giving any false impression that Xen boots on Cortex-R52) ?

May be adding this line to the commit message helps ?

"However, Xen does not fully boot on Cortex-R52 as it requires MPU support which is under review.

Once Xen is supported on Cortex-R52, SUPPORT.md will be amended to reflect it."

- Ayan

Quoted 3 lines

Cheers,

#5 lore raw

Hi Ayan,

Quoted 43 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall

Hi Ayan,

Hi Julien,

Quoted 31 lines · Ayan Kumar Halder
Quoted 29 lines · Julien Grall
Quoted 1 line

Hi,

Hi Julien,

Quoted 14 lines · Ayan Kumar Halder
Quoted 12 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 6 lines
Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

Quoted 7 lines
Quoted 1 line

My aim is to extract the non-dependent changes and send them for review.

I can review the patch. But I am not willing to merge it as it gives the false impression that Xen would boot on Cortex-R52.

In fact, I think this patch should only be merged once we have all the MPU merged.

IMHO, patches are independent are rework (e.g. code split...) that would help the MPU.

Quoted 7 lines

Yes, that's exactly what I intend to do. I will send out the patches (similar to this) which will not be impacted by the MPU changes.

So, that both as an author/reviewer, it helps to restrict MPU serie to only MPU specific changes. >
Can you suggest some change to the commit message, so that we can commit it (without giving any false impression that Xen boots on Cortex-R52) > May be adding this line to the commit message helps ? >
"However, Xen does not fully boot on Cortex-R52 as it requires MPU support which is under review. >
Once Xen is supported on Cortex-R52, SUPPORT.md will be amended to reflect it."

While writing an answer for this patch, I was actually wondering whether the CPU allowlist still make sense for the 32-bit ARMv8-R?

From Armv7-A, we needed it because some CPUs need specific quirk when booting. But it would be best if we can get rid of it for 32-bit ARMv8-R.

Looking at your patch, your merely providing stubs. Do you have any plan to fill them up?

Cheers,

Signature · 1 line
Julien Grall
#6 lore raw
Quoted 1 line · Julien Grall

Hi Ayan,

Hi Julien,

Quoted 53 lines · Ayan Kumar Halder
Quoted 43 lines · Julien Grall
Quoted 1 line

Hi Ayan,

Hi Julien,

Quoted 31 lines · Ayan Kumar Halder
Quoted 29 lines · Julien Grall
Quoted 1 line

Hi,

Hi Julien,

Quoted 14 lines · Ayan Kumar Halder
Quoted 12 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 6 lines
Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

Quoted 7 lines
Quoted 1 line

My aim is to extract the non-dependent changes and send them for review.

I can review the patch. But I am not willing to merge it as it gives the false impression that Xen would boot on Cortex-R52.

In fact, I think this patch should only be merged once we have all the MPU merged.

IMHO, patches are independent are rework (e.g. code split...) that would help the MPU.

Quoted 7 lines

Yes, that's exactly what I intend to do. I will send out the patches (similar to this) which will not be impacted by the MPU changes.

So, that both as an author/reviewer, it helps to restrict MPU serie to only MPU specific changes. >
Can you suggest some change to the commit message, so that we can commit it (without giving any false impression that Xen boots on Cortex-R52) > May be adding this line to the commit message helps ? >
"However, Xen does not fully boot on Cortex-R52 as it requires MPU support which is under review. >
Once Xen is supported on Cortex-R52, SUPPORT.md will be amended to reflect it."

Quoted 5 lines

While writing an answer for this patch, I was actually wondering whether the CPU allowlist still make sense for the 32-bit ARMv8-R?

From Armv7-A, we needed it because some CPUs need specific quirk when booting. But it would be best if we can get rid of it for 32-bit ARMv8-R.

Looking at your patch, your merely providing stubs. Do you have any plan to fill them up?

Actually, I would use cr52_init in a later patch to write to CNTFRQ. See below :-

+#define XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ  800000U +
 cr52_init:
+        /*
+         * Set counter frequency  800 KHZ
+         *
+         * Set counter frequency, CNTFRQ
+         */
+        ldr     r0,=XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ +        mrc     15,0,r1,c14,c0,0  /* Read CNTFRQ */ +        cmp     r1,#0
+        /* Set only if the frequency read is 0 */ +        mcreq   15,0,r0,c14,c0,0  /* Write CNTFRQ */ +
         mov pc, lr

- Ayan

Quoted 3 lines

Cheers,

#7 lore raw

Hi,

Quoted 70 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall

Hi Ayan,

Hi Julien,

Quoted 53 lines · Ayan Kumar Halder
Quoted 43 lines · Julien Grall
Quoted 1 line

Hi Ayan,

Hi Julien,

Quoted 31 lines · Ayan Kumar Halder
Quoted 29 lines · Julien Grall
Quoted 1 line

Hi,

Hi Julien,

Quoted 14 lines · Ayan Kumar Halder
Quoted 12 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 6 lines
Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

Quoted 7 lines
Quoted 1 line

My aim is to extract the non-dependent changes and send them for review.

I can review the patch. But I am not willing to merge it as it gives the false impression that Xen would boot on Cortex-R52.

In fact, I think this patch should only be merged once we have all the MPU merged.

IMHO, patches are independent are rework (e.g. code split...) that would help the MPU.

Quoted 7 lines

Yes, that's exactly what I intend to do. I will send out the patches (similar to this) which will not be impacted by the MPU changes.

So, that both as an author/reviewer, it helps to restrict MPU serie to only MPU specific changes. >
Can you suggest some change to the commit message, so that we can commit it (without giving any false impression that Xen boots on Cortex-R52) > May be adding this line to the commit message helps ? >
"However, Xen does not fully boot on Cortex-R52 as it requires MPU support which is under review. >
Once Xen is supported on Cortex-R52, SUPPORT.md will be amended to reflect it."

Quoted 5 lines

While writing an answer for this patch, I was actually wondering whether the CPU allowlist still make sense for the 32-bit ARMv8-R?

From Armv7-A, we needed it because some CPUs need specific quirk when booting. But it would be best if we can get rid of it for 32-bit ARMv8-R.

Looking at your patch, your merely providing stubs. Do you have any plan to fill them up?

Actually, I would use cr52_init in a later patch to write to CNTFRQ. See below :-

(quoted diff) +4 -0
+#define XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ  800000U
+
  cr52_init:
+        /*
+         * Set counter frequency  800 KHZ

Review

Quoted 10 lines
(quoted diff) +9 -0
+         *
+         * Set counter frequency, CNTFRQ
+         */
+        ldr     r0,=XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ
+        mrc     15,0,r1,c14,c0,0  /* Read CNTFRQ */
+        cmp     r1,#0
+        /* Set only if the frequency read is 0 */
+        mcreq   15,0,r0,c14,c0,0  /* Write CNTFRQ */
+
          mov pc, lr

Why can't you use the device-tree (see clock-frequency) as all the other buggy platform does?

Cheers,

Signature · 1 line
Julien Grall
#8 lore raw
Quoted 1 line · Julien Grall

Hi,

Hi Julien,

Quoted 76 lines · Ayan Kumar Halder
Quoted 74 lines · Julien Grall
Quoted 1 line

Hi Ayan,

Hi Julien,

Quoted 53 lines · Ayan Kumar Halder
Quoted 43 lines · Julien Grall
Quoted 1 line

Hi Ayan,

Hi Julien,

Quoted 31 lines · Ayan Kumar Halder
Quoted 29 lines · Julien Grall
Quoted 1 line

Hi,

Hi Julien,

Quoted 14 lines · Ayan Kumar Halder
Quoted 12 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 6 lines
Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

Quoted 7 lines
Quoted 1 line

My aim is to extract the non-dependent changes and send them for review.

I can review the patch. But I am not willing to merge it as it gives the false impression that Xen would boot on Cortex-R52.

In fact, I think this patch should only be merged once we have all the MPU merged.

IMHO, patches are independent are rework (e.g. code split...) that would help the MPU.

Quoted 7 lines

Yes, that's exactly what I intend to do. I will send out the patches (similar to this) which will not be impacted by the MPU changes.

So, that both as an author/reviewer, it helps to restrict MPU serie to only MPU specific changes. >
Can you suggest some change to the commit message, so that we can commit it (without giving any false impression that Xen boots on Cortex-R52) > May be adding this line to the commit message helps ? >
"However, Xen does not fully boot on Cortex-R52 as it requires MPU support which is under review. >
Once Xen is supported on Cortex-R52, SUPPORT.md will be amended to reflect it."

Quoted 5 lines

While writing an answer for this patch, I was actually wondering whether the CPU allowlist still make sense for the 32-bit ARMv8-R?

From Armv7-A, we needed it because some CPUs need specific quirk when booting. But it would be best if we can get rid of it for 32-bit ARMv8-R.

Looking at your patch, your merely providing stubs. Do you have any plan to fill them up?

Actually, I would use cr52_init in a later patch to write to CNTFRQ. See below :-

(quoted diff) +2 -0
+#define XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ  800000U
+

  cr52_init:
+        /*
+         * Set counter frequency  800 KHZ
+         *
+         * Set counter frequency, CNTFRQ
+         */
+        ldr     r0,=XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ

Quoted 8 lines
Quoted 6 lines

+        mrc     15,0,r1,c14,c0,0  /* Read CNTFRQ */ +        cmp     r1,#0
+        /* Set only if the frequency read is 0 */ +        mcreq   15,0,r0,c14,c0,0  /* Write CNTFRQ */ +
          mov pc, lr

Why can't you use the device-tree (see clock-frequency) as all the other buggy platform does?

That's a good suggestion :). Also, I can do this in the platform specific .init().

Then, can I add the empty stubs for R52 (similar to https://elixir.bootlin.com/linux/latest/source/arch/arm/mm/proc-v7m.S#L165 Cortex-M7, cpu_v7m_proc_init(), cpu_v7m_switch_mm() are stubs).

Or do you propose something like this :-

xen/arch/arm/arm32/head.S +0 -0
@@ -322,7 +322,7 @@ cpu_init:

         PRINT("- Setting up control registers -\r\n")

         mov   r5, lr                       /* r5 := return address */ -
+#ifndef CONFIG_ARM_NO_PROC_INIT
         /* Get processor specific proc info into r1 */
         bl    __lookup_processor_type
         teq   r1, #0
@@ -337,7 +337,7 @@ cpu_init:
         ldr   r1, [r1, #PROCINFO_cpu_init]  /* r1 := vaddr(init func) */ adr   lr, cpu_init_done             /* Save return address */ add   pc, r1, r10                   /* Call paddr(init func) */ -
+#endif
 cpu_init_done:

And we introduce this new bool Kconfig option "CONFIG_ARM_NO_PROC_INIT" which will be defined for processors that do not need any special init (eg R52).

- Ayan

Quoted 3 lines

Cheers,

#9 lore raw

Hi Ayan,

Quoted 89 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall

Hi,

Hi Julien,

Quoted 76 lines · Ayan Kumar Halder
Quoted 74 lines · Julien Grall
Quoted 1 line

Hi Ayan,

Hi Julien,

Quoted 53 lines · Ayan Kumar Halder
Quoted 43 lines · Julien Grall
Quoted 1 line

Hi Ayan,

Hi Julien,

Quoted 31 lines · Ayan Kumar Halder
Quoted 29 lines · Julien Grall
Quoted 1 line

Hi,

Hi Julien,

Quoted 14 lines · Ayan Kumar Halder
Quoted 12 lines

Add a special configuration (CONFIG_AARCH32_V8R) to setup the Cortex-R52 specifics.

Cortex-R52 is an Arm-V8R AArch32 processor.

Refer ARM DDI 0487I.a ID081822, G8-9647, G8.2.112 MIDR, bits[31:24] = 0x41 , Arm Ltd
bits[23:20] = Implementation defined
bits[19:16] = 0xf , Arch features are individually identified bits[15:4] = Implementation defined
bits[3:0] = Implementation defined

Quoted 6 lines
Quoted 4 lines

Thus, the processor id is 0x410f0000 and the processor id mask is 0xff0f0000

Also, there is no special initialization required for R52.

Are you saying that Xen upstream + this patch will boot on Cortex-R52?

This patch will help for earlyboot of Xen. With this patch, cpu_init() will work on Cortex-R52.

There will be changes required for the MPU configuration, but that will be sent after Penny's patch serie "[PATCH v2 00/41] xen/arm: Add Armv8-R64 MPU support to Xen - Part#1" is upstreamed.

Quoted 7 lines
Quoted 1 line

My aim is to extract the non-dependent changes and send them for review.

I can review the patch. But I am not willing to merge it as it gives the false impression that Xen would boot on Cortex-R52.

In fact, I think this patch should only be merged once we have all the MPU merged.

IMHO, patches are independent are rework (e.g. code split...) that would help the MPU.

Quoted 7 lines

Yes, that's exactly what I intend to do. I will send out the patches (similar to this) which will not be impacted by the MPU changes.

So, that both as an author/reviewer, it helps to restrict MPU serie to only MPU specific changes. >
Can you suggest some change to the commit message, so that we can commit it (without giving any false impression that Xen boots on Cortex-R52) > May be adding this line to the commit message helps ? >
"However, Xen does not fully boot on Cortex-R52 as it requires MPU support which is under review. >
Once Xen is supported on Cortex-R52, SUPPORT.md will be amended to reflect it."

Quoted 5 lines

While writing an answer for this patch, I was actually wondering whether the CPU allowlist still make sense for the 32-bit ARMv8-R?

From Armv7-A, we needed it because some CPUs need specific quirk when booting. But it would be best if we can get rid of it for 32-bit ARMv8-R.

Looking at your patch, your merely providing stubs. Do you have any plan to fill them up?

Actually, I would use cr52_init in a later patch to write to CNTFRQ. See below :-

(quoted diff) +2 -0
+#define XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ  800000U
+

  cr52_init:
+        /*
+         * Set counter frequency  800 KHZ
+         *
+         * Set counter frequency, CNTFRQ
+         */
+        ldr     r0,=XPAR_CPU_CORTEXR52_0_TIMESTAMP_CLK_FREQ

Quoted 8 lines
Quoted 6 lines

+        mrc     15,0,r1,c14,c0,0  /* Read CNTFRQ */ +        cmp     r1,#0
+        /* Set only if the frequency read is 0 */ +        mcreq   15,0,r0,c14,c0,0  /* Write CNTFRQ */ +
          mov pc, lr

Why can't you use the device-tree (see clock-frequency) as all the other buggy platform does?

Quoted 1 line

That's a good suggestion :). Also, I can do this in the platform specific .init().

I am not sure I understand why you are referring to .init() when you can simply add the property in the device-tree.

We should not add new .init() if platform-agnostic way to do it.

Quoted 17 lines

Then, can I add the empty stubs for R52 (similar to https://elixir.bootlin.com/linux/latest/source/arch/arm/mm/proc-v7m.S#L165 Cortex-M7, cpu_v7m_proc_init(), cpu_v7m_switch_mm() are stubs).

Or do you propose something like this :-

xen/arch/arm/arm32/head.S +1 -1
@@ -322,7 +322,7 @@ cpu_init:
          PRINT("- Setting up control registers -\r\n")
 
          mov   r5, lr                       /* r5 := return address */
-
+#ifndef CONFIG_ARM_NO_PROC_INIT
          /* Get processor specific proc info into r1 */
          bl    __lookup_processor_type
          teq   r1, #0

xen/arch/arm/arm32/head.S cpu_init: · line 340

Quoted 5 lines
xen/arch/arm/arm32/head.S +1 -1
@@ -337,7 +337,7 @@ cpu_init:
          ldr   r1, [r1, #PROCINFO_cpu_init]  /* r1 := vaddr(init func) */
          adr   lr, cpu_init_done             /* Save return address */
          add   pc, r1, r10                   /* Call paddr(init func) */
-
+#endif

I think it would be best if you just #ifdef the fail below. So if the config selected, then you will still be able to have a Xen that can boot Cortex-A15 or a core that don't need _init.

Note that for now, we should only select this new config for Armv8-R because there are some work to confirm it would be safe for us to boot Xen 32-bit Arm on any CPUs. I vaguely remember that we were making some assumptions on the cache type in the past. But maybe we other check in place to check such assumption.

If this can be confirm (I am not ask you to do it, but you can) then we could even get rid of the #ifdef.

Cheers,

Signature · 1 line
Julien Grall
#10 lore raw

Hi,

Quoted 20 lines · Julien Grall
Quoted 15 lines
xen/arch/arm/arm32/head.S +0 -0
@@ -322,7 +322,7 @@ cpu_init:
           PRINT("- Setting up control registers -\r\n")
 

          mov   r5, lr                       /* r5 := return address */

xen/arch/arm/arm32/head.S +1 -1
-
+#ifndef CONFIG_ARM_NO_PROC_INIT

          /* Get processor specific proc info into r1 */ bl    __lookup_processor_type
          teq   r1, #0

xen/arch/arm/arm32/head.S +0 -0
@@ -337,7 +337,7 @@ cpu_init:

          ldr   r1, [r1, #PROCINFO_cpu_init]  /* r1 := vaddr(init func) */ adr   lr, cpu_init_done             /* Save return address */ add   pc, r1, r10                   /* Call paddr(init func) */

xen/arch/arm/arm32/head.S

Quoted 2 lines
xen/arch/arm/arm32/head.S +1 -1
-
+#endif

I think it would be best if you just #ifdef the fail below. So if the config selected, then you will still be able to have a Xen that can boot Cortex-A15 or a core that don't need _init.

Quoted 3 lines

Note that for now, we should only select this new config for Armv8-R because there are some work to confirm it would be safe for us to boot Xen 32-bit Arm on any CPUs. I vaguely remember that we were making some assumptions on the cache type in the past. But maybe we other check in place to check such assumption.

If this can be confirm (I am not ask you to do it, but you can) then we could even get rid of the #ifdef.

I had a look through the code. We have a check in the 32-bit version of setup_mm() for the instruction cache type. So I think it would be OK to relax the check in head.S.

Bertrand, Stefano, what do you think?

Cheers,

Signature · 1 line
Julien Grall
#11 lore raw
Quoted 1 line · Julien Grall

Hi,

Hi Julien,

Quoted 22 lines · Julien Grall
Quoted 20 lines
Quoted 15 lines
xen/arch/arm/arm32/head.S +0 -0
@@ -322,7 +322,7 @@ cpu_init:
           PRINT("- Setting up control registers -\r\n")
 

          mov   r5, lr                       /* r5 := return address */

xen/arch/arm/arm32/head.S +1 -1
-
+#ifndef CONFIG_ARM_NO_PROC_INIT

          /* Get processor specific proc info into r1 */ bl    __lookup_processor_type
          teq   r1, #0

xen/arch/arm/arm32/head.S +0 -0
@@ -337,7 +337,7 @@ cpu_init:

          ldr   r1, [r1, #PROCINFO_cpu_init]  /* r1 := vaddr(init func) */ adr   lr, cpu_init_done             /* Save return address */ add   pc, r1, r10                   /* Call paddr(init func) */

xen/arch/arm/arm32/head.S

Quoted 2 lines
xen/arch/arm/arm32/head.S +1 -1
-
+#endif

I think it would be best if you just #ifdef the fail below. So if the config selected, then you will still be able to have a Xen that can boot Cortex-A15 or a core that don't need _init.

Quoted 7 lines
Quoted 3 lines

Note that for now, we should only select this new config for Armv8-R because there are some work to confirm it would be safe for us to boot Xen 32-bit Arm on any CPUs. I vaguely remember that we were making some assumptions on the cache type in the past. But maybe we other check in place to check such assumption.

If this can be confirm (I am not ask you to do it, but you can) then we could even get rid of the #ifdef.

I had a look through the code. We have a check in the 32-bit version of setup_mm() for the instruction cache type. So I think it would be OK to relax the check in head.S.

Bertrand, Stefano, what do you think?

As per discussion, I have sent "[XEN v2] xen/arm: arm32: Allow Xen to boot on unidentified CPUs" with the comment addressed.

- Ayan

Quoted 3 lines

Cheers,