Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vhost_vdpa: tell vqs about the negotiated

As is done in the net, iscsi, and vsock vhost support, let the vdpa vqs
know about the features that have been negotiated. This allows vhost
to more safely make decisions based on the features, such as when using
PACKED vs split queues.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230424225031.18947-2-shannon.nelson@amd.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Shannon Nelson and committed by
Michael S. Tsirkin
376daf31 73790bdf

+13
+13
drivers/vhost/vdpa.c
··· 407 407 { 408 408 struct vdpa_device *vdpa = v->vdpa; 409 409 const struct vdpa_config_ops *ops = vdpa->config; 410 + struct vhost_dev *d = &v->vdev; 411 + u64 actual_features; 410 412 u64 features; 413 + int i; 411 414 412 415 /* 413 416 * It's not allowed to change the features after they have ··· 424 421 425 422 if (vdpa_set_features(vdpa, features)) 426 423 return -EINVAL; 424 + 425 + /* let the vqs know what has been configured */ 426 + actual_features = ops->get_driver_features(vdpa); 427 + for (i = 0; i < d->nvqs; ++i) { 428 + struct vhost_virtqueue *vq = d->vqs[i]; 429 + 430 + mutex_lock(&vq->mutex); 431 + vq->acked_features = actual_features; 432 + mutex_unlock(&vq->mutex); 433 + } 427 434 428 435 return 0; 429 436 }