summary refs log tree commit diff
path: root/src/crosvm.rs
Commit message (Collapse)AuthorAge
* 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>