From 401ad67cccf177d1a59b7cc0e92dbb3907fdf94d Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Fri, 22 May 2020 09:34:29 +0200 Subject: [PATCH] vendor: update govmm to bring iommu support Bring support for vIOMMU. Commit: 7efaf0b1cde3883a3f38e656c2223f38b9086469 https://github.com/intel/govmm/pull/127 Signed-off-by: Adrian Moreno --- Gopkg.lock | 4 +- Gopkg.toml | 2 +- vendor/github.com/intel/govmm/qemu/qemu.go | 46 ++++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index e9bd8442bc..8f18223636 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -412,11 +412,11 @@ revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675" [[projects]] - digest = "1:13366d00de1cc5993e6585377c713be208e219b66b9d92b1668c8f2b15ce011a" + digest = "1:1e1ba2e121f1f7db23f0783c777aae4323f1af470886d1d507059ffa4537cb05" name = "github.com/intel/govmm" packages = ["qemu"] pruneopts = "NUT" - revision = "10b22acda6584998b491dc780bbba68bba8517e1" + revision = "7efaf0b1cde3883a3f38e656c2223f38b9086469" [[projects]] digest = "1:60f089a8a2e13f2ada9c1d8e07604e82011fb8b9950e6916e1fcedc3ca8e1a83" diff --git a/Gopkg.toml b/Gopkg.toml index 73c8e5c80c..0c69a8c583 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -48,7 +48,7 @@ [[constraint]] name = "github.com/intel/govmm" - revision = "10b22acda6584998b491dc780bbba68bba8517e1" + revision = "7efaf0b1cde3883a3f38e656c2223f38b9086469" [[constraint]] name = "github.com/kata-containers/agent" diff --git a/vendor/github.com/intel/govmm/qemu/qemu.go b/vendor/github.com/intel/govmm/qemu/qemu.go index 6ba204874f..a149dad8b0 100644 --- a/vendor/github.com/intel/govmm/qemu/qemu.go +++ b/vendor/github.com/intel/govmm/qemu/qemu.go @@ -1861,6 +1861,52 @@ func (b BalloonDevice) deviceName(config *Config) string { return BalloonDeviceTransport[b.Transport] } +// IommuDev represents a Intel IOMMU Device +type IommuDev struct { + Intremap bool + DeviceIotlb bool + CachingMode bool +} + +// Valid returns true if the IommuDev is valid +func (dev IommuDev) Valid() bool { + return true +} + +// deviceName the qemu device name +func (dev IommuDev) deviceName() string { + return "intel-iommu" +} + +// QemuParams returns the qemu parameters built out of the IommuDev. +func (dev IommuDev) QemuParams(_ *Config) []string { + var qemuParams []string + var deviceParams []string + + deviceParams = append(deviceParams, dev.deviceName()) + if dev.Intremap { + deviceParams = append(deviceParams, "intremap=on") + } else { + deviceParams = append(deviceParams, "intremap=off") + } + + if dev.DeviceIotlb { + deviceParams = append(deviceParams, "device-iotlb=on") + } else { + deviceParams = append(deviceParams, "device-iotlb=off") + } + + if dev.CachingMode { + deviceParams = append(deviceParams, "caching-mode=on") + } else { + deviceParams = append(deviceParams, "caching-mode=off") + } + + qemuParams = append(qemuParams, "-device") + qemuParams = append(qemuParams, strings.Join(deviceParams, ",")) + return qemuParams +} + // RTCBaseType is the qemu RTC base time type. type RTCBaseType string