summary refs log tree commit diff
path: root/src/crosvm.rs
Commit message (Collapse)AuthorAge
* acpi: support user provided ACPI SDTs.Tomasz Jeznach2020-06-01
| | | | | | | | | | | | | | | Enable support for user provided ACPI tables with supplementary system description. Argument --acpi-table shall point to exsting file or pseudo-file with valid ACPI table content. BUG=None TEST=boot Linux kernel with generated SSDT tables. Change-Id: I8eac21da070dcc325884ed888cc7bcb01bc086ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2212501 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: Tomasz Jeznach <tjeznach@chromium.org> Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
* devices: virtio: Initial implementation of virtio-video deviceKeiichi Watanabe2020-05-23
| | | | | | | | | | | | | | | | | | | | | | | | | This CL adds a fundamental part of the virtio video device, which will be shared between the encoder and the decoder. Both devices uses the virtio-video protocol proposed as RFC v3 [1,2]. The corresponding driver code is at CL:2060327 and its children CLs. The actual decoding and encoding logic will be implemented in different CLs. [1]: mail: https://markmail.org/thread/wxdne5re7aaugbjg [2]: PDF: https://drive.google.com/file/d/1jOsS2WdVhL4PpcWLO8Zukq5J0fXDiWn-/view BUG=b:147465619, b:140082257 TEST=cargo check --features=video-decoder,video-encoder TEST=ARCVM started with --video-decoder --video-encoder Cq-Depend: chromium:2203997 Change-Id: I01999eea218ba0f3aaed1558ca2311a57d0c6819 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1973973 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Tested-by: Keiichi Watanabe <keiichiw@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
* arch, main: add virtio-console parsing and creationDaniel Verkamp2020-04-23
| | | | | | | | | | | | | | | | | | | | | | This allows the creation of virtio-console devices using the new hardware=virtio-console parameter to the --serial option. Also add support for the serial earlycon option, which allows using virtio-console as the main console device with a traditional serial device as the early console. This allows logging during early boot before PCI device discovery (when virtio-console devices are set up). BUG=chromium:1059924 TEST=crosvm run -r vm_rootfs.img \ --serial hardware=serial,type=stdout,console=false,earlycon=true \ --serial hardware=virtio-console,type=stdout,console=true,stdin=true \ vm_kernel Change-Id: Iff48800272b154d49b1da00f3914799089268afe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2127322 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* arch, devices: move serial creation to archDaniel Verkamp2020-04-23
| | | | | | | | | | | | | | | | | | | | | Split the serial code into two parts: - Configuration and setup: arch/src/serial.rs - Serial device emulation: devices/src/serial.rs No change in functionality - this is just preparation for generalizing the command line parsing/setup code so that it can be used with virtio console devices as well. BUG=chromium:1059924 TEST=emerge-nami crosvm TEST=emerge-kevin crosvm Change-Id: I0aaf9dd6f8096eac4a17077ab5bf569f57d64ff5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2127319 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* Virtio-net: Let queue-num could configurableXiong Zhang2020-04-04
| | | | | | | | | | | | | | | | Virtio-net multi queue feature need multi queue pairs, this patch change queue-num configurable instead of static. --net-vq-pairs parameter could config virtio net device virtual queue pairs. BUG=chromium:1064482 TEST=Test virtio net function in guest with --net-vq-pairs=1 and --net-vq-pairs=2 Change-Id: I75202c8ae52a83b8087b52149ec6d2138d8831cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2120312 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-by: Stephen Barber <smbarber@chromium.org>
* audio: Create AC97 device with --ac97 optionJudy Hsiao2020-03-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Replace --cras-audio, --cras-capture, null-audio options by --ac97 option to create audio devices. 2. "--ac97 backend=BACKEND\ [capture=true,capture_effect=EFFECT]" is comma separated key=value pairs for setting up Ac97 devices. It can be given more than once to create multiple devices. Possible key values are: backend=(null, cras) - Where to route the audio device. `null` for /dev/null, and cras for CRAS server. capture=true - Enable audio capture. capture_effects - | separated effects to be enabled for recording. The only supported effect value now is EchoCancellation or aec. BUG=b:140866281 TEST=1.crosvm run -r ./vm_rootfs.img -c 4 -m 1024 -s /run --cid 5 --host_ip\ 100.115.92.25 --netmask 255.255.255.252 --ac97\ backend=cras,capture=true,capture_effect=aec\ --mac d2:47:f7:c5:9e:53 ./vm_kernel 2. Record with the vm by: arecord -D hw:0,0 -d5 -fS16_LE -c2 -r48000 /tmp/test.mp3 3. Verify that AEC is enabled within the recording stream by cras_test_cleint. Cq-Depend: chromium:2053654 Cq-Depend: chromium:2095644 Cq-Depend: chromium:2038221 Change-Id: Ia9e0e7cda1671a4842ec77a354efaa4a2dc745eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2038413 Tested-by: Judy Hsiao <judyhsiao@chromium.org> Commit-Queue: Judy Hsiao <judyhsiao@chromium.org> Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org> Auto-Submit: Judy Hsiao <judyhsiao@chromium.org>
* Vfio: Multi vfio device supportXiong Zhang2020-03-09
| | | | | | | | | | | | | | | Current one vm could have one vfio device only, this patch let one vm could have multi vfio devices by changing the vfio parameter into vec<>. BUG=chromium:992270 TEST=passthrough two/three devices into guest, these devices are in the same vfio group, then check these devices function in guest. Change-Id: I366d24d750a199d7862fb907fa44f9be429c5944 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2080111 Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
* Use simple virtio_input_events where possible.Noah Gold2020-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, all input events in CrosVM were required to be linux input_events, which have a timestamp field that is actually unused by when we send/receive from the guest which are of type virtio_input_event. This CL allows CrosVM to understand both types of input events in a first class manner. It is a follow up on https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1930405. This CL also addresses some bugs with window driven input: 1. attach_event_device was being called before the surface was created, so the devices were never attached. 2. The default touchpad size was not being set to the display window size. Additionally, it removes the unused event "filter" feature on event sources. Breaking change: from this point forward, CrosVM will treat input events sent via a socket (e.g. SocketEventSource) to be virtio_input_events. BUG=None TEST=builds + manual Change-Id: I7fec07c582e5a071a6f116975ba70d6e621bb483 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2034046 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Noah Gold <nkgold@google.com>
* Use display size as the default size for single touchKaiyi Li2020-02-12
| | | | | | | | | | | | | | | When the user specifies the display size through the gpu argument but not specifies the size of the single touch device, the display size will be used as the size of these touch devices. Use default() to initialize the GpuParameters. Allow initialize the GpuParameters dynamically in the future. Change-Id: I9fa04f8ff479732370514fbaeb062d737adba319 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2043072 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Kaiyi Li <kaiyili@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* crosvm: pstore works for ARCVM on x86_64Kansho Nishida2020-02-03
| | | | | | | | | | | | | | | | Adds support for pstore on ARCVM on x86_64. The backend file of the buffer will be passed via argument of the crosvm. BUG=b:144962428 TEST=kernel crash on eve-arcvm, check /sys/fs/pstore/console-ramoops-0 Launch crostini manually on eve-arcvm Change-Id: I29492ac7a9067aa2ae23eb03fbb942ab7dd3aa8d Signed-off-by: Kansho Nishida <kansho@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1973391 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Kansho Nishida <kansho@chromium.org>
* devices: virtio: wl: Support multiple socketsRyo Hashimoto2020-01-07
| | | | | | | | | | | | | | | | | | | Guest can specify which socket it wants to connect by passing a parameter to VIRTWL_IOCTL_NEW_CTX_NAMED. Even after this CL, only the unnamed wayland socket is used for composition. Additional sockets are used for IPC purpose (e.g. camera). BUG=b:146100044 TEST=Camera works Cq-Depend: chromium:1962108 Change-Id: Ibd8efbae1b2177cc0381d88d151643183c31b519 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1963412 Tested-by: Ryo Hashimoto <hashimoto@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
* utilize EventDevices to make virtio-input devicesZach Reizner2019-12-11
| | | | | | | | | | | | BUG=chromium:1023975 TEST=./build_test Change-Id: I10267e535d4d1dae90b2b5f30db046c388791a16 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1930409 Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* devices: block: add block_size option for disksDaniel Verkamp2019-12-10
| | | | | | | | | | | | | | | This allows overriding the default logical block size (512 bytes) with other values, such as 4096 for 4K block size disks. BUG=chromium:942700 TEST=crosvm run -r vm_rootfs,block_size=4096 vm_kernel TEST=verify block size with lsblk --output-all Change-Id: Ia6db05f369a76557a2afb8b48b5cc2b66cf84b01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1954220 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* Support configurable screen sizesJason Macnak2019-12-10
| | | | | | | | | | | | | | | | | | This change enables Cuttlefish to run with a user specified display size on top of virtio gpu accelerated graphics rendering. This change makes the width and height an argument/flag and adds the necessary plumbing to pass this width and height through the gpu backend. BUG=b:134086390 TEST=built crosvm and booted cuttlefish locally Change-Id: Idabf7ef083b2377e3ebf3b50dd0296f4bf7e8ddc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1927872 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Jason Macnak <natsu@google.com>
* linux: check memory size calculation overflowDaniel Verkamp2019-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | On systems where usize is 32 bits wide (e.g. 32-bit arm), the calculation of memory_size in bytes based on the -m configuration option in megabytes would silently overflow when the resulting value was wider than 32 bits. Change the shift that converts megabytes to bytes into a checked_mul so that a suitable error is produced if the size overflows. Additionally, change the cfg.memory type to u64 instead of usize; this is representing a size in megabytes, so its maximum value isn't related to the size of an object in memory anyway, and this avoids the need for a cast in the memory_size calculation. Requesting a memory size larger than the crosvm process can map will still result in an error at a later stage in guest startup. BUG=chromium:1028747 TEST=`crosvm run -m $((5 * 1024)) ...` on kevin Change-Id: I8fef7070bab4dafff70ed54738b26d0bb7632150 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1937551 Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* Add fs device to --shared-dirChirantan Ekbote2019-11-19
| | | | | | | | | | | | | | Expand the `--shared-dir` option to allow callers to select between 9p and virtio-fs for sharing directories. BUG=b:136128319 TEST=start a VM with a virtio-fs based shared directory Change-Id: Ie8afc1965b693805dd6000f0157786317aab060d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1705656 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
* devices: block: add option to control sparsenessDaniel Verkamp2019-11-18
| | | | | | | | | | | | | | | | | | Extend the --disk option and other related options to allow a particular disk to have the sparse operations (virtio-blk's discard command) enabled or disabled. By default, the sparse flag will be enabled for virtio-blk devices, matching current behavior. BUG=chromium:858815 TEST=Run `crosvm with --rwdisk file.img,sparse=false` and try to discard Change-Id: Ib72c949711fbe869a3f444d7f929a80d0e039f72 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1906750 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Remove unnecessary static str lifetimesDaniel Verkamp2019-11-08
| | | | | | | | | | | | | | | | | | Const and static variables imply a static lifetime, so declaring it isn't necessary. Fixes clippy warnings of the form: Statics have by default a `'static` lifetime BUG=None TEST=bin/clippy Change-Id: I99e63b435b6b2fd5fbce9ef617e89ec114587ad7 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1896087 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* vfio: Integrate VFIO device into pci device modelXiong Zhang2019-10-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create VFIO device and VFIO PCI device in create_devices() function, and intergrate it into PciRootBridge, so guest could see this vfio device. Add a vfio config parameter, this config point to passthrough or mdev device sysfs path. For passthrough case, first user unbind host device from its driver, then bind host device to vfio-pci. Like: echo 0000:00:02.0 > /sys/bus/pci/devices/0000:00:02.0/driver/unbind ech0 8086 1912 > /sys/bus/pci/drivers/vfio-pci/new_id Finally pass the sysfs to crosvm through --vfio=/sys/bus/pci/devices/0000:00:02.0 For mdev case, user create a mdev device through echo $UUID > mdev_type/create, then pass this mdev device to crosvm like --vfio=/sys/bus/pci/devices/0000:00:02.0/$UUID BUG=chromium:992270 TEST=none Change-Id: I0f59d6e93f62f9ab0727ad3a867d204f4ff6ad2d Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1581140 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* crosvm: add x-display argument for choosing the X11 gpu displayZach Reizner2019-08-08
| | | | | | | | | | | | TEST=cargo run -- run --gpu --x-display :0 BUG=None Change-Id: I76b4b33a6b14cb6fad322ffa95f00cce976f81a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1670550 Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* split crosvm into a library and a main "crosvm" binaryZach Reizner2019-08-06
This change has 3 parts: - Modify the Cargo.toml to point at the bin and the lib source. - Move modules and Config struct into the lib source - Fix the argument/plugins module's doc comments which had never been tested. The motivation for this change is to make testing crosvm's major functionality (booting guest kernels, emulating hardware, etc) easier to do from a cargo test. Being able to launce a crosvm config via the API instead of the binary's command line will be possible with this change. A side benefit is that this also enables doc tests in the lib side of crosvm. The doc tests in binaries are not run due to a limitation in how they get tested by cargo. TEST=cargo test ./build_test kokoro/kokoro_simulator.sh emerge crosvm BUG=None Change-Id: I9d4b3a24231b895e8dfaf9e7b0f2b33350772041 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1730333 Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Zach Reizner <zachr@chromium.org>