From: Espen Skoglund Subject: Re: MSI-X interrupts to guests Date: Thu, 16 Apr 2009 16:39:53 +0100 Message-ID: <18919.20809.69840.702986@gargle.gargle.HOWL> References: <1239810184.4306.38.camel@moonstone.uk.level5networks.com> <18918.1125.161033.236856@gargle.gargle.HOWL> <18918.1787.569721.715154@gargle.gargle.HOWL> <1239812710.4306.48.camel@moonstone.uk.level5networks.com> <18918.3011.32917.886597@gargle.gargle.HOWL> <1239895162.4289.52.camel@moonstone.uk.level5networks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1239895162.4289.52.camel@moonstone.uk.level5networks.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Kieran Mansley Cc: xen-devel , Espen Skoglund List-Id: xen-devel@lists.xenproject.org [Kieran Mansley] > On Wed, 2009-04-15 at 17:30 +0100, Espen Skoglund wrote: >> The API is the same as used for mapping regular PIRQs (they just >> happen to be MSI-X vectors). In particular, xend will use the >> right API when mapping a PIRQ to the guest. > Changing the code to do as I think you describe gives a different > error: the call to PHYSDEVOP_map_pirq to map the GSI into the guest > fails as from reading the code (xen/arch/x86/physdev.c:58) it seems > to be expecting an IRQ number to be passed in when what we have is > an MSI-X vector, and it falls out of the range of IRQ numbers. The > frustrating part is that the code that handles PHYSDEVOP_map_pirq in > the hypervisor just turns the IRQ back into a vector. > For the record, this is what I'm doing now: > 1) Call pci_enable_msix() to set up the MSI-X tables and allocate a set > of vectors. This works fine. As I understand things this calls among > other things PHYSDEVOP_map_pirq to map it into dom0. > 2a) Attempt to map this to the guest using PHYSDEVOP_map_pirq with > parameters: > map_irq.domid = guest_domid; > map_irq.type = MAP_PIRQ_TYPE_GSI; > map_irq.index = vector; > map_irq.pirq = -1; > => gives an error in the hypervisor: > (XEN) physdev.c:61: dom1: map invalid irq 510 IRQ510? This definitely sounds wrong. This can't possibly be the "PIRQ" assigned to the MSI vector. > One point that is causing some confusion is the need to map the > MSI-X into dom0 and get a physical IRQ in the first place before > mapping it to the guest. Is this strictly necessary? It suggests > that, once it has also been mapped to the guest the interrupt may be > delivered to two different domains. Only if two different domains bind to the pirq. MSI-X vectors could in theory be shared between multiple domains. I have not attempted this, and don't know if it would work with the current code base. eSk