Commit Graph

1982 Commits

Author SHA1 Message Date
Rob Bradford
78fe807284 build: Run unit tests on the Jenkins server
The addition of [workspace] to the top level Cargo.toml is necessary to
have the binaries colocated together.

The Cargo.lock files have also been refreshed by the change to the
Cargo.toml.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-07-16 17:09:05 +02:00
Sebastien Boeuf
1ddc8f2f0d vm-virtio: Add vhost-user-fs support
The vhost-user-fs or virtio-fs device allows files and directories to
be shared between host and guest. This patch adds the implementation
of this device to the cloud-hypervisor device model.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-06-27 21:46:00 +02:00
Jing Liu
30266a41be vm-memory usage: vm-memory latest codes rename MmapError to Error
Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
2019-06-26 08:33:46 -07:00
Sebastien Boeuf
5e803ab18f vmm: Integrate userspace IOAPIC
The previous commit introduced a userspace implementation of an IOAPIC
and this commits aims to plumb it into the cloud-hypervisor VMM.

Here is the list of new things brought by this patch:
- Update the rust-vmm/kvm-ioctls dependency to benefit from latest
  patches including the support for split irqchip, and the vector
  being returned when a VM exit is caused by an EOI.
- Enable the split irqchip (which means no IOAPIC or PIC is emulated
  in kernel). This is done conditionally based on the support of the
  TSC_DEADLINE_TIMER from both KVM and the underlying CPU. The
  dependency on TSC_DEADLINE_TIMER is related to KVM which does not
  support creating the in kernel PIT if it has a split irqchip.
- Rely on callbacks to handle the following use cases:
  - in kernel IOAPIC + serial IRQ (pin based)
  - in kernel IOAPIC + virtio-pci MSI-X
  - in kernel IOAPIC + virtio-pci IRQ (pin based)
  - userspace IOAPIC + serial IRQ (pin based)
  - userspace IOAPIC + virtio-pci MSI-X
  - userspace IOAPIC + virtio-pci IRQ (pin based)

Fixes #13

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-06-21 10:09:34 +02:00
Rob Bradford
c4c8b9314d build: Switch over to using rust-vmm linux-loader crate
With everything now merged upstream we no longer need to rely on Cathy's
fork.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-06-13 11:28:20 +01:00
Sebastien Boeuf
946a5d4f21 build: Update Cargo.lock for syn crate update
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-06-10 09:11:47 -07:00
Sebastien Boeuf
4be3dfeb37 build: Update Cargo.lock for linux-loader crate update
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-06-07 18:19:52 +01:00
Rob Bradford
bbd0f5eebb build: Update Cargo.lock for linux-loader crate update
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-06-07 12:39:42 +01:00
Sebastien Boeuf
13a065d2cd dep: Rely on latest kvm-ioctls crate
In order to have access to the newly added signal_msi() function
from the kvm-ioctls crate, this commit updates the version of the
kvm-ioctls to the latest one.

Because set_user_memory_region() has been swtiched to "unsafe", we
also need to handle this small change in our cloud-hypervisor code
directly.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-06-06 15:27:35 +01:00
Rob Bradford
1f53488003 tests: Switch to launching by command
Launch the test binary by command rather than using using the vmm layer.
This makes it easier to manage the running VM as you can explicitly kill
it.

Also switch to using credibility for the tests which catches assertions
and continues with subsequent commands and reports the issues at the
end. This means it is possible to cleanup even on failed test runs.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-06-06 11:03:13 +01:00
Rob Bradford
ddce3df826 tests: Add basic integration testing
Add basic integration testing of the hypervisor using a cloud-init to
configure the VM at boot and SSH to control it at runtime.

Initial test just boots the VM up checks some basic resources and
reboots. With a second test that calls into the first to check that
subsequent tests work correctly.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-06-06 11:03:13 +01:00
Samuel Ortiz
74a21f24e1 vendor: Remove vendoring
The cargo interaction with the .cargo/config does not meet our
requirements.

Regardless of .cargo/config explicitly replacing our external sources
with vendored ones, cargo build will rely first on Cargo.lock to update
its local source cache. If a dependency has been push forced, build
fails because of our top level Cargo.toml description.
This prevents us from actually pinning dependencies, which defeats the
vendoring purpose.

We're removing vendoring for now, until we understand it better.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-06-06 10:00:16 +01:00
Sebastien Boeuf
842515c2f1 vendor: Add vmm-sys-util duplicate
Since the top-level Cargo.toml specifies a vmm-sys-util revision
but not the sub crates, Cargo.lock points at 2 different crates.
cargo vendor copies both of them into the vendor directory but
forces the build to use the one coming from the top level driven
requirement.

Although this is a waste of space, this is a cargo vendor limitation
that we have to live with for now.

