* [PATCH] xen/arm: Save/restore GICH_VMCR on domain context switch
@ 2014-02-18 13:58 Julien Grall
2014-02-18 14:51 ` Ian Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2014-02-18 13:58 UTC (permalink / raw)
To: xen-devel
Cc: stefano.stabellini, Julien Grall, tim, ian.campbell, George Dunlap
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.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: George Dunlap <george.dunlap@citrix.com>
---
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(+)
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 62294ac..51e5990 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -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();
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/arm: Save/restore GICH_VMCR on domain context switch
2014-02-18 13:58 [PATCH] xen/arm: Save/restore GICH_VMCR on domain context switch Julien Grall
@ 2014-02-18 14:51 ` Ian Campbell
2014-02-18 17:13 ` George Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2014-02-18 14:51 UTC (permalink / raw)
To: Julien Grall; +Cc: xen-devel, tim, George Dunlap, stefano.stabellini
On Tue, 2014-02-18 at 13:58 +0000, Julien Grall wrote:
> 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.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Cc: George Dunlap <george.dunlap@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> 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.
> ---
> xen/arch/arm/gic.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index 62294ac..51e5990 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -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();
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xen/arm: Save/restore GICH_VMCR on domain context switch
2014-02-18 14:51 ` Ian Campbell
@ 2014-02-18 17:13 ` George Dunlap
0 siblings, 0 replies; 3+ messages in thread
From: George Dunlap @ 2014-02-18 17:13 UTC (permalink / raw)
To: Ian Campbell, Julien Grall
Cc: xen-devel, tim, George Dunlap, stefano.stabellini
On 02/18/2014 02:51 PM, Ian Campbell wrote:
> On Tue, 2014-02-18 at 13:58 +0000, Julien Grall wrote:
>> 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.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> Cc: George Dunlap <george.dunlap@citrix.com>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
>
>> ---
>> 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.
It looks that way to me as well:
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-18 17:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-18 13:58 [PATCH] xen/arm: Save/restore GICH_VMCR on domain context switch Julien Grall
2014-02-18 14:51 ` Ian Campbell
2014-02-18 17:13 ` George Dunlap
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.