Commit Graph

4012 Commits

Author SHA1 Message Date
Sebastien Boeuf
d4316d0228 vmm: http: Allow file descriptor to be sent with add-net
In order to let a separate process open a TAP device and pass the file
descriptor through the control message mechanism, this patch adds the
support for sending a file descriptor over to the Cloud Hypervisor
process along with the add-net HTTP API command.

The implementation uses the NetConfig structure mutably to update the
list of fds with the one passed through control message. The list should
always be empty prior to this, as it makes no sense to provide a list of
fds once the Cloud Hypervisor process has already been started.

It is important to note that reboot is supported since the file
descriptor is duplicated upon receival, letting the VM only use the
duplicated one. The original file descriptor is kept open in order to
support a potential reboot.

Fixes #2525

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-19 09:51:32 +02:00
Muminul Islam
e481f97550 vmm, virtio-devices:seccomp: Add MSHV related seccomp rule
MSHV needs SYS_clock_gettime to pause and resume
the guest VM.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2021-07-15 11:05:11 -07:00
Muminul Islam
3937e03c02 vmm, virtio-devices: Extend mshv feature
There are some seccomp rules needed for MSHV
in virtio-devices but not for KVM. We only want to
add those rules based on MSHV feature guard.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2021-07-15 11:05:11 -07:00
Sebastien Boeuf
d68c388cac vmm: Update seccomp filters for HTTP thread
The micro-http crate now uses recvmsg() syscall in order to receive file
descriptors through control messages. This means the syscall must be
part of the authorized list in the seccomp filters.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-15 08:13:48 +00:00
dependabot[bot]
e60078d939 build: bump micro_http from 81a3c71 to 9517a30
Bumps [micro_http](https://github.com/firecracker-microvm/micro-http) from `81a3c71` to `9517a30`.
- [Release notes](https://github.com/firecracker-microvm/micro-http/releases)
- [Commits](81a3c71efb...9517a30037)

---
updated-dependencies:
- dependency-name: micro_http
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-15 08:13:48 +00:00
Wei Liu
39bc444db4 vmm, vm-device: make use of the kvm feature gate in vfio-ioctls
The vfio-ioctls crate now contains a KVM feature gate. Make use of it in
Cloud Hypervisor.

That crate has two users. For the vmm crate is it straight-forward. For
the vm-device crate, we introduce a KVM feature gate as well so that the
vmm crate can pass on the configuration.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-07-15 09:35:51 +02:00
Wei Liu
e8bafd8caa build: bump vfio-ioctls to 9b84069e9f41
Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-07-15 09:35:51 +02:00
dependabot[bot]
50e0869a17 build: bump env_logger from 0.8.4 to 0.9.0
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.8.4 to 0.9.0.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.4...v0.9.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-15 00:44:49 +00:00
Wei Liu
867016757e fuzz: patch versionize_derive in Cargo.toml
Just like how it is done in the top-level Cargo.toml.

This fixes a warning [0] when building the fuzzer binaries.

[0] https://github.com/rust-lang/rust/issues/82523

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-07-13 11:55:52 -07:00
Bo Chen
1365388f0b tests: Extend 'test_vfio' with block device passthrough
Fixes: #2822

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-07-13 14:08:57 +02:00
dependabot[bot]
73cc443213 build: bump cc from 1.0.68 to 1.0.69 in /fuzz
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.68 to 1.0.69.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.68...1.0.69)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-13 00:32:16 +00:00
dependabot[bot]
4e759ab437 build: bump synstructure from 0.12.4 to 0.12.5
Bumps [synstructure](https://github.com/mystor/synstructure) from 0.12.4 to 0.12.5.
- [Release notes](https://github.com/mystor/synstructure/releases)
- [Commits](https://github.com/mystor/synstructure/commits)

---
updated-dependencies:
- dependency-name: synstructure
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 23:59:15 +00:00
dependabot[bot]
8c0f2ae87c build: bump cc from 1.0.68 to 1.0.69
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.68 to 1.0.69.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.68...1.0.69)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 23:58:35 +00:00
Yukiteru
2b1173acc3 main: Add missing comma in help of arguments
The help of arguments `memory` and `memory-zone` missing a comma.
Before adding, these parts are as follows:

> hugepage_size=<hugepage_size>hotplug_method=acpi|virtio-mem

After adding, these parts will be:

> hugepage_size=<hugepage_size>,hotplug_method=acpi|virtio-mem

Signed-off-by: Yukiteru Lee <wfly1998@sina.com>
2021-07-12 17:43:40 +02:00
dependabot[bot]
26b46ec435 build: bump anyhow from 1.0.41 to 1.0.42
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.41...1.0.42)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 10:37:15 +02:00
dependabot[bot]
2100f97cbc build: bump vm-fdt from 849f31d to 3c05f2d
Bumps [vm-fdt](https://github.com/rust-vmm/vm-fdt) from `849f31d` to `3c05f2d`.
- [Release notes](https://github.com/rust-vmm/vm-fdt/releases)
- [Commits](849f31df6f...3c05f2dc84)

---
updated-dependencies:
- dependency-name: vm-fdt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 10:37:09 +02:00
dependabot[bot]
607fd3a8e5 build: bump micro_http from 9b605a8 to 81a3c71
Bumps [micro_http](https://github.com/firecracker-microvm/micro-http) from `9b605a8` to `81a3c71`.
- [Release notes](https://github.com/firecracker-microvm/micro-http/releases)
- [Commits](9b605a8b61...81a3c71efb)

---
updated-dependencies:
- dependency-name: micro_http
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 07:36:46 +00:00
dependabot[bot]
429928057d build: bump anyhow from 1.0.41 to 1.0.42 in /fuzz
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.41...1.0.42)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 07:36:28 +00:00
Sebastien Boeuf
7f507dd77d arch: x86_64: tdx: Fix HobHandoffInfoTable
The handoff table was missing the boot_mode field.

Suggested-by: Jiaqi Gao <jiaqi.gao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-09 14:56:28 -07:00
Henry Wang
ea0918e5e8 docs, scripts: Use upstream edk2 for AArch64
The edk2 upstream has already suppoorted AArch64 Cloud Hypervisor,
and hence we can use upstream edk2 in CI and doc.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-09 15:36:37 +02:00
Sebastien Boeuf
6b710209b1 numa: Add optional sgx_epc_sections field to NumaConfig
This new option allows the user to define a list of SGX EPC sections
attached to a specific NUMA node.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-09 14:45:30 +02:00
Sebastien Boeuf
3987026997 docs: Fix errors regarding NUMA documentation
A few fixes to the NUMA documentation as there were some mistakes in
there.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-09 14:45:30 +02:00
Sebastien Boeuf
9aedabe11e sgx: Add mandatory id field to SgxEpcConfig
In order to uniquely identify each SGX EPC section, we introduce a
mandatory option `id` to the `--sgx-epc` parameter.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-09 14:45:30 +02:00
Muminul Islam
4a3cec8c1f resources: Enable CONFIG_HYPERV in the kernel config
Enabling CONFIG_HYPERV in the Linux Kernel allows
guest to use hyperv clock source. This changes
improves guest performance. Without this changes
we saw slowness in the guest on MSHV.

Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com>
Signed-off-by: Muminul Islam <muislam@microsoft.com>
2021-07-09 09:23:29 +02:00
dependabot[bot]
3229fcc900 build: bump iced-x86 from 1.12.0 to 1.13.0
Bumps [iced-x86](https://github.com/icedland/iced) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/icedland/iced/releases)
- [Commits](https://github.com/icedland/iced/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: iced-x86
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-09 07:21:42 +00:00
dependabot[bot]
910313cfde build: bump iced-x86 from 1.12.0 to 1.13.0 in /fuzz
Bumps [iced-x86](https://github.com/icedland/iced) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/icedland/iced/releases)
- [Commits](https://github.com/icedland/iced/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: iced-x86
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-09 07:21:19 +00:00
dependabot[bot]
5b8eed0e8c build: bump libc from 0.2.97 to 0.2.98 in /fuzz
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.97 to 0.2.98.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.97...0.2.98)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-08 05:02:16 +00:00
dependabot[bot]
6cd6bb2755 build: bump vhost from 50b41b8 to 12fa070
Bumps [vhost](https://github.com/rust-vmm/vhost) from `50b41b8` to `12fa070`.
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](50b41b8477...12fa07029b)

---
updated-dependencies:
- dependency-name: vhost
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-08 04:18:06 +00:00
dependabot[bot]
613f74ca1e build: bump vm-fdt from 02d1b8f to 849f31d
Bumps [vm-fdt](https://github.com/rust-vmm/vm-fdt) from `02d1b8f` to `849f31d`.
- [Release notes](https://github.com/rust-vmm/vm-fdt/releases)
- [Commits](02d1b8fde2...849f31df6f)

---
updated-dependencies:
- dependency-name: vm-fdt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-08 04:17:56 +00:00
dependabot[bot]
5effa20a5b build: bump libc from 0.2.97 to 0.2.98
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.97 to 0.2.98.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.97...0.2.98)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-08 04:15:16 +00:00
Sebastien Boeuf
17c99ae00a vmm: Enable provisioning for SGX guest
The guest can see that SGX supports provisioning as it is exposed
through the CPUID. This patch enables the proper backing of this
feature by having the host open the provisioning device and enable
this capability through the hypervisor.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-07 14:56:38 +02:00
Sebastien Boeuf
9ec0c981f8 hypervisor: Add enable_sgx_attribute to the Vm API
We need a dedicated function to enable the SGX attribute capability
through the Hypervisor abstraction.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-07 14:56:38 +02:00
Arafatms
3d4e27fa0a virtio-devices: Remove VIRTIO_F_RING_PACKED from default virtio features
The cloud hypervisor tells the VM and the backend to support the PACKED_RING feature,
but it actually processes various variables according to the split ring logic, such
as last_avail_index. Eventually it will cause the following error (SPDK as an example):

    vhost.c: 516:vhost_vq_packed_ring_enqueue: *ERROR*: descriptor has been used before
    vhost_blk.c: 596:process_blk_task: *ERROR*: ====== Task 0x200113784640 req_idx 0 failed ======
    vhost.c: 629:vhost_vring_desc_payload_to_iov: *ERROR*: gpa_to_vva((nil)) == NULL

Signed-off-by: Arafatms <arafatms@outlook.com>
2021-07-07 14:30:47 +02:00
Henry Wang
c46441c937 build: bump vm-fdt from bbfd1e7 to 02d1b8f
Bumps [vm-fdt](https://github.com/rust-vmm/vm-fdt) from `bbfd1e7` to `02d1b8f`.
- [Release notes](https://github.com/rust-vmm/vm-fdt/releases)
- [Commits](bbfd1e7719...02d1b8fde2)

---
updated-dependencies:
- dependency-name: vm-fdt
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-07 09:55:18 +02:00
Sebastien Boeuf
5b6d424a77 arch, vmm: Fix TDVF section handling
This patch fixes a few things to support TDVF correctly.

The HOB memory resources must contain EFI_RESOURCE_ATTRIBUTE_ENCRYPTED
attribute.

Any section with a base address within the already allocated guest RAM
must not be allocated.

The list of TD_HOB memory resources should contain both TempMem and
TdHob sections as well.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-06 11:47:43 +02:00
dependabot[bot]
76ac0f1555 build: bump thiserror from 1.0.25 to 1.0.26 in /fuzz
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.25 to 1.0.26.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.25...1.0.26)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-06 07:32:25 +00:00
dependabot[bot]
74950d07dd build: bump thiserror from 1.0.25 to 1.0.26
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.25 to 1.0.26.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.25...1.0.26)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-06 07:02:29 +00:00
Henry Wang
894a46f30c tests: Re-enable AArch64 snapshot/restore test
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-05 22:51:56 +02:00
Jianyong Wu
8744162a0e arch: gic: Change restoring order of GICR register
If GICR_CTLR is restored before GICR_PROPBASER and GICR_PENDBASER,
the restoring of the latter registers will fail, as the LPI enable
bit is already set in GICR_CTLR. Therefore, in this commit, the
order of restoring GICR registers is changed.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2021-07-05 22:51:56 +02:00
Henry Wang
4da3bdcd6e vmm: Split restore device_manager and devices
Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-05 22:51:56 +02:00
Henry Wang
95ca4fb15e vmm: vm: Enable snapshot/restore of GICv3ITS
This commit enables the snapshot/restore of GICv3ITS in the process
of VM snapshot/restore.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-05 22:51:56 +02:00
Henry Wang
6dcf9f6588 arch: aarch64: Implement ITS Snapshottable trait
This commit implements the GicV3Its Snapshottable trait, including:

- GicV3Its state: GIC registers and ITS registers
- Save/restore logic of GicV3Its state

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-05 22:51:56 +02:00
Henry Wang
4440671739 arch: gic: Prepare helper functions to access ITS
This commit implements two helper functions `gicv3_its_attr_access`
and `gicv3_its_tables_access` to access ITS device attributes and
ITS tables.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-05 22:51:56 +02:00
Henry Wang
957d3deeea arch: gic: Extend GicV3Its with its_device field
In current code, the ITS device fd of GICv3 will be lost after the
creation of GIC. This commit adds a new `its_device` field for the
`GicV3Its` struct, which will be useful to save the ITS device fd.
This fd will be used in restoring the ITS device.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
2021-07-05 22:51:56 +02:00
Rob Bradford
6e63df98ba pci: vfio: Fix and clarify BAR calculation code
The BAR calculation code was incorrect for calculating I/O BARs but also
has misleading comments (mixing bits and bytes, first and least
significant, etc).

This change adjusts the algorithm to more closely match the version
described in the PCI specification and takes advantage of Rust's binary
literals for ease of reading. Although this is slightly longer by
calculating the 64-bit and 32-bit paths separately I think this is
easier to read.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-07-05 17:38:23 +02:00
Wei Liu
1f2915bff0 vmm: hypervisor: split set_user_memory_region to two functions
Previously the same function was used to both create and remove regions.
This worked on KVM because it uses size 0 to indicate removal.

MSHV has two calls -- one for creation and one for removal. It also
requires having the size field available because it is not slot based.

Split set_user_memory_region to {create/remove}_user_memory_region. For
KVM they still use set_user_memory_region underneath, but for MSHV they
map to different functions.

This fixes user memory region removal on MSHV.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-07-05 09:45:45 +02:00
Wei Liu
63b8d2eb58 build: bump mshv-{bindings, ioctls} to 3bdb6cae
Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-07-05 09:45:45 +02:00
Wei Liu
71bbaf556f vmm: seccomp: add seccomp rules for MSHV
Add a minimum set of rules that allow Cloud Hypervisor to run Linux on
top of Microsoft Hypervisor.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-07-05 09:44:02 +02:00
Wei Liu
8819bb0f21 vmm: seccomp: make use of KVM feature
The to-be-introduced MSHV rules don't need to contain KVM rules and vice
versa.

Put KVM constants into to a module. This avoids the warnings about
dead code in the future.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-07-05 09:44:02 +02:00
dependabot[bot]
215372fd78 build: bump vhost from 9982541 to 50b41b8
Bumps [vhost](https://github.com/rust-vmm/vhost) from `9982541` to `50b41b8`.
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](9982541776...50b41b8477)

---
updated-dependencies:
- dependency-name: vhost
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-04 09:00:01 +00:00