On Sun, Jan 04, 2009 at 06:14:45PM +0200, Avi Kivity wrote:
> While the PIT is masked the guest cannot ack the irq, so the reinject logic
> will never allow the interrupt to be injected.
> 
> Fix by resetting the reinjection counters on unmask.
> 
> Unbreaks Xen.
> 
> Signed-off-by: Avi Kivity <a...@redhat.com>
> ---
>  arch/x86/kvm/i8254.c |   15 +++++++++++++++
>  arch/x86/kvm/i8254.h |    1 +
>  2 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
> index 528daad..d78d430 100644
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -539,6 +539,16 @@ void kvm_pit_reset(struct kvm_pit *pit)
>       pit->pit_state.irq_ack = 1;
>  }
>  
> +static void pit_mask_notifer(struct kvm_irq_mask_notifier *kimn, int mask)
> +{
> +     struct kvm_pit *pit = container_of(kimn, struct kvm_pit, mask_notifier);
> +
> +     if (!mask) {
> +             atomic_set(&pit->pit_state.pit_timer.pending, 0);
> +             pit->pit_state.irq_ack = 1;
> +     }
> +}

I'm not sure about zeroing the counter here. The guest can mask the
interrupt during normal operation, and in such cases you want the
pending count to be retained (and reinjected later).

I suppose setting irq_ack to one is enough.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to