Commit Graph

193 Commits

Author SHA1 Message Date
bin liu
f971801b10 qemu: only set wait parameter for server mode socket based char device
Now the `wait` is passed to qmp command, even at non-server mode. This
will cause qemu return this error:
'wait' option is incompatible with socket in client connect mode

Fixes: #205

Signed-off-by: bin liu <liubin0329@gmail.com>
2021-11-18 15:52:22 +08:00
Shengjing Zhu
82cc01d24d qemu: Fix 32 bit int overflow in test file
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2021-11-07 03:00:27 +08:00
Eric Ernst
ab7aa42147 Merge pull request #203 from mcastelino/topic/legacy-serial
qemu: Add support for legacy serial device
2021-11-04 16:15:28 -07:00
Manohar Castelino
1d1a23134a qemu: Add support for legacy serial device
- Add support for legacy serial device
- Additionally add support for the file backend for chardev

Legacy serial plus char backend file will allow us to support
capture early boot messages.

Signed-off-by: Manohar Castelino <mcastelino@apple.com>
2021-11-04 15:44:12 -07:00
Jakob Naucke
9a2bbedac7 qemu: Remove -realtime in favor of -overcommit
as `-realtime` has been removed in QEMU 6. `-overcommit` has been
supported since at least QEMU 3.1.

Fixes: #189
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-09-22 11:24:15 +02:00
Eric Ernst
c4da1a902a Merge pull request #202 from mcastelino/topic/fix-shutdown
Add clean shutdown support
2021-09-16 14:20:51 -07:00
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
Manohar Castelino
1ed52714c0 qmp: wait for POWERDOWN event in ExecuteSystemPowerdown()
ExecuteSystemPowerdown issues `system_powerdown` and waits
for `SHUTDOWN`. The event emitted is `POWERDOWN` per spec.

Without this we get an error even though the VM has shutdown
gracefully.

Per QEMU spec:

```

POWERDOWN (Event)

Emitted when the virtual machine is powered down through the power
control system, such as via ACPI.

Since

0.12

Example

<- { "event": "POWERDOWN",
     "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }

SHUTDOWN (Event)

Emitted when the virtual machine has shut down, indicating that qemu is
about to exit.

Arguments

guest: boolean
If true, the shutdown was triggered by a guest request (such as a
guest-initiated ACPI shutdown request or other hardware-specific action)
rather than a host request (such as sending qemu a SIGINT). (since 2.10)
reason: ShutdownCause
The ShutdownCause which resulted in the SHUTDOWN. (since 4.0)
Note

If the command-line option “-no-shutdown” has been specified, qemu will
not exit, and a STOP event will eventually follow the SHUTDOWN event

Since

0.12

Example

<- { "event": "SHUTDOWN", "data": { "guest": true },
     "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }

```

Signed-off-by: Manohar Castelino <mcastelino@apple.com>
2021-09-16 13:01:58 -07:00
David Gibson
de039da2a9 govmm/qemu: Let IO/memory reservations be specified for bridge devices
This adds fields to BridgeDevice struct to allow qemu's io-reserve,
mem-reserve and pref64-reserve properties to be set for PCI bridges.
This is needed for Kata's upcoming change to ACPI hotplug.

fixes #200

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-09-09 11:47:50 +10:00
Hui Zhu
5c7998db04 QMP: Add ExecuteBlockdevAddWithDriverCache
ExecuteBlockdevAddWithDriverCache has three one parameter driver
than ExecuteBlockdevAddWithCache.
Parameter driver can set the driver of block device.

Fixes: #198

Signed-off-by: Hui Zhu <teawater@antfin.com>
2021-08-31 16:34:33 +08: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
David Gibson
d27256f863 qmp: Don't use deprecated 'props' field for object-add
Use of the 'props' argument to 'object-add' has been deprecated since QEMU
5.0 (commit 5f07c4d60d09) in favor of flattening the properties directly
into the 'object-add' arguments.  Support for 'props' is removed entirely
in qemu 6.0 (commit 50243407457a).

fixes #193

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-08-04 13:42:41 +10:00
David Gibson
d8cdf9aa2a qemu: Drop support for versions older than 5.0
Kata requires version 5.2 (or 5.1 on ARM) anyway.  Simplify code by
dropping support for older versions.  In any case explicit checks against
version number aren't necessarily reliable for patched qemu versions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-08-04 13:42:41 +10: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
David Gibson
1b02192986 Use 'host_device' driver for blockdev backends
ExecuteBlockdevAdd() and ExecuteBlockdevAddWithCache() both appear to be
intended to create block devices in the guest which backend onto a block
device in the host. That seems to be the way that Kata always uses it.
However blockdevAddBaseArgs(), used by both those functions always uses the
"file" driver, which is only intended for use with regular file backends.

Use of the "file" driver for host block devices was deprecated in qemu-3.0,
and has been removed entirely in qemu-6.0 (commit 8d17adf34f5).  We should
be using the "host_device" driver instead.

fixes #191

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-07-29 13:32:39 +10: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
Marcel Apfelbaum
0e19ffb67e qemu: Allow hot-plugging memory devices on PCI bridges
Currently virtio-mem-pci devices can be hotplugged only on the root bus.
This doesn't work for PCIe machines like q35.

Extend the API to optionally support hotplugging on PCI bridges.

Fixes: #176

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
2021-06-21 19:55:20 +03: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
Fabiano Fidêncio
7183b12b07 Merge pull request #166 from kata-containers/egernst-patch-1
qmp: remove chatty log
2021-04-26 23:36:31 +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
Eric Ernst
b3eac95b28 qmp: remove frequent, chatty log
In Kata, we are getting a *lot* of logs at runtime from QMP, in particular `read from QMP: xxxx`

Ideally we'd set this to only be visible for trace, but I did not see this working when adding a
V(7) check around these prints. To avoid filling journal with info that isn't useful, let's drop.

Fixes: #165

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-04-01 09:09:32 -07: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
Eric Ernst
e2eb549fcd qmp: Add ro argument for block-device hotplug funcs
We should allow users to specify if a block device should be hotplugged
as read-only.

Fixes: #157

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-01-11 15:33:20 -08: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
b8cd705901 qmp: add dump-guest-memory support
By adding `dump-guest-memory` command, user can get kernel
memory dump when guest panic occurred.

Fixes: #152

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-19 17:09:12 +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
Julio Montes
2f6bb3dbec Merge pull request #146 from jodh-intel/update-for-new-github-org
misc: Update for new GitHub organisation name
2020-10-09 08:01:28 -05: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
James O. D. Hunt
9f309c2aa1 misc: Update for new GitHub organisation name
`govmm` is now part of the `kata-containers` GitHub organisation, so
update to reflect this.

Fixes: #145.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-10-09 09:10:10 +01:00
David Gibson
3d46d08a90 Add qom-get function
Add a function to access the qom-get QMP command so we can query
information from qemu.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-09-03 14:05:00 +10:00