* [PATCH] KVM: i8259: initialize IMR to 0xff on reset
@ 2010-08-30 9:20 Avi Kivity
2010-08-30 9:22 ` Avi Kivity
2010-08-30 13:36 ` Paolo Bonzini
0 siblings, 2 replies; 4+ messages in thread
From: Avi Kivity @ 2010-08-30 9:20 UTC (permalink / raw)
To: kvm, Marcelo Tosatti
Otherwise, a wily interrupt can slip through while the guest isn't prepared
for it (and while the irq base is zero).
Signed-off-by: Avi Kivity <avi@redhat.com>
---
arch/x86/kvm/i8259.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 8d10c06..5de9ee0 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -275,7 +275,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s)
s->last_irr = 0;
s->irr = 0;
- s->imr = 0;
+ s->imr = 0xff;
s->isr = 0;
s->isr_ack = 0xff;
s->priority_add = 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: i8259: initialize IMR to 0xff on reset
2010-08-30 9:20 [PATCH] KVM: i8259: initialize IMR to 0xff on reset Avi Kivity
@ 2010-08-30 9:22 ` Avi Kivity
2010-08-30 13:36 ` Paolo Bonzini
1 sibling, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-08-30 9:22 UTC (permalink / raw)
To: kvm, Marcelo Tosatti
On 08/30/2010 12:20 PM, Avi Kivity wrote:
> Otherwise, a wily interrupt can slip through while the guest isn't prepared
> for it (and while the irq base is zero).
>
>
> s->last_irr = 0;
> s->irr = 0;
> - s->imr = 0;
> + s->imr = 0xff;
> s->isr = 0;
> s->isr_ack = 0xff;
> s->priority_add = 0;
For some reason, this bug only shows on the non-atomic-injection branch
(specifically, the KVM_REQ_EVENT part).
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: i8259: initialize IMR to 0xff on reset
2010-08-30 9:20 [PATCH] KVM: i8259: initialize IMR to 0xff on reset Avi Kivity
2010-08-30 9:22 ` Avi Kivity
@ 2010-08-30 13:36 ` Paolo Bonzini
2010-08-30 13:53 ` Avi Kivity
1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2010-08-30 13:36 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm, Marcelo Tosatti
On 08/30/2010 11:20 AM, Avi Kivity wrote:
> Otherwise, a wily interrupt can slip through while the guest isn't prepared
> for it (and while the irq base is zero).
>
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
> arch/x86/kvm/i8259.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
> index 8d10c06..5de9ee0 100644
> --- a/arch/x86/kvm/i8259.c
> +++ b/arch/x86/kvm/i8259.c
> @@ -275,7 +275,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s)
>
> s->last_irr = 0;
> s->irr = 0;
> - s->imr = 0;
> + s->imr = 0xff;
> s->isr = 0;
> s->isr_ack = 0xff;
> s->priority_add = 0;
Sounds sane, but the datasheet says explicitly that upon reset "The
Interrupt Mask Register is cleared"... (FWIW, I checked because it
looked like QEMU and Xen also had the same behavior of setting IMR to zero).
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: i8259: initialize IMR to 0xff on reset
2010-08-30 13:36 ` Paolo Bonzini
@ 2010-08-30 13:53 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-08-30 13:53 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Marcelo Tosatti
On 08/30/2010 04:36 PM, Paolo Bonzini wrote:
> On 08/30/2010 11:20 AM, Avi Kivity wrote:
>> Otherwise, a wily interrupt can slip through while the guest isn't
>> prepared
>> for it (and while the irq base is zero).
>>
>> Signed-off-by: Avi Kivity<avi@redhat.com>
>> ---
>> arch/x86/kvm/i8259.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
>> index 8d10c06..5de9ee0 100644
>> --- a/arch/x86/kvm/i8259.c
>> +++ b/arch/x86/kvm/i8259.c
>> @@ -275,7 +275,7 @@ void kvm_pic_reset(struct kvm_kpic_state *s)
>>
>> s->last_irr = 0;
>> s->irr = 0;
>> - s->imr = 0;
>> + s->imr = 0xff;
>> s->isr = 0;
>> s->isr_ack = 0xff;
>> s->priority_add = 0;
>
> Sounds sane, but the datasheet says explicitly that upon reset "The
> Interrupt Mask Register is cleared"... (FWIW, I checked because it
> looked like QEMU and Xen also had the same behavior of setting IMR to
> zero).
Hm, right.
Reading the spec, the correct approach is not to do a full reset on
ICW1(D4=1), instead just do what the spec says (which is different from
reset). I'll try it out.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-30 13:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-30 9:20 [PATCH] KVM: i8259: initialize IMR to 0xff on reset Avi Kivity
2010-08-30 9:22 ` Avi Kivity
2010-08-30 13:36 ` Paolo Bonzini
2010-08-30 13:53 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).