Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
qemu: Fix kernel_irqchip=split option for IOMMU enabled sandbox
Browse files Browse the repository at this point in the history
When an x86 sandbox has a vIOMMU (needed for VFIO), it needs the
'kernel_irqchip=split' option or it can't start.  fdcd1f3 attempts to set
that, but ends up just writing it to a temporary (looks like Go for range
loops pass by value).

Fixes: #2694
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
dgibson committed Jun 17, 2020
1 parent ada62fc commit 651d5ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions virtcontainers/qemu_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ func newQemuArch(config HypervisorConfig) qemuArch {
kernelParams = append(kernelParams,
Param{"iommu", "pt"})

for _, m := range qemuMachines {
for i, m := range qemuMachines {
if m.Type == QemuQ35 {
m.Options = q35QemuIOMMUOptions
qemuMachines[i].Options = q35QemuIOMMUOptions
}
}
} else {
Expand Down
16 changes: 16 additions & 0 deletions virtcontainers/qemu_amd64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,19 @@ func TestQemuAmd64Microvm(t *testing.T) {

assert.False(amd64.supportGuestMemoryHotplug())
}

func TestQemuAmd64Iommu(t *testing.T) {
assert := assert.New(t)

config := qemuConfig(QemuQ35)
config.IOMMU = true
qemu := newQemuArch(config)

p := qemu.kernelParameters(false)
assert.Contains(p, Param{"intel_iommu", "on"})

m, err := qemu.machine()

assert.NoError(err)
assert.Contains(m.Options, "kernel_irqchip=split")
}

0 comments on commit 651d5ff

Please sign in to comment.