vhost-backend: do not depend on CONFIG_VHOST_VSOCK
PATCH 1/1 vhost-backend: do not depend on CONFIG_VHOST_VSOCK
The vsock callbacks .vhost_vsock_set_guest_cid and .vhost_vsock_set_running are the only ones to be conditional on #ifdef CONFIG_VHOST_VSOCK. This is different from any other device-dependent callbacks like .vhost_scsi_set_endpoint, and it also broke when CONFIG_VHOST_VSOCK was changed to a per-target symbol.
It would be possible to also use the CONFIG_DEVICES include, but really there is no reason for most virtio files to be per-target so just remove the #ifdef to fix the issue.
--- hw/virtio/vhost-backend.c | 4 ---- 1 file changed, 4 deletions(-)
hw/virtio/vhost-backend.c +0 -4
@@ -203,7 +203,6 @@ static int vhost_kernel_get_vq_index(struct vhost_dev *dev, int idx)return idx - dev->vq_index; } -#ifdef CONFIG_VHOST_VSOCK static int vhost_kernel_vsock_set_guest_cid (struct vhost_dev *dev,uint64_t guest_cid) {
@@ -214,7 +213,6 @@ static int vhost_kernel_vsock_set_running(struct vhost_dev *dev, int start) {return vhost_kernel_call (dev,VHOST_VSOCK_SET_RUNNING , &start); } -#endif /* CONFIG_VHOST_VSOCK */ static void vhost_kernel_iotlb_read (void *opaque) {
@@ -319,10 +317,8 @@ const VhostOps kernel_ops = { .vhost_set_owner = vhost_kernel_set_owner, .vhost_reset_device = vhost_kernel_reset_device, .vhost_get_vq_index = vhost_kernel_get_vq_index, -#ifdef CONFIG_VHOST_VSOCK .vhost_vsock_set_guest_cid = vhost_kernel_vsock_set_guest_cid, .vhost_vsock_set_running = vhost_kernel_vsock_set_running, -#endif /* CONFIG_VHOST_VSOCK */ .vhost_set_iotlb_callback = vhost_kernel_set_iotlb_callback, .vhost_send_device_iotlb_msg = vhost_kernel_send_device_iotlb_msg, };
Signature · 1 line
2.36.0
Quoted 11 lines · Paolo Bonzini
The vsock callbacks .vhost_vsock_set_guest_cid and .vhost_vsock_set_running are the only ones to be conditional on #ifdef
CONFIG_VHOST_VSOCK. This is different from any other device-dependent callbacks like .vhost_scsi_set_endpoint, and it also broke whenCONFIG_VHOST_VSOCKwas changed to a per-target symbol.It would be possible to also use the
CONFIG_DEVICESinclude, but really there is no reason for most virtio files to be per-target so just remove the #ifdef to fix the issue.
I'm i doubt whether or not to add the following Fixes tag, since that commit only highlighted the problem:
Quoted 5 lines
Reported-by Dov Murik <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>---
hw/virtio/vhost-backend.c| 4 ----1 file changed, 4 deletions(-)
Anyway, the path LGTM:
Thanks,
Stefano
Quoted 36 lines
hw/virtio/vhost-backend.c +0
-4@@ -203,7 +203,6 @@ static int vhost_kernel_get_vq_index(struct vhost_dev *dev, int idx)return idx - dev->vq_index; } -#ifdef CONFIG_VHOST_VSOCK static int vhost_kernel_vsock_set_guest_cid (struct vhost_dev *dev,uint64_t guest_cid) {@@ -214,7 +213,6 @@ static int vhost_kernel_vsock_set_running(struct vhost_dev *dev, int start) {return vhost_kernel_call (dev,VHOST_VSOCK_SET_RUNNING , &start); } -#endif /* CONFIG_VHOST_VSOCK */ static void vhost_kernel_iotlb_read (void *opaque) {@@ -319,10 +317,8 @@ const VhostOps kernel_ops = { .vhost_set_owner = vhost_kernel_set_owner, .vhost_reset_device = vhost_kernel_reset_device, .vhost_get_vq_index = vhost_kernel_get_vq_index, -#ifdef CONFIG_VHOST_VSOCK .vhost_vsock_set_guest_cid = vhost_kernel_vsock_set_guest_cid, .vhost_vsock_set_running = vhost_kernel_vsock_set_running, -#endif /* CONFIG_VHOST_VSOCK */ .vhost_set_iotlb_callback = vhost_kernel_set_iotlb_callback, .vhost_send_device_iotlb_msg = vhost_kernel_send_device_iotlb_msg, };Signature · 1 line
2.36.0