summary refs log tree commit diff
path: root/devices
Commit message (Collapse)AuthorAge
* 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>
* devices: usb: remove unused imports in testsDaniel Verkamp2019-04-10
| | | | | | | | | | | | | | Clean up warnings when building tests. BUG=None TEST=cargo test -p devices; FEATURES=test emerge-nami crosvm Change-Id: I0efe723fee37c822a6bdd4a88766b37d559833d8 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1560092 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
* Wrap the UnixSeqpacket with a more descriptive type.Jakub Staron2019-04-10
| | | | | | | | | | | | | | | | Host/device sockets are now created as a pairs of MsgSockets instead of UnixSeqpacket sockets. BUG=chromium:950663 TEST=cargo check TEST=cargo test Change-Id: I8f61a711fe3c2547bf5d18fcfa23bfd0dc0ef5fd Reviewed-on: https://chromium-review.googlesource.com/1559041 Commit-Ready: Jakub Staroń <jstaron@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Jakub Staroń <jstaron@google.com> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* edition: Use 2018-style paths in devices crateDavid Tolnay2019-04-09
| | | | | | | | | | | | | | | | These are import paths in new code added since CL:1513054 that need to be made compatible with 2018 edition's treatment of paths. TEST=cargo check TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu Change-Id: Icb3ecf2fb2015332e0c03cdc22bff2ecab2c40df Reviewed-on: https://chromium-review.googlesource.com/1559264 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>
* cargo: Sort all dependency lists in Cargo.tomlDavid Tolnay2019-04-09
| | | | | | | | | | | | | | | This may help reduce cases of conflicts between independent CLs each appending a dependency at the bottom of the list, of which I hit two today rebasing some of my open CLs. TEST=cargo check --all-features Change-Id: Ief10bb004cc7b44b107dc3841ce36c6b23632aed Reviewed-on: https://chromium-review.googlesource.com/1557172 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* edition: Use dyn syntax for trait objectsDavid Tolnay2019-04-08
| | | | | | | | | | | | | | | | | | | | | Found by running: `cargo rustc -- -D bare_trait_objects` Bare trait objects like `&Trait` and `Box<Trait>` are soft-deprecated in 2018 edition and will start warning at some point. As part of this, I replaced `Box<Trait + 'static>` with `Box<dyn Trait>` because the 'static bound is implied for boxed trait objects. TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu TEST=local kokoro Change-Id: I41c4f13530bece8a34a8ed1c1afd7035b8f86f19 Reviewed-on: https://chromium-review.googlesource.com/1513059 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>
* Add PIC device.Miriam Zimmerman2019-04-03
| | | | | | | | | | | | | | | | | | The PIC device that this commit provides isn't quite complete: It needs to interact with a userspace APIC in order to properly route interrupts, but crosvm does not yet have a userspace APIC. In the interest of not making this CL too much larger, the userspace APIC implementation will come in a future CL. BUG=chromium:908689 TEST=Unit tests in file. Integration testing is blocked on rest of split-irqchip being implemented. Change-Id: Id1f23da12fa7b83511a2a4df895b0cfacdbc559e Reviewed-on: https://chromium-review.googlesource.com/1475057 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* devices: gpu: Silently accept empty command buffers.David Riley2019-04-03
| | | | | | | | | | | | | | Prior to this change empty command buffers would generate errors and syslogs. BUG=None TEST=glbench nop_virtgpu_execbuffer test Change-Id: I456fb342c945beebe121e22543bd93fe41cc5cbe Reviewed-on: https://chromium-review.googlesource.com/1532796 Commit-Ready: David Riley <davidriley@chromium.org> Tested-by: David Riley <davidriley@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* fix endpoint id in set tr dequeue pointerJingkui Wang2019-03-30
| | | | | | | | | | | | | | We were lucky that adb does not trigger this code path, but Arduino do. BUG=None TEST=local build, deploy and run Change-Id: I0cf02c5de0a73af4e5cb6f5b668cef6606ed166b Reviewed-on: https://chromium-review.googlesource.com/1542032 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* devices: block: report block size in configDaniel Verkamp2019-03-28
| | | | | | | | | | | | | | | | | Set up the infrastructure for reporting block size in the virtio-blk device model. For now, we'll keep reporting SECTOR_SIZE (512), which is the default block size that is assumed if we don't report it. This prepares us to easily switch the reported block size in the future. BUG=chromium:942700 TEST=Boot Crostini on nami with an existing VM and container Change-Id: I983817743c40e8278fe6cb9a10498011a8887ec9 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1526334 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Validate and configure tap interfaces from --tap_fdJorge E. Moreira2019-03-28
| | | | | | | | | | | | | | | | Checks for the IFF_NO_PI and IFF_VNET_HDR flags, failing if those are not set. Sets the offload and vnet header sizes to the required values, instead of trusting the values on the interface. Bug=b/128686192 Change-Id: Ibbbfbf3cdedd6e64cdcfb446bcdfb26b4fd38395 Reviewed-on: https://chromium-review.googlesource.com/1526771 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
* pci: match pci cap structs with linux/virtio_pci.hDaniel Prilik2019-03-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VirtioPciCap omits the `cap_vndr` and `cap_next` fields from it's definition, deferring the instantiation of these bytes to the add_capability method in PCI configuration. There is even a comment on add_capability that mentions this omission. Unfortunately, comments tend not to be read, and mismatches between the linux headers and crosvm structures can result in some subtle and tricky to debug bugs, especially when implementing other types of virtio capabilties that subsume VirtioPciCap. Case in point, when implementing the VirtioPciShmCap (used by virtio-fs), this subtle mismatch resulted in a bug where an additional 2 bytes of padding were inserted between the `cap` member and the `offset_hi` member (see CL:1493014 for the exact struct). Since the cap_len field was instantiated using mem::sizeof Self, the additional padding just-so-happened to be the perfect ammount to sneak past the sanity checks in add_capabilities. The bug manifested itself by shifting over the length_hi field by 16 bits, resulting in much larger than expected cache sizes. This CL brings the VirtioPciCap structures in-line with their linux/virtio_pci.h counterparts, marking the structures as repr(C) (as opposed to repr(packed)) and leaving the cap_vndr and cap_next members in the struct, noting that they will be automatically populated in add_capability. BUG=chromium:936567 TEST=cargo test -p devices, boot vm Change-Id: Ia360e532b58070372a52346e85dd4e30e81ace7a Reviewed-on: https://chromium-review.googlesource.com/1540397 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* devices: improve get_device_bars/caps interfaceDaniel Prilik2019-03-28
| | | | | | | | | | | | | | | | Removes an unnecessary Option from the return type. Also added a note about moving PCI methods out of the VirtioDevice trait, as the trait shouldn't be tied to any particular transport layer. BUG=chromium:936567 TEST=cargo build --features=gpu Change-Id: I2c75c830bbe2d2b4a15461e8497535c526775bbe Reviewed-on: https://chromium-review.googlesource.com/1536206 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* devices: gpu: use render optimized buffersGurchetan Singh2019-03-26
| | | | | | | | | | | | | | | | | | Using non-linear buffer seems to be safe based on the apps I've tested. This is similiar to the ARC++ use case, which also doesn't explicitly send modifiers to Chrome. BUG=chromium:945033 TEST=clear_clear goes from 980 mpixels --> 6797.90 mpixels on Nami Change-Id: I2dcb78366c2d2d83d64bb23f6da1f07c8747819c Reviewed-on: https://chromium-review.googlesource.com/1538463 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Riley <davidriley@chromium.org> Reviewed-by: Chia-I Wu <olv@google.com> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
* crosvm: add memfd for GuestMemoryDaniel Prilik2019-03-25
| | | | | | | | | | | | | | | | | Building off CL:1290293 Instead of having a seperate GuestMemoryManager, this adds SharedMemory as a Arc'd member of GuestMemory. This is nice since it removes the need to plumb the Manager struct throughout the codebase. BUG=chromium:936567 TEST=cargo test -p sys_util Change-Id: I6fa5d73f7e0db495c2803a040479818445660345 Reviewed-on: https://chromium-review.googlesource.com/1493013 Commit-Ready: Daniel Prilik <prilik@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@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>
* usb: remove unused/abused fd argument from EventHandler::on_eventZach Reizner2019-03-18
| | | | | | | | | | | | | | | | | | None of instances of EventHandler::on_event actually used the fd. The PollfdChangeHandler::remove_poll_fd callback fabricated a potentially valid fd (0), which went undetected because nobody used it. Additionally, using RawFds almost always requires unsafe and should be avoided. CQ-DEPEND=CL:1522214 BUG=chromium:831850 TEST=cargo test Change-Id: I095edbcad317e4832b1fb29fd08d602fbde4fd5d Reviewed-on: https://chromium-review.googlesource.com/1525135 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Jingkui Wang <jkwang@google.com>
* usb: remove unused usb-emulation feature flagZach Reizner2019-03-17
| | | | | | | | | | | | | | This cleans up some feature flag plumping for libusb sandboxing as well. BUG=chromium:831850 TEST=cargo test CQ-DEPEND=CL:1512762 Change-Id: Ic70784db204ddced94498944b021bcb7dd708bb1 Reviewed-on: https://chromium-review.googlesource.com/1522214 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Jingkui Wang <jkwang@google.com>
* implement xhci and add it to pci busJingkui Wang2019-03-17
| | | | | | | | | | | | | | Implement xhci controller, setup seccomp filters and add xhci to pci bus. CQ-DEPEND=CL:1512761 BUG=chromium:831850 TEST=local build Change-Id: I5c05452ece66e99d3a670e259e095fca616e835d Reviewed-on: https://chromium-review.googlesource.com/1512762 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Jingkui Wang <jkwang@google.com>
* usb: add host backendJingkui Wang2019-03-16
| | | | | | | | | | | | | | | | | | Host backend implement backend device. It will attach a read device to xhci controller. Also squashed from ce6b35, author: zachr@. CQ-DEPEND=CL:1510820 BUG=chromium:831850 TEST=local build Change-Id: Idcf2d7d6aca92de9859b7c38d1bf1d98032eae91 Reviewed-on: https://chromium-review.googlesource.com/1512761 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* usb: Add device slot, command ring and transfer ringJingkui Wang2019-03-16
| | | | | | | | | | | | | | | | Device can be assigned to slot. Command ring handles usb commands, transfer ring handles usb transfers. CQ-DEPEND=CL:1510819 BUG=chromium:831850 TEST=cargo test Change-Id: Ib0836ee518d1c7a3e902630c7ea04e29b9496c80 Reviewed-on: https://chromium-review.googlesource.com/1510820 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* usb: add usb hub, transfer and usb backend interfaceJingkui Wang2019-03-16
| | | | | | | | | | | | | | | Those are bridges between xhci and backend. CQ-DEPEND=CL:1510818 BUG=chromium:831850 TEST=cargo test Change-Id: I04feab449d48b0c908aeebfda08d1869239cbe6f Reviewed-on: https://chromium-review.googlesource.com/1510819 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* usb: add ring buffer and ring buffer controllerJingkui Wang2019-03-16
| | | | | | | | | | | | | | for ring buffer, guest kernel is producer and crosvm is consumer CQ-DEPEND=1510817 BUG=chromium:831850 TEST=cargo test Change-Id: Ib62d2b42de1a77ff71ca0e2a0066feacc56dddc1 Reviewed-on: https://chromium-review.googlesource.com/1510818 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Add IOAPIC device skeleton.Miriam Zimmerman2019-03-16
| | | | | | | | | | | | | | | | | | This CL adds some necessary constants and types, as well as a few skeleton function declarations, for an IOAPIC device. I'm sending this CL first in the interest of minimizing CL size and making future CLs easier to review. TEST=Built BUG=chromium:908689 Change-Id: Ib8ae37e0092c31d7cb8073070f9592baed236323 Reviewed-on: https://chromium-review.googlesource.com/1520809 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: David Tolnay <dtolnay@chromium.org>
* usb: Verify usb_debug args even when not loggingDavid Tolnay2019-03-16
| | | | | | | | | | | | | | | | | | Implementing this macro by ignoring the args and expanding to nothing makes it possible to pass invalid args like `usb_debug!("{}")`. Use `if false` instead to ensure that the args are valid formatter args. As part of this, fix a call to a non-existent function inside one of the usb_debug invocations. TEST=cargo check devices Change-Id: Id82dad7b021060dce7b4d3b828bbd21aaa6ef410 Reviewed-on: https://chromium-review.googlesource.com/1518730 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jingkui Wang <jkwang@google.com>
* register_space: Only run panic test when debug assertions are onChirantan Ekbote2019-03-13
| | | | | | | | | | | | | | | | | | The regs_reg_overlap() test is a panic test but the function that it is testing only uses debug_asserts so the test will fail if debug assertions are disabled. Only run the test when debug assertions are enabled. BUG=chromium:940668 TEST=`FEATURES=test USE=-cros-debug emerge-nami crosvm` Change-Id: Ie722cb49908ae4c4a9ecc5f248a6ec25fbcc05c9 Reviewed-on: https://chromium-review.googlesource.com/1518729 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* edition: Update absolute paths to 2018 styleDavid Tolnay2019-03-13
| | | | | | | | | | | | | | | | | | | | | | | | | | This is an easy step toward adopting 2018 edition eventually, and will make any future CL that sets `edition = "2018"` this much smaller. The module system changes in Rust 2018 are described here: https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html Generated by running: cargo fix --edition --all in each workspace, followed by bin/fmt. TEST=cargo check TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu Change-Id: I000ab5e69d69aa222c272fae899464bbaf65f6d8 Reviewed-on: https://chromium-review.googlesource.com/1513054 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>
* add scatter gather bufferJingkui Wang2019-03-13
| | | | | | | | | | | | | | | | scatter gather buffer is a buffer with segments. CQ-DEPEND=CL:1510816 BUG=chromium:831850 TEST=cargo test Change-Id: Iea54d5b3d6f9194113f6237eb14aafab71ca2ff9 Reviewed-on: https://chromium-review.googlesource.com/1510817 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* usb: add interrupter and resample handler for xhciJingkui Wang2019-03-13
| | | | | | | | | | | | | | | | Interrupter owns event ring and send interrupt. Resample handler will reassert interrupt when resample happens. CQ-DEPEND=CL:1510815 BUG=chromium:831850 TEST=local build Change-Id: If2c4349e50d0ab275f29dfa48b0860c86f0c8ea3 Reviewed-on: https://chromium-review.googlesource.com/1510816 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Jingkui Wang <jkwang@google.com>
* allow dead code for usb modulesJingkui Wang2019-03-13
| | | | | | | | | | | | | | This will remove warning messages for dead code. TEST=run crosvm locally BUG=chromium:831850 CQ-DEPEND=CL:1510814 Change-Id: Ia5c8768647737e3091e1a0b5e435d3c25bbbe383 Reviewed-on: https://chromium-review.googlesource.com/1510815 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Jingkui Wang <jkwang@google.com>
* devices: compile usb module and update current codeJingkui Wang2019-03-13
| | | | | | | | | | | | | | | | | | | This patch did the following: start compile usb module fix register macro update error handling reformat code update xhci reg setup to support usb3 and usb2 BUG=chromium:831850 TEST=local build CQ-DEPEND=CL:1510813 Change-Id: I851cf02d01ae6e988b2628552cf57c1f43aa86c8 Reviewed-on: https://chromium-review.googlesource.com/1510814 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Jingkui Wang <jkwang@google.com>
* Add usb log macroJingkui Wang2019-03-13
| | | | | | | | | | | | | | | Usb implementation will use usb_debug to log verbose debug logs. It will be turned off by default. BUG=chromium:831850 TEST=local build Change-Id: Ieaa22e57e624841a5f78a6a1a1874351bbd77a86 Reviewed-on: https://chromium-review.googlesource.com/1510813 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* add utils for device implementationsJingkui Wang2019-03-13
| | | | | | | | | | | | | | | | | event_loop: event loop based on poll context. async_job_queue: queue a job, it will be invoked on event loop. This could be used to invoke a function without holding any locks. BUG=chromium:831850 TEST=local build Change-Id: Iab61ac43221bf5d635a0138073d7f88401e5ab07 Reviewed-on: https://chromium-review.googlesource.com/1509852 Commit-Ready: Jingkui Wang <jkwang@google.com> Tested-by: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Add tests for virtio input deviceJorge E. Moreira2019-03-12
| | | | | | | | | | | | | These tests would have caught chromium:939585 Test=cargo test -p devices Change-Id: If980fe8b56b9d76e77b652fb727b8849dbedd9cc Reviewed-on: https://chromium-review.googlesource.com/1512759 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Jorge Moreira Broche <jemoreira@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* devices: PCI: add capabilities callbackDaniel Prilik2019-03-11
| | | | | | | | | | | | | virtio devices should be able to specify capabilities BUG=chromium:936567 TEST=boot vm Change-Id: I049f9967eb59a7904528fff5aea844e30c636e28 Reviewed-on: https://chromium-review.googlesource.com/1493012 Commit-Ready: Daniel Prilik <prilik@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Stephen Barber <smbarber@chromium.org>
* Add a (single touch only) touch screen input deviceJorge E. Moreira2019-03-09
| | | | | | | | | | | | Very similar to the trackpad device, it has the INPUT_PROP_DIRECT property and does not support any buttons, just touch events. Change-Id: I2c963013e402ff2aa1b4b529c6c494dd57f4add9 Reviewed-on: https://chromium-review.googlesource.com/1509697 Commit-Ready: Jorge Moreira Broche <jemoreira@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* crosvm: PIT: Remove debug! logs.Miriam Zimmerman2019-03-08
| | | | | | | | | | | | BUG=chromium:908689 TEST=None Change-Id: I5bd59e294b8bb48d99cac0752ddd5058987bf79c Reviewed-on: https://chromium-review.googlesource.com/1503665 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* Input device: Don't send more events than received from the sourceJorge E. Moreira2019-03-08
| | | | | | | | | | Bug=chromium:939585 Change-Id: Ie7215da519b2f92ab3ef35dc401a83fa98808b37 Reviewed-on: https://chromium-review.googlesource.com/1509855 Commit-Ready: Jorge Moreira Broche <jemoreira@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* devices: PCI: fix underflow for 64 bit BAR configDaniel Prilik2019-03-08
| | | | | | | | | | | | | | | underflow occurs when configuring a 64 bit register with a <33 bit address. BUG=chromium:924405 TEST=boot VM Change-Id: I53a309b7bff3c91012bacb12d9fc9f8ceed68699 Reviewed-on: https://chromium-review.googlesource.com/1493011 Commit-Ready: Daniel Prilik <prilik@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* rename mmio_space to register spaceJingkui Wang2019-03-08
| | | | | | | | | | | | | | | | rename mmio_space to register_space, mmio_register to register. BUG=chromium:831850 TEST=local build CQ-DEPEND=CL:1509515 Change-Id: Ia229be984d38ca8445828fdfa132bdbbedb74c33 Reviewed-on: https://chromium-review.googlesource.com/1509516 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* register_space: fix u64 write callbackJingkui Wang2019-03-08
| | | | | | | | | | | | | | | u64 register callback will only be invoked when the write is done. BUG=chromium:831850 TEST=local build CQ-DEPEND=CL:1509514 Change-Id: Id0be69535898fdcc4ba24d3151df7a5107a2725b Reviewed-on: https://chromium-review.googlesource.com/1509515 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* register_space: use sync::Mutex instead of std::sync::MutexJingkui Wang2019-03-08
| | | | | | | | | | | | | Then we don't need to unwrap BUG=chromium:831850 TEST=cargo test CQ-DEPEND=CL:1506828 Change-Id: I4200ea6351d61df1974e5e4c8583e783b21ea0eb Reviewed-on: https://chromium-review.googlesource.com/1509514 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Jingkui Wang <jkwang@google.com> Reviewed-by: Jingkui Wang <jkwang@google.com>
* Move and rename mmio_register to devices/srcJingkui Wang2019-03-08
| | | | | | | | | | | | | | A later CL will rename structs. BUG=chromium:831850 TEST=local build Change-Id: I8cf70da16918035a6fad2e925f91a315693ff1ed Reviewed-on: https://chromium-review.googlesource.com/1506828 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Jingkui Wang <jkwang@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* PCI: Return results from pci setup functionsDylan Reid2019-03-06
| | | | | | | | | | | | | | | | Enough failure cases have been added to `add_pci_bar` and `add_pci_capabilities` that they should return unique errors instead of an `Option`. BUG=none TEST=cargo test in devices Signed-off-by: Dylan Reid <dgreid@chromium.org> Change-Id: Ice2a06d2944011f95707f113f9d709da15c90cfe Reviewed-on: https://chromium-review.googlesource.com/1497740 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* Don't grab input devices created from sockets.Jorge E. Moreira2019-03-06
| | | | | | | | | | | | The grab ioctl only makes sense for event devices. Bug=chromium:938760 Change-Id: I6b0c170185c40de37451a5f3efd2071491eb49a6 Reviewed-on: https://chromium-review.googlesource.com/1504777 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* virtio-gpu: add a BAR for deviceGurchetan Singh2019-03-05
| | | | | | | | | | | | BUG=chromium:924405 TEST=compile Change-Id: I8a583df2a9db4ea7e066eb284eac54fc62580350 Reviewed-on: https://chromium-review.googlesource.com/1480744 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* ac97: Add top level unit testDylan Reid2019-03-04
| | | | | | | | | | | Check that the device can be created. This test would have caught the bug with adding pci bars. Change-Id: Ib0cc2edf0d8d1b2d95d9c3588ac325b5da886603 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1497738 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
* error: Consistently use Display instead of error description()David Tolnay2019-03-02
| | | | | | | | | | | | | | | | The description method is deprecated and its signature forces less helpful error messages than what Display can provide. BUG=none TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu Change-Id: I27fc99d59d0ef457c5273dc53e4c563ef439c2c0 Reviewed-on: https://chromium-review.googlesource.com/1497735 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* ac97: Fix setting the pci configDylan Reid2019-03-02
| | | | | | | | | | | | | When switching to PciBarConfiguration, the set_* functions were changed to return self. The self for register index 1 was not being used. TEST=boot a VM and check that there isn't a pci bus creation error. Change-Id: I8d5162c70fcec1159a6283e26e744d0c3c76b804 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1497737 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>