|
@@ -172,6 +172,7 @@ error:
|
|
|
static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned index,
|
|
|
void (*callback)(struct virtqueue *vq),
|
|
|
const char *name,
|
|
|
+ bool ctx,
|
|
|
u16 msix_vec)
|
|
|
{
|
|
|
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
|
@@ -183,7 +184,7 @@ static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned index,
|
|
|
if (!info)
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
- vq = vp_dev->setup_vq(vp_dev, info, index, callback, name,
|
|
|
+ vq = vp_dev->setup_vq(vp_dev, info, index, callback, name, ctx,
|
|
|
msix_vec);
|
|
|
if (IS_ERR(vq))
|
|
|
goto out_info;
|
|
@@ -274,6 +275,7 @@ void vp_del_vqs(struct virtio_device *vdev)
|
|
|
static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
|
|
|
struct virtqueue *vqs[], vq_callback_t *callbacks[],
|
|
|
const char * const names[], bool per_vq_vectors,
|
|
|
+ const bool *ctx,
|
|
|
struct irq_affinity *desc)
|
|
|
{
|
|
|
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
|
@@ -315,6 +317,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
|
|
|
else
|
|
|
msix_vec = VP_MSIX_VQ_VECTOR;
|
|
|
vqs[i] = vp_setup_vq(vdev, i, callbacks[i], names[i],
|
|
|
+ ctx ? ctx[i] : false,
|
|
|
msix_vec);
|
|
|
if (IS_ERR(vqs[i])) {
|
|
|
err = PTR_ERR(vqs[i]);
|
|
@@ -345,7 +348,7 @@ error_find:
|
|
|
|
|
|
static int vp_find_vqs_intx(struct virtio_device *vdev, unsigned nvqs,
|
|
|
struct virtqueue *vqs[], vq_callback_t *callbacks[],
|
|
|
- const char * const names[])
|
|
|
+ const char * const names[], const bool *ctx)
|
|
|
{
|
|
|
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
|
|
int i, err;
|
|
@@ -367,6 +370,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev, unsigned nvqs,
|
|
|
continue;
|
|
|
}
|
|
|
vqs[i] = vp_setup_vq(vdev, i, callbacks[i], names[i],
|
|
|
+ ctx ? ctx[i] : false,
|
|
|
VIRTIO_MSI_NO_VECTOR);
|
|
|
if (IS_ERR(vqs[i])) {
|
|
|
err = PTR_ERR(vqs[i]);
|
|
@@ -383,20 +387,21 @@ out_del_vqs:
|
|
|
/* the config->find_vqs() implementation */
|
|
|
int vp_find_vqs(struct virtio_device *vdev, unsigned nvqs,
|
|
|
struct virtqueue *vqs[], vq_callback_t *callbacks[],
|
|
|
- const char * const names[], struct irq_affinity *desc)
|
|
|
+ const char * const names[], const bool *ctx,
|
|
|
+ struct irq_affinity *desc)
|
|
|
{
|
|
|
int err;
|
|
|
|
|
|
/* Try MSI-X with one vector per queue. */
|
|
|
- err = vp_find_vqs_msix(vdev, nvqs, vqs, callbacks, names, true, desc);
|
|
|
+ err = vp_find_vqs_msix(vdev, nvqs, vqs, callbacks, names, true, ctx, desc);
|
|
|
if (!err)
|
|
|
return 0;
|
|
|
/* Fallback: MSI-X with one vector for config, one shared for queues. */
|
|
|
- err = vp_find_vqs_msix(vdev, nvqs, vqs, callbacks, names, false, desc);
|
|
|
+ err = vp_find_vqs_msix(vdev, nvqs, vqs, callbacks, names, false, ctx, desc);
|
|
|
if (!err)
|
|
|
return 0;
|
|
|
/* Finally fall back to regular interrupts. */
|
|
|
- return vp_find_vqs_intx(vdev, nvqs, vqs, callbacks, names);
|
|
|
+ return vp_find_vqs_intx(vdev, nvqs, vqs, callbacks, names, ctx);
|
|
|
}
|
|
|
|
|
|
const char *vp_bus_name(struct virtio_device *vdev)
|