From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: KVM Irq injection Date: Tue, 21 Jul 2009 20:16:37 +0300 Message-ID: <20090721171637.GC1424@redhat.com> References: <4158487B9DEE0647BA23911D1C22795767AB1FE8@orsmsx501.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "kvm@vger.kernel.org" To: "Saksena, Abhishek" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:59766 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754264AbZGURQj (ORCPT ); Tue, 21 Jul 2009 13:16:39 -0400 Content-Disposition: inline In-Reply-To: <4158487B9DEE0647BA23911D1C22795767AB1FE8@orsmsx501.amr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jul 21, 2009 at 08:57:26AM -0700, Saksena, Abhishek wrote: > > > > Hi, > I am building some device models around the KVM and am intersted in injecting IRQs. > > The current LibKVM.h provides following function > > int kvm_inject_irq ( kvm_context_t kvm, > int vcpu, > unsigned irq > ) > > Simulate an external vectored interrupt. > > This allows you to simulate an external vectored interrupt. > > Parameters: > kvm Pointer to the current kvm_context > vcpu Which virtual CPU should get dumped > irq Vector number > > Returns: > 0 on success > > My question is if I am say Injecting IRQ on pin 0 on PIC how do I get croosponding vector? I am using KVM's interrupt controllers. > This ioctl should be used if userspace emulates HW that maps IRQ to interrupt vector (PIC/IOAPIC/LAPIC). > > > I also see another function > > > > int kvm_set_irq_level ( kvm_context_t kvm, int irq, int level ) > > > > Can this be used safely to inject IRQ- I am gusseing irq refers to the pin and Level the value of that pin. How do I tell with this function which CPU I want to inject interrupt? > > And this one should be used if PIC/IOAPIC/LAPIC are emulated by a kernel. -- Gleb.