xen/arm: Save/restore GICH_VMCR on domain context switch
PATCH 1/1 xen/arm: Save/restore GICH_VMCR on domain context switch
GICH_VMCR register contains alias to important bits of GICV interface such as:
- priority mask of the CPU
- EOImode
- ...
We were safe because Linux guest always use the same value for this bits. When new guests will handle priority or change EOI mode, VCPU interrupt management will be in a wrong state.
---
This is a bug fix for Xen 4.4. Without this patch we can't support guest that doesn't have the same behavior as Linux to handle GICC interface. theses bits are not modified by them.
--- xen/arch/arm/gic.c | 2 ++ 1 file changed, 2 insertions(+)
xen/arch/arm/gic.c +2 -0
@@ -107,6 +107,7 @@ void gic_save_state(struct vcpu *v) v->arch.gic_lr[i] =GICH [GICH_LR + i]; v->arch.lr_mask =this_cpu (lr_mask); v->arch.gic_apr =GICH [GICH_APR ]; + v->arch.gic_vmcr =GICH [GICH_VMCR ];/* Disable until next VCPU scheduled */ GICH [GICH_HCR ] =0 ;isb ();
@@ -123,6 +124,7 @@ void gic_restore_state(struct vcpu *v)for ( i=0 ; i<nr_lrs; i++)GICH [GICH_LR + i] = v->arch.gic_lr[i];GICH [GICH_APR ] = v->arch.gic_apr; +GICH [GICH_VMCR ] = v->arch.gic_vmcr;GICH [GICH_HCR ] =GICH_HCR_EN ;isb ();
Signature · 1 line
1.7.10.4
Quoted 11 lines · Julien Grall
GICH_VMCRregister contains alias to important bits of GICV interface such as:
- priority mask of the CPU
- EOImode
- ...We were safe because Linux guest always use the same value for this bits. When new guests will handle priority or change EOI mode, VCPU interrupt management will be in a wrong state.
Signed-off-by Julien Grall <[email protected]>Cc George Dunlap <[email protected]>
Quoted 4 lines
---
This is a bug fix for Xen 4.4. Without this patch we can't support guest that doesn't have the same behavior as Linux to handle GICC interface. theses bits are not modified by them.
I'd say we pretty much have to take this -- otherwise some guest can break things for everyone else by writing to GICC registers.
I've had a look at the GICH register list and I think we correctly switch everything else.
Ian.
Quoted 24 lines
--- xen/arch/arm/gic.c | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/gic.c +2
-0@@ -107,6 +107,7 @@ void gic_save_state(struct vcpu *v) v->arch.gic_lr[i] =GICH [GICH_LR + i]; v->arch.lr_mask =this_cpu (lr_mask); v->arch.gic_apr =GICH [GICH_APR ]; + v->arch.gic_vmcr =GICH [GICH_VMCR ];/* Disable until next VCPU scheduled */ GICH [GICH_HCR ] =0 ;isb ();@@ -123,6 +124,7 @@ void gic_restore_state(struct vcpu *v)for ( i=0 ; i<nr_lrs; i++)GICH [GICH_LR + i] = v->arch.gic_lr[i];GICH [GICH_APR ] = v->arch.gic_apr; +GICH [GICH_VMCR ] = v->arch.gic_vmcr;GICH [GICH_HCR ] =GICH_HCR_EN ;isb ();
Quoted 18 lines · Ian Campbell
Quoted 11 lines · Julien Grall
GICH_VMCRregister contains alias to important bits of GICV interface such as:
- priority mask of the CPU
- EOImode
- ...We were safe because Linux guest always use the same value for this bits. When new guests will handle priority or change EOI mode, VCPU interrupt management will be in a wrong state.
Signed-off-by Julien Grall <[email protected]>Cc George Dunlap <[email protected]>Acked-by Ian Campbell <[email protected]>Quoted 4 lines
---
This is a bug fix for Xen 4.4. Without this patch we can't support guest that doesn't have the same behavior as Linux to handle GICC interface. theses bits are not modified by them.
Quoted 5 lines
I'd say we pretty much have to take this -- otherwise some guest can break things for everyone else by writing to GICC registers.
I've had a look at the GICH register list and I think we correctly switch everything else.
It looks that way to me as well: