Commit Graph

96 Commits

Author SHA1 Message Date
Manohar Castelino
fe83c208dc qemu: Add support for --no-shutdown Knob
Add support for --no-shutdown Knob. This allows us to
shutdown the VM without quitting QEMU.

Note: Also fix the comment around --no-reboot to be
more accurate.

Signed-off-by: Manohar Castelino <mcastelino@apple.com>
2021-09-16 13:07:48 -07:00
Julio Montes
68676b43a5 Merge pull request #179 from Jakob-Naucke/iommu-platform
qemu: Fix iommu_platform for CCW
2021-08-19 07:52:15 -05:00
Feng Wang
3a9a67499f qemu: Add credentials to qemu Cmd
add credentials to the command attribute

Fixes #2444

Signed-off-by: Feng Wang <feng.wang@databricks.com>
2021-08-16 10:44:00 -07:00
Jakob Naucke
18352c36ec qemu: Fix iommu_platform for vhost user CCW
Enable iommu_platform for vhost user devices

Fixes: #178
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-29 12:51:32 +02:00
Liang Zhou
9518675e11 add support for "sandbox" feature to qemu
Update the govmm code in order to support "sandbox" feature on qemu,
which can introduce another protect layer on the host,
to make the secure container more secure.

Fixes: #185

Signed-off-by: Liang Zhou <zhoul110@chinatelecom.cn>
2021-07-23 04:24:40 -07:00
Archana Shinde
0173713ea9 Merge pull request #187 from devimc/2021-07-21/nvdimmRO
qemu: support read-only nvdimm
2021-07-22 04:53:11 -07:00
Julio Montes
335fa81667 qemu: fix golangci-lint errors
fix golangci-lint errors

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-07-21 15:08:12 -05:00
Julio Montes
0d21263a9b qemu: support read-only nvdimm
Append `readonly=on` to a `memory-backend-file` object and
`unarmed=on` to a `nvdimm` device when `ReadOnly` is set to `true`

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-07-21 11:26:19 -05:00
Jakob Naucke
ff34d283db qemu: Consistent parameter building
Always join by ",", do not put commas in the parameter slices. Always
use the variable name `deviceParams`.

Fixes: #180
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-16 15:14:14 +02:00
Amulyam24
c135681d9a qemu: Add support for PEF
Adding the support for Protected Execution Facility(PEF) is
which is the confidential computing technology on ppc64le.

Fixes: #174

Signed-off-by: Amulyam24 <amulmek1@in.ibm.com>
2021-05-20 13:50:25 +00:00
Jakob Naucke
03b55ea51d qemu: Add support for Secure Execution
Secure Execution, also known as Protected Virtualization in QEMU, is a
confidential computing technology for s390x (IBM Z & LinuxONE). Allow
the respective object.

Fixes: #172

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-05-20 10:45:39 +02:00
Jakob Naucke
7a367dc0a8 qemu: Simplify (Object).Valid()
so that more object types can be added without going over cyclomatic
complexity limits

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-05-20 10:45:37 +02:00
Sandeep Gupta
a6cec2d38c qemu: add support for SevGuest object
Signed-off-by: Jim Cadden <jcadden@ibm.com>
2021-05-20 10:08:02 +02:00
Jakob Naucke
abd3c7ea03 qemu: VhostUserDevice CCW device numbers
Add CCW (s390x) device numbers to VhostUserDevices, as is with other
device types. Add them to VhostUserFS devices (the only type currently
supported on s390x) when building QEMU parameters.

Fixes: #170

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-04-28 00:28:25 +02:00
Jakob Naucke
3eaeda7f6d qemu: Refactor vhostuserDev.QemuParams
by splitting out the respective functionality to QemuNetParams,
QemuSCSIParams, QemuBlkParams, and QemuFSParams. This allows adding
functionality to these functions without going beyond the cyclomatic
complexity of 15 mandated by the lint checks.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-04-28 00:28:11 +02:00
Michael Qiu
511cf58b0c Fix qemu commandline issue with empty romfile
Currently, if romfile field is empty, the commandline will
shows like below:
-device driver=virtio-net-pci,...,mq=on,vectors=4,romfile=

This does not make sense, just remove this field in commandline

Add unittest support.

Signed-off-by: Michael Qiu <qiudayu@huayun.com>
2021-04-22 04:09:16 -04:00
Julio Montes
3141894033 qemu: add support for tdx-guest object
support tdx-guest guest objects

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-03-30 16:18:11 -06:00
Fabiano Fidêncio
7fbc685865 Merge pull request #161 from Jakob-Naucke/memory-backend
qemu: Append memory backend for non-DIMM setups
2021-03-29 22:58:24 +02:00
GabyCT
4f6a403cde Merge pull request #162 from devimc/2021-03-24/deviceLoader
qemu: add support for device loaders
2021-03-29 10:22:21 -06:00
Jakob Naucke
4b136f3f1c qemu: Append memory backend for non-DIMM setups
Some architectures and setups do not support DIMM/NUMA. However, they
can still use memory backends, provided a memory backend of the same ID
is specified under -machine. This was introduced in QEMU 5.0. Enable
this functionality in appendMemoryKnobs.

