Commit Graph

854 Commits

Author SHA1 Message Date
Rob Bradford
07cdb37dda vmm: cpu & acpi: Query CPU manager for CPU status
Rather than hardcode the CPU status for all the CPUs instead query from
the CPU manager via the I/O port that is is on via the ACPI tables.

Each CPU device has a _STA method that calls into the CSTA method which
reads and writes the I/O ports via the PRST field which exposes the I/O
port through and OpRegion.

As we only support boot CPUS report that all the CPUs are enabled for
now.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
5faf8b756c vmm: acpi: Add an _MAT for the CPU devices containing a LAPIC
The Linux kernel expects all CPUs, whether they be enabled or disabled
to have an _MAT entry containing the LAPIC details for this CPU with the
enabled bit set to 1 (in the flags.)

In the MADT table the same bit is used to determine if the CPU is
present at boot vs available later.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
e51ebe045f acpi_tables: Add support for Buffer objects
These are necessary to populate "_MAT" entries for CPU devices.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
1da0ff395d vmm: cpu: Add the CpuManager onto the IO bus
This allows the kernel (via ACPI based controls) to query and control
the CPU state.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
39a1b8f4db acpi_tables: aml: Add support for calling methods
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
d5bb0781e4 acpi_tables: aml: Add support for while loops
Which also requires adding support for addition.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
89f0db2173 acpi_tables: aml: Add support for device notification
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
d6696e1bdd acpi_tables: aml: Add support for mutexes
And add support for operations on them.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
3d70ce9ad1 acpi_tables: aml: Add "if" with local variables and arguments
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
d06623fb97 acpi_tables: aml: Add support for OpRegion
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
93ee6f5e62 acpi_tables: aml: Add support for field definitions
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
4b5ce23d97 acpi_tables: Add PkgLength variant that does not include itself
This is necessary as adding support for NamedFields requires a PkgLength
calculation that does not include the length itself.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
50c8335d3d vmm: device_manager: Expose the SystemAllocator
This allows other code to allocate I/O ports for use on the (already)
exposed IO bus.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Rob Bradford
1ac1231292 vmm: Encase CpuManager within an Arc<Mutex<>>
This is necessary to be able to add the CpuManager onto the IO bus.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 09:17:15 -08:00
Wu Zongyong
d7dc1a9226 pci: don't cleanup msi/msix interrupts repeatedly
We disabled msi/msix twice inside Drop trait for VfioPciDevice,
which resulted in error message "Could not disable MSI-X". Eliminating
this error by check whether the msi/msix capability is enabled.

Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>
CC: Liu Jiang <gerry@linux.alibaba.com>
2019-11-21 06:38:36 -08:00
Wu Zongyong
66fde245b3 vfio: use correct flags to disable interrupts
The comments of vfio kernel module said that individual subindex
interrupts can be disabled using the -1 value for DATA_EVENTFD or
the index can be disabled as a whole with:
    flags = (DATA_NONE|ACTION_TRIGGER), count = 0.

Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>
CC: Liu Jiang <gerry@linux.alibaba.com>
2019-11-21 06:38:36 -08:00
Rob Bradford
8ec89bc884 misc: Update to new repository locations
Update all references to the new repository locations. Many of these will
redirect however the one used for the hypervisor-fw binary does not so
this is required to allow the builds to pass.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-21 11:39:11 +00:00
Sebastien Boeuf
64305dab16 docs: device_model: Fix formatting error
Fix the summary table format.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-11-19 15:45:52 -08:00
Sebastien Boeuf
b55d75ea62 docs: Add device model
This commit introduces a dedicated document describing the device model
supported by cloud-hypervisor VMM.

It needs to be updated anytime a new device will be added in the future.

Fixes #437

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-11-19 14:10:36 -08:00
Samuel Ortiz
f0e618431d vmm: device_manager: Use consistent naming when adding devices
When adding devices to the guest, and populating the device model, we
should prefix the routines with add_. When we're just creating the
device objects but not yet adding them we use make_.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-19 13:36:21 -08:00
Samuel Ortiz
a2ee681665 vmm: device_manager: Add an MMIO devices creation routine
In order to reduce the DeviceManager's new() complexity, we can move the
MMIO devices creation code into its own routine.

