0

Some time ago, I asked a similar question, "How to connect GPIO in QEMU-emulated machine to an object in host?" and after some work, I have found a not perfect but satisfactory solution.

However, now we have virtio that supports GPIO, and it would be good to use that solution instead of a modified mpc8xxx driver. That previous solution was not perfect and difficult to maintain (I have only ported it to Buildroot 2021.02 and stopped further maintenance).

Unfortunately, I don't see any implementation of host-side virtio-user-gpio that I could use to connect GUI to a machine emulated in QEMU.

Is there any library (preferably with Python bindings) that could facilitate this task? Should I start from scratch, implementing the virtio protocol for the GPIO device as defined in the specification?

wzab
  • 788
  • 7
  • 24
  • I tried to implement a simple Python server listening on a TCP/IP port and have QEMU connected to it by adding `-device vhost-user-gpio-pci,chardev=cg0 -chardev socket,id=cg0,host="127.0.0.1",port="4321"` Hovewer, after an attempt to connect I get: `qemu-system-aarch64: -device vhost-user-gpio-pci,chardev=cg0: Failed to set msg fds. qemu-system-aarch64: ../hw/virtio/vhost.c:1633: vhost_dev_get_config: Assertion 'hdev->vhost_ops' failed.` – wzab Apr 15 '23 at 14:48
  • I have moved my server from TCP/IP socket to UNIX socket, and now I get a single message: `"b'\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00'"`. According to https://qemu-project.gitlab.io/qemu/interop/vhost-user.html#message-specification and https://elixir.bootlin.com/qemu/v7.2.1/source/subprojects/libvhost-user/libvhost-user.h#L75 it looks like a VHOST_USER_GET_FEATURES request. It seems that implementation of Python based vhost backend is possible ;-). The cause of the previous problem was using a TCP/IP instead of a UNIX socket. – wzab Apr 15 '23 at 15:01
  • Yet another possibility may connecting the Rust implementation of vhost-user-gpio ( https://github.com/rust-vmm/vhost-device ) to the Python-implemented GUI. – wzab Apr 15 '23 at 19:32

0 Answers0