Skip to contentSkip to conversation

Arm: Enable GICv3 for AArch32

RFC PATCH Superseded Ayan Kumar Halder 1 participant 4 messages Oct 24, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Arm: Enable GICv3 for AArch32

Hi All,

Please find the following patches to enable GICv3 for AArch32. This is a pre-requisite to support Xen on Cortex-R52 (AArch32-v8R system)

Let me know your thoughts.

Ayan Kumar Halder (12):
Arm: GICv3: Sysreg emulation is applicable for Aarch64 only
Arm: GICv3: Move the macros to compute the affnity level to

    arm64/arm32

Arm: GICv3: Enable vreg_reg64_* macros for AArch32
Arm: GICv3: Emulate GICR_TYPER on AArch32
Arm: GICv3: Emulate GICR_PENDBASER and GICR_PROPBASER on AArch32
Arm: GICv3: Emulate of ICC_SGI1R on AArch32
Arm: GICv3: Emulate ICH_LR<n>_EL2 on AArch32
Arm: GICv3: Define ICH_AP0R<n> and ICH_AP1R<n> for AArch32
Arm: GICv3: Define GIC registers for AArch32
Arm: GICv3: Use ULL instead of UL for 64bits
Arm: GICv3: Define macros to read/write 64 bit
Arm: GICv3: Enable GICv3 for AArch32

 xen/arch/arm/Kconfig                       |   2 +-
 xen/arch/arm/gic-v3-its.c                  |  20 ++--
 xen/arch/arm/gic-v3-lpi.c                  |   8 +-
 xen/arch/arm/gic-v3.c                      | 132 ++++++++++-----------
 xen/arch/arm/include/asm/arm32/io.h        |   4 +
 xen/arch/arm/include/asm/arm32/processor.h |  10 ++
 xen/arch/arm/include/asm/arm32/sysregs.h   |  80 +++++++++++++
 xen/arch/arm/include/asm/arm64/processor.h |  13 ++
 xen/arch/arm/include/asm/arm64/sysregs.h   |   7 +-
 xen/arch/arm/include/asm/cpufeature.h      |   1 +
 xen/arch/arm/include/asm/gic_v3_defs.h     |  24 ++--
 xen/arch/arm/include/asm/gic_v3_its.h      |   2 +-
 xen/arch/arm/include/asm/processor.h       |  14 ---
 xen/arch/arm/include/asm/vreg.h            |  23 ++--
 xen/arch/arm/vgic-v3-its.c                 |  17 +--
 xen/arch/arm/vgic-v3.c                     |  26 ++--
 16 files changed, 242 insertions(+), 141 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

RFC PATCH 1/12 Arm: GICv3: Sysreg emulation is applicable for Aarch64 only

Refer ARM DDI 0487G.b ID072021, EC==0b011000 is supported for Aarch64 state only. This is when MSR, MRS, System instruction execution in AArch64 state is trapped, that is not reported using EC 0b000000, 0b000001 or 0b000111.

---
 xen/arch/arm/vgic-v3.c | 4 ++++
 1 file changed, 4 insertions(+)
xen/arch/arm/vgic-v3.c +4 -0
index 0c23f6df9d..c31140eb20 100644
@@ -1520,6 +1520,7 @@ static bool vgic_v3_emulate_sgi1r(struct cpu_user_regs *regs, uint64_t *r,
     }
 }
 
+#ifdef CONFIG_ARM_64
 static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
 {
     struct hsr_sysreg sysreg = hsr.sysreg;
@@ -1540,6 +1541,7 @@ static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
         return false;
     }
 }
