The virtio-console device implementation was losing track of the host
input stream when it reset. This change only creates the read thread
once and reuses it for all worker threads.
Test: Run with a virtio-console device that resets
Bug: b/208540565
Change-Id: I6abcd35a7e7664f2bbdc0d977c2eacad49e50378
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3309208
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
The previous implementation would lose track of the host output
io::Write stream on receiving a virtio reset request, due to how the
output instance was being passed around through Option instances.
This change replaces one level of Option state with a reference instead,
so the Console instance retains ownership over the output instance and
the virtio-console Worker instance only holds a mutable reference.
Test: Run with a virtio-console device that receives a virtio reset
Bug: b/208540565
Change-Id: Ib672ac244a7209797e1d64feca913b12f31a66d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3309207
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
- F_CONTEXT_INIT is in Linux 5.16 now
- F_RESOURCE_SYNC should come before other features now.
BUG=b:208516032
TEST=compile
Change-Id: I8dfed584b544d6140ba80c2d474dedfcb679417e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3309197
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Intel SSD 660P Series NVME block device has an overlapping msix
table and msix pba table as the following information shows.
ab:00.0 Non-Volatile memory controller: Intel Corporation SSD 660P Series (rev 03)
Capabilities: [b0] MSI-X: Enable- Count=22 Masked-
Vector table: BAR=0 offset=00002000
PBA: BAR=0 offset=00002100
In curruent add_bar_mmap_msix function, these two table would occupy
the same page. So when add_bar_mmap_msix trys to find the msix table
corresponding pages for the second time, it fails to find the page and
lead to the entire mmaps are cleared and return null mmaps. Thus, there
is no real memory region are mmaped and lead to quite low I/O performance
for this pass-through NVME disk.
BUG=None
TEST=Unit test
TEST=pass-through the 660P SSD into guest and run FIO read/write test,
the throught increases to ~500MBps form ~20MBps.
Change-Id: I1571e694b0a1f01a738650b361eaef93554a8c55
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3213315
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Virtio-iommu might be created without any endpoints. In this case, we
need to assume a default page_size_mask default value. 4K is a
reasonable value to devices.
BUG=b:185084350
TEST=Boot a guest with a pass-through device which has the "iommu=on"
Change-Id: I29344f8ef52e3358198dd5a917083244310ffaaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3297406
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Pass-through PCI devices don't need vfio to do the iova mapping for
their bars' memory, because when accessing their bars' memory,
pass-through PCI devices' DMA requests don't travel to RC. Therefore,
keeping the mapping relationship is useless.
BUG=b:185084350
TEST=Boot a guest with a pass-through device
Change-Id: I7944183553518437d03bdfcfebf3790268bbd9e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3284012
Reviewed-by: Xiong Y Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Since vhost_user is the only module in vmm_vhost now, remove this module
and have everything in the top-level module.
BUG=b:206900656
TEST=cargo check
Change-Id: I6663a93654e5d692efc7d9904fff0d207144c352
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3295219
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Remove the previous vmm_vhost::Error enum, as most of its variants are
no longer used. Instead, expose vhost_user::Error as the top-level one.
BUG=b:206900656
TEST=cargo check
Change-Id: Ic5d9f7dcc6e2986d7b51885e2c0f44aa4e012e5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3295218
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Since we're using vmm_vhost only for vhost-user, we can delete
vmm_vhost's vhost-kern/vhost-vsock parts.
Note that we own vhost crate, which vmm_vhost was copied from.
BUG=b:206900656
TEST=cargo test --all-features in vmm_vhost
Change-Id: I622fbb856fb99fc2cb078d79f79491fa35ede8e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3295217
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
By modifying the interface of `Endpoint::recv_into_bufs()` slightly,
`Endpoint::recv_data()` can be moved to `EndpointExt` trait.
This means a new device struct will be required to implement less
methods.
BUG=none
TEST=run vhost-user block device
Change-Id: I141eed0ff91aded5df5827cbc6965905820dac2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3288735
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Stop returning the number of bytes along with data, as the value should
be obtained by `data.len()`.
BUG=b:204720423
TEST=cargo test --all-features
Change-Id: I0c9d143b2d9e657d61cc2469ba7270a170401b2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3288734
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Replace `&mut [u8]` in recv_into_bufs() with IoSliceMut.
Note that recv_into_bufs_all()'s interface is unchanged as it changes
internal cursor with advance().
BUG=none
TEST=cargo test --features=vhost-user-master,vhost-user-slave
Change-Id: I74666cd2472f879a473c07dbe617add79d0ca903
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3302693
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Introduce `Endpoint` trait and add `EndpointExt` trait as its blanket
implementation.
This trait generalizes the existing socket-based endpoint struct and
allow us to add a new VFIO device backend later.
BUG=b:194137301
TEST=vhost-user block device worked
Change-Id: I9c276bbbf14570b67d3c55507054f48e1210d019
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3270299
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
The async interrupt resample thread borrows the interrupt object passed
to it, so borrowing mutably will fail at runtime. The two calls to
interrupt.borrow_mut() were in places that did not need a mutable
reference anyway, so just switch them to interrupt.borrow().
BUG=b:208264646
TEST=Boot crostini on kevin
Change-Id: Ie873273f862b1d4ef11b595596fea51cd202ac6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3309200
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Disable the root port creation code for arm, since the required
Arch::register_pci_device() function just returns unsupported on
aarch64.
Fixes crosvm startup on arm.
BUG=b:208503471
TEST=Start crosvm on kevin
Change-Id: I690a3f163b570387a5e58294ba94e496a97da815
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3309199
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The topic is reasonably useful to get a feel of how healthy the current
uprev process is.
BUG=None
TEST=read it.
Change-Id: I6dc329fdb7f1bbb7bea47a156cabf3eb76a3ff9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3302692
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Make the "video-decoder" and "video-encoder" capable of taking an
argument to explicitly specify which backend should be used. At the
moment there is only one backend (libvda), but this is going to change
soon and this change prepares for that.
The argument-less forms of "video-decoder" and "video-encoder" are also
kept and will select the libvda backend for compatibility.
BUG=b:161774071
BUG=b:169295147
TEST=Android Youtube plays properly on Hatch.
Change-Id: Ia2afd8932dbeabf381a3a2a81424812d50b99d50
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026350
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
The syscall is used for the file backed memory region used
by the audio device since https://crrev.com/c/3159883
BUG=b:208264646
TEST=CQ
Change-Id: I02c24da6389d60847996a62ee0eab658f9c4f7cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3307240
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
we would like to have all anyhow::Error instances print out
their full context, thus we need to use `{:#}`
BUG=None
TEST=compiles
Change-Id: Iba3d1757e8816cb5d91aa1b9615e5660125c463e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3300823
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Maciek Swiech <drmasquatch@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Create an async_utils module and deduplicate the common async helper
functions there.
In particular, this moves wait_kill (renamed to await_and_exit) and
handle_irq_resample into the new module and replaces all uses throughout
the async device implementations.
BUG=None
TEST=tools/presubmit --quick
Change-Id: If3b5b9f71c8553afa5ccd8c57933ca748fc990e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3292635
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
`sys_util::recv_iovecs_with_fds` was implemented as a safe function, but
it was actually unsafe because it assumed that the caller would give a
slice of `libc::iovec` where each `iov_base` points a valid memory
region with `iov_len`.
To make the function truly safe, it should take a slice of IoSliceMut
instead.
BUG=none
TEST=cargo test in sys_util/vmm_vhost
TEST=vhost-user block still works
Change-Id: I45458ee4545af13ce7e0955fb67b3703b147e7df
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3288733
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This field acts as a global upper bound on the size of any request so
read and write requests are truncated to fit this size even if
`max_readahead` and `max_write` are set to larger values. Initialize
this field to the number of pages needed to fit the largest supported
requset size.
BUG=none
TEST=arc.PlayStore.vm
Change-Id: Ia82d3e5709971c642312c45b26c288a953dedb18
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3299973
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
This is repeated for each Worker struct creation, so deduplicate it
inside of the run function.
BUG=None
TEST=tools/presubmit --quick
Change-Id: If96ed9cf04f3a57070dfa6018678d5cda51db7f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3299122
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Remove the crates.io patch from the top-level Cargo.toml and make
devices point to the third_party/vmm_vhost location directly, since
vmm_vhost has been forked in crosvm and cannot be replaced by the
crates.io version anymore.
Incidentally fixes this warning from cargo:
warning: patch for `vmm_vhost` uses the features mechanism.
default-features and features will not take effect because the
patch dependency does not support this mechanism
BUG=b:205511695
TEST=cargo build
TEST=tools/presubmit --quick
Change-Id: Id29578b57f7540805cf85a3db9a09542b7b84825
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3299125
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
'pupr' and 'uprev' are terms that we use quite often, add some documentation.
BUG=None
TEST=read it.
Change-Id: I888d024b0cffabd43beadce0d76a1cc3644a39e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3292385
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Some devices file like /dev/mem and vfio don't support MADV_DONTDUMP,
in order to avoid the warn flood, this commit ignore the MADV_DONTDUMP result.
BUG=b:19935428
TEST=boot manatee image with platform devices enabled
Change-Id: I779188cf768b4c3e8444781932260ef4bce36029
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3259932
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
write_all_at()/read_exact_at() fail to access pmc_mux through /dev/mem.
while devmem2 tool success to access them through /dev/mem, so this
commit reference devmem2 implementation and use mmap to access direct
mmio.
BUG=b:199354528
TEST=Apply https://chromium-review.googlesource.com/c/chromiumos/platform/initramfs/+/3194150
, then verify platform device (like typec) function in ManaTEE CrOS
Change-Id: Id69c44444e2dc1ef6d40cb7b36febda38848d4f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3259931
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
msix vector table is stored in mmio, its contents is saved and restored by pci bus
dirver during device PM. With vfio-pci device, msix is virtualized and guest pci
bus driver could maintain virtualized msix vector table. But vfio-pci device maybe
poweroff and the physical msix vector table will be lost, crosvm couldn't maintain
physical msix vector table during vfio-pci device suspend and resume.
kernel vfio-pci set msix message for each enabled vector which is specified in
VFIO_DEVICE_SET_IRQS() ioctl, this commit use this to restore physical msix vector
table during vfio-pci device's resume.
__pci_restore_msix_state() is called during device resume, this function set enable
and maskall bit first, then restore msix vetor table, finally set enable bit and
clear maskall bit.
so when enable and maskall bit is set, virtualized msix could be disabled. When enable
is set and maskall is cleared, vituallized msix will be enabled through
VFIO_DEVICE_SET_IRQS() ioctl, and kernel restores vfio-pci device's physical msix table.
BUG=b:185084350
TEST=verify vfio-pci device's suspend and resume function in vm, this device should have
msix capability like TBT controller.
Change-Id: I0a9e91874a9d1ec4b0bb9ff655b83a293daa6865
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3291758
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit 95b80d1 made the dev container persistent between invocations,
but hard-coded `docker` again. This change fixes that and also adds
further improvements:
- Do not use `--privileged` with podman. If the rootless user has
permissions to access `/dev/kvm`, so will the container.
- Map `/dev/vhost-net` and `/dev/vhost-vsock` as well.
- Use `BASH_SOURCE` to find this script's directory. As we're using Bash
to start with, this is more robust than using plain `$0`.
BUG=None
TEST=Run `./tools/dev_container cargo build` with Podman and Docker
Change-Id: I05c699f327c8e1c4f3c4df9679ee92bf7e609e2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3295372
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Christian Blichmann <cblichmann@google.com>
Each vfio pci device has a pci address, in order to support vfio
pci device hotplug repeatedly, its pci address should be returned
to system, so it could be hotplug in the next time.
BUG=b:185084350
TEST=Boot a guest and hotplug vfio pci device repeatedly
Change-Id: I0daf5bae9695c4ac87ac09581b80b69048538c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955578
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When guest poweroff root port, its downstream device could be destroyed
safely, so put the downstream device into
PciDevice->get_removed_children_devices(), then the downstream device
will be removed by pci root.
BUG=b:185084350
TEST=Boot a guest and hotplug vfio pci device repeatedly
Change-Id: Icb8104a2417832864d8dbe4947895028dabb46d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955577
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When PCIE root port receives poweroff config register write, its
downstream devices could be removed. So get_removed_children_devices()
in PciDevice trait is used to get removed downstream children devices
pci address, then these children devices will be destroyed by pci root.
BUG=b:185084350
TEST=Boot a guest and hotplug vfio device repeatedly
Change-Id: Iea861459b3cbabd7a9daf639ed4b7ad181a81e01
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955576
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When vfio-pci device is hotplug out from guest machine, guest will
write some registers to notify the device could be removed from
crosvm, then destroy_device() is used to destroy vfio pci device
from pci_root.
BUG=b:185084350
TEST=Boot a guest and hotplug vfio device repeatedly
Change-Id: I40f72aeb2c12d885f5cf5c8189238bd1cea0c1e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955575
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When vfio pci device is hotplug out from the guest machine, vfio device's
resource should be returned to system, so vfio pci device's close() is
needed.
BUG=b:185084350
TEST=Boot a guest and hotplug vfio pci device repeatedly
Change-Id: I4686d737e93ae6db6078851e2add3275b9faaa84
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955574
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When vfio group is opened at the first time, group is added into
kvm vfio device. In order to support vfio device hotplug repeatedly,
vfio group should be deleted from kvm vfio device when group is
closed.
BUG=b:185084350
TEST=Boot a guest and hotplug vfio device repeatedly
Change-Id: I4a8a18a6a890846f514df12b48a7440786e4e74c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955573
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
One container could contains multi groups, one group could contains
multi devices, when all the devices in the group are closed, the
group itself should be removed also.
BUG=b:185084350
TEST=Boot a guest with and without passthrough device
Change-Id: Ia43da3e2e9ad58d0a7596141645926931c0bcc5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955572
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Vfio pci device's bar are mapped into ept and iommu page table for
hardware acceleration, when vfio pci device is hotplug in the guest,
guest kernel will reallocate the bar, so the old bar address should
be deleted from ept and iommu, and the new bar address should be
added.
BUG=b:185084350
TEST=Boot a vm and hotplug add a device
Change-Id: Icc489917f4c241180bbef412a17917b34fafe7e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955571
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
PcieRootPort implement hotplug_bus trait, it should be added into
RunnableLinuxVm->hotplug_bus, so create pcie root port when
RunnableLinuxVm->hotplug_bus is ready.
Many hotplug bus may exist, when a hotplug device is added, is_match()
should be called on each hotplug bus before attach that device to
the bus.
BUG=b:185084350
TEST=Boot a vm with passthrough device and check its function
Change-Id: I89dbc091f336b3f9d0435b52963f7cf62d408a67
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955570
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When pci bridige is created, caller should specify its primary bus
number and secondary bus number. And supposing kernel won't modify
them as the current pci device topology is simple enough, once
guest modify them, warn message will be printed.
The secondary bus number shouldn't be assigned to any other device,
so this patch loop the bus number to find a free bus number.
BUG=b:185084350
TEST=Boot a vm with passthrough device and check its function
Change-Id: Iae72a0e0401a6e75c62582456b92792a1a36211a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2955569
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The updated presubmit script allows parallel execution of checks
with --tmux.
It will also try to detect if the host is set up for aarch64 builds
and use the dev container if needed.
BUG=None
TEST=./tools/presubmit --tmux
Change-Id: I0247c39d826ee38d5f7f689de5e63380fe789cf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3292101
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This vastly improves iterative build times and enables more flexible
usage of the container.
BUG=None
TEST=./tools/dev_container cargo build
First run will build everything. Second run will finish right away.
Change-Id: I9b4eeee0689f0e9d07f0a32f846d21ab42f689f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3292100
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Instead of enumerating crosvm crates separately, we can now use
the workspace to build all tests for crosvm.
This enables the vmm_vhost tests.
BUG=b:206026060
TEST=./tools/presubmit
Change-Id: I2af84ad8111e874ddea5e438bda41599caf1fd30
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3287463
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
With the new glibc 2.33 roll, we're seeing crashes live relating to
statx (syscall 397). The process that's crashing is pcivirtio-video,
so we suspect video_device.policy is the breaking policy.
Crash report: http://shortn/_4EWpF4q77O
This was very recently fixed in arm (where the original crash occured),
however, it's still missing in the amd64/x86_64 policy file. It's
very feasible we'll see a similar case in the future with this arch.
BUG=b:187795909
TEST=CQ
Change-Id: I7b02ccf02d214590aadc37dc53e00ad34e178a4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3291890
Auto-Submit: Jordan R Abrahams <ajordanr@google.com>
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>