Also, because the dependency onto linux-loader had to be updated,
we had to specify a newly introduced feature called "elf".

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-06-06 10:12:04 +02:00
Samuel Ortiz
a6b7715f4b vendor: Move to the rust-vmm vmm-sys-util package
Locked to 60fe35be but no longer dependent on liujing2 repo.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-06-04 17:51:52 +02:00
Samuel Ortiz
d5f5648b37 vendor: Add vendored dependencies
We use cargo vendor to generate a .cargo/config file and the vendor
directory. Vendoring allows us to lock our dependencies and to modify
them easily from the top level Cargo.toml.

We vendor all dependencies, including the crates.io ones, which allows
for network isolated builds.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-06-04 17:51:52 +02:00
Rob Bradford
e3f7bc2e9d build: Update Cargo.lock to reflect changed dependencies
This also adds a new comment to Cargo.lock that is introduced by newer
cargo.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-06-03 14:18:18 +01:00
Samuel Ortiz
8bb71fad76 vmm: Simplify the vcpu run switch
Use a catchall case for all reasons that we do not handle, and
move the vCPU run switch into its own function.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-21 07:56:17 -07:00
Samuel Ortiz
9299502955 cloud-hypervisor: Switch to crates.io kvm-ioctls
Fixes: #15

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-15 05:59:08 +01:00
Samuel Ortiz
576a28ae5e net_util: Add helper for generating a random local MAC
We must ensure our MAC addresses do not conflict with a global one.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-10 16:32:39 +02:00
Samuel Ortiz
0c4c330843 cloud-hypervisor: Switch to the linux-loader pending PR branch
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-10 16:32:39 +02:00
Sebastien Boeuf
c0be6642ad vmm: Leverage virtio-net to provide connectivity
This patch expand the device registration to add a new virtio-net
device in case the user provide the appropriate flag --net from the
command line.

If the flag is provided, the code will parse the TAP interface name
and the expected MAC address from the command line. The VM will be
connected to the provided TAP interface, and it will communicate the
MAC address to the virtio-net driver.

If the flag is not provided, the VM will not register any virtio-net
device, therefore it will not have any connectivity with the host.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-05-10 16:32:39 +02:00
Sebastien Boeuf
53f5295454 network: Add virtio-net dependencies
The newly added virtio-net implementation needs to interact with TAP
interfaces and MAC addresses, which is the reason why it is easier
to rely on existing packages net_util and net_gen.

One more thing, both net_util and net_gen could be trimmed down,
based on using only the things we need from cloud-hypervisor.

Both net_util, net_gen and sys_util are based on Firecracker
commit d4a89cdc0bd2867f821e3678328dabad6dd8b767.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-05-10 16:32:39 +02:00
Sebastien Boeuf
b67e0b3dad vmm: Use virtio-blk to support booting from disk image
After the virtio-blk device support has been introduced in the
previous commit, the vmm need to rely on this new device to boot
from disk images instead of initrd built into the kernel.

In order to achieve the proper support of virtio-blk, this commit
had to handle a few things:

  - Register an ioevent fd for each virtqueue. This important to be
    notified from the virtio driver that something has been written
    on the queue.

  - Fix the retrieval of 64bits BAR address. This is needed to provide
    the right address which need to be registered as the notification
    address from the virtio driver.

  - Fix the write_bar and read_bar functions. They were both assuming
    to be provided with an address, from which they were trying to
    find the associated offset. But the reality is that the offset is
    directly provided by the Bus layer.

  - Register a new virtio-blk device as a virtio-pci device from the
    vm.rs code. When the VM is started, it expects a block device to
    be created, using this block device as the VM rootfs.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-05-08 08:55:09 +02:00
Chao Peng
80ac3a84bb qcow: Add qcow support
Extracted from crosvm (commit:f82d632), with clippy fixes.

Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
2019-05-08 08:55:09 +02:00
Samuel Ortiz
0adc3481df vmm: Add PCI root
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-08 08:55:06 +02:00
Samuel Ortiz
c6c5e10a04 vmm: Add a basic stdin loop
After starting all vCPUs, we loop for STDIN input.
We need a more scalable eventfd control loop, obviously.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-08 08:40:42 +02:00
Samuel Ortiz
1853b350ee cloud-hypervisor: Add devices crate
Based on the Firecracker devices crate from commit 9cdb5b2.

It is a trimmed down version compared to the Firecracker one, to remove
a bunch of pulled dependencies (logger, metrics, rate limiter, etc...).

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-08 08:40:42 +02:00
Samuel Ortiz
0921cfb8f8 vmm: Basic Vcpu implementation
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-08 08:40:38 +02:00
Samuel Ortiz
539367b58c cloud-hypervisor: Initial kernel booting implementation
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-07 18:49:51 +02:00
Samuel Ortiz
a0da3deb5e cloud-hypervisor: Call into the test_vm() routine
test_vm is a dummy VM workload, we use it to test our initial VMM
settings.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-07 16:06:21 +02:00
Samuel Ortiz
2ed17abb5c cloud-hypervisor: Application handling
We will only support a --kernel option for now.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-07 16:03:17 +02:00
Samuel Ortiz
73337c8b19 cloud-hypervisor: Initial commit
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-05-07 10:19:57 +02:00