summary refs log tree commit diff
path: root/resources/src
Commit message (Collapse)AuthorAge
* Merge remote-tracking branch 'origin/master'Alyssa Ross2020-06-14
|\
| * resources: add address_from_pci_offset functionGurchetan Singh2020-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor current code and add tests. BUG=chromium:924405 TEST=compile and test Change-Id: I9476f3a4ffd8ae85fc95d6889ada6b056613bbfa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2216447 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
* | Merge remote-tracking branch 'origin/master'Alyssa Ross2020-06-14
|\|
| * resources: release support for address_allocatorTomasz Jeznach2020-05-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support for address_allocator by-alloc release. Address regions coalescing is performed at the release time. BUG=None TEST=cargo test -p resources && tast test vm.* Change-Id: Ibd39dac923d1b2f8b6a711d2a9fcbb662fc95bdc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2209171 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
| * resources: allocate_at support for address_allocatorTomasz Jeznach2020-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support for address range allocation at specific location and size. Allocation is successful only if requested range is available and free. Change to address_allocator allocation algorithm from contiguous memory allocation to first-fit like implementation to allow memory release/reuse in future. BUG=None TEST=cargo test -p resources && tast test vm.* Change-Id: I58218f5a2c6a215152904cc1cf0748e842fa7374 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2203297 Tested-by: Tomasz Jeznach <tjeznach@chromium.org> Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
* | Merge remote-tracking branch 'origin/master'Alyssa Ross2020-05-10
|\|
| * devices: pci: refactor PCI devices to use PciAddress.Tomasz Jeznach2020-05-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Simple refactor of PCI device addressing to use PciAddress type providing bus:device.function number. BUG=None TEST=build_test & tast run crostini.Sanity Change-Id: I7755ad6b31aa8c882475cd8212630e1cc86ef49e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2172766 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
| * Remove redundant single-component importsDaniel Verkamp2020-04-26
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix clippy 1.43.0 clippy::single-component-path-imports warnings. BUG=None TEST=bin/clippy Change-Id: I3f4f54138bedce16dc1ca937bb8bc00a94594f69 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2163203 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
* | 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: pstore works for ARCVM on x86_64Kansho Nishida2020-02-03
| | | | | | | | | | | | | | | | Adds support for pstore on ARCVM on x86_64. The backend file of the buffer will be passed via argument of the crosvm. BUG=b:144962428 TEST=kernel crash on eve-arcvm, check /sys/fs/pstore/console-ramoops-0 Launch crostini manually on eve-arcvm Change-Id: I29492ac7a9067aa2ae23eb03fbb942ab7dd3aa8d Signed-off-by: Kansho Nishida <kansho@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1973391 Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Kansho Nishida <kansho@chromium.org>
* resource: Rename device memory to mmioXiong Zhang2019-11-10
| | | | | | | | | | | | | | Since unified allocator is used to allocate mmio, this patch remove the device memory name, and rename device to mmio. BUG=chromium:992270 TEST=this patch doesn't change function, run build_test Change-Id: I234b0db4b3c5de8cfee372ace5212a980564d0c7 Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1895234 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* Resource: Unify mmio allocatorXiong Zhang2019-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | Current mmio and device two allocators exist, the purpose to define two allocator is: Accessing to gpa from mmio allocator cause vm exit, while gpa from device allocator doesn't cause vm exit. Whether vm exits exist or not, dependency on whether vm->add_device_memory() is called with gpa from allocator or not.Even if gpa is from mmio alloator, and vm->add_device_memory() is called with this gpa, accessing this gpa won't cause vm exit. So mmio allocator and device allocator couldn't guarantee the original purpose. This patch unify mmio allocator and device allocator into one mmio allocator. BUG=chromium:992270 TEST=this patch doesn't change function, so just run build_test Change-Id: If87d5c2838eb122ef627fa45c394b1b3ccfafeb0 Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1895233 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
* Add explicit `dyn` for trait objectsDaniel Verkamp2019-10-17
| | | | | | | | | | | | | | | Fix "trait objects without an explicit `dyn` are deprecated" warnings introduced in Rust 1.38. BUG=None TEST=emerge-nami crosvm Change-Id: I8ca6aa747475268ae898adddd5d091d401326ceb Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1862999 Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
* vm_control: support registering memory at a specific addressGurchetan Singh2019-10-01
| | | | | | | | | | | | | | | | | | The guest kernel will allocate from PCI range of the virtgpu device, and send physical addresses via a hypercall. Right now, only support buffers that can be mmap'ed. We could add optimizations for GBM buffers later if needed. BUG=chromium:924405 TEST=compile Change-Id: I094de96a2c35bcd2e18c8a6a2d8cdc39bb392e36 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1626794 Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* crosvm: virtio-pmem deviceJakub Staron2019-06-05
| | | | | | | | | | | | | | | | | | | | Adds support for virtio-pmem device as an alternative for virtio-blk. Exposing disk image to guest as virtio-blk device results in both guest and host independently caching the disk I/O. Using virtio-pmem device allows to mount disk image as direct access (DAX) in the guest and thus bypass the guest cache. This will reduce memory foodprint of the VMs. BUG=None TEST=cargo test TEST=Boot patched termina kernel in crosvm; mount virtio-pmem device as DAX and run xfstests. Change-Id: I935fc8fc7527f79e5169f07ec7927e4ea4fa6027 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1605517 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Jakub StaroĊ„ <jstaron@google.com>
* resources+pci: allocator rework (allocation tags)Daniel Prilik2019-04-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | AddressAllocator now maintains a HashMap<Alloc, (u64, u64, u64)>, which uniquely maps a Allocation enum (e.g: PciBar(bus, dev, bar), GpuRenderNode, etc...) to it's address, size, and human-readable tag / description. The interface has also been modified to use Error instead of Option. Aside from improving debugging, tracking allocations will have numerous uses in the future. For example, when allocating guest memory over VmControl sockets, it will be possible to restrict allocations to pre-allocated slices of memory owned by the requesting device. To plumb through PCI information to PCI devices, this CL necessitated the addition of a PciDevice method called `assign_bus_dev`, which notifies PCI devices of their uniquely assigned Bus and Device numbers. BUG=chromium:936567 TEST=cargo test -p resources && cargo build --features="gpu gpu-forward" Change-Id: I8b4b0e32c6f3168138739249ede53d03143ee5c3 Reviewed-on: https://chromium-review.googlesource.com/1536207 Commit-Ready: Daniel Prilik <prilik@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* resources: add build method to SystemAllocatorDaniel Prilik2019-04-17
| | | | | | | | | | | | | | | | | | AddressRanges' name doesn't suggest that it's a SystemAllocator builder. This CL renames it to SystemAllocatorBuilder, and adds a SystemAllocator::builder() that removes the need to have a separate import for the Builder. A minor change, but it cleans up the interface a bit. BUG=chromium:936567 TEST=cargo test -p resources && cargo build Change-Id: I6d14368490c0d3c4018858f541e4ae5390995878 Reviewed-on: https://chromium-review.googlesource.com/1540398 Commit-Ready: Daniel Prilik <prilik@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
* edition: Remove extern crate linesDavid Tolnay2019-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Rust 2018 edition, `extern crate` is no longer required for importing from other crates. Instead of writing: extern crate dep; use dep::Thing; we write: use dep::Thing; In this approach, macros are imported individually from the declaring crate rather than through #[macro_use]. Before: #[macro_use] extern crate sys_util; After: use sys_util::{debug, error}; The only place that `extern crate` continues to be required is in importing the compiler's proc_macro API into a procedural macro crate. This will hopefully be fixed in a future Rust release. extern crate proc_macro; TEST=cargo check TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu TEST=local kokoro Change-Id: I0b43768c0d81f2a250b1959fb97ba35cbac56293 Reviewed-on: https://chromium-review.googlesource.com/1565302 Commit-Ready: David Tolnay <dtolnay@chromium.org> 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>
* 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>
* 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>
* resources: re-alphabetize importsDaniel Verkamp2019-01-13
| | | | | | | | | | | | | | | After removing a #[macro_use], rustfmt wants to reorder the block of 'extern crate' statements. BUG=None TEST=cargo fmt --all -- --check Change-Id: I3489d7253bca4abcf7c01494f32a92a3ce46c6f8 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1407209 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: David Tolnay <dtolnay@chromium.org>
* Remove unused #[macro_use] attributesDaniel Verkamp2019-01-10
| | | | | | | | | | | | | This removes two unused import warnings. BUG=None TEST=cargo build produces no warnings Change-Id: I0d1ac9d13d6ae0fc620b9c2d561972f23cdc27e3 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1394724 Reviewed-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
* wl: silence unused code warningsDaniel Verkamp2018-11-21
| | | | | | | | | | | | When wl-dmabuf is not enabled, rustc complains about unused imports and enum values. Add compiler directives to silence the warnings. BUG=None TEST='cargo build', 'emerge-nami crosvm' Change-Id: Ib39735d329f8aa835c0b5842b10bfe78d0e578d9 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1327827
* 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>
* cargo fmt all source codeZach Reizner2018-10-09
| | | | | | | | | | | | | | Now that cargo fmt has landed, run it over everything at once to bring rust source to the standard formatting. TEST=cargo test BUG=None Change-Id: Ic95a48725e5a40dcbd33ba6d5aef2bd01e91865b Reviewed-on: https://chromium-review.googlesource.com/1259287 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>
* resources: fix allocator doc testsDylan Reid2018-09-10
| | | | | | | Change-Id: I5a9b7460fc798d9abf1ad1f452233fe76c449b29 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1208151 Reviewed-by: Dylan Reid <dgreid@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
* 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>