`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>
Passing an open FD is necessary to avoid racing for vsock context IDs:
On Borg, we first want to generate a random, unused CID and pass this to
crosvm. This requires us to open `/dev/vhost-vsock` and call the
`VHOST_VSOCK_SET_GUEST_CID` ioctl on it. Closing the device and simply
assing its path to crovm opens up a time window where an overlapping VM
creation request may set a different CID on the device.
BUG=none
TEST=tools/presubmit --quick
Change-Id: If053e26ba93ab357b06e8cf07798679c8ad06c9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3263933
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Christian Blichmann <cblichmann@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Extend the ABI in protected mode to provide the protected VM firmware
with the size of the loaded image by using register x2.
BUG=b:203505371
TEST=presubmit
Change-Id: Ib01b88dcce2f3fbfba759599d7fce9de62de720c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3259937
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Andrew Walbran <qwandor@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
I guess this was caused by libc uprev so the actual used
system call changed.
BUG=b:206348631
TEST=manual - Run arc.Boot.vm on kukui-arc-r with updated policy
Change-Id: Ibb8702d9ec6844624c9779088aefcdad34322d80
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3290581
Auto-Submit: Lepton Wu <lepton@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
In addition to SharedMemory, we allow File (e.g. mmap'd file) to be an
backing object of MemoryRegion.
BUG=b:194137301
TEST=kokoro
Change-Id: I9dafd028eaf74cf34820ba3f16e458c08ec67cb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3159883
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This is a preparation for CL:3159883, where GuestMemory will be backed
by `dyn AsRawDescriptor` instead of `SharedMemory`.
So this CL adds a logic to create a SharedMemory from `&dyn
AsRawDescriptor`.
BUG=b:194137301
TEST=cargo test --all-features in audio_streams
Change-Id: I615be5976184696bcb9ae90928e366276467013a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3159882
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Define `SharedMemory` trait, implement it for `base::SharedMemory`, and
use it for `ShmStreamSource::new_stream()` so that we can pass on
`base::SharedMemory` without exposing `base` to libcras.
Note that we implement the trait for `base::SharedMemory` in `base`
crate instead of in `audio_streams`, which means `base` depends on
`audio_streams`, because `audio_streams` is available for non-crosvm
projects while `base` isn't.
The corresponding CRAS change is crrev.com/c/3251123.
BUG=b:194137301, b:204444445
TEST=cargo test --all-features
Change-Id: I2430d9881d98032592c9f9202d70deb22e006f63
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3251820
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This matches the crosvm submodule to the version currently used in
Chrome OS: https://crrev.com/c/3230048
BUG=None
TEST=cargo build
TEST=tools/presubmit --quick
Change-Id: I7fadc5b1a4ecc26bd0598642966e088f1890a0d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3290322
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Add device label to vfio related error messages to get device name when
debugging
BUG=None
TEST=./tools/run_tests
TEST=./tools/presubmit
Change-Id: I910cbe35dde2d88155f693f90225a2708663d75d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3288284
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This won't actually build as-is if the vhost-kern feature was enabled,
but since we don't use that feature currently, this unblocks building
crosvm without the rust-vmm vm-memory crate.
BUG=b:205511695
TEST=emerge-hatch -C vm-memory && emerge-hatch crosvm
Change-Id: I614616b38e796e28f13f0bb867e97c3be532305b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3290311
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Cause panic when it failed to read or write VFIO regions because there
are no ways of recovery.
BUG=b:194137301
TEST=build
Change-Id: I0f6296d1835443641a12d5608b774ec35fdea7e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3149872
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
As before, some are automatically fixed by clippy, some manually
fixed.
BUG=b:192373803
TEST=./tools/presubmit
Change-Id: Ifcab4cf60775ee6bb7d4530af6406a74958432ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3283683
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Some automatic fixes by clippy, some manual nit fixes.
This enables clippy on all but the cros_async crate, which
is to be replaced with cros_async2 soon.
BUG=b:192425184
TEST=./tools/presubmit
Change-Id: I2b3a09b67ead64f2adb71dd4f94465b0d65a7c65
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3282678
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This fixes a bug introduced by [1] when msix pba table offset is smaller than
msix table offset.
An error may occure when booting guest with some vfio devices:
[ERROR:src/panic_hook.rs:90] thread 'main' panicked at 'attempt to subtract with overflow', devices/src/pci/vfio_pci.rs:274:26
[1] 7458a3a19b
So limit the adjustment of table size only if pba table offset is greater than
table offset.
BUG=b:1971693450
TEST=passthrough a nvme which the msix table offset is greater than pba
table offset, boot and verify MSIX-capable passed-through devices work
properly.
Change-Id: I1432c2290feaa5f6db088ebd416dc346547e7952
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3279957
Reviewed-by: Tina Zhang <tina.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>
Developers may need to manually clean up the common/enumn directory - it
will be left behind if there are build artifacts (Cargo.lock, target
directory, etc.):
rm -rf common/enumn
BUG=b:205344148
TEST=cargo build
TEST=tools/presubmit
TEST=emerge-hatch crosvm # with https://crrev.com/c/3265967
Change-Id: I1af3bdd22f40e87895a78a5cbc8033476058c927
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3278774
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This change will allow the script to be executed from any path.
BUG=none
TEST=run tools/chromeos/setup_cargo from outside of crosvm directory
Change-Id: I9752f4a41987259f446431bf89c322095ef26e63
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3280361
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
There were not too many cases here. This fixes:
- comparison_chain
- wrong_self_convention
- upper_case_acronyms
- from_over_into
- let-and-return
The collapsible_if check is moved to the permanently
allowed checks. The cases we do have improve
readability or semantics.
BUG=chromium:908640
TEST=Kokoro
Change-Id: I6e905d08e2a87aa0862d4d1cf5ff57b60e95fa7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3278776
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Sprinkle cfg checks throughout build.rs to get rid of the compiler
warnings about unused functions when building with the default features
(without --features=virgl_renderer).
BUG=None
TEST=cargo build
TEST=cargo build --features=virgl_renderer
Change-Id: I2a1548ec0de33d958c5cd5b6658ec92cd6840566
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3243013
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This applies the same clippy config to rust_analyzer
as well.
BUG=b:193893457
TEST=./tools/clippy and VSCode show the same linter results
Change-Id: I5deec4a24d71fec4692ed708664130f46c1311b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3278773
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This ensures that we can open files whose sizes may be larger than a
32-bit off_t.
BUG=b:181113648
TEST=emerge-kukui crosvm
Change-Id: I2322480dcf507f83609117b4def40846d619b69b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3270100
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This currently gives a compiler warning:
warning: dereferencing a null pointer
--> aarch64/src/lib.rs:71:19
|
71 | unsafe { &(*(0 as *const $str))$(.$field)* $([$idx])* as *const _ as usize }
| ^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
...
622 | arm64_core_reg!(pc)
| ------------------- in this macro invocation
|
= note: this warning originates in the macro `offset__of` (in Nightly builds, run with -Z macro-backtrace for more info)
Fix the UB with an implementation based on memoffset::offset_of and
addr_of_mut! instead.
BUG=none
TEST=`emerge-kukui crosvm` no longer complains about UB
Change-Id: I0ab55dc7527c3a4acffe02ee587742dbddd45a0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3270099
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
We have not been running clippy on many crates before. This CL
does not contain any clippy fixes, but documents how many issues
each disabled clippy check and crate currently has.
Many of them should be easy to fix.
BUG=b:192425184
TEST=./tools/presubmit --quick
Change-Id: I9ea25bc9a24d405700027ca4e72fb2a50e376c9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276668
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Fixes https://crrev.com/c/3199298, which only added the new ioctl
argument to the seccomp syscall filters on x86.
BUG=b:169908659
TEST=tast.crostini.SecureCopyPaste.* on scarlet
Change-Id: Ifd44c7b403f862d5528d8cc3655f0cd2c71c6e13
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276675
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
This should fix the current uprev problem.
BUG=b:205997217
TEST=FEATURES=test emerge-amd64-generic crosvm
Change-Id: I0a0bb46fb004a7a057be9b2e4b13878038551e81
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3276714
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>