|
| 1 | +# vhost-device-scmi |
| 2 | + |
| 3 | +This program is a vhost-user backend for a VirtIO SCMI device. |
| 4 | +It provides SCMI access to various entities on the host; not |
| 5 | +necessarily only those providing an SCMI interface themselves. |
| 6 | + |
| 7 | +It is tested with QEMU's `-device vhost-user-scmi-pci` but should work |
| 8 | +with any virtual machine monitor (VMM) that supports vhost-user. See |
| 9 | +the Examples section below. |
| 10 | + |
| 11 | +## Synopsis |
| 12 | + |
| 13 | +**vhost-device-scmi** [*OPTIONS*] |
| 14 | + |
| 15 | +## Options |
| 16 | + |
| 17 | +.. program:: vhost-device-scmi |
| 18 | + |
| 19 | +.. option:: -h, --help |
| 20 | + |
| 21 | + Print help. |
| 22 | + |
| 23 | +.. option:: -s, --socket-path=PATH |
| 24 | + |
| 25 | + Location of the vhost-user Unix domain sockets. |
| 26 | + |
| 27 | +.. option:: -d, --device=SPEC |
| 28 | + |
| 29 | + SCMI device specification in the format `ID,PROPERTY=VALUE,...`. |
| 30 | + For example: `-d iio,path=/sys/bus/iio/devices/iio:device0,channel=in_accel`. |
| 31 | + Can be used multiple times for multiple exposed devices. |
| 32 | + If no device is specified then no device will be provided to the |
| 33 | + guest OS but VirtIO SCMI will be still available there. |
| 34 | + Use `--help-devices` to list help on all the available devices. |
| 35 | + |
| 36 | +You can set `RUST_LOG` environment variable to `debug` to get maximum |
| 37 | +messages on the standard error output. |
| 38 | + |
| 39 | +## Examples |
| 40 | + |
| 41 | +The daemon should be started first: |
| 42 | + |
| 43 | +:: |
| 44 | + |
| 45 | + host# vhost-device-scmi --socket-path=scmi.sock --device fake,name=foo |
| 46 | + |
| 47 | +The QEMU invocation needs to create a chardev socket the device can |
| 48 | +use to communicate as well as share the guests memory over a memfd: |
| 49 | + |
| 50 | +:: |
| 51 | + |
| 52 | + host# qemu-system \ |
| 53 | + -chardev socket,path=scmi.sock,id=scmi \ |
| 54 | + -device vhost-user-scmi-pci,chardev=vscmi,id=scmi \ |
| 55 | + -machine YOUR-MACHINE-OPTIONS,memory-backend=mem \ |
| 56 | + -m 4096 \ |
| 57 | + -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \ |
| 58 | + ... |
| 59 | + |
| 60 | +## Supported SCMI protocols |
| 61 | + |
| 62 | +The currently supported SCMI protocols are: |
| 63 | + |
| 64 | +- base |
| 65 | +- sensor management |
| 66 | + |
| 67 | +Basically only the mandatory and necessary parts of the protocols are |
| 68 | +implemented. |
| 69 | + |
| 70 | +See source code (`scmi` crate) documentation for details and how to |
| 71 | +add more protocols, host device bindings or other functionality. |
| 72 | + |
| 73 | +## Testing |
| 74 | + |
| 75 | +SCMI is supported only on Arm in Linux. This restriction doesn't |
| 76 | +apply to the host, which can be any architecture as long as the guest |
| 77 | +is Arm. |
| 78 | + |
| 79 | +The easiest way to test it on the guest side is using the Linux SCMI |
| 80 | +Industrial I/O driver there. If an 3-axes accelerometer or gyroscope |
| 81 | +VirtIO SCMI device is present and the guest kernel is compiled with |
| 82 | +`CONFIG_IIO_SCMI` enabled then the device should be available in |
| 83 | +`/sys/bus/iio/devices/`. The vhost-device-scmi fake device is |
| 84 | +suitable for this. |
| 85 | + |
| 86 | +Of course, other means of accessing SCMI devices can be used too. The |
| 87 | +following Linux kernel command line can be useful to obtain SCMI trace |
| 88 | +information, in addition to SCMI related messages in dmesg: |
| 89 | +`trace_event=scmi:* ftrace=function ftrace_filter=scmi*`. |
| 90 | + |
| 91 | +### Kernel support for testing |
| 92 | + |
| 93 | +`kernel` subdirectory contains |
| 94 | +[instructions](kernel/iio-dummy/README.md) how to create emulated |
| 95 | +industrial I/O devices for testing. |
| 96 | + |
| 97 | +## License |
| 98 | + |
| 99 | +This project is licensed under either of |
| 100 | + |
| 101 | +- [Apache License](http://www.apache.org/licenses/LICENSE-2.0), Version 2.0 |
| 102 | +- [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause) |
| 103 | + |
| 104 | +unless specified in particular files otherwise. |
0 commit comments