Fixes: #441

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-19 13:36:21 -08:00
Samuel Ortiz
79b8f8e477 vmm: device_manager: Add a PCI devices creation routine
In order to reduce the DeviceManager's new() complexity, we can move the
PCI devices creation code into its own routine.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-19 13:36:21 -08:00
Samuel Ortiz
5087f633f6 vmm: device_manager: Add an IOAPIC creation routine
In order to reduce the DeviceManager's new() complexity, we can move the
ACPI device creation code into its own routine.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-19 13:36:21 -08:00
Samuel Ortiz
ce1765c8af vmm: device_manager: Add an ACPI device creation routine
In order to reduce the DeviceManager's new() complexity, we can move the
ACPI device creation code into its own routine.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-19 13:36:21 -08:00
Samuel Ortiz
cfca2759fc vmm: device_manager: Add a legacy devices creation routine
In order to reduce the DeviceManager's new() complexity, we can move the
legacy devices creation code into its own routine.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-19 13:36:21 -08:00
Samuel Ortiz
4b469b98cf vmm: device_manager: Add a console creation routine
In order to reduce the DeviceManager's new() complexity, we can move the
console creation code into its own routine.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-19 13:36:21 -08:00
dependabot-preview[bot]
e1281b5488 build(deps): bump cast from 0.2.2 to 0.2.3
Bumps [cast](https://github.com/japaric/cast.rs) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/japaric/cast.rs/releases)
- [Changelog](https://github.com/japaric/cast.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/japaric/cast.rs/compare/v0.2.2...v0.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-18 08:43:57 +00:00
dependabot-preview[bot]
fa0d573fef build(deps): bump arc-swap from 0.4.3 to 0.4.4
Bumps [arc-swap](https://github.com/vorner/arc-swap) from 0.4.3 to 0.4.4.
- [Release notes](https://github.com/vorner/arc-swap/releases)
- [Changelog](https://github.com/vorner/arc-swap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorner/arc-swap/compare/v0.4.3...v0.4.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-18 08:43:17 +00:00
Sebastien Boeuf
d9695a0fd9 docs: fs: Update virtio-fs documentation
The cloud-hypervisor supports the DAX shared region for better virtio-fs
performances, but it was not updated in the documentation. This commit
takes care of this and also update the mount command since it changed
with virtio-fs v0.3.

Fixes #433

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-11-15 10:51:31 -08:00
dependabot-preview[bot]
4d0872df5f build(deps): bump vm-memory from 8d6ca35 to bb29ec8
Bumps [vm-memory](https://github.com/rust-vmm/vm-memory) from `8d6ca35` to `bb29ec8`.
- [Release notes](https://github.com/rust-vmm/vm-memory/releases)
- [Commits](8d6ca3553c...bb29ec8713)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-15 06:35:41 +00:00
Emin Ghuliev
c204d5404b docs: networking: Fix typo in hyperlink
An extra double quote was introduced by mistake in one of the hyperlink.

Signed-off-by: Emin Ghuliev drmint80@gmail.com
2019-11-13 13:18:26 +01:00
Samuel Ortiz
b930b3fb41 vmm: api: Specify which integers are 64 bit wide
By default, client will assume 32-bits for OpenAPI interger types.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-12 08:39:05 -08:00
Samuel Ortiz
6af2f57644 vmm: api: Fix the vm.info response payload
We are returning a state and a config.

Fixes: #431

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-12 08:39:05 -08:00
dependabot-preview[bot]
2dcd36f2f0 build(deps): bump synstructure from 0.12.2 to 0.12.3
Bumps [synstructure](https://github.com/mystor/synstructure) from 0.12.2 to 0.12.3.
- [Release notes](https://github.com/mystor/synstructure/releases)
- [Commits](https://github.com/mystor/synstructure/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-11 19:29:20 +00:00
Rob Bradford
6958ec4922 vmm: Move CPU management code to its own module
Move CpuManager, Vcpu and related functionality to its own module (and
file) inside the VMM crate

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-11 15:46:24 +00:00
dependabot-preview[bot]
7b77189c80 build(deps): bump vm-memory from 366a907 to 8d6ca35
Bumps [vm-memory](https://github.com/rust-vmm/vm-memory) from `366a907` to `8d6ca35`.
- [Release notes](https://github.com/rust-vmm/vm-memory/releases)
- [Commits](366a907660...8d6ca3553c)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-11 12:43:48 +00:00
Samuel Ortiz
3dde848c8f vmm: api: Update our OpenAPI document
In most cases we return a 204 (No Content) and not a 201.
In those cases, we do not send any HTTP body back at all.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-10 14:51:55 +01:00
Samuel Ortiz
96aa2441ad vmm: http: Convert to micro_http HttpServer
The new micro_http package provides a built-in HttpServer wrapper for
running a more robust HTTP server based on the package HTTP API.

Switching to this implementation allows us to, among other things,
handle HTTP requests that are larger than 1024 bytes.

Fixes: #423

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-10 14:51:55 +01:00
Samuel Ortiz
f34ace7673 vmm: http_endpoint: Do not sent 200 status code when our body is empty
Otherwise HTTP client will not close the connection and wait for a
pending body.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-11-10 14:51:55 +01:00
Jose Carlos Venegas Munoz
ede262684d API: HTTP: change response content type to JSON
The HTTP API responses are encoded in json

Suggested-by:  Samuel Ortiz <sameo@linux.intel.com>
Tested-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-11-08 22:49:08 +01:00
Jose Carlos Venegas Munoz
7498647e3f cargo: Update micro_http
Update micro_http create to allow set content type.

Suggested-by:  Samuel Ortiz <sameo@linux.intel.com>
Tested-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-11-08 22:49:08 +01:00
dependabot-preview[bot]
fa94635282 build(deps): bump syn from 1.0.7 to 1.0.8
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.7...1.0.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-08 21:18:37 +00:00
Rob Bradford
ff36fa99e6 vm-virtio: Replace use of deprecated std::mem::uninitialized
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-08 20:43:52 +00:00
Rob Bradford
3c715daa9d vmm: Fix rustfmt failure by removing extra ";"
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-08 20:43:52 +00:00
Rob Bradford
73b4668bd9 acpi_tables: Fix rustfmt failure by removing extra ";"
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-08 20:43:52 +00:00
Rob Bradford
a1a5fe0c93 vmm: Split CPU management into it's own struct
Pull details of vCPU management (booting, pausing, resuming, shutdown)
into it's own structure. This will ultimately enable this to be moved to
its own file and encapsulate all the vCPU handling for the VMM.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-08 11:59:21 +01:00
Rob Bradford
0319a4a09a arch: vmm: Move ACPI tables creation to vmm crate
Remove ACPI table creation from arch crate to the vmm crate simplifying
arch::configure_system()

GuestAddress(0) is used to mean no RSDP table rather than adding
complexity with a conditional argument or an Option type as it will
evaluate to a zero value which would be the default anyway.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-11-07 14:02:27 +00:00
Sergio Lopez
c3eaa41b77 ci: use the new vhost-user-blk backend for integration tests
Use the new vhost-user-blk backend for the integration tests,
eliminating the need for building vubd using the implementation in
QEMU.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2019-11-07 10:36:30 +00:00
Sergio Lopez
ceafd4cee7 vhost_user_backend: remove ownership check in set_features()
set_features() fails with InvalidOperation if !self.owned. I don't see
this as a requirement in the specification and, in fact, vm-virtio
implementation for resetting the device calls SET_FEATURES just after
RESET_OWNER.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2019-11-07 10:36:30 +00:00
Sergio Lopez
5870452d25 src: add vhost-user-blk backend
Create a vhost-user-blk backend using vhost-user-backend and following
the conventions established by the existing vhost-user-net
implementation.

This backend is based on https://github.com/slp/vhost-user-backend,
but a bit simplified, making it closer to the original implementation
in Firecracker. The main features missing are EVENT_IDX, support for
asynchronous I/O and multiqueue, but it's still fully functional and
provides a good starting point for evolving it into a more complete
implementation.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2019-11-07 10:36:30 +00:00