Fixes: #160

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-03-29 15:53:39 +02:00
Julio Montes
6213dea42a qemu: support QEMU 6
Use `on` and `off` to enable or disable features,
`no` prefix is deprecated

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-03-24 11:05:24 -06:00
Julio Montes
0d47025d05 qemu: add support for device loaders
Devices loaders can be used to load some firmwares.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-03-24 10:35:45 -06:00
Jianyong Wu
0592c82536 qemu: add arm64 to support list of dimm
dimm is supported on arm64, so add is to check list.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
Fixes: #155
2020-11-19 16:44:16 +08:00
Edmond AK Dantes
2079c15c26 qemu: enable "-pflash"
flash image can store some critical data like firmware, enable it here.

Fixes: #140
Signed-off-by: Edmond AK Dantes <edmond.dantes.ak47@outlook.com>
2020-10-22 21:26:23 +08:00
Peng Tao
99f43ec188 Merge pull request #153 from liubin/feature/152-add-pvpanic-and-dump-guest-memory-support
qemu: add pvpanic and dump guest memory support
2020-10-20 13:20:39 +08:00
bin liu
d7836877e9 qemu: add pvpanic device to get GUEST_PANICKED event
Listening to the events channel from QEMU and a guest
panic event issued, then we can get the event and do some
work for the special event.

