summary refs log tree commit diff
path: root/Cargo.lock
Commit message (Collapse)AuthorAge
...
* sync: Mutex type with methods that panic instead of return errorDavid Tolnay2018-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds a crate `sync` containing a type sync::Mutex which wraps the standard library Mutex and mirrors the same methods, except that they panic where the standard library would return a PoisonError. This API codifies our error handling strategy around poisoned mutexes in crosvm. - Crosvm releases are built with panic=abort so poisoning never occurs. A panic while a mutex is held (or ever) takes down the entire process. Thus we would like for code not to have to consider the possibility of poison. - We could ask developers to always write `.lock().unwrap()` on a standard library mutex. However, we would like to stigmatize the use of unwrap. It is confusing to permit unwrap but only on mutex lock results. During code review it may not always be obvious whether a particular unwrap is unwrapping a mutex lock result or a different error that should be handled in a more principled way. Developers should feel free to use sync::Mutex anywhere in crosvm that they would otherwise be using std::sync::Mutex. TEST=boot linux Change-Id: I9727b6f8fee439edb4a8d52cf19d59acf04d990f Reviewed-on: https://chromium-review.googlesource.com/1359923 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* usb_util: Create libusb wrapperJingkui Wang2018-12-01
| | | | | | | | | | | | | This wrapper will be part of usb emulation backend. BUG=chromium:831850 TEST=local build Change-Id: I084b15201941e4c16c4e3ff9b967e55db09db567 Reviewed-on: https://chromium-review.googlesource.com/1124870 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Jingkui Wang <jkwang@google.com>
* uprev crosvm and 9s libc to 0.2.44Stephen Barber2018-11-27
| | | | | | | | | | | | BUG=chromium:908695 TEST=emerge crosvm CQ-DEPEND=CL:1351218 Change-Id: Ife3895ed07eaba6e768fa7816dca403bc290fb7c Reviewed-on: https://chromium-review.googlesource.com/1351219 Commit-Ready: Stephen Barber <smbarber@chromium.org> Tested-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* macros: Update syn to 0.15David Tolnay2018-11-21
| | | | | | | | | | | | | | | | | | | | | | | | | This brings us onto the stable API surface area for procedural macros that stabilized in Rust 1.30, rather than the string-based shim on older compilers. https://blog.rust-lang.org/2018/10/25/Rust-1.30.0.html Intervening release notes: - https://github.com/dtolnay/syn/releases/tag/0.13.0 - https://github.com/dtolnay/syn/releases/tag/0.14.0 - https://github.com/dtolnay/syn/releases/tag/0.15.0 TEST=cargo check crosvm TEST=cargo test each of the three proc-macro crates TEST=build_packages CQ-DEPEND=CL:1340766 Change-Id: Idcf14df0225ab41423b9a8639d0bba0a63513712 Reviewed-on: https://chromium-review.googlesource.com/1338507 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
* crosvm: use msg_socket in vm_controlJingkui Wang2018-11-19
| | | | | | | | | | | | | Refactor existing code to use msg_socket. BUG=None TEST=local build and run Change-Id: Iee72326b330e035303f679e1aedd6e5d18ad4f8a Reviewed-on: https://chromium-review.googlesource.com/1260260 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Reland "devices: refactor proxy to use msg_socket"Jingkui Wang2018-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9d5e8f34ade78222a8a4ab0a6fb259e2c2d1faa3. Reason for revert: msg_socket was fixed to not call sendmsg/recvmsg BUG=None TEST=local build Original change's description: > Revert "devices: refactor proxy to use msg_socket" > > This reverts commit 142ce3efd9c6a20efb4685fa632ad522509441f2. > > Reason for revert: <INSERT REASONING HERE> > > Original change's description: > > devices: refactor proxy to use msg_socket > > > > Use msg socket in proxy. > > > > BUG=None > > TEST=None > > > > Change-Id: Ia5ebc4410918a261fe525abc1051ebbbdc66a876 > > Reviewed-on: https://chromium-review.googlesource.com/1260259 > > Commit-Ready: Jingkui Wang <jkwang@google.com> > > Tested-by: Jingkui Wang <jkwang@google.com> > > Reviewed-by: Zach Reizner <zachr@chromium.org> > > Bug: None > Change-Id: Ic7827969e9ad508cd1b65cb7b8747e81e0cd02d0 > Reviewed-on: https://chromium-review.googlesource.com/c/1313014 > Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> > Commit-Queue: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> > Tested-by: Jingkui Wang <jkwang@google.com> Bug: None Change-Id: I27822d7572cab028ec6ed1f0f686fface0858a9a Reviewed-on: https://chromium-review.googlesource.com/1315511 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* move qcow_utils to members from dependenciesZach Reizner2018-11-16
| | | | | | | | | | | | | | | | | | The qcow_utils crate is not a dependency of crosvm and should not be built in the same phase as crosvm. Doing so was harmless before the recent rustc/cargo changes, which seem to be triggering some kind of race condition. This change works around the bug. CQ-DEPEND=CL:1336738 TEST=cargo test --release BUG=chromium:900366 Change-Id: I01048128b20cf06580e809f6701688ab72e7756d Reviewed-on: https://chromium-review.googlesource.com/1336737 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* Revert "devices: refactor proxy to use msg_socket"Jingkui Wang2018-11-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 142ce3efd9c6a20efb4685fa632ad522509441f2. Reason for revert: <INSERT REASONING HERE> Original change's description: > devices: refactor proxy to use msg_socket > > Use msg socket in proxy. > > BUG=None > TEST=None > > Change-Id: Ia5ebc4410918a261fe525abc1051ebbbdc66a876 > Reviewed-on: https://chromium-review.googlesource.com/1260259 > Commit-Ready: Jingkui Wang <jkwang@google.com> > Tested-by: Jingkui Wang <jkwang@google.com> > Reviewed-by: Zach Reizner <zachr@chromium.org> Bug: None Change-Id: Ic7827969e9ad508cd1b65cb7b8747e81e0cd02d0 Reviewed-on: https://chromium-review.googlesource.com/c/1313014 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jingkui Wang <jkwang@google.com>
* devices: refactor proxy to use msg_socketJingkui Wang2018-10-31
| | | | | | | | | | | | | Use msg socket in proxy. BUG=None TEST=None Change-Id: Ia5ebc4410918a261fe525abc1051ebbbdc66a876 Reviewed-on: https://chromium-review.googlesource.com/1260259 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Revert "Revert "linux: Convert all virtio devices to PCI""Daniel Verkamp2018-10-12
| | | | | | | | | | | | | | This reverts commit c8986f14a8dd9f256d6faed55996d955b50ff923. Re-land the virtio PCI conversion after the preceding fixes. BUG=chromium:854766 TEST=Boot crosvm on nami and kevin Change-Id: I3699e3ed1a45cecc99c51e352d0cf0c32bc4116f Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1265862 Reviewed-by: Dylan Reid <dgreid@chromium.org>
* arch: add virtio-pci eventfds with exact matchDaniel Verkamp2018-10-11
| | | | | | | | | | | | | | | | | | | | The virtio PCI spec (4.1.5.2 Notifying The Device) says: "The driver notifies the device by writing the 16-bit virtqueue index of this virtqueue to the Queue Notify address." We were previously registering the notify address specifying NoDatamatch; switch this to a 16-bit match of the queue index to follow the specification. BUG=chromium:854766 TEST=Boot crosvm with virtio devices converted to PCI Change-Id: Ic950a8c7751268f7fcc21d5c37b0afc859f1e6d0 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1265861 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* crosvm: add msg_sock.Jingkui Wang2018-10-09
| | | | | | | | | | | | | | MsgSock wraps UnixDatagram and provides simple macro to define Messages that could be send through sock easily. TEST=cargo test BUG=None Change-Id: I296fabc41893ad6a3ec42ef82dd29c3b752be8b8 Reviewed-on: https://chromium-review.googlesource.com/1255548 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Revert "linux: Convert all virtio devices to PCI"Daniel Verkamp2018-10-04
| | | | | | | | | | | | | | | This reverts commit d635acbaf348c0863bc05b8f889b2fa5f8156aaa. This commit seems to be responsible for introducing hung tasks in tests, so let's revert it for now to get the tests green and debug it offline. BUG=chromium:891806 TEST=None Change-Id: I83504058baeae00909d9fb4f4bb704a144a0dfaf Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1259408 Reviewed-by: Dylan Reid <dgreid@chromium.org>
* linux: Convert all virtio devices to PCIDaniel Verkamp2018-10-02
| | | | | | | | | | | | | Change the main create_virtio_devs() function to create virtio devices using the PCI transport rather than MMIO. BUG=chromium:854766 TEST=Boot crosvm and verify that all virtio devices still work Change-Id: I9a6e60b21edea1e5ac2b3ae5c91793d45cf5063a Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1241541 Reviewed-by: Dylan Reid <dgreid@chromium.org>
* qcow: Add a utility program for qcow analysisDylan Reid2018-09-19
| | | | | | | | | This program makes figuring out the state of a qcow file easier. Change-Id: If297eb0cd835a86d8f284d3aef3d7e962e095726 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1207455 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* sys_util: remove Scm struct and sock_ctrl_msg C libraryZach Reizner2018-09-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Scm object was made to reduce the number of heap allocations in the hot paths of poll loops, at the cost of some code complexity. As it turns out, the number of file descriptors being sent or received is usually just one or limited to a fixed amount that can easily be covered with a fixed size stack allocated buffer. This change implements that solution, with heap allocation as a backup in the rare case that many file descriptors must be sent or received. This change also moves the msg and cmsg manipulation code out of C and into pure Rust. The move was necessary to allocate the correct amount of buffer space at compile time. It also improves safety by reducing the scope of unsafe code. Deleting the code for building the C library is also a nice bonus. Finally, the removal of the commonly used Scm struct required transitioning existing usage to the ScmSocket trait based methods. This includes all those changes. TEST=cargo test BUG=None Change-Id: If27ba297f5416dd9b8bc686ce740866912fa0aa0 Reviewed-on: https://chromium-review.googlesource.com/1186146 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Arch: Big refactor and add an empty PCI busDylan Reid2018-09-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When setting up IO, accept an optional PciRoot device to put on the IO bus. For aarch64, it's currently ignored. For x86_64, it will be added at 0xcf8. break up mmio device creation and registration Moving forward registration will be handled by the architecture specific code. However, creation will be handled by the common code. To make that easier split up the two steps so a list of devices is created, then each is registered later. Start moving to a model where the configuration generates a set of components that are passed to the architecture. The architecture will crate a VM from the components. Break up the big run_config function and move architecture specific parts to the various architectures. This doesn't refactor the function calls each architecture makes, but moves the setup flow in to the arch impls so that they can diverge in the future. Change-Id: I5b10d092896606796dc0c9afc5e34a1b288b867b Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1099860 Commit-Ready: Daniel Verkamp <dverkamp@chromium.org> Tested-by: Daniel Verkamp <dverkamp@chromium.org>
* virtio: Implement the 9P deviceChirantan Ekbote2018-08-08
| | | | | | | | | | | | | | | | | | | | | | | Implement a new virtio_9p device to be used for sharing directories with the VM. BUG=chromium:703939 TEST=mount inside a VM and run `bonnie++ -r 256` Append the shared directory to the crosvm command line: --shared-dir /path/to/dir:test_9p Then mount in the guest: mkdir /tmp/9p mount -t 9p -o trans=virtio test_9p /tmp/9p -oversion=9p2000.L Or for a 9p root: run --shared-dir /mnt/vm_root:/dev/root -p 'root=/dev/root ro rootflags=ro,trans=virtio,version=9p2000.L,cache=loose rootfstype=9p' vmlinux.bin CQ-DEPEND=CL:1065170 Change-Id: I41fc21306ab5fa318a271f172d7057b767b29f31 Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1065173 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* 9s: Server binary for the 9p file systemChirantan Ekbote2018-08-08
| | | | | | | | | | | | | | | | | | Add the 9s crate, which provides an executable that can serve the 9p file system protocol. It initially only supports connections over vsock but can easily be extended to support network and unix domain socket based connections. BUG=chromium:703939 TEST=Run the server, have maitred connect to it over vsock, mount the 9p file system in the guest kernel, share it with the penguin container, and run `bonnie++ -r 256 -s 512` CQ-DEPEND=CL:1121550, CL:1166446 Change-Id: Ia0c72bcf29188bba4c07b6c0a2dd5a83d02339b5 Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1112870 Reviewed-by: Dylan Reid <dgreid@chromium.org>
* crosvm: Add bit_field_deriveJingkui Wang2018-08-03
| | | | | | | | | | | | | Support macro derive(BitField) to make life easier. BUG=None. TEST=local build and run test. Change-Id: I582620de250017fb7c0b601f9ad4fbcbbc2fe02a Reviewed-on: https://chromium-review.googlesource.com/1069331 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* plugin: allow retrieving list of supported MSRsDmitry Torokhov2018-07-31
| | | | | | | | | | | | Add crossvm plugin API to allow fetching list of supported MSRs. BUG=b:111083877 TEST=cargo test -p kvm; cargo test --features=plugin Change-Id: I178c7bc33d606bef10422faac6bb9afb3fe0a014 Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1152229 Reviewed-by: Zach Reizner <zachr@chromium.org>
* gpu: implement virtio-gpuZach Reizner2018-07-20
| | | | | | | | | | | | | | | | | | Basic 2D and 3D support is there. The drm_cursor_test and null_platform_test in drm-tests should run to completion. The extra device is hidden behind both a build time feature called 'gpu' and the device is only added to a VM if the '--gpu' flag is given. TEST=build with --features=gpu; drm_cursor_test && null_platform_test BUG=chromium:837073 Change-Id: Ic91acaaebbee395599d7e1ba41c24c9ed2d84169 Reviewed-on: https://chromium-review.googlesource.com/1036862 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* gpu_renderer: add virglrenderer bindingsZach Reizner2018-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These bindings are needed for virtio-gpu 3D capabilities. All the rust files under gpu_renderer/src/generated are generated via the gpu_renderer/src/generated/generate script. The gpu_renderer/src/lib.rs file contains the Renderer and Context structs, which are the main interfaces to virglrenderer. They encapsulate the global state of virglrenderer (Renderer) and each context ID (Context). The command_buffer module is included only for basic testing and is not intended for production use. The pipe_format_fourcc module is provided for the conversion of virglrenderer specifc formats to standard fourcc formats. BUG=chromium:837073 TEST=cargo build -p gpu_renderer CQ-DEPEND=CL:1144406 Change-Id: Iad153390f618309bf493e92e76432c0b1c4a8a93 Reviewed-on: https://chromium-review.googlesource.com/1043447 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* plugin: allow retrieving and setting VCPU eventsSlava Malyugin2018-07-11
| | | | | | | | | | | | | Add crosvm plugin API to allow fetching and setting VCPU events. BUG=b:110056268 TEST=cargo test --features plugin -p kvm Change-Id: Id66230f180f4bdb95bd1850ed050e439083701cc Reviewed-on: https://chromium-review.googlesource.com/1128045 Commit-Ready: Slava Malyugin <slavamn@chromium.org> Tested-by: Slava Malyugin <slavamn@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Move gpu allocator to resourcesDylan Reid2018-07-09
| | | | | | | | | | Combine GPU buffer allocation with the system resource allocator making life easier as only one allocator needs to get passed to the execute function. Change-Id: I199eb0fd6b99b629aaec1ae3295e8a1942da5309 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1099856
* gpu_display: provides wayland based output for virtio-gpuZach Reizner2018-07-09
| | | | | | | | | | | | | | | | | | This provides virtual display style output, useful for debugging virtio-gpu. Although using virtio-gpu for display purposes clashes with the more integreated virtio-wayland support, it is nonetheless helpful for debugging virtio-gpu, and is technically required to fully implement that device. TEST=cargo build -p gpu_display BUG=chromium:837073 CQ-DEPEND=CL:1096300 Change-Id: I59f895e951ef593d4119e7558168dd34223519ee Reviewed-on: https://chromium-review.googlesource.com/1043446 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* x86_64: fill cache info in cpuid, stop spoofing CPU vendor idSlava Malyugin2018-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | The fix passes through cache-related CPU entries 2, 4, 0x80000005 and 0x80000006 similar to how QEMU does it. Note passing this cpuid info itself is not sufficient unless CPU vendor is something Linux kernel recognizes. Therefore, I am removing cute spoofing of the vendor id, allowing host value to pass through. I believe it is generally a bad idea to spoof vendor id as lots of kernel and user space code gets confused and may take unoptimized paths. The corollary is that removing the spoofing may have unintended consequences correctness- and performance-wise. I would appreciate recommendation on additional testing. BUG=chromium:859678 TEST=lscpu in Guest, 'cargo test' Change-Id: I6963b00d9eecf49fb4578bcc75ad744c3099f045 Reviewed-on: https://chromium-review.googlesource.com/1125529 Commit-Ready: Slava Malyugin <slavamn@chromium.org> Tested-by: Slava Malyugin <slavamn@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* Remove the device manager and use the new resource allocatorDylan Reid2018-06-29
| | | | | | | | | | | | | | | | | Allow IRQs to be assigned before creating device manager. For PCI, we need to add devices with interrupts before MMIO setup. Add the ability to tell the architecture device manager about IRQs that we have stolen. There was only one function in device_manager and all of its state is now delegated to the resource allocator, remove it. Change-Id: I9afa0e3081a20cb024551ef18ae34fe76a1ef39d Reviewed-on: https://chromium-review.googlesource.com/1089720 Commit-Ready: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* resources: Add system resource allocatorDylan Reid2018-06-29
| | | | | | | | | | Start a system resource allocator that will be able to manage the resources specific to each architecture. Change-Id: I98cf35c280fefd7b0000801eb7405a236373b753 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1089719 Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* resources: Add address allocation helperDylan Reid2018-06-29
| | | | | | | | | | | | Add the AddressAllocator module that will be used by both architectures to manage distributing address ranges to devices. This will make the addition of PCI devices easier as now both MMIO and PCI will need to share address space. Add this to a new resources crate. Change-Id: I6a971dd795f2118bd6cfec7dc34a65b0d4a32f9b Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1072570 Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
* p9: Add server implementationChirantan Ekbote2018-06-15
| | | | | | | | | | | | | Implement all the server methods for the 9P protocol. BUG=chromium:703939 TEST=bonnie++ -r 256 Change-Id: I6b1b5fe4fea4d4941db42e5c1a364a54d0827054 Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1013203 Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* Update libc version to 0.2.40Chirantan Ekbote2018-05-23
| | | | | | | | | | | | | | The p9 crate needs the libc::DT_UNKNOWN constant, which isn't available in version 0.2.34 but is available in version 0.2.40. BUG=chromium:703939 TEST=none CQ-DEPEND=CL:1065064 Change-Id: If1451d5bcc2737abc2a14d2b81005c6318165e1f Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1013202 Reviewed-by: Stephen Barber <smbarber@chromium.org>
* Add low-level p9 protocol implementationChirantan Ekbote2018-05-22
| | | | | | | | | | | | | | | Implement encoding and decoding various primitives using the p9 protocol. In addition, add a procedural macro to derive the encoding and decoding implementation for structs built out of the primitives. BUG=chromium:703939 TEST=unit tests CQ-DEPEND=CL:1065063 Change-Id: I7256633fb7002da9ce8af03be2f24410b90ccf3f Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/969965 Reviewed-by: Stephen Barber <smbarber@chromium.org>
* crosvm: Switch to cc crate.Manoj Gupta2018-05-18
| | | | | | | | | | | | | | | | We do not want to add dependencies on GCC. Switch to cc crate instead of gcc to honor CC setting. CQ-DEPEND=CL:1066462 BUG=chromium:814480 TEST=emerge-{eve,kevin} crosvm works. Change-Id: I4e846b2080503e5617ed66e709f7af5263c98fba Reviewed-on: https://chromium-review.googlesource.com/1066461 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* plugin: allow retrieving and setting XCR VCPU statesDmitry Torokhov2018-05-18
| | | | | | | | | | | | | Add crossvm plugin API to allow fetching and setting XCRs for VCPU. BUG=b:79692549 TEST=cargo test -p kvm Change-Id: I2a988279c08051a8d8865efc1e60f9692fa26272 Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1062646 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* virtwl: Add DMABuf allocation support.David Reveman2018-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements DMABuf allocation type in the virtio wayland device. We attempt to locate a supported DRM device prior to engaging the device jail. If found, the DRM device is passed to the wayland device code and used to serve DMABuf allocations. DMABuf support can be disabled by not providing crosvm with access to any DRM device nodes. The guest is expected to handle the case when DMABuf allocation fails and fall-back to standard shared memory. This initial change uses DRM directly but is structured in a way that would allow the allocator to be replaced by minigbm with minimal effort. BUG=chromium:837209 TEST=crosvm finds drm device and returns valid dmabufs to guest Change-Id: Ic1fd776dfdfefae2d7b321d449273ef269e9cc62 Reviewed-on: https://chromium-review.googlesource.com/1034088 Commit-Ready: David Reveman <reveman@chromium.org> Tested-by: David Reveman <reveman@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* gpu_buffer: create bindings to minigbmZach Reizner2018-05-08
| | | | | | | | | | | | | | | These bindings are needed to allocate dmabufs that will be used for accelerated rendering and zero-copy virtio-wayland support. TEST=cargo test -p gpu_buffer BUG=chromium:837073 Change-Id: I96d7bcdeaa1eda616a25fdcfedcbb734cd585ae7 Reviewed-on: https://chromium-review.googlesource.com/1029410 Commit-Ready: David Reveman <reveman@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* crosvm: aarch64 guest supportSonny Rao2018-04-03
| | | | | | | | | | | | | | | | | | | - removes old ARMv7a (32-bit) bindings as we're only supporting aarch64 guests right now - switches both ARMv7 and aarch64 builds to use aarch64 kvm bindings - adds support for ARMv8 Linux guest with dynamic flattened-device-tree CQ-DEPEND=990894 BUG=chromium:797868 TEST=./build_test passes on all architectures TEST=crosvm runs on caroline TEST=crosvm runs on kevin built with USE="kvm_host" Change-Id: I7fc4fc4017ed87fd23a1bc50e3ebb05377040006 Reviewed-on: https://chromium-review.googlesource.com/969987 Commit-Ready: Sonny Rao <sonnyrao@chromium.org> Tested-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* plugin: allow retrieving and setting VM and VCPU statesDmitry Torokhov2018-03-30
| | | | | | | | | | | | | This change allows plugin to retrieve and set various VM and VCPU states: interrupt controller, PIT, LAPIC and MP state. BUG=b:76083711 TEST=cargo test -p kvm Change-Id: Ie32a67b0cd4a1f0a19ccd826a6e1c9dc25670f95 Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/986511 Reviewed-by: Zach Reizner <zachr@chromium.org>
* crosvm: create a LinuxArch trait and use it for x86Sonny Rao2018-03-15
| | | | | | | | | | | | | | | | | | | | | This creates a trait that different architectures can implement to support running Linux VMs. In the implementation on X86 we remove some error and return errors from lower-level modules as appropriate. These modules now implement the Error trait so we can get meaningful descriptions without an extra error from the calling function. This still keeps all the ifdefs in linux.rs for now until we have another implementation to use for ARM. BUG=chromium:797868 TEST=./build_test passes on all architectures TEST=crosvm runs on caroline Change-Id: If24bcc83e25f9127d6aea68f9272e639296aad8b Reviewed-on: https://chromium-review.googlesource.com/952368 Commit-Ready: Sonny Rao <sonnyrao@chromium.org> Tested-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* plugin: add crosvm_net_get_configStephen Barber2018-03-08
| | | | | | | | | | | BUG=none TEST=sudo cargo test --features plugin Change-Id: Ib38fad250295d73529dff0451345b4274a261073 Reviewed-on: https://chromium-review.googlesource.com/911943 Commit-Ready: Stephen Barber <smbarber@chromium.org> Tested-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* sys_util: custom derive for PollTokenZach Reizner2018-03-07
| | | | | | | | | | | | | | | | Using an enum implementing PollToken is the recommended way to use PollContext, but writing the trait impls for each enum is mechanical yet error prone. This is a perfect candidate for a custom derive, which automates away the process using a simple derive attribute on an enum. BUG=chromium:816692 TEST=cargo test -p sys_util Change-Id: If21d0f94f9af4b4f6cef1f24c78fc36b50471053 Reviewed-on: https://chromium-review.googlesource.com/940865 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
* crosvm: move x86_64 arch specific stuff into the x86_64 crateSonny Rao2018-03-02
| | | | | | | | | | | | | | | | | This is in preparation to make different architectures implement a trait, but for now it's just moving code out of linux.rs and into x86_64 trait. A few new functions were required which will become part of the trait interface. There's still a lot of ugly ifdefs everywhere that should go away in subsequent CLs. BUG=chromium:797868 TEST=./build_test TEST=run crosvm on caroline Change-Id: Ifc95d4eb84f64ebacb4481a172524d94dc96b7bb Signed-off-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/942084 Reviewed-by: Zach Reizner <zachr@chromium.org>
* allow plugin to query KVM for supported/emulated CPUIDsDmitry Torokhov2018-02-28
| | | | | | | | | | | | | This plumbs calls to KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID to be available to plugins. TEST=cargo test --features plugin; cargo test -p kvm BUG=chromium:800626 Change-Id: I98879599b5f970c6c2720772658689a505d8abe1 Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/938674 Reviewed-by: Zach Reizner <zachr@chromium.org>
* plugin_proto: add helpers to convert CPUID data between KVM and protobufDmitry Torokhov2018-02-27
| | | | | | | | | | | | | We need to convert between protobuf and KVM format of cpuid data in several places, so let's add helpers to plugin_proto crate. TEST=cargo test --features plugin; cargo test -p kvm BUG=chromium:800626 Change-Id: Ida7b59825d2146b0d02711e441f477d90dd4263a Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/939660 Reviewed-by: Zach Reizner <zachr@chromium.org>
* crosvm: move device_manager to it's own crateSonny Rao2018-02-26
| | | | | | | | | | | | | I will be refactoring this code to mostly live in the architecture code, but for now it's simpler to move it out into it's own crate. BUG=chromium:797868 TEST=./build_test passes on all architectures TEST=crosvm runs on caroline Change-Id: I85c12696fcd5cbef6a72a6dcbc484a443e0b0784 Signed-off-by: Sonny Rao <sonnyrao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/933084
* allow plugin to query for KVM extensionsZach Reizner2018-02-12
| | | | | | | | | | | | | | The guest may need to check for KVM extensions before blindly using them. TEST=cargo test --features plugin; cargo test -p kvm; ./build_test BUG=chromium:800626 Change-Id: If87b928753cd71adeabac4fc7732c3fce7265834 Reviewed-on: https://chromium-review.googlesource.com/906008 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* add plugin support for configuring CPUIDZach Reizner2018-02-12
| | | | | | | | | | | | | | The guest expects to be able to read the CPUID, so the plugin process needs to specify what the CPUID for each VCPU will have. TEST=cargo test --features plugin; ./build_test BUG=chromium:800626 Change-Id: I9258540ab2501126c3d8cadbd09b7fc01d19f7a9 Reviewed-on: https://chromium-review.googlesource.com/906006 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* allow non-dirty log memory regions from the plugin processZach Reizner2018-02-12
| | | | | | | | | | | | | | | Dirty logging is not necessary for every memory region, so the plugin process should be able to specific exactly which regions it would like dirty logging enabled for. TEST=cargo test --features plugin BUG=chromium:800626 Change-Id: I28b8285357e7de1c8c3a1392bdfdb4853ec5a654 Reviewed-on: https://chromium-review.googlesource.com/900294 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* add plugin support for model specific registersZach Reizner2018-02-12
| | | | | | | | | | | | | | The MSRs are useful for booting a full operating system that requires them. TEST=cargo test --features plugin; cargo test -p kvm; ./build_test BUG=chromium:800626 Change-Id: I817fbf3e6868c85b373808bd48e568b5b2b458eb Reviewed-on: https://chromium-review.googlesource.com/897412 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>