summary refs log tree commit diff
path: root/Cargo.lock
Commit message (Collapse)AuthorAge
* kvm: use MappedRegion traitGurchetan Singh2020-06-12
| | | | | | | | | | | | | | | | | | | - Reduces code duplication between MMIO and mmap arenas - Makes adding future types easier - Makes upcoming deprecation of kvm crate easier - Use BTreeMap instead of HashMap since it's more efficient BUG=chromium:924405 TEST=compile and test Change-Id: I520abed0926489e64aac046e0dc0cfeb72fae7b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2216446 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Steven Richman <srichman@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
* 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>
* hypervisor: x86 irqchip structsColin Downs-Razouk2020-05-28
| | | | | | | | | | | | | | | | | | | | Hypervisor-agnostic structures for the pic, ioapic, lapic, and pit. These are derived from existing structures in the pic, ioapic, and pit implementations, as well as from the kvm_sys bindings. Includes From implementations converting these structures to their associated KVM structures. Also includes tests for these conversion implementations. BUG=chromium:1077058 TEST=added tests to convert kvm structures to hypervisor-agnostic structures Change-Id: Ie2f254bf2dba3aed755008296c00cb6a49f845fd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2197716 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Colin Downs-Razouk <colindr@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Cargo.lock: add sync dependency to hypervisorDaniel Verkamp2020-05-27
| | | | | | | | | | | | | | | | Update Cargo.lock via `cargo build` after commit 0aacc50fd25d61ae1274d6054550f45acaa50897. BUG=None TEST=`cargo build` does not modify Cargo.lock TEST=kokoro Change-Id: Ib8942b38f881322f3e74726fdabe4fc68a2f3b6d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2212948 Tested-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* Make VolatileSlice ABI-compatible with iovecChirantan Ekbote2020-05-25
| | | | | | | | | | | | | | | | | | | | | | Change VolatileSlice so that it is ABI-compatible with iovec. This allows us to directly pass in a VolatileSlice for a C function that expects an iovec without having to create temporaries that convert from one to the other. Also change all the parameters from u64 to usize. It's not possible to address more memory than fits into a usize so having u64 here didn't really provide much benefit and led to a lot of tedious casting back and forth all over the place. BUG=none TEST=unit tests Cq-Depend: chromium:2206621 Change-Id: I258f9123c603d9a4c6c5e2d4d10eb4aedf74466d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2203998 Tested-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@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>
* Cargo.lock: add kvm to hypervisor dependenciesDaniel Verkamp2020-05-21
| | | | | | | | | | | | | | | | | Update Cargo.lock to match the latest commit. (Updated automatically via `cargo build`.) BUG=None TEST=`cargo build` does not modify Cargo.lock any further TEST=kokoro passes Change-Id: I1c022c6111b063eb0d31dda59ed3125c91b49d19 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2209351 Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* devices: irqchip: new irqchip moduleColin Downs-Razouk2020-05-18
| | | | | | | | | | | | | | | | | | This new module contains the irqchip trait and it's implementations. The irqchips will work with the new hypervisor crate to abstract the interaction between crosvm and kvm. This just defines the irqchip trait and an empty implementation of the KvmKernelIrqChip. BUG=chromium:1077058 TEST=added test for creating a KvmKernelIrqChip and adding a Vcpu to it Change-Id: Ic1609c965e0a057f5a9d4d74f1cae46edb46dcb4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2197398 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Stephen Barber <smbarber@chromium.org> Commit-Queue: Colin Downs-Razouk <colindr@google.com>
* acpi: refactor the ACPI PM deviceChuanxiao Dong2020-05-11
| | | | | | | | | | | | | | | | | | Add the AML support to generate the S1 table instead of hard coding. Also use the IO allocater to allocate the IO resouce for ACPI PM. BUG=None TEST=boot crosvm by command "crosvm run -s crosvm.sock -m 4096 --cpus 4 --rwdisk rootfs.img -p "root=/dev/vda rootfstype=ext4" vmlinux". Check the S1 capability by "#echo standby > /sys/power/state" from guest side. Linux guest is suspended. And resume linux guest by "#crosvm resume crosvm.sock" from host side. Change-Id: I75b484c44db05f98d49557ba694a1531b57871c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2119571 Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
* msg_socket: impl for Arc and MutexZach Reizner2020-05-05
| | | | | | | | | | | | | | | | | | | These types are simple wrappers, and so this change just adds trivial passthroughs. For data sent over a socket, the data is not Arc-ed or Mutex-ed on the other end with the same ref count or lock. Sending over the data is more like a deep copy, rather than a simple ref count increase. TEST=cargo test -p msg_socket BUG=None Change-Id: I519096b0b3b6ab75e79c37addf0d60ce3da4a717 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2168586 Commit-Queue: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@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>
* Add logic to setup PIC/IOAPIC.Zhuocheng Ding2020-03-05
| | | | | | | | | | | | | TODO: Route irqfd to PIC/IOAPIC to make them fully work. BUG=chromium:908689 TEST=None Change-Id: I301287b1cf32cfccffce6c52ebbb5e123931178e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1945796 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Zhuocheng Ding <zhuocheng.ding@intel.corp-partner.google.com>
* x86_64: generate ACPI tablesChuanxiao Dong2020-02-28
| | | | | | | | | | | | | | | | | | | | | | | | Add acpi_rsdp_addr in boot_params to allow crosvm to pass a physicall address of RSDP to the Linux guest kernel, so that the linux guest kernel can parse the constructed ACPI tables and enable the ACPI. Although there is ACPI tables but as we still have "acpi=off" in command line parameter, there is still no ACPI in guest kernel. The ACPI construction refers to the implementation of the Cloud-hypervisor commit: - arch: x86_64: Generate basic ACPI tables BUG=chromium:1018674 TEST=None Change-Id: Ibcb2ae98c43da8ef8c07a07eda9213f61570d14c Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2035351 Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
* acpi_tables: Add initial ACPI tables supportChuanxiao Dong2020-02-27
| | | | | | | | | | | | | | | | | The basic ACPI table support for creating XSDT. It refers to the implementation of the Cloud-hypervisor's ACPI commit: - Cloud-hypervisor: acpi_tables: Add initial ACPI tables support BUG=chromium:1018674 TEST=cargo test -p acpi_tables Change-Id: Ia3b597936fef214fcb92fce28c91152dfa03bec9 Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2035350 Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* msg_socket: Add async receiving of messagesDylan Reid2020-02-26
| | | | | | | | | | | | | | | | | Add a member to MsgSocket that effectively returns an async iterator over messages received on the socket. This is done by setting the socket as non-blocking and registering with the async infrastructure when the socket would block. This feature will be used by devices that wish to handle messages in an async fn context. Change-Id: I47c6e83922068820cd19ffd9ef604ed8a16b755e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1997243 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org>
* x86_64: use __cpuid intrinsicDaniel Verkamp2020-02-22
| | | | | | | | | | | | | | | | | | | | | | Use the Rust __cpuid and __cpuid_count intrinsics to replace the C implementation in host_cpuid.c. These are defined in core, but they are also re-exported in std, despite being undocumented there due to technical reasons: https://github.com/rust-lang/rust/pull/57808#issuecomment-457390549 Use the std version for consistency (we don't currently use anything from core anywhere else in crosvm). BUG=None TEST=cargo test -p x86_64 TEST=Boot crosvm on x86_64 Change-Id: Ic7a1094d1b804304a2944f8ee1fe55c5e2db23e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2067159 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* docker: check out minijail in expected locationDaniel Verkamp2020-02-19
| | | | | | | | | | | | | | | | | | | Move the minijail source checkout location in the Dockerfile so that it is in the expected place relative to the crosvm checkout so that Docker (and kokoro) can successfully find it. Also update Cargo.lock for the new minijail-sys dependency; this fixes "read-only filesystem" errors from cargo running inside Docker when it tries to write the updated Cargo.lock. BUG=None TEST=docker/build_crosvm_base.sh && docker/wrapped_smoke_test.sh Change-Id: Ic399030004c2c4891a03a60474348b0bed9f01d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2062675 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Tested-by: Daniel Verkamp <dverkamp@chromium.org>
* Update audio_streams checkout and dependenciesDaniel Verkamp2020-02-11
| | | | | | | | | | | | | | | | | Uprev the pinned commit and update Cargo.lock to match: - libcras no longer depends directly on sync - cras-sys now depends on audio_streams - audio_streams now depends on sync and sys_util BUG=None TEST=`cargo build` and verify Cargo.lock is unchanged TEST=docker/build_crosm_base.sh && docker/wrapped_smoke_test.sh Change-Id: Iba1fba57284e1e233725e4086d5d98bb460f118c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2047492 Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
* Update syn, quote, and proc-macro past 1.0Dylan Reid2020-02-06
| | | | | | | | | | | | | | These were pinned at pre-1.0 versions. Update to the stable API to allow new features to be used in the future. Cq-Depend: chromium:2026764 Change-Id: Id2d979525e5210436cbb1cfa61e2b05fafb288f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2025907 Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* disk: move qcow into disk crateDaniel Verkamp2020-01-06
| | | | | | | | | | | | | | | | | | | Move qcow from being its own crate into a module of the disk crate, similar to the composite disk module. This will allow use of qcow from disk and vice versa without introducing a circular crate dependency. BUG=None TEST=./build_test.py TEST=USE='asan fuzzer' emerge-nami crosvm Change-Id: I77512bbe4b94faff1b5460f9796ee56505135580 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1972477 Reviewed-by: Cody Schuffelen <schuffelen@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* gpu_display: add X11 input bindings.Noah Gold2020-01-03
| | | | | | | | | | | | | | | | Adds bindings to the X11 display window to capture keyboard & mouse input & send it to the guest via an EventDevice. Original implementation by zachr@chromium.org. BUG=chromium:1023975 TEST=None Change-Id: I33156a8ca0b8c610a2080e3b6891cca2a865734b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1971121 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Noah Gold <nkgold@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* crosvm: move vec_with_array_field to data_modelGurchetan Singh2019-12-11
| | | | | | | | | | | | | | Move it to the newly created flexible array file. BUG=chromium:892806 TEST=compiles Change-Id: I6c423a885cec17e376b0da87a4adbd17c71ff6f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1325510 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* Remove render node forward codeLepton Wu2019-12-10
| | | | | | | | | | | | | We don't use it for ARCVM now. BUG=None TEST=`emerge-eve crosvm` Change-Id: I14343a2eb24c24a0216950b7c4eeb56ac482973e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1958569 Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Lepton Wu <lepton@chromium.org> Auto-Submit: Lepton Wu <lepton@chromium.org>
* Cargo.lock: add sync to libcras dependenciesDaniel Verkamp2019-11-23
| | | | | | | | | | | | | | | | | | | libcras now depends on crosvm's sync crate; add it to Cargo.lock to satsify non-portage builds of crosvm with cargo (otherwise cargo updates Cargo.lock itself). The dependency was added here: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/1871758 The pinned commit for adhd used in the Docker build is also upgraded to the current master so that it matches. BUG=None TEST=`cargo build; git diff` and verify Cargo.lock was not modified Change-Id: I53526ae2448b95c287528596099a804ec28a16d1 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1924784
* io_jail: add additional apisMatt Delco2019-11-16
| | | | | | | | | | | | | | | | | | This change adds additional APIs that are present in the libminijail header file but not in the rust thunk. In particular it adds the API that allows pre-compiled bpf files to be used as a policy file. The native API lacks an API to specify a filename (it only provides an API to provide the contents of the file). BUG=None TEST=Local run of build_test to confirm that both .bpf and .policy files work in a subsequent change. Change-Id: I15510ffa857b501512f3f9905882545f407bcd78 Signed-off-by: Matt Delco <delco@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1914415 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* net_util: impl FileReadWriteVolatile for TapStephen Barber2019-11-05
| | | | | | | | | | | | | BUG=chromium:753630 TEST=cargo build Change-Id: I55e0d47c4afcb1bf01f4d7f738bda09022956898 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1881418 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Stephen Barber <smbarber@chromium.org> Commit-Queue: Stephen Barber <smbarber@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
* devices: fs: Implement virtio-fs serverChirantan Ekbote2019-10-27
| | | | | | | | | | | | | | | | Add a `Server` type that links the FUSE protocol with the virtio transport. It parses messages sent on the virtio queue and then calls the appropriate method of the `Filesystem` trait. BUG=b:136128319 TEST=`tast run vm.VirtioFs` Change-Id: I7d6fb521f6c620efe1bdb4fa0fa8fb8c42a82f45 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1757242 Auto-Submit: Chirantan Ekbote <chirantan@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org> Tested-by: Chirantan Ekbote <chirantan@chromium.org>
* Cargo.lock: update rust-protobuf to 2.8.1Daniel Verkamp2019-10-22
| | | | | | | | | | | | | | | | | | | | | | This is the latest version of rust-protobuf at the moment, and it includes fixes so that the generated code no longer triggers rustc warnings about missing `dyn` specifiers on trait objects. Note that Cargo.lock is unused in normal Chrome OS builds; this only affects other environments like running `cargo build` directly. This change was generated using: cargo update -p protobuf -p protoc-rust --precise 2.8.1 BUG=chromium:1015571 TEST=cargo check --features=plugin Change-Id: Id1ea387be70ef81ae62b6d39f99d85d48c938d58 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1869552 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* usb: replace libusb with Rust usb_util libraryDaniel Verkamp2019-10-17
| | | | | | | | | | | | | | | | | | | | | Drop the dependency on libusb and reimplement the host USB backend using usb_sys to wrap the Linux usbdevfs ioctls. This allows sandboxing to work without any dependency on libusb patches, and it gives us the flexibility to modify and update the USB backend without depending on an external third-party library. BUG=chromium:987833 TEST=`adb logcat` on nami with Nexus 5 attached TEST=deploy app to phone with Android Studio TEST=Run EdgeTPU USB accelerator demo (including DFU mode transition) Cq-Depend: chromium:1773695 Change-Id: I4321c2b6142caac15f48f197795a37d59d268831 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1783601 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* devices: fs: Add fuse constants and struct definitionsChirantan Ekbote2019-10-16
| | | | | | | | | | | | | | | | | Add the constants and struct definitions from the kernel fuse interface. These bindings are manually generated from `include/uapi/linux/fuse.h` in the kernel repo. BUG=b:136128319 TEST=none; these aren't used anywhere yet Change-Id: I03d11bc55eca6b8269f1e63a1187ef458ee16f28 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1705655 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
* Support composite disks.Cody Schuffelen2019-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new disk file type next to raw files and qcow images that represent an indirection to further raw disk files. The disk file itself is a proto file with references to file paths for other disks to open and their virtual offsets and lengths. The intention is to make it easy to assemble a single virtual hard disk out of several distinct partition files. In the particular case of Cuttlefish running Android in a VM, this is relevant as the Android build system distributes partitions as separate raw files. While the simple solution is to pass each partition as a separate raw disk, some functionality (like the bootloader) assumes there is a partition table with multiple distinct partitions on a single disk. Implementing composite disk support in the VMM bridges this gap through supporting the general-purpose case of a disk built out of multiple component files. If desired, this can be extended to support qcow files to support unusual configurations like a mixed qcow/raw disk. Enabled with the "composite-disk" feature. Bug: b/133432409 Change-Id: I2b0c47d92fab13b5dc0ca5a960c7cfd2b7145b87 Signed-off-by: Cody Schuffelen <schuffelen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1667767 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* crosvm: add 'virtio-gpu-next' feature flagGurchetan Singh2019-10-01
| | | | | | | | | | | | | | | With this, crosvm builds that don't have the CrOS version of virglrenderer can build against master without adjustments. BUG=chromium:924405 TEST=compile Change-Id: Iee27c003bee1eb8947cb048dc16e2da6c68af11e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1797067 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* vfio: Implement PciDevice Trait for vfio deviceXiong Zhang2019-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | According to kernel Documents/vfio.txt and Documents/vfio-mediated-device.txt,user pass host assigned device or mdev to crosvm through --vfio parameter, vfio module open this device and get this device's information. Implement PciDevice trait on this device, then vfio_pci module could trap guest pci cfg r/w and mmio r/w, and transfer this operation into kernel vfio. Currently the relationship of vfio container:group:device are 1:1:1, in the future it could extend to 1:m:n. BUG=chromium:992270 TEST=none Change-Id: I8006ef65022d56197eaeb464811a59db2ce54b9a Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1580458 Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* Extract disk creation logic out of qcow and src.Cody Schuffelen2019-08-28
| | | | | | | | | Bug: b/133432409 Change-Id: Iba25d5f6bb5f60619bb2f5a3d72ddfd3a81650b4 Signed-off-by: Cody Schuffelen <schuffelen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1691460 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* Remove remaining byteorder crate referencesDaniel Verkamp2019-08-26
| | | | | | | | | | | | | | Remove the last (unused) reference to byteorder in vm_control/Cargo.toml and remove it from the list of external crates in README.md. BUG=None TEST=./build_test Change-Id: Ie70c0bc2f96c19b34ef1596885245eca7bc202f4 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1761156 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* devices: pci: replace byteorder with from_le_bytes()Daniel Verkamp2019-08-26
| | | | | | | | | | | | | | Use the standardized from_le_bytes() functions rather than the byteorder crate. BUG=None TEST=./build_test Change-Id: I07a062bf63c5d3ae1e25f403713bf9a1677e8cba Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1761155 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* x86_64: replace byteorder with {to,from}_le_bytes()Daniel Verkamp2019-08-26
| | | | | | | | | | | BUG=None TEST=./build_test Change-Id: Ic7873c6b70d9a0e9f34b7a2977845552144934ea Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1761152 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* qcow: replace byteorder with {to,from}_be_bytes()Daniel Verkamp2019-08-26
| | | | | | | | | | | | | | | | Use the standard byte order conversion functions rather than the byteorder crate. BUG=None TEST=./build_test TEST=cargo build -p qcow_utils TEST=cargo test -p qcow Change-Id: I9ff7368cc54c539db1996f81d4220cabf7e6e301 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1761151 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* arch: fdt: replace byteorder with to_be_bytes()Daniel Verkamp2019-08-26
| | | | | | | | | | | | | | Use the standard library u32 and u64 byteorder conversion functions (now that they are stabilized) rather than the byteorder crate. BUG=None TEST=./build_test Change-Id: I7d2b523c2df5f7cdf1cd7d5b760ede8e827e0517 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1761150 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* tempfile: Unify the two tempdir implementationsDavid Tolnay2019-07-11
| | | | | | | | | | | | | | | | | | | | | | Looks like we ended up with two totally different tempdir implementations: one from CL:520706 and the other from CL:1409705. This CL consolidates them into one implementation. BUG=chromium:974059 TEST=tempfile: cargo test TEST=crosvm: cargo check --all-features TEST=devices: cargo check --tests TEST=sys_util: cargo check --tests TEST=local kokoro TEST=./build_test Cq-Depend: chromium:1574668 Change-Id: Id70e963c9986ed2fc5f160819c4a7f9f16092b3b Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1573227 Tested-by: kokoro <noreply+kokoro@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
* tempfile: reimplement using libc::mkdtempDaniel Verkamp2019-07-03
| | | | | | | | | | | | | | | | | | POSIX provides a standard mkdtemp() function to securely create a temporary directory; use it rather than reinventing the wheel. This also drops the dependency of tempfile on rand_ish, which will allow easier use of the tempfile implementation outside of crosvm. BUG=chromium:974059 TEST=cargo test -p tempfile Change-Id: I34a226b046dc6f272106988a78d121a24a377f44 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1659971 Tested-by: kokoro <noreply+kokoro@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* eliminate mut from non-mut referencesZach Reizner2019-06-04
| | | | | | | | | | | | | | | | | | | | | | | This manifested itself in a couple places that were turning shared memory buffers into slices for the purposes of passing these slices to `Read` and `Write` trait methods. However, this required the removal of the methods that took `Read` and `Write` instances. This was a convenient interface but impossible to implement safely because making slices from raw pointers without enforcing safety guarantees causes undefined behaviour in Rust. It turns out lots of code in crosvm was using these interfaces indirectly, which explains why this CL touches so much. TEST=crosvm run BUG=chromium:938767 Change-Id: I4ff40c98da6ed08a4a42f4c31f0717f81b1c5863 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1636685 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Zach Reizner <zachr@chromium.org>
* Add cargo-generated Cargo.lock comment blockDaniel Verkamp2019-04-19
| | | | | | | | | | | | | | | | | | Cargo 1.34.0 insists on adding a header comment to Cargo.lock on each invocation to indicate that the file is not meant to be edited by hand. Add the header to our checked-in copy of Cargo.lock so it doesn't continually dirty the working copy. BUG=None TEST=cargo build Change-Id: I2ef10bfd997a9a1f7d4928467daa830d227cf165 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1568829 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
* clippy: Resolve cast_ptr_alignmentDavid Tolnay2019-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | This CL fixes four cases of what I believe are undefined behavior: - In vhost where the original code allocates a Vec<u8> with 1-byte alignment and casts the Vec's data pointer to a &mut vhost_memory which is required to be 8-byte aligned. Underaligned references of type &T or &mut T are always undefined behavior in Rust. - Same pattern in x86_64. - Same pattern in plugin::vcpu. - Code in crosvm_plugin that dereferences a potentially underaligned pointer. This is always undefined behavior in Rust. TEST=bin/clippy TEST=cargo test sys_util Change-Id: I926f17b1fe022a798f69d738f9990d548f40c59b Reviewed-on: https://chromium-review.googlesource.com/1566736 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
* lints: Enforce sorted order for enum variantsDavid Tolnay2019-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | To avoid wasting time re-sorting these things (CL:1492612). https://docs.rs/remain Disclaimer: I wrote the macro. This CL adds #[sorted] attributes to those Error enums that seemed to have made some effort to be in sorted order. TEST=cargo check TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu TEST=emerge-nami crosvm TEST=local kokoro CQ-DEPEND=CL:1524247 Change-Id: I89685ced05e2f149fa189ca509bc14c70aebb531 Reviewed-on: https://chromium-review.googlesource.com/1515998 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
* protos: Merge plugin_proto crate under protos::pluginDavid Tolnay2019-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | This de-duplicates the two separate build.rs files dealing with proto compilation. The trunks interface.proto will be exposed under protos::trunks and the plugin proto will be exposed under protos::plugin. BUG=none TEST=cargo check TEST=cargo check --features tpm TEST=cargo check --features plugin TEST=cargo check --features tpm,plugin TEST=FEATURES=test emerge-nami crosvm TEST=FEATURES=test USE=crosvm-tpm emerge-nami crosvm TEST=FEATURES=test USE=crosvm-plugin emerge-nami crosvm TEST=FEATURES=test USE='crosvm-tpm crosvm-plugin' emerge-nami crosvm TEST=local kokoro CQ-DEPEND=CL:1553971 Change-Id: I203b654a38e9d671a508156ae06dfb6f70047c4f Reviewed-on: https://chromium-review.googlesource.com/1556417 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* protos: Compile protos for trunks daemonDavid Tolnay2019-04-12
| | | | | | | | | | | | | | | | | | | | | | | The TPM device will need these protos to communicate TPM commands to the Trunks daemon and receive TPM responses. BUG=chromium:911799 TEST=cargo check TEST=cargo check --features tpm TEST=FEATURES=test emerge-nami crosvm TEST=FEATURES=test USE=crosvm-tpm emerge-nami crosvm TEST=local kokoro CQ-DEPEND=CL:1553610 CQ-DEPEND=CL:1553971 Change-Id: I1a67a7b4a3714236b20a790068ca19129446f71c Reviewed-on: https://chromium-review.googlesource.com/1554982 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* protos: Update to protobuf 2.3David Tolnay2019-04-12
| | | | | | | | | | | | | | | | | | | | | This matches the version already used by crostini_client. The newer protobuf version depends on the tempfile crate rather than tempdir, the latter being now deprecated. So I replaced our immitation tempdir crate with one that matches the API of tempfile instead. As a reminder, we use this crate as a patch to avoid pulling in all of the rand crate and its many dependencies. TEST=cargo check --features plugin CQ-DEPEND=CL:1553971 Change-Id: I28eed3ceadb1013f015400b4c582aaf8dc89eee1 Reviewed-on: https://chromium-review.googlesource.com/1562924 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* Revert "qcow_utils: Add tests"Dylan Reid2019-03-28
| | | | | | | | | | | | | | | This test breaks the asan builders BUG=945423 This reverts commit fbbcf7ad1457b5daff1be151793441006f186683. Signed-off-by: Dylan Reid <dgreid@chromium.org> Change-Id: I4db9720118ea6e3002045fad997774ab84d3b59a Reviewed-on: https://chromium-review.googlesource.com/1540339 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
* Move split_irqchip_common to devices/.Miriam Zimmerman2019-03-20
| | | | | | | | | | | | | | | Previously, code in devices/ couldn't use split_irqchip_common, since x86_64/ already has a dependency on devices/. TEST=Built. BUG=chromium:908689 Change-Id: I481514ae6bbd68e47feecc6f364ca8f4fd798e67 Reviewed-on: https://chromium-review.googlesource.com/1526762 Commit-Ready: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>