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>
This commit is contained in:
Adrian Moreno
2020-03-10 18:28:50 +01:00
parent 10b22acda6
commit e57e86e2ea
2 changed files with 70 additions and 0 deletions

View File

@@ -1125,3 +1125,27 @@ func TestBadCPUs(t *testing.T) {
t.Errorf("Error expected")
}
}
var (
vIommuString = "-device intel-iommu,intremap=on,device-iotlb=on,caching-mode=on"
vIommuNoCacheString = "-device intel-iommu,intremap=on,device-iotlb=on,caching-mode=off"
)
func TestIommu(t *testing.T) {
iommu := IommuDev{
Intremap: true,
DeviceIotlb: true,
CachingMode: true,
}
if !iommu.Valid() {
t.Fatalf("iommu should be valid")
}
testAppend(iommu, vIommuString, t)
iommu.CachingMode = false
testAppend(iommu, vIommuNoCacheString, t)
}