Fixes: #152

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-19 16:59:37 +08:00
Julio Montes
11b6ac380d Merge pull request #151 from mazzy89/blk-device-serial
Add serial ID to blk device
2020-10-16 08:28:30 -05:00
Salvatore Mazzarino
43d774d27b Add serial to blk device
Signed-off-by: Salvatore Mazzarino <dev@mazzarino.cz>
2020-10-12 17:35:06 +02:00
Salvatore Mazzarino
8cb8b24c05 Make fw_cfg a slice
Signed-off-by: Salvatore Mazzarino <dev@mazzarino.cz>
2020-10-12 12:29:05 +02:00
Salvatore Mazzarino
29ba5a9012 qemu: add fw_cfg flag to config
Signed-off-by: Salvatore Mazzarino <dev@mazzarino.cz>
2020-10-09 10:17:58 +02:00
Jakob-Naucke
39c372a201 Add support for hot-plugging IBM VFIO-AP devices
Add ExecuteAPVFIOMediatedDeviceAdd to qmp.go, which executes a hotplug
for an IBM Adjunct processor (AP) VFIO device (see also
https://www.kernel.org/doc/html/latest/s390/vfio-ap.html )
Also includes the respective unittest and adds the VfioAP DeviceDriver
constant to qemu.go.

Pushing again due to incidental CI failure

Fixes: #133

Signed-off-by: Jakob-Naucke <jakob.naucke@ibm.com>
Reviewed-by: alicefr <afrosi@redhat.com>
2020-08-18 17:35:23 +02:00
Qi Feng Huo
cf0f05d2e9 qemu: add iommu_platform knob for qemuParams
Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>

fix typo

Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>

qemu: remove useless fmt.Sprintf for qemuParams

Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>

fix test cases for s390x

Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>
2020-07-30 22:19:49 +08:00
Liam Merwick
6645baf249 qemu: Add NoReboot config Knob for qemuParams
The Kata architecture does not support rebooting VMs (the lifecycle
being start/exec/kill) and if a VM is killed (e.g. using sysrq-trigger),
the VM does not exit fully and other layers do not notice the state change.
Kata needs a way to tell QEMU to run with the '--no-reboot' option
so that the guest VM exits and does not attempt to reboot.

Add a NoReboot boolean Knob so when Knobs.NoReboot is set, the '--no-reboot'
command-line option will be passed to QEMU on startup.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2020-07-27 15:04:54 +01:00
Julio Montes
abca6f3ce9 Add multidevs option to fsdev
multidevs specifies how to deal with multiple devices being shared with a 9p
export. `multidevs=remap` fixes the following warning:

```
9p: Multiple devices detected in same VirtFS export, which might lead to file
ID collisions and severe misbehaviours on guest!
You should either use a separate export for each device shared from host or
use virtfs option 'multidevs=remap'!
```

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-07-23 10:56:22 -05:00
Adrian Moreno
e57e86e2ea qemu: add IOMMU Device
The following options can be provided

Intremap: activates interrupt remapping
DeviceIotlb: enables device IOTLB support for the vIOMMU
CachingMode: enables Cahing Mode

See: https://wiki.qemu.org/Features/VT-d

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
2020-05-26 18:29:02 +02:00
Pradipta Kr. Banerjee
b2aa0225ac Enable Numa support for Power (ppc64le) architecture
Fixes #124
Signed-off-by: bpradipt@in.ibm.com
2020-05-13 01:21:00 +05:30
Julio Montes
ad66e4caf8 Merge pull request #122 from devimc/topic/qemu/maxPorts
qemu: Add max_ports option to virtio-serial device
2020-05-08 13:47:10 -05:00
Shuicheng Lin
29529a5d72 Add rt clock definition for rtc clock in qemu
There are three different types for the RTC clock: host, rt and vm.
Add `rt` to the list of RTC clocks.

Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
2020-05-06 08:43:40 +08:00
Julio Montes
0e98b613a8 qemu: Add max_ports option to virtio-serial device
Allow API consumers to change the maximum number of ports in the virtio-serial
devices, setting a lower number of ports can improve the boot time and
reduce the attack surface.

fixes #120

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-04-24 15:10:51 +00:00
Liam Merwick
787c86b7e5 qemu: Add microvm machine type support
Following on from #111 which added support for multiple virtio transports,
add code to use virtio-mmio as the transport when booting a guest with
the microvm machine type and add a microvm case when checking for
NUMA support. Also add a test case for machine string parsing.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2020-04-23 22:27:03 +01:00
Peng Tao
3700c55dd7 qemu: add block device readonly support
So that we can attach it readonly.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-02-21 08:58:53 +01:00
Mark Ryan
37b0d9c12f Merge pull request #111 from slp/multiple_transports
Refactor code to support multiple virtio transports at runtime
2020-02-18 13:51:07 +01:00
Sergio Lopez
88a25a2d68 Refactor code to support multiple virtio transports at runtime
Currently, virtio transports for each device are determined with
architecture dependent build time conditionals. This isn't the ideal
solution, as virtio transports aren't exactly tied to the host's
architecture.

For example, aarch64 VMs do support both PCI and MMIO devices, and
after the recent introduction of the microvm machine type, that's also
the case for x86_64.

This patch extends each device that supports multiple transports with
a VirtioTransport field, so users of the library can manually specify
a transport for each device. To avoid breaking the compatibility, if
VirtioTransport is empty a behavior equivalent to the legacy one is
achieved by checking runtime.GOARCH and Config.Machine.Type.

Keeping support for isVirtioPCI/isVirtioCCW in qmp.go is a bit
tricky. Eventually, the hot-plug API should be extended so callers
must manually specify the transport for the device.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-07 18:17:12 +01:00
Fabiano Fidêncio
2ee53b00ca qemu: Don't set ".cache-size=" when CacheSize is 0
As there's no guarantee that ".cache-size" is a supported QEMU property,
let's not add it to the QEMU command line when the user explicitly set
virtio_fs_cache_size to zero.

By not always setting ".cache-size" property we avoid errors like:
```
$ sudo podman --runtime=/usr/bin/kata-runtime run --security-opt label=disable -it fedora:31 /bin/bash
Error: failed to launch qemu: exit status 1, error messages from qemu log: qemu-kvm: -device vhost-user-fs-pci,chardev=char-88c350403e95d3db,tag=kataShared,cache-size=0M: Property '.cache-size' not found: OCI runtime error
```

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-02-07 09:56:36 +01:00
Jimmy Xu
f1252f6e17 qemu: Add pcie-root-port device support. 2020-01-26 21:44:11 +08:00
Jan Schintag
cb9f640b4e virtio-blk: Add support for share-rw flag
This allows multiple instances of qemu to share the same file for
virtio-blk device.

Fixes: #108
Signed-off-by: Jan Schintag <jan.schintag@de.ibm.com>
2019-09-13 08:58:23 +02:00
Alice Frosi
9463486d58 s390x: dimm not supported
Dimm is not supported on s390x

Fixes: #106
Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2019-08-27 08:37:21 +02:00
Peng Tao
234e0edfd7 qemu: fix memory prealloc handling
Memory preallocation is just a property of different memory backends.
We should treat it similar to memory sharing property. Also rename
FileBackedMemShared to MemShared as it is just another memory backend
property that works with different memory backends not just file backed
memory.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-14 00:32:00 -07:00
Peng Tao
30bfcaaa6d qemu: add debug logfile
When LogFile is specified, output debug log there.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-13 01:44:45 -07:00
Ace-Tang
8fd28e23ac Support x-pci-vendor-id and x-pci-device-id pass to qemu
since some vendor id like 1ded can not be identified by virtio-pci
driver, so upper level need to pass a specified vendor id to qemu.

the upper level will change unavailable id and pass it to qemu.

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-07-09 12:19:51 +08:00