mirror of
https://github.com/torvalds/linux.git
synced 2026-04-19 23:34:00 -04:00
virtio: add context flag to find vqs
Allows maintaining extra context per vq. For ease of use, passing in NULL is legal and disables the feature for all vqs. Includes fixes by Christian for s390, acked by Cornelia. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
@@ -189,7 +189,7 @@ static bool kvm_notify(struct virtqueue *vq)
|
||||
static struct virtqueue *kvm_find_vq(struct virtio_device *vdev,
|
||||
unsigned index,
|
||||
void (*callback)(struct virtqueue *vq),
|
||||
const char *name)
|
||||
const char *name, bool ctx)
|
||||
{
|
||||
struct kvm_device *kdev = to_kvmdev(vdev);
|
||||
struct kvm_vqconfig *config;
|
||||
@@ -211,7 +211,7 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev,
|
||||
goto out;
|
||||
|
||||
vq = vring_new_virtqueue(index, config->num, KVM_S390_VIRTIO_RING_ALIGN,
|
||||
vdev, true, (void *) config->address,
|
||||
vdev, true, ctx, (void *) config->address,
|
||||
kvm_notify, callback, name);
|
||||
if (!vq) {
|
||||
err = -ENOMEM;
|
||||
@@ -256,6 +256,7 @@ static int kvm_find_vqs(struct virtio_device *vdev, unsigned nvqs,
|
||||
struct virtqueue *vqs[],
|
||||
vq_callback_t *callbacks[],
|
||||
const char * const names[],
|
||||
const bool *ctx,
|
||||
struct irq_affinity *desc)
|
||||
{
|
||||
struct kvm_device *kdev = to_kvmdev(vdev);
|
||||
@@ -266,7 +267,8 @@ static int kvm_find_vqs(struct virtio_device *vdev, unsigned nvqs,
|
||||
return -ENOENT;
|
||||
|
||||
for (i = 0; i < nvqs; ++i) {
|
||||
vqs[i] = kvm_find_vq(vdev, i, callbacks[i], names[i]);
|
||||
vqs[i] = kvm_find_vq(vdev, i, callbacks[i], names[i],
|
||||
ctx ? ctx[i] : false);
|
||||
if (IS_ERR(vqs[i]))
|
||||
goto error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user