forked from kata-containers/govmm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qemu/qmp: preparation for s390x support
This PR prepares for the s390x support. It introduces: - a generalization of ccw and pci devices. The variable 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 return the right parameters. In the case of ccw devices, they don't have the flag disable-modern - a function mqParameter has been introduced to return the right parameters for the mq case. The virtio-net-ccw 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: in the disable-modern=on/off have been changed to disable-modern=true/false. In the code there was a mixture of on/true off/false Fixes: kata-containers#61 Co-authored-by: Yash D Jain <ydjainopensource@gmail.com> Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
- Loading branch information
Alice Frosi
and
Yash D Jain
committed
Nov 21, 2018
1 parent
e82e849
commit e0e77a8
Showing
5 changed files
with
265 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// +build !s390x | ||
|
||
package qemu | ||
|
||
const ( | ||
// Virtio9P is the 9pfs device driver. | ||
Virtio9P DeviceDriver = "virtio-9p-pci" | ||
|
||
// VirtioSerial is the serial device driver. | ||
VirtioSerial DeviceDriver = "virtio-serial-pci" | ||
|
||
// VirtioNet is the virt-io pci networking device driver. | ||
VirtioNet DeviceDriver = VirtioNetPCI | ||
|
||
// Vfio is the vfio driver | ||
Vfio DeviceDriver = "vfio-pci" | ||
|
||
// VirtioScsi is the virtio-scsi device | ||
VirtioScsi DeviceDriver = "virtio-scsi-pci" | ||
|
||
// VHostVSock is a generic Vsock vhost device | ||
VHostVSock DeviceDriver = "vhost-vsock-pci" | ||
) | ||
|
||
// isVirtioPCI is a map indicating if a DeviceDriver is considered as a | ||
// virtio PCI device, which is helpful to determine if the option "romfile" | ||
// applies or not to this specific device. | ||
var isVirtioPCI = map[DeviceDriver]bool{ | ||
NVDIMM: false, | ||
Virtio9P: true, | ||
VirtioNetPCI: true, | ||
VirtioSerial: true, | ||
VirtioBlock: true, | ||
Console: false, | ||
VirtioSerialPort: false, | ||
VHostVSock: true, | ||
VirtioRng: true, | ||
VirtioBalloon: true, | ||
VhostUserSCSI: true, | ||
VhostUserBlk: true, | ||
Vfio: true, | ||
VirtioScsi: true, | ||
PCIBridgeDriver: true, | ||
PCIePCIBridgeDriver: true, | ||
} | ||
|
||
// QemuNetdevParam converts to the QEMU -netdev parameter notation | ||
func (n NetDeviceType) QemuNetdevParam() string { | ||
switch n { | ||
case TAP: | ||
return "tap" | ||
case MACVTAP: | ||
return "tap" | ||
case IPVTAP: | ||
return "tap" | ||
case VETHTAP: | ||
return "tap" // -netdev type=tap -device virtio-net-pci | ||
case VFIO: | ||
return "" // -device vfio-pci (no netdev) | ||
case VHOSTUSER: | ||
return "vhost-user" // -netdev type=vhost-user (no device) | ||
default: | ||
return "" | ||
|
||
} | ||
} | ||
|
||
// QemuDeviceParam converts to the QEMU -device parameter notation | ||
func (n NetDeviceType) QemuDeviceParam() DeviceDriver { | ||
switch n { | ||
case TAP: | ||
return "virtio-net-pci" | ||
case MACVTAP: | ||
return "virtio-net-pci" | ||
case IPVTAP: | ||
return "virtio-net-pci" | ||
case VETHTAP: | ||
return "virtio-net-pci" // -netdev type=tap -device virtio-net-pci | ||
case VFIO: | ||
return "vfio-pci" // -device vfio-pci (no netdev) | ||
case VHOSTUSER: | ||
return "" // -netdev type=vhost-user (no device) | ||
default: | ||
return "" | ||
|
||
} | ||
} |
Oops, something went wrong.