Add some context for debugging failures so it is possible to determine
which register read is failing.
BUG=None
TEST=./build_test.py
Change-Id: I6084971bc6dbd1f7b5d46e6c5d7ba017bb32edc6
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1893637
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This will be used for configuration interrupts as well.
No functional change.
BUG=chromium:854765
TEST=./build_test.py
Change-Id: Iacccfd0a93a5c90783033a8e37598c2683704351
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898267
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
The virtio specification allows the driver to configure a queue's MSI-X
vector to the magic NO_VECTOR value (0xffff); in this case, if MSI-X is
enabled, no interrupt should be delivered (neither MSI-X nor INTx).
BUG=chromium:854765
TEST=./build_test.py
Change-Id: Icb5e82bf9a57ded60fc8c022c4d8630b5ab70dcf
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898266
Reviewed-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The first interrupt_status.fetch_or() operation already sets the
appropriate bit; calling fetch_or() again with the same value is
unnecessary.
In addition, if the interrupt_status field has any bit set (not just the
USED_RING bit), then the interrupt is already pending and we don't need
to trigger it again.
BUG=chromium:854765
TEST=./build_test.py
Change-Id: Iba7fb9b934d062db801f8ba0e743618f9db580ee
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898045
Reviewed-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The virtio specification says that the device must have all queue and
configuration change events unmapped upon reset. The queue MSI-X vector
configuration was already initialized to VIRTIO_MSI_NO_VECTOR (0xffff),
but the device configuration change notification vector was initialized
to 0. Move the constant to the virtio module so it can be used to
initialize the config vector to the correct value.
BUG=chromium:854765
TEST=./build_test.py
Change-Id: Ife1117e54196a898782238a2b81e69b20ac79784
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898044
Reviewed-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
When everybody's an OWNER, nobody is! Since crosvm doesn't have sticky +2,
we want anyone with committer access to self +2 when needed.
BUG=none
TEST=none
Change-Id: I18b71be6eff3612dba9ed98659815c7fc7f49160
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1901624
Tested-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Add a new virtio-fs device for sharing files between the host and the
guest. This change adds all the device infrastructure necessary for the
driver probe to succeed but doesn't currently handle the actual fuse
protocol. Additionally, shared memory support is not currently
implemented. The device is not hooked up to the command line.
Testing this device requires a kernel with the virtio-fs patches. To
test with a standard crostini setup, use
https://user.git.corp.google.com/chirantan/virtiofs/+/refs/heads/chromeos-5.1
which is the 5.1 kernel with the virtio-fs and chromium-specific
virtio-{gpu,wl} patches applied.
BUG=b:136128319
TEST=`tast run vm.VirtioFs`
Change-Id: I09dcefafaf0d2a7e13d54df11384dfcee3b85ba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1705654
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
struct stat64 uses different types on 32-bit platforms like arm; cast to
the types used there to allow compilation on both x86-64 and arm.
In addition, a 64-bit offset was being passed to libc::ftruncate, but
this API takes a 32-bit off_t on 32-bit platforms; switch to ftruncate64
to allow the full range of offsets.
BUG=b:136128319
TEST=emerge-kevin crosvm
TEST=emerge-nami crosvm
Change-Id: I382aef8509ca723efcf5024b22e140265636dc10
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1899218
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This removes the unnecessary copy on the tx path. On nami, this increases
tx throughput by ~60%.
BUG=chromium:753630
TEST=crostini.NetworkPerf
Cq-Depend: chromium:1873142
Change-Id: I58be5a7acef5d118d34b3c42ffb5a34e90070bf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1881419
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Certain types of file descriptors, such as tap devices, aren't compatible with
writing at offsets. Split the volatile_impl macro into two, one for
FileReadWriteVolatile and another for FileReadWriteAtVolatile.
Tweak the macros be usable from other crates.
BUG=chromium:753630
TEST=cargo build
Change-Id: I0671024e24e8b5eaedbde2c1da80e3ec684c06a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1881417
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
This allows the conversion of (part of) a descriptor chain into an iovec
suitable for use with sys_util functions like send_with_fds().
BUG=None
TEST=./build_test.py
Change-Id: I4e3f7d9c1175c1173661b0661d3fa15d1da72d1a
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1815417
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Allow IntoIovec to produce an iovec with more than one entry.
BUG=None
TEST=./build_test.py
Change-Id: I21e8512f3edb06d9c0be4a1707432dde9fda6e9e
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1815316
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
When guest ram >= 4G, as mmio hole exists in ram GuestMemory,
GuestMemory->end_addr() is larger than memsize, if memsize is used as
start address of device memory, device memory will overlap with Guest ram.
This patch use GuestMemory->end_addr() as the start address of device
memory.
BUG=None
TEST=Boot vm with guest memory above 4G, and enable vGPU, and run
vGPU benchmark.
Change-Id: Ifc28f3a022cb0a179d16fee4056016a192f2acbd
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1895232
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
When guest boot with -m 4096, guest e820 is:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x0000000000200000-0x00000000cfffffff] usable
so guest usable ram is 3.25G which is smaller than specified 4G.
3.25G~4G is assigned to pci device as mmio, this range should be
relocated to 4G above like 4G to 4.75G. So guest could see the full 4G
usable ram.
With this patch, guest e820 is:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x0000000000200000-0x00000000cfffffff] usable
BIOS-e820: [mem 0x0000000100000000-0x000000012fffffff] usable
The guest could use 4G ram equal to specified 4G.
Then mmio hole exists in guest ram's regions, GuestMemory's end_addr
is larger than the memsize. end_addr couldn't be used to judge an
address in a guest memory or not We should iterate all the regions
to avoid the address in the hole; end_addr couldn't be used for
checked_offset() also, it may faill into mmio hole.
BUG=none
TEST=build_test; Boot vm with different guest memory size, and check
vm's e820 table
Change-Id: I2cd7c3223173ab635041875b9d8b49c2800c8dab
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1895231
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Cargo test fail on register_irqfd, irqfd_resample, and unregister_irqfd.
The reason is KVM_IRQFD() ioctl will return EINVAL if vm doesn't have
irq chip device.
This patch add IrqChip creation before KVM_IRQFD() ioctl.
BUG=None
TEST=build_test
Change-Id: Ida48dd364186e64f86d17e533a9d7e812354b0db
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1893790
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The stats are typically alive in the plugin library, but we typically
don't care about or use these stats.
BUG=None.
TEST=Compiled and ran test. Verified release binary size got smaller
by 25KB and debug by 50KB.
Change-Id: I2469ff83f91a3aebf86d70807088bba3edce6641
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1835034
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This call was changed to not return a Result in "7f64f50
descriptor_utils: check for size overflow in new()".
BUG=b:136128319
TEST=build and run pjdfstests
Change-Id: Ibdc786b26ff35977723ba61c51e8cdf1b631edc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1890581
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Add a "passthrough" file system implementation that just forwards it's
requests to the appropriate system call.
BUG=b:136128319
TEST=`tast run vm.VirtioFs`
Change-Id: I802c91dd0af8cdd8b9e761d9f04f874ae41ec033
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1758103
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Temporarily turn off MSI-X support in the block and net devices since it
seems this is responsible for some test flakiness that manifests as
timeouts/hangs in the ProxyDevice read handler, e.g.:
[devices/src/proxy.rs:238] failed read from child device process
virtio-pci (virtio-block): failed to receive request or response:
Resource temporarily unavailable (os error 11)
This is a minimally-invasive change to disable MSI-X without a full
revert of the relevant patches by just changing the relevant devices so
that they no longer request MSI-X vectors.
BUG=chromium:1019986
BUG=chromium:854765
TEST=check /proc/interrupts inside crosvm does not contain "PCI-MSI"
Change-Id: Ib37b503e609e2b9e22265370bcfe5804f04057ef
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1891643
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
This change tries to improve the performance of a plugin-based VM
by adding a hint API that allows crosvm to proactively push cpu
state to the plugin when certain ports for hypercalls are accessed
by the VM.
BUG=None
TEST=build and run. See performance increase significantly.
Change-Id: I71af24ebc034095ffea42eedb9ffda0afc719cd6
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1873005
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This is the first `cargo test` which uses a linux kernel binary in
testing crosvm's major functionality. To get that binary, the test tries
various sources which may be influenced by the enviroment. If need be,
the chromiumos kernel is downloaded via git, configured, and built so
that crosvm can use it. The resulting binary is cached so that other
tests which need it can run much quicker.
TEST=cargo test -- boot
BUG=None
Cq-Depend: chromium:1867729
Change-Id: I123441d358ef886e0d7369eaa4ebd87373026d99
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1742924
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Auto-Submit: Zach Reizner <zachr@chromium.org>
Use immediate exit when avaialable to improve performance.
BUG=None
TEST=Local build and test.
Change-Id: I5a4fb3dc310f3b2969113f6d57290099f84a0187
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1847861
Reviewed-by: Zach Reizner <zachr@chromium.org>
If the immediate exit feature is available then we use use it to improve
performance.
BUG=None
TEST=Local build and test.
Change-Id: I368ae7a711de72955777cd434450789e9a10616c
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1847860
Reviewed-by: Zach Reizner <zachr@chromium.org>
The straightforward API is for use by the vcpu loop, while the API based
on thread-local state is intended for use by a signal handler.
BUG=None
TEST=Local compile and test.
Change-Id: I2e01bba11687b664418d113fc5faa480524b093a
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1847859
Reviewed-by: Zach Reizner <zachr@chromium.org>
The `next_avail` field is a Wrapping<u16> but we pull out the underlying
u16 when calculating the descriptor index address offset in Queue::pop
and only convert the result to a u64 after applying all the operations.
This can cause a u16 overflow if the queue size is the max
allowed (2^15). Instead, convert to a u64 immediately after calculating
the index so that the rest of the operations are carried out as u64s and
will not overflow.
BUG=chromium:1018319
TEST=`cros_fuzz reproduce` and unit tests
Change-Id: I49743e239e2a407498d862c5137930f3f0cdf72a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1884404
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Use the "at" variants of the read/write functions in the block device.
This reduces the number of syscalls on the host per I/O to one
(pread64/pwrite64) rather than two (lseek + read/write).
The CompositeDiskFile implementation is also updated in this commit,
since it's both a producer and consumer of DiskFile, and it isn't
trivial to update it in a separate commit without breaking compilation.
BUG=None
TEST=Start Crostini on kevin, banon, and nami
Change-Id: I031e7e87cd6c99504db8c56b1725ea51c1e27a53
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1845948
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Rather than using self.current_offset in the internal read_cb and
write_cb helper functions, make them take the starting offset as a
parameter, and move the current_offset update to the callers.
This will allow the read_cb and write_cb functions to be used in
implementing the FileReadWriteAtVolatile trait.
BUG=None
TEST=cargo test -p qcow
Change-Id: Ifa60f6fea27050d0a88f2c00e77e62d4e36b809f
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1845945
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Improve the virtqueue_fuzzer's performance by reducing the maximum queue
size as well as the size of the guest memory. Zeroing out 256MB of
memory on every iteration was slowing things down quite a bit and we
don't actually need that much memory to fuzz the virtqueue code.
Additionally, refactor the fuzzer to use the virtqueue structs from the
virtio spec to fill out the guest memory. This should give us more
targeted fuzzing compared to the previous implementation, while also
removing cases where the fuzzer would spin for thousands of iterations
without making any progress.
BUG=chromium:1018267
TEST=`cros_fuzz reproduce` and also run the fuzzer manually
Change-Id: Ibf71aa83c31f16b7f58b23045a0919f7f6824c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1886533
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Sean Abraham <seanabraham@chromium.org>
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
When vfio device msi is enabled, use VmIrqRequest->AllocateOneMsi() to
allocate one gsi for a msi vector, and link gsi with irqfd through
vm->register_irqfd, use VmIrqRequest->AddMsiRoute() to add msi routing
info into kvm route table.
BUG=chromium:992270
TEST=none
Change-Id: I5e2d2347e5e26f0ef6e12554dae4b12934b65e82
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1581146
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This eliminates the boilerplate for catching panics and creating a Rust
slice from the fuzzer input data.
BUG=None
TEST=`USE='asan fuzzer' emerge-nami crosvm`
Change-Id: I49666a344b02e3333ad6823bfa7dace08b66b290
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1879495
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Replace the copy_{to,from} calls for VolatileSlice with
ptr::copy_nonoverlapping. The copy_{to,from} implementations were doing
a volatile read/write per byte, which is significantly slower than just
using a memcpy.
Using copy_nonoverlapping should be safe here as that's how this was
implemented before the refactor.
BUG=chromium:1014999
TEST=unit tests
Change-Id: Iad29e76056ff3064a5fe7e816b517b4ac75eaaef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1866894
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When hw reports it could support INTX, this patch enable it by passing
irqfd into vfio kernel.
Then once hw intx happens, the vfio kernel irq handler receives and
handles it, the handler will trigger irqfd and kvm injects the interrupt
into guest.
BUG=chromium:992270
TEST=None
Change-Id: I8b200174a91183b7324b0044fde13b44c751d4d7
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1813457
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The multikey module provides a BTreeMap implementation that can use one
of 2 different kinds of keys to look up a value. This is needed by the
virtio-fs server since it needs to be able to look up keys either by u64
or by a (ino_t, dev_t) pair.
BUG=b:136127316
TEST=`tast run vm.VirtioFs`
Change-Id: I3a22331e7a15b2316c31ac803bf2813a14bf948f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1837025
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Add a `Server` type that links the FUSE protocol with the virtio
transport. It parses messages sent on the virtio queue and then calls
the appropriate method of the `Filesystem` trait.
BUG=b:136128319
TEST=`tast run vm.VirtioFs`
Change-Id: I7d6fb521f6c620efe1bdb4fa0fa8fb8c42a82f45
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1757242
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Add the `Filesystem` trait, which is the main interface between the
transport and the actual file system implementation.
BUG=b:136128319
TEST=`tast run vm.VirtioFs`
Change-Id: Ic8bc9e231652020501e10ad0be810a9f66e90b8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1757241
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
The code to inject interrupt to the guest can be generic to all
virtio devices. This patch:
- move those guest interrupt related fields out of Worker structure and
put in a separate file, making the worker code cleaner.
- remove redandant functions across virtio devices: signal_used_queue(),
signal_config_changed(), etc.
BUG=chromium:854765
TEST=sanity test on eve and Linux
TEST=cargo test -p devices
Change-Id: I8e9f760f2057f192fdc74d16a59fea2e6b08c194
Signed-off-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1869553
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
- signal_used_queue(): trigger MSI-X interrupts to the guest if MSI-X is
enabled, otherwise trigger INTx interrupts
- enable MSI-X on vhost-net: allocate one vhost_interrupt for every
MSI-X vector.
Performance wise, fio random R/W test on eve pixelbook:
INTx MSI-X delta
fio write 8.13MiB/s 9.79MiB/s +1.66MiB/s (+20%)
fio read 24.35MiB/s 29.3MiB/s +4.95MiB/s (+20%)
For networking performance (TCP stream), test results on eve pixelbook:
INTx MSI-X delta
iperf3 5.93Gbits/s 6.57Gbits/s +0.64Gbits/s (+10.7%)
iperf3 -R 5.68Gbits/s 7.37Gbits/s +1.30Gbits/s (+22.8%)
iperf test results on VM launched from Ubuntu host (client sends only):
INTx MSI-X delta
virtio-net 9.53Gbits/s 11.4 Gbits/s +1.87Gbits/s (+19.5%)
vhost 28.34Gbits/s 44.43Gbits/s +16.09Gbits/s (+56.7%)
BUG=chromium:854765
TEST=cargo test -p devices
TEST=tested virtio-net and block on Linux VM and eve pixelbook
Change-Id: Ic4952a094327e6b977f446def8209ea2f796878c
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Signed-off-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1828340
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
https://crrev.com/c/1856586 uses a new audio_streams interface but did
not update the revision used in kokoro/docker builds to match. Update
it to fix the crosvm kokoro builder.
BUG=None
TEST=docker/wrapped_smoke_test.sh
Change-Id: I12fda23861aad4b5a12eda79298ac507382188a5
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1876831
Reviewed-by: Fletcher Woodruff <fletcherw@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Move the check for length overflow that was in available_bytes() into
Reader::new() and Writer::new(). This simplifies callers, since they
can assume that once a valid Reader or Writer has been constructed,
available_bytes() cannot fail. Since we are walking the descriptor
chain during new() anyway, this extra check should be essentially free.
BUG=None
TEST=cargo test -p devices descriptor_utils
Change-Id: Ibeb1defd3728e7b71356650094b0885f3419ed47
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1873142
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Allocate per device VmMsi msg_socket for communication between virtio
devices and main VM process, which owns the KVM fd and issues ioctl to
KVM for KVM_IRQFD and KVM_SET_GSI_ROUTING.
BUG=chromium:854765
TEST=None
Change-Id: Ie1c81534912eaab7fbf05b5edef7dca343db301c
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Signed-off-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1828339
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
- add a new field "vector" to struct Queue, which represents the entry
number to the MSI-X Table. This can be used to find out the desired irqfd
to inject MSI-X interrupts to the guest.
- enable MSI-X when MSI-X Enable bit of the Message Control word is
being set: allocate irqfd per MSI-X vector; register the irqfd to KVM;
update GSI routing to KVM.
- update GSI routing if the Message Data or Message Addr of individual
MSI-X table Entry is being changed in run time.
BUG=chromium:854765
TEST=cargo test -p devices
Change-Id: I81533999ab6cd9ec5f111b256caf34077a4a7d1a
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Signed-off-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1828338
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
The MsixConfig struct is responsible for all the operations of MSI-X
Capability Structure and MSI-X Table.
A msix_config object is created for each virtio device.
BUG=chromium:854765
TEST=cargo test -p devices
Change-Id: Ide7c34d335d49a201f20b0a4307bcda97d1d61b7
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Signed-off-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1828337
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
The MSI-X feature is ported from Cloud-hypervisor commit 69e27288a2e.
(https://github.com/intel/cloud-hypervisor.git)
In this commit:
- add a new "msix" module to the pci crate.
- implement the MSI-X Capability Structure.
- implement per virtio device msix_vectors() function which represents the
supported MSI-X vector for this device.
BUG=chromium:854765
TEST=launch Crosvm on eve and Linux
TEST=cargo test -p devices
TEST=./bin/clippy
TEST=./build_test.py --x86_64-sysroot /build/eve
Change-Id: I5498b15a3bf115e34764e6610407b3ba204dae7f
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1873356
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen Barber <smbarber@chromium.org>