xen/arm: gic-v3: Make sure ICC_SRE_EL1 is restored before ICH_VMCR_EL2
PATCH 1/1 xen/arm: gic-v3: Make sure ICC_SRE_EL1 is restored before ICH_VMCR_EL2
Per 8.4.8 in ARM IHI 0069D, ICH_VMCR_EL2.VFIQEn is RES1 when ICC_SRE_EL1.SRE is 1. This causes a Group 0 interrupt (as generated in GICv2 mode) to be delivered as a FIQ to the guest, with potentially consequence. So we must make sure that ICC_SRE_EL1 has been actually programmed before at ICH_VMCR_EL2.
This was discovered when booting EFI in a GICv2 guest on a GICv3 hardware.
---
This patch should be backported up to Xen 4.7.
--- xen/arch/arm/gic-v3.c | 9 +++++++++ 1 file changed, 9 insertions(+)
xen/arch/arm/gic-v3.c +9 -0
@@ -392,7 +392,16 @@ static void gicv3_restore_state(const struct vcpu *v) val |=GICC_SRE_EL2_ENEL1 ;WRITE_SYSREG32 (val,ICC_SRE_EL2 ); +/* +* VFIQEn is RES1 if ICC_SRE_EL1.SRE is 1. This causes a Group0 +* interrupt (as generated in GICv2 mode) to be delivered as a FIQ +* to the guest, with potentially consequence. So we must make sure +* that ICC_SRE_EL1 has been actually programmed with the value we +* want before starting to mess with the rest of the GIC, and +* VMCR_EL1 in particular. +*/ WRITE_SYSREG32 (v->arch.gic.v3.sre_el1,ICC_SRE_EL1 ); +isb ();WRITE_SYSREG32 (v->arch.gic.v3.vmcr,ICH_VMCR_EL2 );restore_aprn_regs (&v->arch.gic);gicv3_restore_lrs (v);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 10 lines · Julien Grall
Per 8.4.8 in ARM IHI 0069D, ICH_VMCR_EL2.VFIQEn is RES1 when ICC_SRE_EL1.SRE is 1. This causes a Group 0 interrupt (as generated in GICv2 mode) to be delivered as a FIQ to the guest, with potentially consequence. So we must make sure that
ICC_SRE_EL1has been actually programmed before atICH_VMCR_EL2.This was discovered when booting EFI in a GICv2 guest on a GICv3 hardware.
Signed-off-by Julien Grall <[email protected]>
Nice catch!
Quoted 31 lines
---
This patch should be backported up to Xen 4.7.
--- xen/arch/arm/gic-v3.c | 9 +++++++++ 1 file changed, 9 insertions(+)xen/arch/arm/gic-v3.c +9
-0@@ -392,7 +392,16 @@ static void gicv3_restore_state(const struct vcpu *v) val |=GICC_SRE_EL2_ENEL1 ;WRITE_SYSREG32 (val,ICC_SRE_EL2 ); +/* +* VFIQEn is RES1 if ICC_SRE_EL1.SRE is 1. This causes a Group0 +* interrupt (as generated in GICv2 mode) to be delivered as a FIQ +* to the guest, with potentially consequence. So we must make sure +* that ICC_SRE_EL1 has been actually programmed with the value we +* want before starting to mess with the rest of the GIC, and +* VMCR_EL1 in particular. +*/ WRITE_SYSREG32 (v->arch.gic.v3.sre_el1,ICC_SRE_EL1 ); +isb ();WRITE_SYSREG32 (v->arch.gic.v3.vmcr,ICH_VMCR_EL2 );restore_aprn_regs (&v->arch.gic);gicv3_restore_lrs (v);Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Stefano Stabellini
Quoted 6 lines · Julien Grall
Per 8.4.8 in ARM IHI 0069D, ICH_VMCR_EL2.VFIQEn is RES1 when ICC_SRE_EL1.SRE is 1. This causes a Group 0 interrupt (as generated in GICv2 mode) to be delivered as a FIQ to the guest, with potentially consequence. So we must make sure that
ICC_SRE_EL1has been actually programmed before atICH_VMCR_EL2.
Quoted 8 lines
Quoted 4 lines
This was discovered when booting EFI in a GICv2 guest on a GICv3 hardware.
Signed-off-by Julien Grall <[email protected]>Nice catch!
Signed-off-by Stefano Stabellini <[email protected]>
Sorry wrong tag :)
Quoted 16 lines
Quoted 16 lines
---
This patch should be backported up to Xen 4.7.
--- xen/arch/arm/gic-v3.c | 9 +++++++++ 1 file changed, 9 insertions(+)xen/arch/arm/gic-v3.c +0
-0@@ -392,7 +392,16 @@ static void gicv3_restore_state(const struct vcpu *v) val |=GICC_SRE_EL2_ENEL1 ;WRITE_SYSREG32 (val,ICC_SRE_EL2 );
Quoted 17 lines
Quoted 16 lines
xen/arch/arm/gic-v3.c +9
-0+/* +* VFIQEn is RES1 if ICC_SRE_EL1.SRE is 1. This causes a Group0 +* interrupt (as generated in GICv2 mode) to be delivered as a FIQ +* to the guest, with potentially consequence. So we must make sure +* that ICC_SRE_EL1 has been actually programmed with the value we +* want before starting to mess with the rest of the GIC, and +* VMCR_EL1 in particular. +*/ WRITE_SYSREG32 (v->arch.gic.v3.sre_el1,ICC_SRE_EL1 ); +isb ();WRITE_SYSREG32 (v->arch.gic.v3.vmcr,ICH_VMCR_EL2 );restore_aprn_regs (&v->arch.gic);gicv3_restore_lrs (v);Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel