mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-29 19:24:23 +01:00
Merge pull request #304 from fidencio/wip/forward_port_2703
[foward port] Add vIOMMU support to qemu q35
This commit is contained in:
@@ -148,6 +148,9 @@ const (
|
||||
// HugePages is a sandbox annotation to specify if the memory should be pre-allocated from huge pages
|
||||
HugePages = kataAnnotHypervisorPrefix + "enable_hugepages"
|
||||
|
||||
// Iommu is a sandbox annotation to specify if the VM should have a vIOMMU device
|
||||
IOMMU = kataAnnotHypervisorPrefix + "enable_iommu"
|
||||
|
||||
// FileBackedMemRootDir is a sandbox annotation to soecify file based memory backend root directory
|
||||
FileBackedMemRootDir = kataAnnotHypervisorPrefix + "file_mem_backend"
|
||||
|
||||
|
||||
@@ -539,6 +539,15 @@ func addHypervisorMemoryOverrides(ocispec specs.Spec, sbConfig *vc.SandboxConfig
|
||||
|
||||
sbConfig.HypervisorConfig.HugePages = hugePages
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.IOMMU]; ok {
|
||||
iommu, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing annotation for iommu: Please specify boolean value 'true|false'")
|
||||
}
|
||||
|
||||
sbConfig.HypervisorConfig.IOMMU = iommu
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -771,6 +771,7 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
||||
ocispec.Annotations[vcAnnotations.EnableSwap] = "true"
|
||||
ocispec.Annotations[vcAnnotations.FileBackedMemRootDir] = "/dev/shm"
|
||||
ocispec.Annotations[vcAnnotations.HugePages] = "true"
|
||||
ocispec.Annotations[vcAnnotations.IOMMU] = "true"
|
||||
ocispec.Annotations[vcAnnotations.BlockDeviceDriver] = "virtio-scsi"
|
||||
ocispec.Annotations[vcAnnotations.DisableBlockDeviceUse] = "true"
|
||||
ocispec.Annotations[vcAnnotations.EnableIOThreads] = "true"
|
||||
@@ -802,6 +803,7 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
||||
assert.Equal(config.HypervisorConfig.Mlock, false)
|
||||
assert.Equal(config.HypervisorConfig.FileBackedMemRootDir, "/dev/shm")
|
||||
assert.Equal(config.HypervisorConfig.HugePages, true)
|
||||
assert.Equal(config.HypervisorConfig.IOMMU, true)
|
||||
assert.Equal(config.HypervisorConfig.BlockDeviceDriver, "virtio-scsi")
|
||||
assert.Equal(config.HypervisorConfig.DisableBlockDeviceUse, true)
|
||||
assert.Equal(config.HypervisorConfig.EnableIOThreads, true)
|
||||
|
||||
Reference in New Issue
Block a user