vhost-device icon indicating copy to clipboard operation
vhost-device copied to clipboard

README: clarify `vhost-user-device-pci` usage

Open stefano-garzarella opened this issue 3 months ago • 6 comments

In vhost-device-can/README.md and vhost-device-console/README.md we suggest to use -device vhost-user-device-pci but IIUC that device can't be created by the user without patching QEMU, at least QEMU <= 10.1. Next version of QEMU is changing the device name (see https://patchew.org/QEMU/[email protected]/).

So @stsquad @epilys should we clarify it better what to do with QEMU <= 10.1 and QEMU > 10.1 (when the patch will be merged?

stefano-garzarella avatar Aug 28 '25 08:08 stefano-garzarella

@uran0sH this should be related to the issue you told us (@germag) while testing vhost-device-console on macOS, so IIUC you just need to patch QEMU in this way:

diff --git a/hw/virtio/vhost-user-device-pci.c b/hw/virtio/vhost-user-device-pci.c
index f10bac874e..0c593da83a 100644
--- a/hw/virtio/vhost-user-device-pci.c
+++ b/hw/virtio/vhost-user-device-pci.c
@@ -39,7 +39,7 @@ static void vhost_user_device_pci_class_init(ObjectClass *klass,
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
 
     /* Reason: stop users confusing themselves */
-    dc->user_creatable = false;
+    dc->user_creatable = true;
 
     k->realize = vhost_user_device_pci_realize;
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);

stefano-garzarella avatar Aug 28 '25 08:08 stefano-garzarella

Yes, good idea.

epilys avatar Aug 28 '25 10:08 epilys

I have another question. Is there a plan to send the vhost-device-console patches to upstream? It is still in https://github.com/virtualopensystems/qemu/tree/vhu-console-rfc

uran0sH avatar Aug 28 '25 11:08 uran0sH

I have another question. Is there a plan to send the vhost-device-console patches to upstream? It is still in https://github.com/virtualopensystems/qemu/tree/vhu-console-rfc

@uran0sH I guess you mean QEMU patches, right? I have no idea, @TimosAmpel maybe knows the plan.

stefano-garzarella avatar Aug 28 '25 11:08 stefano-garzarella

FYI: we're proposing adding a generic vhost-user device to Cloud Hypervisor in https://github.com/cloud-hypervisor/cloud-hypervisor/pull/7221, not as a development/testing device, but as a solution for allowing Cloud Hypervisor users to use devices that upstream doesn't necessarily want dedicated code for due to its tight focus.

alyssais avatar Sep 04 '25 09:09 alyssais

There have been a couple of attempts: https://patchew.org/QEMU/[email protected]/ and https://patchew.org/QEMU/[email protected]/ but there is resistance to having a "generic" test device which might get abused.

stsquad avatar Sep 23 '25 17:09 stsquad