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, mapping, 3);
>> if (vec) {
>>   error handling
>> }
>>
>> and then find_vq as usual.
>>   
>
> Is it possible to just delay the msix enablement until after the queues  
> have been finalized (IOW in virtio-pci.c:vp_finalize_features)?

Yes, but

1. vp_finalize_features returns void, while enabling requested
   number of interrupts might fail.

2. we don't know in advance (without trying) whether we'll be able
   to allocate a specific number of vectors.
   So if we want to give drivers the flexibility to assign queues to
   vectors, driver must request vectors, we'll try to allocate
   and driver will decide what to do on failure.

After thinking about it, request_vqs was not a bad API for virtio, good
enough for existing drivers.  And the PCI space can be made future proof
allowing mapping virtqueues to vectors in case we extend API later.

Thoughts?


-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to