Commit Graph

777 Commits

Author SHA1 Message Date
dependabot[bot]
5f1c19d9e5 build(deps): bump rust-vmm-ci from 7c1057e to 665f31f
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `7c1057e` to `665f31f`.
- [Commits](7c1057e9bc...665f31f4b4)
2023-09-13 15:58:52 +01:00
dependabot[bot]
802d09c542 build(deps): bump serde_json from 1.0.105 to 1.0.106
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.105 to 1.0.106.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.105...v1.0.106)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 10:07:07 +02:00
dependabot[bot]
212d6282bb build(deps): bump pest_derive from 2.7.2 to 2.7.3
Bumps [pest_derive](https://github.com/pest-parser/pest) from 2.7.2 to 2.7.3.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.2...v2.7.3)

---
updated-dependencies:
- dependency-name: pest_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-13 09:55:21 +02:00
Milan Zamazal
95d8e1d846 scmi: Add a SCMI link to the top README
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-13 09:33:26 +02:00
Alex Bennée
9c05c28a3a build(deps): bump vm-memory to 0.12.2
This should hopefully stop cargo audit complaining about our old
version.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2023-09-13 09:19:18 +02:00
dependabot[bot]
5fc40c0838 build(deps): bump pest from 2.7.2 to 2.7.3
Bumps [pest](https://github.com/pest-parser/pest) from 2.7.2 to 2.7.3.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.2...v2.7.3)

---
updated-dependencies:
- dependency-name: pest
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-08 08:29:25 +01:00
Milan Zamazal
c0a5c39b99 scmi: Add some notes on testing to README
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
923fa4312a scmi: Add CHANGELOG.md
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
58650819ff Increase coverage score
CI complains not only when the score is too low but also when it is
too high.  Accommodate the increased average coverage caused by adding
vhost-device-scmi and its unit tests.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
07cbe73dc8 scmi: Improve output on backend configuration error
Print a properly formatted error to both the log and terminal.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
0261d315ac scmi: Improve command line processing
When a device help is requested with `-d help', the socket argument is
still required.  This patch:

- replaces `-d help' with --help-devices;
- stops requiring the socket argument in such a case;
- prints help in case of command line parsing errors.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
847b3f44a6 scmi: Add source code docstrings
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
b84bf46d68 scmi: Add scale & offset to the accelerator in the kernel
To be able to test scaling in guests running on hosts with the dummy
IIO module.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
458f168639 scmi: Add support for industrial I/O devices
Industrial I/O (IIO) devices are present in /sys/bus/iio/devices/ on
Linux.  This patch makes them accessible to the guests via the sensor
SCMI protocol.

The implementation no way covers all the possible IIO devices.  It
supports some basic stuff, other sensors can be added as needed.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
c1637e94b8 scmi: Use new_device for ScmiDevice constructors
Instead of `new', which should be reserved for direct constructors.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
789288c372 scmi: Add sensor device initialization function
Implementation accessing real sensors will need to set up the device
instance.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
cbb0449d43 scmi: Refactor unit handling
Make unit handling better SCMI compliant.  Let's distinguish between
scalar sensors and axis sensors and report the units in the
appropriate SCMI commands.  Also, let's change the unit type to u8 to
correspond to the number of unit bits in SCMI.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
58ddb26d5b scmi: Use separate modules for device implementations
For a better readability once we start adding more devices.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
ca8f181bcd scmi: Refactor device specification and creation
Making the device configuration polymorphic requires the device struct
to exist before the device parameters are checked and assigned to the
struct fields.  Which means wrapping the struct fields by Option
unnecessarily or introducing other data confusion.

Let's extract the device configuration from traits to plain functions
in order to keep the device struct's unencumbered.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
73c536df2e scmi: Provide help for devices
Writing `--device help' on the command line will list all the
available devices and their parameters.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
4014a6366f scmi: Kernel instructions and changes for IIO added
Followup patches will allow connecting vhost-user-scmi to industrial
I/O devices.  On host without IIO devices, it’s possible to use
emulated devices for testing.  This patch documents how to use them
and also provides a slightly customized IIO dummy kernel module.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
e0fdfa4c38 scmi: Refactor devices.rs for sensor code reuse
Different sensors will have similar handling.  Let’s extract generic
parts from FakeSensor implementation into a reusable code, within the
limits of Rust.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
3d1cc5b370 scmi: Add a command line option for defining devices
The code already contains support for creating devices that can serve
as SCMI-accessible sensors and a sample fake devices.  But to actually
use the device, the code must be modified.

This patch adds a command line option to define the devices on start.
The format of the option value is in the QEMU style:
DEVICE,PROPERTY=VALUE,…

For example:

  --device fake,name=fake1 fake,name=fake2

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
bc7faf7685 scmi: Add sensor management protocol
This patch implements the necessary parts of the SCMI sensor
management protocol, required either by the SCMI standard or by Linux
VIRTIO SCMI drivers to function correctly.  A part of this
implementation is a fake sensor device, which is useful for both unit
testing here and a testing with a real guest OS.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
5b0b8c3753 scmi: Implement SCMI base protocol
Implementation of the mandatory parts of the SCMI base protocol.  This
allows the daemon to communicate with the guest SCMI VIRTIO device,
although not yet providing any useful functionality.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
Milan Zamazal
9513ed841c scmi: Initial skeleton
This patch adds support for a SCMI vhost-user device.  It implements
the basic skeleton of the vhost-user daemon and of SCMI processing.
It doesn’t provide any real functionality yet, adding it will be the
subject of followup patches.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
2023-09-04 16:15:33 +01:00
dependabot[bot]
e7d0e80282 build(deps): bump regex-syntax from 0.7.4 to 0.7.5
Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.7.4 to 0.7.5.
- [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/commits)

---
updated-dependencies:
- dependency-name: regex-syntax
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-31 08:22:51 +05:30
dependabot[bot]
9926e75c41 build(deps): bump winnow from 0.5.14 to 0.5.15
Bumps [winnow](https://github.com/winnow-rs/winnow) from 0.5.14 to 0.5.15.
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.5.14...v0.5.15)

---
updated-dependencies:
- dependency-name: winnow
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-30 08:32:54 -06:00
Bilal Elmoussaoui
2fa80555d2 misc: Update dependencies lockfile
Following up the update num_enum dependency

Signed-off-by: Bilal Elmoussaoui <belmouss@redhat.com>
2023-08-24 15:42:44 +05:30
Bilal Elmoussaoui
ee2abe6df0 scsi: Bump num_enum
Signed-off-by: Bilal Elmoussaoui <belmouss@redhat.com>
2023-08-24 15:42:44 +05:30
Bilal Elmoussaoui
fad00d3e3c vsock: Set edition to 2021
Similar to other crates

Signed-off-by: Bilal Elmoussaoui <belmouss@redhat.com>
2023-08-24 15:42:44 +05:30
Bilal Elmoussaoui
38624410db misc: Set workspace resolver to 2
cargo complains with the following otherwise:
some crates are on edition 2021 which defaults to resolver = 2,
but virtual workspaces default to resolver = 1

Signed-off-by: Bilal Elmoussaoui <belmouss@redhat.com>
2023-08-24 15:42:44 +05:30
Bilal Elmoussaoui
05cfece5f8 i2c: Don't take a mut ref for reqs
Fixing a nightly clippy warning

Signed-off-by: Bilal Elmoussaoui <belmouss@redhat.com>
2023-08-24 15:42:44 +05:30
Stefano Garzarella
8da7657df0 Update vhost-user-backend package dependency
vhost-user-backend v0.10.0 introduced an issue that affects
all vhost-user backends. I easily reproduced the problem with
vhost-device-vsock: just restart the guest kernel and the
device no longer works.

vhost-user-backend v0.10.1 includes the fix [1] for that issue.

[1] https://github.com/rust-vmm/vhost/pull/180

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2023-08-22 16:12:31 +05:30
dependabot[bot]
4718ef80ad build(deps): bump log from 0.4.19 to 0.4.20
Bumps [log](https://github.com/rust-lang/log) from 0.4.19 to 0.4.20.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.19...0.4.20)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 11:19:23 +05:30
dependabot[bot]
a9770822f9 build(deps): bump serde from 1.0.183 to 1.0.184
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.183 to 1.0.184.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.183...v1.0.184)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 11:19:18 +05:30
dependabot[bot]
4fa44ea06c build(deps): bump serde_json from 1.0.104 to 1.0.105
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.104 to 1.0.105.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.104...v1.0.105)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 11:19:11 +05:30
Viresh Kumar
033a0ed614 Update cargo dependencies
The main target of this update is vm-memory to a newer stable version,
but lets update everything anyway.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2023-08-14 11:55:44 +05:30
dependabot[bot]
6754ca091f build(deps): bump aho-corasick from 1.0.2 to 1.0.3
Bumps [aho-corasick](https://github.com/BurntSushi/aho-corasick) from 1.0.2 to 1.0.3.
- [Commits](https://github.com/BurntSushi/aho-corasick/compare/1.0.2...1.0.3)

---
updated-dependencies:
- dependency-name: aho-corasick
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 11:47:29 +05:30
dependabot[bot]
89362cf3b5 build(deps): bump either from 1.8.1 to 1.9.0
Bumps [either](https://github.com/bluss/either) from 1.8.1 to 1.9.0.
- [Commits](https://github.com/bluss/either/compare/1.8.1...1.9.0)

---
updated-dependencies:
- dependency-name: either
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 11:47:21 +05:30
dependabot[bot]
d8fdbb79cd build(deps): bump serde_json from 1.0.100 to 1.0.104
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.100 to 1.0.104.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.100...v1.0.104)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-14 11:47:13 +05:30
dependabot[bot]
ace68f6722 build(deps): bump pest_generator from 2.7.0 to 2.7.1
Bumps [pest_generator](https://github.com/pest-parser/pest) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: pest_generator
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 16:39:10 +05:30
dependabot[bot]
87e51d55f0 build(deps): bump pest_meta from 2.7.0 to 2.7.1
Bumps [pest_meta](https://github.com/pest-parser/pest) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/pest-parser/pest/releases)
- [Commits](https://github.com/pest-parser/pest/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: pest_meta
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 16:39:02 +05:30
dependabot[bot]
eea36eefa5 build(deps): bump equivalent from 1.0.0 to 1.0.1
Bumps [equivalent](https://github.com/cuviper/equivalent) from 1.0.0 to 1.0.1.
- [Commits](https://github.com/cuviper/equivalent/compare/v1.0.0...v1.0.1)

---
updated-dependencies:
- dependency-name: equivalent
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 16:38:57 +05:30
Priyansh Rathi
decfd8bd73 vsock: Add VM groups in sibling communication
Restrict the VMs a given VM can communicate with by introducing VM groups.
A group is simply a list of names assigned to the device in the
configuration. A VM can communicate with another VM only if the list of
group names assigned to their devices have atleast one group name in
common.

Signed-off-by: Priyansh Rathi <techiepriyansh@gmail.com>
2023-08-07 16:38:10 +05:30
Priyansh Rathi
bd59ff2462 vsock: Allow optional fields in config file
Currently need to provide all the fields in the yaml config file,
otherwise the application panics. Modify this behaviour to allow not
specifying the optional fields to make it consistent with specifying the
configuration using only CLI arguments.

Signed-off-by: Priyansh Rathi <techiepriyansh@gmail.com>
2023-08-07 16:38:10 +05:30
dependabot[bot]
1da9705549 build(deps): bump thiserror from 1.0.41 to 1.0.44
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.41 to 1.0.44.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.41...1.0.44)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-31 10:37:32 +05:30
dependabot[bot]
005bdfa17a build(deps): bump num_enum from 0.5.11 to 0.6.1
Bumps [num_enum](https://github.com/illicitonion/num_enum) from 0.5.11 to 0.6.1.
- [Commits](https://github.com/illicitonion/num_enum/compare/0.5.11...0.6.1)

---
updated-dependencies:
- dependency-name: num_enum
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-31 10:37:24 +05:30
dependabot[bot]
2c3786084d build(deps): bump proc-macro2 from 1.0.63 to 1.0.66
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.63 to 1.0.66.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.63...1.0.66)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-31 10:37:13 +05:30
Jeongik Cha
637969d0e7 vsock: Increase NUM_QUEUES to 3
In virtio standard, vsock uses 3 vqs. crosvm expects 3 vqs from
vhost-user-vsock impl, but this vhost-user-vsock device sets up
only 2 vqs because event vq isn't handled. And it causes crash in
crosvm. To avoid crash in crosvm, I increase NUM_QUEUES to 3

Signed-off-by: Jeongik Cha <jeongik@google.com>
2023-07-28 09:58:36 +05:30