|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] MSI-X interrupts to guests
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|