Amit Shah wrote:
> This function injects an interrupt into the guest given the kvm struct,
> the (guest) irq number and the interrupt level.
>
> Signed-off-by: Amit Shah <[EMAIL PROTECTED]>
> ---
>  arch/x86/kvm/irq.c |   11 +++++++++++
>  arch/x86/kvm/irq.h |    2 ++
>  2 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
> index 76d736b..0d9e552 100644
> --- a/arch/x86/kvm/irq.c
> +++ b/arch/x86/kvm/irq.c
> @@ -100,3 +100,14 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
>       __kvm_migrate_apic_timer(vcpu);
>       __kvm_migrate_pit_timer(vcpu);
>  }
> +
> +/* This should be called with the kvm->lock mutex held */
> +void kvm_set_irq(struct kvm *kvm, int irq, int level)
> +{
> +     /* Not possible to detect if the guest uses the PIC or the
> +      * IOAPIC.  So set the bit in both. The guest will ignore
> +      * writes to the unused one.
> +      */
> +     kvm_ioapic_set_irq(kvm->arch.vioapic, irq, level);
> +     kvm_pic_set_irq(pic_irqchip(kvm), irq, level);
> +}
>   

pic supports only irqs 0-15.

I guess instead of adding the check here, better move it into i8259.c 
and ioapic.c.


-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization

Reply via email to