Commit Graph

29 Commits

Author SHA1 Message Date
Mark Ryan
a70ffd1980 Build: Fix the build after repo move.
Ciao has recently moved from github.com/01org/ciao to
github.com/ciao-project/ciao.  This moves requires us to update our
import paths to build successfully.

Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
2017-09-21 17:39:45 +01:00
Manohar Castelino
0c206170c4 Knobs: Modify the behaviour of the Mlock knob.
The Mlock knob is unfortunately tied to realtime.
Allow Mlock knob to implicitly enable realtime to get the
desired swapping behavior when swapping is desired.

Note: Realtime as implemented today can only be used to enable
swap, and as such does not really control realtime behaviour.
The knob is redundant but retained here just to ensure that
when more capabilities are added in future QEMU iterations
we can take advantage of the same.

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2017-09-15 10:36:13 -07:00
Manohar Castelino
ddee41d553 QEMU: Enable realtime options
Enable realtime options in QEMU. Also add support to control memory
locking. Turning realtime on with memory locking disabled allows
memory to be swapped out, potentially increasing density of VMs.

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2017-09-14 08:54:35 -07:00
Manohar Castelino
4ecb9de5b3 qemu: Add support for memory pre-allocation
Add support for pre-allocating all of the RAM.
This increases the memory footprint of QEMU and should be used
only when needed.

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2017-09-12 15:45:16 -07:00
Sebastien Boeuf
e74aeef1ad qemu: Add disable-modern option for virtio devices
For some cases, we have to disable the fast MMIO support, by disabling
virtio 1.0. The reason for this is that we want to be able to nest our
qemu VM inside a VM run by an hypervisor with no support for fast MMIO.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2017-08-17 08:47:50 -07:00
Sebastien Boeuf
8d617ff5b9 qemu: Update virtio-net-pci command line
In case of a network device, and specifically virtio-net-pci, we have
to update to what is expected by qemu. In this case, the driver name
should be prefixed with "driver=".

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2017-08-17 00:51:32 -07:00
Sebastien Boeuf
d48b5b5f48 qemu: Add PCI option to the NetDevice
The existing NetDevice relies on virtio-net driver, but there is a
useful PCI variant which was not available: virtio-net-pci.
This patch adds this new driver and adds two parameters specific to
this: "bus" and "addr".

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2017-03-09 14:54:11 -08:00
Samuel Ortiz
2aa5f5a3c0 qemu: Add support for serial port addition
We add a new device driver, and also a name to the CharDev structure
this is needed for qemu to actually create the serial port on
the guest.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-10-13 17:56:31 +02:00
Samuel Ortiz
6fe338d604 qemu: Support creating multiple QMP sockets
The QMP socket implementation does not support multiple clients sending
and receiving QMP commands. As a consequence we need to be able to
create multiple QMP sockets from the qemu package, so that at least we
can support a fixed number of QMP clients.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-10-11 14:32:41 +02:00
Samuel Ortiz
992b861ec5 qemu: Add the daemonize qemu option to the Knobs structure
This way callers can choose if they want the qemu process to be a daemon
or not.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-30 15:56:28 +02:00
Samuel Ortiz
eae8fae0e7 qemu: Fix security model typo
The right qemu parameter is "security_model", not "security-model".

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-21 17:48:47 +02:00
Samuel Ortiz
db067857bd qemu: Make Config's FDs field private
All file descriptors will come from specific devices configurations, so
this patch:

1) Make the Config FDs file private
2) Provide an appendFDs() method for Config, that takes a slice of
os.File pointers and
   a) Adds them to the Config private fd slice
   b) Return a slice of ints that represent the file descriptors for
      these device specific files, as seen by the qemu process.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-19 12:43:03 +02:00
Samuel Ortiz
12f6ebe389 qemu: Embed the qemu parameters into the Config structure
It is a private field now, and all append*() routines are now
Config methods instead of private qemu functions.

Since we will have to carry a kernelParams private field as well,
this change will keep all built parameters internal and make things
consistent.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-19 12:41:40 +02:00
Samuel Ortiz
e193a77b8d qemu: Add support for block devices
For now we only support QCOW2 backed block devices.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 01:08:31 +02:00
Samuel Ortiz
6d7dfa04bf qemu: Get rid of the Driver structure
By adding QemuParams() to the Device interface, we can get rid of the
driver structure and simplify further the appendDevices() routine.

With that implementation we can generate the following qemu parameters:

"-device virtio-9p-pci,fsdev=foo,mount_tag=rootfs -fsdev local,id=foo,path=/bar/foo,security-model=none"

from these single structures:

        fsdev := FSDevice{
                Driver:        Virtio9P
                FSDriver:      Local,
                ID:            "foo",
                Path:          "/bar/foo",
                MountTag:      "rootfs",
                SecurityModel: None,
        }

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:43:41 +02:00
Samuel Ortiz
cc9cb33a5d qemu: Add QMPSocket specific type
Instead of open coding the QMP socket type, we now have a specific type
for it.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
2d736d7173 qemu: Add RTC specific types
Instead of open coding the RTC fields, we now have specific types for
it.
We also have a RTC unit test now.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
e543c3383d qemu: Probe each qemu device with a driver
Having separate structures for the qemu driver definitions
and each possible device definitions is confusing and error prone as one
needs to be very careful using matching IDs and names in both
structures.

As the driver parameter can be derived from the device
ones, this patch changes the Device and Driver structures to be linked
together, i.e. each driver needs to have its corresponding device.

For example this allows us to build the following 9pfs qemu parameters:

"-fsdev local,id=foo,path=/bar/foo,security-model=none -device virtio-9p-pci,fsdev=foo,mount_tag=rootfs"

from these structures:

	fsdev := FSDevice{
		Driver:        Local,
		ID:            "foo",
		Path:          "/bar/foo",
		MountTag:      "rootfs",
		SecurityModel: None,
	}

	driver := Driver{
		Driver: Virtio9P,
		Device: fsdev,
	}

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
eda8607cc6 qemu: Add netdev options to the Device structure
With the NetDev and MACAddress strings, we can now create networking
device drivers.
We also add a unit test for netdev Device creation.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
4780e2371f qemu: Add multi-queue and vhost definitions to NetDevice
We can now specify if we want vhost to be enabled and wich fds we should
use for multiqueue support.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
137e7c7242 qemu: Add a NetDevice slice to the Config structure
The NetDevice structure represents a network device to be emulated by
qemu.
We also add the corresponding unit test.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
c0e2aacad2 qemu: Add one unit test for the Config strings
Here we test that name, UUID and the CPU model are properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
5ba8ef79df qemu: Add QMP socket unit tests
We test that the QMP socket parameter is properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
7b2f7eb5d8 qemu: Add Memory and SMP unit tests
We test that the memory and SMP configuration parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
2ea9b9a385 qemu: Add a Kernel unit test
We test that the kernel path and the kernel parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
8e495f6eff qemu: Add a Knobs unit test
We test that all true and all false knobs parameters are properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
8aeb3d45aa qemu: Add an Object unit test
We test that memory-backend-file and empty objects parameters are
properly built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
38e041dc9d qemu: Add Device unit tests
We add a NVDIMM, a filesystem and an empty device.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00
Samuel Ortiz
54d32c2414 qemu: Add parameters adding unit tests
We only test the Machine parameters for now.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-09-17 00:41:13 +02:00