summary refs log tree commit diff
Commit message (Collapse)AuthorAge
* Remove unnecessary "extern crate" linesAlyssa Ross2020-04-11
| | | | | The proc_macro ones have been unnecessary since Rust 1.42, and the rest have been unnecessary since the 2018 edition.
* crosvm: collapse simple boolean matchesAlyssa Ross2020-04-11
| | | | | Rust 1.42 introduces matches!(), which can be used to collapse simple match statements like these.
* msg_socket: fix derive for unit enumsAlyssa Ross2020-04-10
|
* crosvm: tweak --net-vq-pairs docsAlyssa Ross2020-04-10
|
* Merge remote-tracking branch 'origin/master'Alyssa Ross2020-04-10
|\
| * ac97: Set CRAS_CLIENT_TYPE_CROSVM for crosvmpaulhsia2020-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set client type for debug log and ucm. BUG=b:140401362 TEST=Build, deploy and run `aplay -f dat /dev/zeros` and check `cras_test_client --dump_a` results Change-Id: I2b040ddaaafe0b7d6e7c3a6f3973598d0a79ff82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2142836 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Chih-Yang Hsia <paulhsia@chromium.org> Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
| * io_uring: allocate iovecs based on returned count from the kernelDylan Reid2020-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kernel is allowed to not only limit the number of requested entries, but also provide more than is requested. If a non-power-of-2 is requested, it will be rounded up to the next power of 2. Ensure that there are enough iovecs by allocating them based on the number returned from io_uring_setup instead of the number of entries requested. TEST=cargo test read_parallel Change-Id: If92e0a31858d1af53b99af8415002a4f26b48230 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140915 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
| * io_uring: add reading and writing iovecsDylan Reid2020-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the user of the io_uring interface specify a slice of iovecs to read from or write to when queueing an operation to the ring. These ops can be used by block that has a Vec of iovecs from the descriptor chain already. Change-Id: Ia91e03e441cdae03e4fdba33bb601de006ef53ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140914 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
| * io_uring: operation results are unsignedDylan Reid2020-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch from returning an i32 to a u32. This will make handling the number easier for users, as they can assume it is >= 0. Any value < 0 would not be returned as Ok(value) anyways as ret < 0 is used for error conditions. Change-Id: I609ce55d3c6be6e28f4d7aadf7148b2ac3b18878 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140913 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
| * devices: pmem: implement flush using msync()Daniel Verkamp2020-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, writable pmem devices implemented the flush command using fsync(); however, this does not guarantee synchronization of memory mappings via mmap() to the file on disk. What we actually need is msync() on the pmem file mapping, but we don't have access to that mapping in the pmem child process, and it isn't trivial to pass it along since it is owned by the Vm object once it has been added as a mmap_arena. In order to call msync() on the mapping, add a new VmControl socket so that the pmem device can request that the main process issues an msync() on the MemoryMappingArena identified by its slot number. BUG=chromium:1007535 TEST=mount filesystem on /dev/pmem0 and sync; verify msync in strace Change-Id: Id0484757c422cf81d454fd54012a12dbcc1baaf6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2044365 Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
| * Fix performance problem on Android Sparse imagesA. Cody Schuffelen2020-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | This was adding ~11 minutes to the boot time with sparse images. BUG=b:151981838 TEST=launch cuttlefish with sparse images. Change-Id: I707258566aee338f742a3a5fe94d0bad8302c447 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2111117 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Cody Schuffelen <schuffelen@google.com>
| * crosvm balance available memoryCharles William Dick2020-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Poll available memory from the host and guest every second. Resize the balloon so that available memory in the guest is the same as in the host. balancemem_timer adds a Token::BalanceMemory to poll_ctx every second which creates a balloon stats request. When the stats results come back from the guest, we compute how much the balloon should change to balance available memory between the guest and host. If this new balloon size is > 5% different than the current balloon size, we make a BalloonControlCommand::Adjust to resize the balloon. BUG=b:147334004 TEST=tast run <DUT> arc.MemoryChomeOSPerf*, .vm shows memory use similar to the base arc test. tast run <DUT> arc.MemoryShiftingPerf.vm, both chromeos and android counters report high numbers. Switch LOWMEM_AVAILABLE constant to non-existing file, check the ARCVM reports not running in ChromeOS, but still boots. Change-Id: I8a581f86bf4881541d2f5f26dc541b35b862d244 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2061518 Reviewed-by: Lepton Wu <lepton@chromium.org> Reviewed-by: Charles Dueck <cwd@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Charles Dueck <cwd@chromium.org>
| * Add io_uring interfacesDylan Reid2020-04-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a low-level interface to operating the new io_uring interface. This is an unsafe interface with the basic operations of setting up the ring, adding to it, removing from it, and polling it. This will be followed by a safe interface layer on top of this code, then by additions to the asynchronous executor that allow for asynchronously doing multiple operations to files from one context. Change-Id: I71f7ffb04ce8cb4da470deda9aee768ab95d3d98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124009 Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org>
| * handle mmap of large offsets on 32 bit systemsDylan Reid2020-04-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While only 32 bits of address can be mapped, that 32 bits can be offset by further than 32 bits in to a large file. As chirantan points out, the try_mmap call was already casting the usize to u64 on all architectures. Convert the usize offset in mmap to u64 and address users of the API as well. Change-Id: I67aed928ea521049fb51eb7aa61ea4de8b4d096c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124879 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>
| * msg_socket: support dynamically sized typesZach Reizner2020-04-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is a major shift in how the MsgOnSocket trait works to allow `self` to be used to determine the result `msg_size()`. This is to support data structures with `Vec` or other dynamically sized type. TEST=./build_test cargo test -p msg_socket tast run <DUT> crostini.CopyPaste.* BUG=None Cq-Depend: chromium:2025907 Change-Id: Ibdb51b377b2a2a77892f6c75e1a9f30b2f8b0240 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2029930 Tested-by: Zach Reizner <zachr@chromium.org> Auto-Submit: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Zach Reizner <zachr@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>
| * docker: Add setup for libvdaKeiichi Watanabe2020-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the following setup for libvda, which will be used by video features introduced by CL:1973973: * Pull down platform2 as /platform2 * Create a dummpy libvda.pc file Note that we don't build libvda.so. BUG=b:147465619 TEST=build_crosvm.sh Change-Id: I1f61df57244a13b7df1b7a373d955b6cfe91e188 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2133987 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
| * docker: Run cargo check with all features enabledKeiichi Watanabe2020-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current Dockerfile builds crosvm only with some selected features. To cover all of crosvm code, this CL adds 'cargo check' command. BUG=none TEST=./build_crosvm_base.sh && ./build_crosvm.sh Change-Id: I6e1efa8f68476912c9cec46188f096d430df663c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2134003 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
| * virtio-gpu: add support for exporting virtgpu resourcesDavid Stevens2020-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | BUG=b:136269340 TEST=boot ARCVM and launch play store Change-Id: I2d78ffb15dcf2dc0f245916485f5ebb636ef6e78 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2014680 Reviewed-by: David Stevens <stevensd@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: David Stevens <stevensd@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
| * Virtio-net: Add multi queues in multi threadsXiong Zhang2020-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support 2 vq pairs for virtio-net, this patch create 2 sockets in one tap interface, 2 vq pairs(rx/tx) and 2 threads in device model, So one vq pair has one thread and one socket in tap corresponding. On my SkyLake desktop with crosvm and ubuntu 18.04 guest: If run one iperf server on host and one iperf client in guest, 2 vq pairs has the same netwrok bandwidth as 1 vq pair, the bandwidth is 5.99Gbits/sec If run two iperf server on host and two iperf client in guest, In 1 vq pair mode, two iperf cliens bandwidth are 3.19Gbits/sec and 3.18Gbits/sec. In 2 vq pairs mode, two iperf clients bandwidth are 4.87Gbits/sec and 4.86Gbits/sec. So 2 vq pairs improve net bandwidth 52.7% compared with 1 vq pair in this case. BUG=chromium:1064482 TEST=Run iperf test in guest Change-Id: I1fa14d7e24085552dc828a89a883d4a2ada34789 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2099754 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>
| * crosvm virtio balloon statsCharles William Dick2020-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces the ability to request BalloonStats from a BalloonControlCommand. BUG=b:147334004 TEST=tast run <DUT> arc.Boot.vm, and the balance available changes based on this. Change-Id: I808c4024f8c644c9cc4e30cc455ceda5f477bff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2061517 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Charles Dueck <cwd@chromium.org>
| * sys_util: Allow pre-populating mmapsDylan Reid2020-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | io_uring would like to pre-fault the ring pages as they are likely to be accessed regularly. Allow mmap users to specify the MAP_POPULATE flag through a new API. Change-Id: I5fefc13443280fe832c9601fe5a497b572127f0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124008 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
| * syscall_defines: add new/updated syscallsDylan Reid2020-03-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | io_uring is needed so update the syscall defines to match 5.6-rc5. There was a slight refactor in arm upstream which changed some syscall names to better reflect their 32 vs 64 bit variants. See kernel commit: 00bf25d6: y2038: use time32 syscall names on 32-bit TEST=samus, kukui, and kevin64 build. Change-Id: Idcceb4bba313a3f826556e90ffde94f166de0a05 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124007 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
| * devices: fs: Replace RwLock with MutexChirantan Ekbote2020-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The RwLock implementation on linux has a tendency to starve writers. Since the fs device workload has a roughly evenly distributed number of reads and writes, using a Mutex should give us better performance. BUG=b:150264042 TEST=vm.Blogbbench.virtiofs Change-Id: I85ec4053bf03d19bb21b420c0aa506720e666708 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2103604 Auto-Submit: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen Barber <smbarber@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
| * devices: usb: temporarily disable resetsDaniel Verkamp2020-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a workaround for a bug encountered with newer Android phones - when connected to the Linux VM, resetting the USB device via USBDEVFS_RESET causes the device to disconnect from the host, preventing its use in the VM. This works around the issue by removing both paths that can cause a USB device reset (initial reset at device insertion plus reset when requested by the guest kernel). Both of these must be removed to restore functionality; if either is still in place, the failure is still observed. The workaround specifically exempts Edge TPU devices, which need a reset for firmware update; these devices will still issue a reset on connect and when requested by the guest. BUG=chromium:1058059 TEST=Connect Pixel 3 to eve, adb logcat Change-Id: I7a689da1120e1fb772d95e41a0d4debe64f7d6a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105814 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
| * devices: fs: Use l{get,set,list,remove}xattrChirantan Ekbote2020-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the `open_inode` method on an fd for a symlink results in the kernel returning -ELOOP. Since there are no `*at` methods for extended attributes, manually read the path for the file and then use the l{get,set,list,remove}xattr method on the returned path. BUG=b:136128512 TEST=boot arcvm with virtio-fs and selinux enabled Change-Id: I2fde57db8a075838a3a877309f6cf89059f19258 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2120763 Auto-Submit: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen Barber <smbarber@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
| * devices: fs: Add missing `&` in copy_file_rangeChirantan Ekbote2020-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `offset_dst` is supposed to be a pointer. BUG=none TEST=none Change-Id: I033501ba5a57a130625e68be88457b15ad1484ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2120762 Auto-Submit: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* | sys_util: EpollContext doc copy editsAlyssa Ross2020-04-10
| |
* | devices: remove unnecessary RefCell in VmRequesterAlyssa Ross2020-04-09
| | | | | | | | | | | | | | There's no need for vm_socket to be mutably borrowed. Neither send() nor recv() are mutating methods, we don't have to worry about multiple racing immutable borrows, because the type can only be used on one thread thanks to Rc.
* | Merge remote-tracking branch 'origin/master'Alyssa Ross2020-03-26
|\|
| * gfxstream: fix buildLingfeng Yang2020-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | API for export_resource changed Bug: b/146066070 Change-Id: I614880704658bbe7aae2f7ad8b10c76555d99c1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2102760 Tested-by: Lingfeng Yang <lfy@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Jason Macnak <natsu@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
| * vhost-net: implement direct msix irq fdChuanxiao Dong2020-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current vhost-net msix irq injection flow is from vhost-kernel to crosvm vhost-net, then to the KVM for irq injection. It still need crosvm vhost-net to trigger irq, which is because the set_vring_call is not directly using the msix irq fd. To optimize this flow to be from vhost-kernel to KVM directly, need: 1. if the msix is enabled and unmasked, use the misx irq fd for the vring_call directly so that all the misx injection can directly to KVM from vhost-kernel. 2. if the msix is disabled or masked, use the indirect vhost_interrupt fd to let the crosvm to control the irq injection. BUG=None TEST=cargo test -p devices TEST=start crosvm with vhost-net, and run the iperf3 on the network without any issue Change-Id: Idb3427f69f23b728305ed63d88973156a03e7c6b Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2046452 Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
| * vhost: pass response_socket to activate threadChuanxiao Dong2020-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass the Option of the response socket should be used by the activate thread, to communicate with its device model. BUG=None TEST=cargo test -p devices Change-Id: I929f4c901468e920116f2a744ec73571d91080e3 Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2046451 Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
| * vhost-net: add control socket basic supportChuanxiao Dong2020-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a pair of control socket for vhost net. This pair can be used for the vhost-net device model to control and communicate with its activate thread. BUG=None TEST=cargo test -p devices Change-Id: I8bacdb9132787dc499ef00eea1df26ff3b35028d Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2046450 Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
| * docker: update ADHD commit to fix kokoro buildDaniel Verkamp2020-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the audio_streams dependency to fix a build failure introduced in https://crrev.com/c/2038413. BUG=None TEST=docker/build_crosvm_base.sh && docker/wrapped_smoke_test.sh Change-Id: I99b26c925a8bc5bb6f77575eb64c0972a5a5e0ae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2116274 Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: George Engelbrecht <engeg@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
| * usb: avoid setting configuration when unnecessaryDaniel Verkamp2020-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On devices with only one configuration, skip the code that attempts to change the device's active configuration, since it must always be the single available configuration. This works around an issue observed with some USB devices (e.g. Servo Micro) where the initial Get Configuration control request fails with -EPIPE. BUG=chromium:1061382 BUG=b:151408644 TEST=Attach servo micro, see /dev/ttyUSB[012], screen /dev/ttyUSB0 Change-Id: Ic3333e1d70a0c57b090de64e4d3b7932ce2cf81d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2108871 Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: George Engelbrecht <engeg@google.com> Commit-Queue: George Engelbrecht <engeg@google.com>
| * devices: gpu: complete resource V2 rebaseGurchetan Singh2020-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove RESOURCE_V2_UNREF * Add RESOURCE_MAP/RESOURCE_UNMAP to enable resources without guest storage that don't need to be mapped directly either BUG=chromium:924405 TEST=compile and test Change-Id: I10d6cd120d86131fa7ed8917ddad25cdb99ae50c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2015587 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
| * devices: gpu: modify resource v2Gurchetan Singh2020-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rebase of zero-copy virtio-gpu flow: * Removes guest_memory_type/guest_caching_type in favor of a bitmask * Removes ALLOCATION_METADATA, since ideally we'd just read from guest memory to get guest responses * Renames HOST_COHERENT to HOST_VISIBLE * Adds a few more feature flags BUG=chromium:924405 TEST=compile Change-Id: I0d5a84b66cfa6d09f7e2d07ed8e761e7ba850284 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2013767 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
| * gpu_renderer: disable debug callback on armDavid Stevens2020-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vararg bindings are different for different architectures. Limit support to x86 and x86_64, since those are the bindings that are checked in. BUG=chromium:1063640 TEST=compiles Change-Id: Ic69753959684f55855fd7a8577a422638cd05f8b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2114633 Reviewed-by: Lepton Wu <lepton@chromium.org> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Commit-Queue: David Stevens <stevensd@chromium.org> Tested-by: David Stevens <stevensd@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>
| * devices: virtio: add virtio-console deviceDaniel Verkamp2020-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a virtio device that provides a serial console. It has constructors matching the existing Serial device (new_in_out, new_out, and new_sink) that take generic io::Read and io::Write streams. This change just adds the device code; additional changes are required to add the console device to the command-line parsing and device setup code. BUG=chromium:1059924 TEST=boot linux with console=hvc0 Change-Id: I917157d5ecb5160c9b00b499eabe6fb08486776c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2095534 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
| * ACPI: enable ACPI from command lineChuanxiao Dong2020-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the "acpi=off" in cmdline has disabled the ACPI for the guest kernel. With removing the "acpi=off", the ACPI will be enabled for the guest kernel by default. With acpi enabled, the SCI irq will be needed by the ACPI core driver. Register the SCI irq in MP table so that it can use IO-APIC routing. The reason to have "pci=noacpi" is that, in the current DSDT there is only suspend capability, so PCI scan still need to be done by the traditional way. BUG=chromium:1018674 TEST=Linux guest is able to boot up with the virtio devices functional. Also able to see the S1 capability from kernel dmesg. Change-Id: Id54e788f4aa4c944fac5e3fa1c92b76865dd5021 Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2078967 Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
| * devices: fs: Bump fuse minor version to 31Chirantan Ekbote2020-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new definitions and constants to support fuse minor version 31. These include the FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING opcodes used by the virtio-fs driver for implementing DAX support. BUG=b:147341783 TEST=vm.Virtiofs Change-Id: Ie59ec1a44e555910f2ee2c5ba7afccb8bd435db9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105823 Tested-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
| * devices: fs: Implement copy_file_rangeChirantan Ekbote2020-03-19
| | | | | | | | | | | | | | | | | | | | | | | | BUG=none TEST=vm.Virtiofs Change-Id: I2ed7137a901e6e506e6b1562b77fdb042bdc58ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105822 Tested-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
| * devices: fs: Support FOPEN_CACHE_DIRChirantan Ekbote2020-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for FOPEN_CACHE_DIR so that the guest can cache directory entries for longer. BUG=b:150264964 TEST=vm.Virtiofs Change-Id: Iade67b54084ed72378afa70af9e9e0f7f0bc03e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105821 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
| * devices: fs: Add support for fuse minor version 28Chirantan Ekbote2020-03-19
| | | | | | | | | | | | | | | | | | | | | | BUG=b:150264964 TEST=vm.Virtiofs Change-Id: I544329b63352956647d07aefdfce3118947d0821 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105820 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
| * seccomp: add frequency file to x86_64Matt Delco2020-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a frequency file that teaches the seccomp compiler to weight the comparison tree in favor of the most frequenctly called syscalls. This frequency file was created by running strace against vm_conciege's pid (e.g., "strace -p PID -ff -e raw=all -o /tmp/strace") when performing a start and stop of a VM, deleting the trace files that weren't for a crosvm process, passing the files to minijail's tools/generate_seccomp_policy.py (using the -frequency option), and combining the results of the frequency file. I rounded the #s to the nearest multiple of 5 and only retained the syscalls that had at least 10 calls. BUG=None TEST=Local build and deploy. Verified that crostini VM still boots and shuts down properly. Used scmp_bpf_disasm to disassemble a few bpf files before and after this change to confirm that with the frequency file the first comparision is "jge 2" (to quickly whitelist syscalls 0 and 1 ['read' and 'write']) instead of a comparison around the middle of the range of syscall numbers that are used. Change-Id: Icace2b5cdbcae6e51cfd67a3034a1a17fdb6d59e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2005793 Commit-Queue: Matt Delco <delco@chromium.org> Commit-Queue: Stephen Barber <smbarber@chromium.org> Tested-by: Matt Delco <delco@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Auto-Submit: Matt Delco <delco@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
| * crosvm: Change expected field to String in InvalidValueJudy Hsiao2020-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the type of argument::Error::InvalidValue::expected from "&'static str" to String. It allows the lower level parse error object to handle the output of the expected value so that the rule of parsing will not be duplicated. For example, instead of: ``` v.parse::<Settings>() .map_err(|e| argument::Error::InvalidValue { value: v.to_string(), expected: "The value of setting should null or cras", })?; ``` we can have: ``` v.parse::<Settings>() .map_err(|e| argument::Error::InvalidValue { value: v.to_string(), expected: e.to_string(), })?; ``` and the expected value can be handled in the Display implementaion of Settings::ParseError. BUG=b:140866281 TEST=cargo build Change-Id: Ieba12a21103945fe0e47c70a190a4e5d985af537 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2103605 Tested-by: Judy Hsiao <judyhsiao@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Auto-Submit: Judy Hsiao <judyhsiao@chromium.org> Commit-Queue: Judy Hsiao <judyhsiao@chromium.org>
| * Fix warnings added in rust 1.42Dylan Reid2020-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rustc now warns about return statements that have an extra set of parenthesis. Remove such instances so that the code is warning free. TEST=cargo build completes without warnings Change-Id: I55148f8aceca8ba90f6bead2b6929e2c843351aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2104767 Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
| * devices: Ignore O_DIRECT in 9p and fs devicesChirantan Ekbote2020-03-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifying O_DIRECT in the 9p device doesn't actually work correctly and leads to an error. O_DIRECT handling in the fs device works correctly but also makes it look much worse in disk I/O benchmarks because the block device gets the benefit of the host cache while the fs device depends on the performance of the actual storage device. BUG=none TEST=`tast run vm.Fio.*` Change-Id: I738e4032081e331ef956c9d4c33616607e403d86 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2093967 Commit-Queue: Chirantan Ekbote <chirantan@chromium.org> Tested-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>