Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-05-04 Thread Avi Kivity
Michael S. Tsirkin wrote: On Mon, May 04, 2009 at 12:21:28PM +0300, Avi Kivity wrote: Michael S. Tsirkin wrote: So what I see is transports providing something like: struct virtio_interrupt_mapping { int virtqueue; int interrupt; }; map_vqs_to_interrupt(dev, struct vir

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-05-04 Thread Michael S. Tsirkin
On Mon, May 04, 2009 at 12:21:28PM +0300, Avi Kivity wrote: > Michael S. Tsirkin wrote: So what I see is transports providing something like: struct virtio_interrupt_mapping { int virtqueue; int interrupt; }; map_vqs_to_interrupt(dev, struct virtio_inte

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-05-04 Thread Avi Kivity
Michael S. Tsirkin wrote: So what I see is transports providing something like: struct virtio_interrupt_mapping { int virtqueue; int interrupt; }; map_vqs_to_interrupt(dev, struct virtio_interrupt_mapping *, int nvirtqueues); unmap_vqs(dev); Isn't that the same thing?

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-28 Thread Michael S. Tsirkin
On Tue, Apr 28, 2009 at 02:56:15PM -0500, Anthony Liguori wrote: > Michael S. Tsirkin wrote: >> So to map vq 0 to vector 0, vq 1 to vector 1 and vq 2 to vector 2 the driver >> would do: >> >> struct virtio_interrupt_mapping mapping[3] = { {0, 0}, {1, 1}, {2, 2} }; >> vec = map_vqs_to_interrupt(dev

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-28 Thread Anthony Liguori
Michael S. Tsirkin wrote: So to map vq 0 to vector 0, vq 1 to vector 1 and vq 2 to vector 2 the driver would do: struct virtio_interrupt_mapping mapping[3] = { {0, 0}, {1, 1}, {2, 2} }; vec = map_vqs_to_interrupt(dev, mapping, 3); if (vec) { error handling } and then find_vq as usual. I

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-28 Thread Michael S. Tsirkin
On Tue, Apr 28, 2009 at 08:51:08PM +0300, Avi Kivity wrote: > Michael S. Tsirkin wrote: >> This does not work for MSIX - in linux, you must map all MSI-X entries >> to interrupt vectors upfront. >> > > What? that's very inflexible. > > Can you point me at the code? See pci_enable_msix in inclu

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-28 Thread Avi Kivity
Michael S. Tsirkin wrote: This does not work for MSIX - in linux, you must map all MSI-X entries to interrupt vectors upfront. What? that's very inflexible. Can you point me at the code? So what I see is transports providing something like: struct virtio_interrupt_mapping { int

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-28 Thread Michael S. Tsirkin
On Tue, Apr 28, 2009 at 09:47:14AM +0300, Avi Kivity wrote: > Michael S. Tsirkin wrote: >>> That saves us the new API (at the expense of a lot more code, but >>> with added flexibility). >>> >> >> So we'll probably need to rename request_vqs to request_vectors, >> but we probably still need

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Avi Kivity
Michael S. Tsirkin wrote: That saves us the new API (at the expense of a lot more code, but with added flexibility). So we'll probably need to rename request_vqs to request_vectors, but we probably still need the driver to pass the number of vectors it wants to the transport. Right?

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Michael S. Tsirkin
On Mon, Apr 27, 2009 at 09:39:06AM -0500, Anthony Liguori wrote: > Michael S. Tsirkin wrote: >> Add optional MSI-X support: use a vector per virtqueue with >> fallback to a common vector and finally to regular interrupt. >> Teach all drivers to use it. >> >> I added 2 new virtio operations: request

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Michael S. Tsirkin
On Mon, Apr 27, 2009 at 06:59:52PM +0200, Christian Borntraeger wrote: > Am Monday 27 April 2009 17:39:36 schrieb Michael S. Tsirkin: > > So we'll probably need to rename request_vqs to request_vectors, > > but we probably still need the driver to pass the number of > > vectors it wants to the tran

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Michael S. Tsirkin
On Mon, Apr 27, 2009 at 05:37:25PM +0200, Christian Borntraeger wrote: > > As number of virtqueues <= number of vectors, > > we could pre-allocate all vectors that host supports, but this seems > > a bit drastic as an MSI-X device could support up to 2K vectors. > > > > > In fact, the transport h

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Christian Borntraeger
Am Monday 27 April 2009 17:39:36 schrieb Michael S. Tsirkin: > So we'll probably need to rename request_vqs to request_vectors, > but we probably still need the driver to pass the number of > vectors it wants to the transport. Right? This might be a stupid idea, but would something like the follow

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Michael S. Tsirkin
On Mon, Apr 27, 2009 at 06:06:48PM +0300, Avi Kivity wrote: > Christian Borntraeger wrote: >> Am Monday 27 April 2009 14:31:36 schrieb Michael S. Tsirkin: >> >>> Add optional MSI-X support: use a vector per virtqueue with >>> fallback to a common vector and finally to regular interrupt. >>> Teac

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Christian Borntraeger
Am Monday 27 April 2009 16:32:56 schrieb Michael S. Tsirkin: > > I dont know, if that is feasible for MSI, but the transport(virtio_pci) > > should > > already know the number of virtqueues, which should match the number of > > vectors, no? > > I think no, the transport can find out the max numb

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Avi Kivity
Christian Borntraeger wrote: Am Monday 27 April 2009 14:31:36 schrieb Michael S. Tsirkin: Add optional MSI-X support: use a vector per virtqueue with fallback to a common vector and finally to regular interrupt. Teach all drivers to use it. I added 2 new virtio operations: request_vqs/free_v

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Anthony Liguori
Michael S. Tsirkin wrote: Add optional MSI-X support: use a vector per virtqueue with fallback to a common vector and finally to regular interrupt. Teach all drivers to use it. I added 2 new virtio operations: request_vqs/free_vqs because MSI needs to know the total number of vectors upfront. S

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Michael S. Tsirkin
On Mon, Apr 27, 2009 at 04:00:30PM +0200, Christian Borntraeger wrote: > Am Monday 27 April 2009 14:31:36 schrieb Michael S. Tsirkin: > > Add optional MSI-X support: use a vector per virtqueue with > > fallback to a common vector and finally to regular interrupt. > > Teach all drivers to use it. >

Re: [PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Christian Borntraeger
Am Monday 27 April 2009 14:31:36 schrieb Michael S. Tsirkin: > Add optional MSI-X support: use a vector per virtqueue with > fallback to a common vector and finally to regular interrupt. > Teach all drivers to use it. > > I added 2 new virtio operations: request_vqs/free_vqs because MSI > needs to

[PATCH RFC 0/8] virtio: add guest MSI-X support

2009-04-27 Thread Michael S. Tsirkin
Add optional MSI-X support: use a vector per virtqueue with fallback to a common vector and finally to regular interrupt. Teach all drivers to use it. I added 2 new virtio operations: request_vqs/free_vqs because MSI needs to know the total number of vectors upfront. Signed-off-by: Michael S. Tsi