|
@@ -148,17 +148,18 @@
|
|
* x0: Register pointing to VCPU struct
|
|
* x0: Register pointing to VCPU struct
|
|
*/
|
|
*/
|
|
.macro restore_vgic_v3_state
|
|
.macro restore_vgic_v3_state
|
|
- // Disable SRE_EL1 access. Necessary, otherwise
|
|
|
|
- // ICH_VMCR_EL2.VFIQEn becomes one, and FIQ happens...
|
|
|
|
- msr_s ICC_SRE_EL1, xzr
|
|
|
|
- isb
|
|
|
|
-
|
|
|
|
// Compute the address of struct vgic_cpu
|
|
// Compute the address of struct vgic_cpu
|
|
add x3, x0, #VCPU_VGIC_CPU
|
|
add x3, x0, #VCPU_VGIC_CPU
|
|
|
|
|
|
// Restore all interesting registers
|
|
// Restore all interesting registers
|
|
ldr w4, [x3, #VGIC_V3_CPU_HCR]
|
|
ldr w4, [x3, #VGIC_V3_CPU_HCR]
|
|
ldr w5, [x3, #VGIC_V3_CPU_VMCR]
|
|
ldr w5, [x3, #VGIC_V3_CPU_VMCR]
|
|
|
|
+ ldr w25, [x3, #VGIC_V3_CPU_SRE]
|
|
|
|
+
|
|
|
|
+ msr_s ICC_SRE_EL1, x25
|
|
|
|
+
|
|
|
|
+ // make sure SRE is valid before writing the other registers
|
|
|
|
+ isb
|
|
|
|
|
|
msr_s ICH_HCR_EL2, x4
|
|
msr_s ICH_HCR_EL2, x4
|
|
msr_s ICH_VMCR_EL2, x5
|
|
msr_s ICH_VMCR_EL2, x5
|
|
@@ -244,9 +245,12 @@
|
|
dsb sy
|
|
dsb sy
|
|
|
|
|
|
// Prevent the guest from touching the GIC system registers
|
|
// Prevent the guest from touching the GIC system registers
|
|
|
|
+ // if SRE isn't enabled for GICv3 emulation
|
|
|
|
+ cbnz x25, 1f
|
|
mrs_s x5, ICC_SRE_EL2
|
|
mrs_s x5, ICC_SRE_EL2
|
|
and x5, x5, #~ICC_SRE_EL2_ENABLE
|
|
and x5, x5, #~ICC_SRE_EL2_ENABLE
|
|
msr_s ICC_SRE_EL2, x5
|
|
msr_s ICC_SRE_EL2, x5
|
|
|
|
+1:
|
|
.endm
|
|
.endm
|
|
|
|
|
|
ENTRY(__save_vgic_v3_state)
|
|
ENTRY(__save_vgic_v3_state)
|