The second block of OsStr and PciAddress parsing into host_addr was an
exact duplicate of code earlier in the function. Reuse the existing
host_addr variable instead of parsing it again.
BUG=None
TEST=tools/presubmit
Change-Id: I1cd65701a07636daa6e537d97abff808397d3181
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3488160
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add error checking so invalid user input does not get silently ignored
and converted into bogus addresses.
Also add a PciAddress::new() function that accepts numeric values and
checks their ranges as a helper for the string parsing function as well
as for general use in other cases.
BUG=None
TEST=cargo test -p devices pci_address
Change-Id: I1131716bfd99e1819e7630021048482c2397b137
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3475440
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
cargo fmt will only format those files that are referenced by
crosvm. To really catch all files in our source tree, we need to
run rustfmt directly.
This will check files multiple times, since rustfmt will follow
included modules. But is still faster that cargo fmt.
To run these in parallel, this change adds some tools to common.py
for parallel execution of commands.
This reduces the fmt check time from ~9s to 1.5s.
I verified that we are actually catching all files now by adding a
newline to all .rs files in our sources tree. The formatter reverted
them all.
BUG=b:218559722
TEST=./tools/fmt
Change-Id: If721d837ebc9eee3ce28fa7f439ab0bcc0b993cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3474926
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The original io_uring bindings were hand edited to eliminate some of the
anonymous unions, so there are some changes in the helper functions.
BUG=b:218388029
TEST=tools/presubmit --quick
Change-Id: I8e049296020dd38ba7c97b096ca6cc346b0a20d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339805
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Some changes made it through without clippy testing. Fixing these
now.
BUG=None
TEST=./tools/clippy
Change-Id: If369354042691181d5a251e5707b85672757330b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3508311
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
PCI virtual configuration space is a set of virtual registers similar to
PCI configuration space, but for the guest to configure the hypervisor.
One use case is to facilitate ACPI forwarding at API level.
BUG=b:194390621
TEST=builds
Change-Id: I7902d8f589d19426c8b81629722abbf5c68a905a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3344575
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Victor Ding <victording@chromium.org>
Auto-Submit: Victor Ding <victording@chromium.org>
This change fixes a bug in the VVU proxy device where the main thread
would block until a sibling connected to it. This may disrupt the device
from writing and reading bars from it as those operations happen on the
main thread. Instead, the socket accept logic is now moved to the
beginning of the worker thread and the main thread is unblocked.
BUG=b:194136484
TEST=Run device VM without --disable-sandbox.
Change-Id: I4e3344df20a80316316f2b586c52c8c1a88cc36d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3457900
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Auto-Submit: Abhishek Bhardwaj <abhishekbh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Add an option to allow creating a virtio-iommu device backend without
attached vfio device. This is for hot-pluggable devices whose DMAs are
restricted by the virtio-iommu backend.
BUG=b:185084350
TEST=Boot a guest with crosvm option "--virtio-iommu", a virtio-iommu
device can be seen in guest
Change-Id: I7799cb6ae3051f8ce2b6069a856480a9c9485fef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3301702
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When a vfio pci device is hot-plugged in, its vfio container should be
passed to the virtio-iommu worker for later dynamic mapping/unmapping
requests.
BUG=b:185084350
TEST=Boot a guest, hotplug in and out a vfio-pci
device repeatedly
Change-Id: Ia2a9c9ef4a3ee6399d90aa17c6656acb52647663
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3476650
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Virtio-iommu device can generate viot using pci ranges. After adding a
vfio device, guest can attach this device to virtio-iommu.
BUG=b:185084350
TEST=Boot a guest with vfio device and 'iommu=viommu', another PCI range
node is generated in guest viot.
Change-Id: I9204d8bd341b6e544a62923164d5c8ce46fdd8bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3476649
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
A tube channel is needed for the communication between main process and
virtio-iommu worker thread, e.g. passing a vfio container file
descriptor of a hot-pluggable device to the virtio-iommu backend which
is in charge of the mapping/unmapping for the endpoint.
BUG=b:185084350
TEST=Boot a guest with no error
Change-Id: Ib5061e795227040ca400bc9a92df84a27cd26438
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3301703
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Chrome OS does not currently package memoffset-0.6.5 (only 0.6.4), so
building within cros_sdk will fail to find the expected crate. We don't
need any API requirements past what is provided by 0.6, so just request
that. At the same time, upgrade the cros_asyncv2 memoffset from 0.5 to
0.6 so we don't need two separate versions. (The crosvm ebuild was not
requiring a 0.5 version, so this was technically a bug.)
BUG=None
TEST=cargo build
TEST=emerge-hatch crosvm
Change-Id: I2b6c778cdbf57977e6fffd73867e0c4818c44a61
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3502625
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vineeth Pillai <vineethrp@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add some wrappers to help tame the unruly bindgen anonymous union member
names.
BUG=b:218388029
TEST=cargo build
Change-Id: I4ca5bd9c4d0ae7f60a905a516e8cb5eab761213e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3445532
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add a framework for bindgen scripts.
This will be filled in when each binding is added in upcoming separate
commits.
BUG=b:218388029
TEST=None
Change-Id: I62363b49d92ceb5b54700589c2329daace7181b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339804
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When Crosvm receives a KVM_SYSTEM_EVENT_S2IDLE event, it means the
guest VM is entering s2idle suspend state, and it's requesting the
host to put the whole system in the same state.
If hypervisor sends the request on behalf of a privileged VM, Crosvm
can initiate s2idle suspend on the host since it's been granted with
system power management privileges.
BUG=b:199383670
TEST=trigger s2idle from ChromeOS guest
Change-Id: I589a7e1d93abb5ab971fd58de94ee75df48c3c6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3414635
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmytro Maluka <dmaluka@google.com>
Commit-Queue: Allen Webb <allenwebb@google.com>
For nonroot vfio-pci device, its prefetchable bars will be allocated
in continuous region, its nonprefetchable bars will be allocated in
another continuous region. Without descending the bar's size, this
allocation waste some mmio.
For example, a vfio-pci device has two non prefetchable bars:
bar0's size is 1M, bar2's size is 8M.
without descending [bar0, bar2], it will allocate 16M mmio, 0~8M
for Bar0, 8~16M for Bar2, although bar0 need 1M only, it occupy 8M
to satisfy bar2's 8M alignment requirement.
With descending [bar2, bar0], it will allocate 9M mmio, 0~8M for
bar2, 8M ~ 9M for bar0.
BUG=b:185084350
TEST=check pcie rp's bridge window in brya-manatee.
Change-Id: I7d93e601f6a46cabe8896aaec065a9dba18c60fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3500060
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Bridge window's mmio alignment went wrong during our refactor, fix
it in this commit.
BUG=b:185084350
TEST=Check bridge window and pci device mmio setting in CrOS
Change-Id: Ia1a01d1740f943ec7aa36812defe3aabffcfcbde
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3498219
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
On manatee, a vfio-pci could hotplug into an empty pcie rp when
device's host bus number is in pcie rp's bus range.
But on non-manatee, only one virtual pcie rp is created for device
hot plug, it owns one free bus number only, if a vfio-pci device's
host bus number isn't equal to rp owned bus number, this vfio-pci
device couldn't be added into guest through hotplug, so this commit
change is_match() and allow vfio-pci hotplug onto any empty pcie rp.
BUG=b:185084350
TEST=hot plug in/out a vfio-pci device with host bus_number different from
RP's bus range repeatedly in non-manatee.
Change-Id: I9a1059edd9558683e03d85235e0d164b2aa23672
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3498218
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This snuck through as our builders were temporarily not checking
clippy in presubmit. See https://crrev.com/c/3498847
BUG=None
TEST=./tools/clippy
Change-Id: I38ca27728ab4e108539407f5499484c2b881dc47
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3499740
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Add a flag to the adjust command that allows the command to fail. When
this flag is set, a reply is sent with the balloon size at the end of
adjustment.
The flag also changes the semantics of inflation somewhat. By default,
the balloon driver will indefinitely retry if it fails to allocate pages
during inflation. When the flag is set, the device reacts to puff
failure notifications on the event queue by setting the target num_pages
to the current balloon size, to abort and fail the inflation attempt.
BUG=b:213962590
TEST=manual testing with crrev.com/c/3394436
TEST=check ARCVM balloon still works
Change-Id: Idd606b90550c544ce5bea085f62ac35979679d71
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3394442
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Manatee doesn't support the guest accessing pages in the balloon, since
that would violate the strict its strict memory accounting, so add an
option to skip setting the deflate-on-oom flag.
However, without deflate-on-oom, the Linux driver normally modifies
MemTotal when inflating/deflating the balloon. To avoid that, this
change adds support for the new responsive-device flag proposed in [1].
[1] https://lists.oasis-open.org/archives/virtio-comment/202201/msg00139.html
BUG=b:214864326
TEST=check ARCVM balloon still works
TEST=manual testing with crrev.com/c/3394436
Change-Id: Iabc8352ee30e1b4a240fa3cad8f3b48ba53699a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3471335
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Implement event queue that was recently proposed upstream [1]. The puff
failure event will be used in a followup CL. The pressure event is
currently ignored. Figuring out how to use it will be done later.
[1] https://lists.oasis-open.org/archives/virtio-comment/202201/msg00139.html
BUG=b:213962590,b:216214118
TEST=check ARCVM balloon still works
Change-Id: Ie1990505da8eda1358f10f24ca3c2b6196303184
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3471334
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
The compiler was warning about a missing `dyn` on the impl block for
PciDevice, which only contained supports_iommu():
warning: trait objects without an explicit `dyn` are deprecated
We could add the `dyn` to fix it, but it seems cleaner to just move the
definition into the VirtioPciDevice impl's existing supports_iommu
function.
Additionally fix up a few clippy warnings about open-coded instances of
map and unnecessary references.
BUG=None
TEST=cargo build # completes without warnings
TEST=tools/presubmit
Fixes: 055b81b295 ("VIRTIO_F_ACCESS_PLATFORM support in virtio-iommu")
Change-Id: I7c923d1663d4f8c958a3c79619a06ab04e1e00ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3498843
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
A guest VM that is launched with this new option has privileges to
manage some host system resources, for example to get involved with
host power management.
BUG=b:199383670
TEST=start crosvm with and without --privileged-vm option
Change-Id: I8c36f608458047b4189ce5eed6ea527f58fea88d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3414634
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
These may be used by the pVM firmware or bootloader for protected VMs on
Android to indicate the reason why a VM failed to boot, such as a
verification failure, and so we want to have them in the logs for
debugging.
BUG=b:220084045
Change-Id: I449873fb85d590d9e7978a93648e90586ecfff10
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3473452
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Andrew Walbran <qwandor@google.com>
This reverts commit d2d66bc0a4.
Reason for revert: It turns out that adding the first page to the pool
of memory managed by the MMIO allocator has undesired consequences
since crosvm will actually use it for MMIO regions. The first page
has special semantics in other code though, and thus we get stray
accesses to this region, with hard-to-predict consequences.
BUG=b:188011323
TEST=cq
Original change's description:
> system_allocator: allow more than one region to be in the pool
>
> Allows crosvm-direct to have 0-0xfff regions to be mapped.
>
> limitations: Only the first regions gets reflected in the
> pool_base/pool_size.
>
> BUG=b:188011323
> BUG=b:184815519
> TEST=build
>
> Change-Id: I9da3cb2b8d5611068f9323d6ebf62f44162838b4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3450017
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Bug: b:188011323
Bug: b:184815519
Change-Id: Ib42b3007662a7a49ad876b83a01f1bb88d09d5f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3497136
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Commit-Queue: Mattias Nissler <mnissler@chromium.org>
When a client sends 0-sized data, the device regards that the client
closed the connection and will exit properly.
BUG=b:219674197
TEST=check if no error is shown when a vhost-user blk vmm disconnects
Change-Id: Icd84fb241c39b6dc54a8af41a068a6dd95ce4c2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3468235
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
With VIRTIO_F_ACCESS_PLATFORM, virtqueues and desc chains of a
virtual device will receive IO virtual addresses. Mappings from
IOVA to GPA will be sent to virtio-iommu. `IpcMemoryMapper` is used
by the virtio device to get the translated addresses from the
virtio-iommu in another process.
Memory blocks with contiguous IOVA but discontinguous GPAs are
supported.
The only way to enable this new path is to hardcode the flag in
the features of each device. The flag should be automatically
for every virtio-vhost-user device in the future. It seems
questionable to add a per device command line option just for
testing.
BUG=b:215307964
TEST=cargo test/block device with VIRTIO_F_ACCESS_PLATFORM enabled
Change-Id: I9a89acf4f38d52816adad34c0dbff043677bebac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3347309
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Woody Chow <woodychow@google.com>
With crosvm adding support for windows, we want to make sure that
the line endings are not crlf.
git hooks and configs will be added as a part of another change.
Bug: b:213146393
Test: Modified Cargo.toml to have crlf endings and ran the script.
Change-Id: Ie6f53a7c0687578546e63770bb98706e4315a520
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3495708
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
pvpanic is a simulated device through which a guest panic event could be
sent to the VMM. More details here:
https://github.com/qemu/qemu/blob/master/docs/specs/pvpanic.txt
Implement pvpanic device emulation and its pci interface.
BUG=None
TEST=Built crosvm. Ran a minimal vm to crash and verified that crosvm
receives the panic event. cargo test on devices.
Change-Id: I766fcc08f07760ad5f64f440a577705efd82e32a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3480575
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
On Manatee, all the pcie endpoint device are passed through into guest
and all the physical pcie root port are linked to virtual pcie root
port, if one pcie endpoint is connected to physical pcie rp statically
on host, this pcie endpoint should be connected to a virtual pcie rp in
guest statically. But current crosvm pcie could support hotplug device
only, it couldn't support connection device statically at boot time.
This commit add such support. if virtual pcie rp is used to
connect device statically, it won't use slot and won't have hotplug
capability.
BUG=b:185084350
TEST=On Byra-manatee, link all the physical pcie rp to virtual pcie
rp, then check NVME/SD/WIFI's function in CrOS, these devices are
connected to pcie RP on host directly.
Change-Id: Ie277c749da3c2020ad7361bf9ffa0271fb8f415d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3464512
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Since we'll be putting all PCI devices on non-root buses behind virtual
PCI-E root ports, MMIO BARs in such devices must be inside the forward
windows of their root ports. This presents additional requirements for
their MMIO BAR allocation:
1. All non-prefetchable BARs must be inside the same 32-bit MMIO window
2. All prefetchable BARs must be inside the same MMIO window, but
different than the non-prefetchable MMIO window
3. Both windows must be 1MB-aligned
4. No other PCI devices should occupy MMIO space in these windows
Allocate the entire window from the system resource allocator to prevent
any space within the window from being used elsewhere. To maximize
memory space efficiency, use VfioResourceAllocator for BAR allocation.
BUG=b:185084350
TEST=passthrough a vfio-pci device with bus_number > 0 and static connet it
behind a pcie root port, then check pcie RP and vfio-pci device function in
guest.
Change-Id: Ic9865afc48eb3ff9fa475dbcfdf90642b012980c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3166888
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Introduce the struct BarRange{addr, size, prefetchable} to indicate the
return of allocate_io|device_bars. So it is readable and easy to use.
BUG=b:185084350
TEST=boot Linux kernel and check dmesg
Change-Id: I0073f20401816f60c131bf15a9bc196e5fcba6d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3455126
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Make VfioMsixAllocator a generic resource allocator.
BUG=b:185084350
TEST=boot Linux kernel and check dmesg
Change-Id: I4a301d6829600a90fe0ddef4ccccbd4c8f511208
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3166887
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Split the logic in allocate_io_bars() into several parts in preparation
for the upcoming changes:
- collect_bars(): gather BAR information
- configure_barmem(): configure an MMIO BAR
- allocate_barmem(): main logic for MMIO BAR allocation
BUG=b:185084350
TEST=boot Linux kernel and check dmesg
Change-Id: I7eca48b16081dfd180ce4616239f568355e5031f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3166886
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Adding some conditional compilation flags so we do not need to
exclude them on each test run. None of there actually increase
the number of tests run, but gets us closer to being able
to run `cargo test --workspace`
BUG=b:218374759
TEST=./tools/presubmit --all
Change-Id: I181a84847fc09a4e1a6fb2b5f21538ebc400d607
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3453046
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The merge can trigger conflicts if a change has been cherry picked
ahead of the merge. We always want to resolve conflicts by picking
the incoming version from cros/main.
BUG=None
TEST=./tools/chromeos/create_merge
Change-Id: I06694dd24b051fcdc12dbaccdbab552c72d7f2c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3494968
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The MemoryMapping API has changed and these tests are not run by
default, which prevented us from catching this.
BUG=b:213149154
TEST=with crrev.com/c/3026355: cargo test --features "video-decoder,ffmpeg" -p devices virtio::video
Change-Id: I79a07d5a60c520d16190dd220b9a0f7501565e2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3493533
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The base version of MemoryMapping does not have the from_fd_offset
function. Use base::MemoryMappingBuilder and MemoryMappingBuilderUnix to
get the same functionality without depending directly on sys_util.
Fixes the build with virtio video features enabled.
BUG=b:213149154
TEST=emerge-hatch crosvm
Fixes: 45f1a419d4 ("Make crates depend on base instead of sys_util")
Change-Id: I8924d2334ae3d3ef489114b17071143871d1424d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3490743
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The sys_util implementation of From<MemoryMapping> for
MemoryMappingArena doesn't work with a base::MemoryMapping, since that
is a struct that wraps sys_util's MemoryMapping rather than a direct
re-export. Add an implementation that calls the sys_util impl with the
inner sys_util MemoryMapping.
BUG=b:213149154
TEST=emerge-hatch crosvm
Change-Id: I2a5cddade91f366b86b61cc4cf5b294c31fb1c4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3490742
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>