From: Kieran Mansley Subject: Re: MSI-X interrupts to guests Date: Thu, 16 Apr 2009 16:19:22 +0100 Message-ID: <1239895162.4289.52.camel@moonstone.uk.level5networks.com> 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> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <18918.3011.32917.886597@gargle.gargle.HOWL> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Espen Skoglund Cc: xen-devel List-Id: xen-devel@lists.xenproject.org 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 2b) (This is what we tried before) Attempt to map this to the guest using PHYSDEVOP_map_pirq with parameters: map_irq.domid = guest_domid; map_irq.type = MAP_PIRQ_TYPE_MSI; map_irq.index = -1; map_irq.pirq = -1; map_irq.bus = pci_dev->bus->number; map_irq.devfn = pci_dev->devfn; map_irq.entry_nr = msix_entry; map_irq.table_base = msix_table; => This gives no error, and returns a sane looking value in map_irq.pirq, but it fails with ENOSYS when the guest calls request_irq () Can you suggest what I might be doing wrong? I'm basing the code in (2a) on the approach taken for xc_physdev_map_pirq in xend, but it gets the physical IRQ passed to it. 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. Thanks Kieran