On 11.06.21 09:42, Geert Uytterhoeven wrote:
hi,
I my PoC "[PATCH QEMU v2 0/5] Add a GPIO backend"[1], I didn't have a virtio transport, but just hooked into the PL061 GPIO emulation in QEMU. The PL061 QEMU driver talked to the GPIO backend, which talked to /dev/gpiochipN on the host.
for qemu side you might be interested in my patch queue from last year (including the virtio-gpio implementation) - it also introduces an gpio backend subsys that allows attaching simulation gpio's to various backends. so far just implemented a dummy backend (that can be manipulated by qemu console) and using it just in the virtio-gpio device emulation.
https://github.com/oss-qm/qemu/tree/wip/gpio-v2
So QEMU has to translate the virtio-gpio communication to e.g. /dev/gpiochipN on the host (or a different backend on non-Linux or bare-metal HV).
For qemu case, yes, depending on your actual configuration. You can attach the virtual device to any gpio backend you like (once it's actually implemented). Yet only implemented the dummy, which doesn't speak to a real hosts gpio, but can be used simulations like HIL.
--mtx