vhost-device/vhost-device-gpio
dependabot[bot] c1f9f3c94c build(deps): bump the vhost-device group across 1 directory with 17 updates
Bumps the vhost-device group with 14 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.5.16` | `4.5.17` |
| [vhost](https://github.com/rust-vmm/vhost) | `0.11.0` | `0.12.0` |
| [vhost-user-backend](https://github.com/rust-vmm/vhost) | `0.15.0` | `0.16.0` |
| [virtio-queue](https://github.com/rust-vmm/vm-virtio) | `0.12.0` | `0.13.0` |
| [vm-memory](https://github.com/rust-vmm/vm-memory) | `0.14.1` | `0.15.0` |
| [virtio-vsock](https://github.com/rust-vmm/vm-virtio) | `0.6.0` | `0.7.0` |
| [serde](https://github.com/serde-rs/serde) | `1.0.209` | `1.0.210` |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.86` | `1.0.89` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.17.1` | `1.18.0` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.15` | `1.1.19` |
| [once_cell](https://github.com/matklad/once_cell) | `1.19.0` | `1.20.0` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.35` | `0.38.37` |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | `1.0.12` | `1.0.13` |
| [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation) | `1.11.0` | `1.12.0` |



Updates `clap` from 4.5.16 to 4.5.17
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.16...clap_complete-v4.5.17)

Updates `vhost` from 0.11.0 to 0.12.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.11.0...vhost-v0.12.0)

Updates `vhost-user-backend` from 0.15.0 to 0.16.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.15.0...vhost-user-backend-v0.16.0)

Updates `virtio-bindings` from 0.2.2 to 0.2.3
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-bindings-v0.2.2...virtio-bindings-v0.2.3)

Updates `virtio-queue` from 0.12.0 to 0.13.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.12.0...virtio-queue-v0.13.0)

Updates `vm-memory` from 0.14.1 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vm-memory/releases)
- [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.14.1...v0.15.0)

Updates `virtio-vsock` from 0.6.0 to 0.7.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-vsock-v0.6.0...virtio-vsock-v0.7.0)

Updates `serde` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `anyhow` from 1.0.86 to 1.0.89
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.86...1.0.89)

Updates `bytemuck` from 1.17.1 to 1.18.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.17.1...v1.18.0)

Updates `cc` from 1.1.15 to 1.1.19
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.15...cc-v1.1.19)

Updates `clap_builder` from 4.5.15 to 4.5.17
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.15...v4.5.17)

Updates `once_cell` from 1.19.0 to 1.20.0
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.19.0...v1.20.0)

Updates `rustix` from 0.38.35 to 0.38.37
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.35...v0.38.37)

Updates `serde_derive` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `unicode-ident` from 1.0.12 to 1.0.13
- [Release notes](https://github.com/dtolnay/unicode-ident/releases)
- [Commits](https://github.com/dtolnay/unicode-ident/compare/1.0.12...1.0.13)

Updates `unicode-segmentation` from 1.11.0 to 1.12.0
- [Commits](https://github.com/unicode-rs/unicode-segmentation/compare/v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: vhost
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: vhost-user-backend
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: virtio-bindings
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: virtio-queue
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: vm-memory
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: virtio-vsock
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: anyhow
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: bytemuck
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: clap_builder
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: once_cell
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: unicode-ident
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: unicode-segmentation
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-17 10:29:02 +02:00
..
src tree-wide: continue unwinds on join failures 2023-11-20 13:05:48 +05:30
Cargo.toml build(deps): bump the vhost-device group across 1 directory with 17 updates 2024-09-17 10:29:02 +02:00
CHANGELOG.md chore: standardize changelogs 2024-07-24 19:37:19 +05:30
LICENSE-APACHE Move all crates to workspace root 2023-10-16 12:03:57 +05:30
LICENSE-BSD-3-Clause Move all crates to workspace root 2023-10-16 12:03:57 +05:30
README.md Move all crates to workspace root 2023-10-16 12:03:57 +05:30

vhost-device-gpio - GPIO emulation backend daemon

Description

This program is a vhost-user backend that emulates a VirtIO GPIO device. This program takes a list of gpio devices on the host OS and then talks to them via the /dev/gpiochip{X} interface when a request comes from the guest OS for an GPIO device.

This program is tested with QEMU's -device vhost-user-gpio-pci but should work with any virtual machine monitor (VMM) that supports vhost-user. See the Examples section below.

Synopsis

vhost-device-gpio [OPTIONS]

Options

.. program:: vhost-device-gpio

.. option:: -h, --help

Print help.

.. option:: -s, --socket-path=PATH

Location of vhost-user Unix domain sockets, this path will be suffixed with 0,1,2..socket_count-1.

.. option:: -c, --socket-count=INT

Number of guests (sockets) to attach to, default set to 1.

.. option:: -l, --device-list=GPIO-DEVICES

GPIO device list at the host OS in the format: [:]

  Example: --device-list "2:4:7"

Here, each GPIO devices correspond to a separate guest instance, i.e. the number of devices in the device-list must match the number of sockets in the --socket-count. For example, the GPIO device 0 will be allocated to the guest with "0" path.

MockGpioDevice support

As connecting VM guests to random GPIO pins on your host is generally asking for trouble you can enable the "mock_gpio" feature in your build:

cargo build --features "mock_gpio"

You can then enable simulated GPIOs using the 's' prefix:

--device-list s4,s8

Which will create two gpio devices, the first with 4 pins and the second with 8. By default updates are display via env logger:

vhost-device-gpio -s /tmp/vus.sock -c 1 -l s4
[2023-09-14T14:15:14Z INFO  vhost_device_gpio::mock_gpio] gpio dummy0 set value to 1
[2023-09-14T14:15:14Z INFO  vhost_device_gpio::mock_gpio] gpio dummy0 set direction to 1
[2023-09-14T14:15:14Z INFO  vhost_device_gpio::mock_gpio] gpio dummy0 set direction to 0
[2023-09-14T14:15:19Z INFO  vhost_device_gpio::mock_gpio] gpio dummy1 set value to 1
[2023-09-14T14:15:19Z INFO  vhost_device_gpio::mock_gpio] gpio dummy1 set direction to 1
[2023-09-14T14:15:19Z INFO  vhost_device_gpio::mock_gpio] gpio dummy1 set direction to 0

Examples

The daemon should be started first:

::

host# vhost-device-gpio --socket-path=gpio.sock --socket-count=1 --device-list 0:3

The QEMU invocation needs to create a chardev socket the device can use to communicate as well as share the guests memory over a memfd.

::

host# qemu-system
-chardev socket,path=vgpio.sock,id=vgpio
-device vhost-user-gpio-pci,chardev=vgpio,id=gpio
-m 4096
-object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on
-numa node,memdev=mem
...

License

This project is licensed under either of