+#endif
 
 static bool vgic_v3_emulate_cp64(struct cpu_user_regs *regs, union hsr hsr)
 {
@@ -1563,8 +1565,10 @@ static bool vgic_v3_emulate_reg(struct cpu_user_regs *regs, union hsr hsr)
 {
     switch (hsr.ec)
     {
+#ifdef CONFIG_ARM_64
     case HSR_EC_SYSREG:
         return vgic_v3_emulate_sysreg(regs, hsr);
+#endif
     case HSR_EC_CP15_64:
         return vgic_v3_emulate_cp64(regs, hsr);
     default:
Signature · 1 line
2.17.1
#3 lore raw
In reply to Ayan Kumar Halder
Quoted 6 lines · Ayan Kumar Halder

Hi All,

Please find the following patches to enable GICv3 for AArch32. This is a pre-requisite to support Xen on Cortex-R52 (AArch32-v8R system)

Let me know your thoughts.

NACK. Please ignore this. I have sent by mistake.

Quoted 34 lines

Ayan Kumar Halder (12):
Arm: GICv3: Sysreg emulation is applicable for Aarch64 only
Arm: GICv3: Move the macros to compute the affnity level to

     arm64/arm32

Arm: GICv3: Enable vreg_reg64_* macros for AArch32
Arm: GICv3: Emulate GICR_TYPER on AArch32
Arm: GICv3: Emulate GICR_PENDBASER and GICR_PROPBASER on AArch32
Arm: GICv3: Emulate of ICC_SGI1R on AArch32
Arm: GICv3: Emulate ICH_LR<n>_EL2 on AArch32
Arm: GICv3: Define ICH_AP0R<n> and ICH_AP1R<n> for AArch32
Arm: GICv3: Define GIC registers for AArch32
Arm: GICv3: Use ULL instead of UL for 64bits
Arm: GICv3: Define macros to read/write 64 bit
Arm: GICv3: Enable GICv3 for AArch32

  xen/arch/arm/Kconfig                       |   2 +-
  xen/arch/arm/gic-v3-its.c                  |  20 ++--
  xen/arch/arm/gic-v3-lpi.c                  |   8 +-
  xen/arch/arm/gic-v3.c                      | 132 ++++++++++-----------
  xen/arch/arm/include/asm/arm32/io.h        |   4 +
  xen/arch/arm/include/asm/arm32/processor.h |  10 ++
  xen/arch/arm/include/asm/arm32/sysregs.h   |  80 +++++++++++++
  xen/arch/arm/include/asm/arm64/processor.h |  13 ++
  xen/arch/arm/include/asm/arm64/sysregs.h   |   7 +-
  xen/arch/arm/include/asm/cpufeature.h      |   1 +
  xen/arch/arm/include/asm/gic_v3_defs.h     |  24 ++--
  xen/arch/arm/include/asm/gic_v3_its.h      |   2 +-
  xen/arch/arm/include/asm/processor.h       |  14 ---
  xen/arch/arm/include/asm/vreg.h            |  23 ++--
  xen/arch/arm/vgic-v3-its.c                 |  17 +--
  xen/arch/arm/vgic-v3.c                     |  26 ++--
  16 files changed, 242 insertions(+), 141 deletions(-)
#2 lore raw

Re: [RFC PATCH v1 01/12] Arm: GICv3: Sysreg emulation is applicable for Aarch64 only

In reply to Ayan Kumar Halder

NACK, Please ignore this. I have sent by mistake.

Quoted 40 lines · Ayan Kumar Halder

Refer ARM DDI 0487G.b ID072021, EC==0b011000 is supported for Aarch64 state only. This is when MSR, MRS, System instruction execution in AArch64 state is trapped, that is not reported using EC 0b000000, 0b000001 or 0b000111.

---
  xen/arch/arm/vgic-v3.c | 4 ++++
  1 file changed, 4 insertions(+)
xen/arch/arm/vgic-v3.c +4 -0
index 0c23f6df9d..c31140eb20 100644
@@ -1520,6 +1520,7 @@ static bool vgic_v3_emulate_sgi1r(struct cpu_user_regs *regs, uint64_t *r,
      }
  }
 
+#ifdef CONFIG_ARM_64
  static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
  {
      struct hsr_sysreg sysreg = hsr.sysreg;
@@ -1540,6 +1541,7 @@ static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
          return false;
      }
  }
+#endif
 
  static bool vgic_v3_emulate_cp64(struct cpu_user_regs *regs, union hsr hsr)
  {
@@ -1563,8 +1565,10 @@ static bool vgic_v3_emulate_reg(struct cpu_user_regs *regs, union hsr hsr)
  {
      switch (hsr.ec)
      {
+#ifdef CONFIG_ARM_64
      case HSR_EC_SYSREG:
          return vgic_v3_emulate_sysreg(regs, hsr);
+#endif
      case HSR_EC_CP15_64:
          return vgic_v3_emulate_cp64(regs, hsr);
      default: