vhost-device/vhost-device-gpio
dependabot[bot] a7e356bf35 build(deps): bump the vhost-device group with 34 updates
Bumps the vhost-device group with 34 updates:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.5.3` | `4.5.4` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.58` | `1.0.59` |
| [vhost-user-backend](https://github.com/rust-vmm/vhost) | `0.14.0` | `0.15.0` |
| [virtio-queue](https://github.com/rust-vmm/vm-virtio) | `0.11.0` | `0.12.0` |
| [rstest](https://github.com/la10736/rstest) | `0.18.2` | `0.19.0` |
| [serde](https://github.com/serde-rs/serde) | `1.0.197` | `1.0.198` |
| [allocator-api2](https://github.com/zakarumych/allocator-api2) | `0.2.16` | `0.2.18` |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.81` | `1.0.82` |
| [autocfg](https://github.com/cuviper/autocfg) | `1.1.0` | `1.2.0` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.0.90` | `1.0.95` |
| [cfg-expr](https://github.com/EmbarkStudios/cfg-expr) | `0.15.7` | `0.15.8` |
| [clap_derive](https://github.com/clap-rs/clap) | `4.5.3` | `4.5.4` |
| [either](https://github.com/rayon-rs/either) | `1.10.0` | `1.11.0` |
| [encoding_rs](https://github.com/hsivonen/encoding_rs) | `0.8.33` | `0.8.34` |
| [getrandom](https://github.com/rust-random/getrandom) | `0.2.12` | `0.2.14` |
| [itoa](https://github.com/dtolnay/itoa) | `1.0.10` | `1.0.11` |
| [memchr](https://github.com/BurntSushi/memchr) | `2.7.1` | `2.7.2` |
| [pin-project-lite](https://github.com/taiki-e/pin-project-lite) | `0.2.13` | `0.2.14` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.79` | `1.0.81` |
| [quote](https://github.com/dtolnay/quote) | `1.0.35` | `1.0.36` |
| [regex-syntax](https://github.com/rust-lang/regex) | `0.8.2` | `0.8.3` |
| [rstest_macros](https://github.com/la10736/rstest) | `0.18.2` | `0.19.0` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.32` | `0.38.33` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.197` | `1.0.198` |
| [strsim](https://github.com/rapidfuzz/strsim-rs) | `0.11.0` | `0.11.1` |
| [thiserror-impl](https://github.com/dtolnay/thiserror) | `1.0.58` | `1.0.59` |
| [windows-targets](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |
| [windows_aarch64_gnullvm](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |
| [windows_aarch64_msvc](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |
| [windows_i686_gnu](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |
| [windows_i686_msvc](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |
| [windows_x86_64_gnu](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |
| [windows_x86_64_gnullvm](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |
| [windows_x86_64_msvc](https://github.com/microsoft/windows-rs) | `0.52.4` | `0.52.5` |


Updates `clap` from 4.5.3 to 4.5.4
- [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.3...v4.5.4)

Updates `thiserror` from 1.0.58 to 1.0.59
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.58...1.0.59)

Updates `vhost-user-backend` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/commits)

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

Updates `rstest` from 0.18.2 to 0.19.0
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/v0.18.2...v0.19.0)

Updates `serde` from 1.0.197 to 1.0.198
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.197...v1.0.198)

Updates `allocator-api2` from 0.2.16 to 0.2.18
- [Changelog](https://github.com/zakarumych/allocator-api2/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zakarumych/allocator-api2/compare/v0.2.16...v0.2.18)

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

Updates `autocfg` from 1.1.0 to 1.2.0
- [Commits](https://github.com/cuviper/autocfg/compare/1.1.0...1.2.0)

Updates `cc` from 1.0.90 to 1.0.95
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.90...1.0.95)

Updates `cfg-expr` from 0.15.7 to 0.15.8
- [Release notes](https://github.com/EmbarkStudios/cfg-expr/releases)
- [Changelog](https://github.com/EmbarkStudios/cfg-expr/blob/main/CHANGELOG.md)
- [Commits](https://github.com/EmbarkStudios/cfg-expr/compare/0.15.7...0.15.8)

Updates `clap_derive` from 4.5.3 to 4.5.4
- [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.3...v4.5.4)

Updates `either` from 1.10.0 to 1.11.0
- [Commits](https://github.com/rayon-rs/either/compare/1.10.0...1.11.0)

Updates `encoding_rs` from 0.8.33 to 0.8.34
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.33...v0.8.34)

Updates `getrandom` from 0.2.12 to 0.2.14
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.2.12...v0.2.14)

Updates `itoa` from 1.0.10 to 1.0.11
- [Release notes](https://github.com/dtolnay/itoa/releases)
- [Commits](https://github.com/dtolnay/itoa/compare/1.0.10...1.0.11)

Updates `memchr` from 2.7.1 to 2.7.2
- [Commits](https://github.com/BurntSushi/memchr/compare/2.7.1...2.7.2)

Updates `pin-project-lite` from 0.2.13 to 0.2.14
- [Release notes](https://github.com/taiki-e/pin-project-lite/releases)
- [Changelog](https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project-lite/compare/v0.2.13...v0.2.14)

Updates `proc-macro2` from 1.0.79 to 1.0.81
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.79...1.0.81)

Updates `quote` from 1.0.35 to 1.0.36
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.35...1.0.36)

Updates `regex-syntax` from 0.8.2 to 0.8.3
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.8.2...regex-syntax-0.8.3)

Updates `rstest_macros` from 0.18.2 to 0.19.0
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/v0.18.2...v0.19.0)

Updates `rustix` from 0.38.32 to 0.38.33
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.32...v0.38.33)

Updates `serde_derive` from 1.0.197 to 1.0.198
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.197...v1.0.198)

Updates `strsim` from 0.11.0 to 0.11.1
- [Release notes](https://github.com/rapidfuzz/strsim-rs/releases)
- [Changelog](https://github.com/rapidfuzz/strsim-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rapidfuzz/strsim-rs/compare/v0.11.0...v0.11.1)

Updates `thiserror-impl` from 1.0.58 to 1.0.59
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.58...1.0.59)

Updates `windows-targets` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Updates `windows_aarch64_gnullvm` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Updates `windows_aarch64_msvc` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Updates `windows_i686_gnu` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Updates `windows_i686_msvc` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Updates `windows_x86_64_gnu` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Updates `windows_x86_64_gnullvm` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

Updates `windows_x86_64_msvc` from 0.52.4 to 0.52.5
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  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-queue
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: rstest
  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: allocator-api2
  dependency-type: indirect
  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: autocfg
  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: cfg-expr
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: clap_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: either
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: encoding_rs
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: getrandom
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: itoa
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: memchr
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: pin-project-lite
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: quote
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: regex-syntax
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: rstest_macros
  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: strsim
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: thiserror-impl
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows-targets
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows_aarch64_gnullvm
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows_aarch64_msvc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows_i686_gnu
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows_i686_msvc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows_x86_64_gnu
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows_x86_64_gnullvm
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: windows_x86_64_msvc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-25 14:43:14 +05:30
..
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 with 34 updates 2024-04-25 14:43:14 +05:30
CHANGELOG.md Move all crates to workspace root 2023-10-16 12:03:57 +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