Commit Graph

13 Commits

Author SHA1 Message Date
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
Salvatore Mazzarino
43d774d27b Add serial to blk device
Signed-off-by: Salvatore Mazzarino <dev@mazzarino.cz>
2020-10-12 17:35:06 +02: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
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
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
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
Jimmy Xu
f1252f6e17 qemu: Add pcie-root-port device support. 2020-01-26 21:44:11 +08:00
Alice Frosi
6d6b2d8892 s390x: add s390x travis support
Since we have travis support for s390x. Let's enable it

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2019-12-17 14:54:09 +01: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
Alice Frosi
65cc343f7b test: add devno in the tests for s390x
Add test with devno param

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2019-07-05 08:08:25 +02:00
Mark Ryan
d6173077f1 Run tests for the s390x build
It turns out it is possible to run the unit tests for the s390x build
on travis by renaming the s390x specific files, so that their
inclusion in the build is determined only by tags and not by filename,
and by introducing a new tag s390x_test that we can use to force
their inclusion into a build by using this tag.  The .travis file is
then updated to include the line

go test --tags s390x_test ./...

This creates a build on travis that includes the s390x specific
files and runs the unit tests.

Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
2018-12-03 15:56:20 +01:00
Mark Ryan
ca477a18b6 Update source file headers
This commit updates the headers in the Go source files to adhere
to the new guidelines in the CONTRIBUTING.md file.

Signed-off-by: Mark Ryan <mark.d.ryan@intel.com>
2018-11-30 09:34:21 +01:00
Alice Frosi
e4892e3396 qemu/qmp: preparation for s390x support
This PR prepares for the s390x support. It introduces:
 - a generalization of ccw and pci devices. The variables for the pci devices
   have been renamed by removing the Pci suffix. They have been moved to the
   qemu_arch_base.go
 - the mapping isVirtioPCI has been move to qemu_arch_base.go because in
   this way a different mapping can be added for other architecture (e.g
   s390x)
 - the functions QemuNetdevParam and QemuDeviceParam have been moved to
   qemu_arch_base.go. In this way, they could be reimplemented for other
   architecture for the case VHOSTUSER
 - a function disableModern has been introduced to check if the device is
   a pci device and then returns the right parameters. In the case of ccw
   devices, they don't have the disable-modern flag
 - a function mqParameter has been introduced to return the right
   parameters for the mq case. The virtio-net-ccw device doesn't have the
   vectors flag
 - in qemu_arch_base_test.go contains the test and strings that can be
   overwritten for other architectures (e.g s390). The devices names and
   the flags for the devices can be overwritten.
 - the string for the romfile has been replaced by a variable romfile
   that could be left empty if the devices doesn't support a romfile as
   for the ccw devices for s390.
 - clean-up: the disable-modern=on/off options have been changed to
   disable-modern=true/false. In the code there was a mixture of on/true
   off/false

Fixes: #61

Co-authored-by: Yash D Jain <ydjainopensource@gmail.com>
Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2018-11-23 10:15:09 +00:00