Skip to content

Commit

Permalink
qemu-arm64: Support nvdimm on arm64
Browse files Browse the repository at this point in the history
Original guest image was reprensented as block device in qemu-aarch64,
and it will bring up write lock error when running multiple containers.
Thanks to the new expanded IPA_SIZE feature in kernel 4.20 and
Eric Auger's related patch set in qemu(which are still under upstream
review), we could fully support nvdimm on arm64.

Fixes: kata-containers#843

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
  • Loading branch information
Pennyzct committed Mar 6, 2019
1 parent 5dda0b7 commit e75d40e
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions virtcontainers/qemu_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package virtcontainers

import (
"io/ioutil"
"os"
"runtime"
"strings"

Expand All @@ -24,7 +25,7 @@ const defaultQemuPath = "/usr/bin/qemu-system-aarch64"

const defaultQemuMachineType = QemuVirt

var defaultQemuMachineOptions = "usb=off,accel=kvm,gic-version=" + getGuestGICVersion()
var defaultQemuMachineOptions = "usb=off,accel=kvm,nvdimm,gic-version=" + getGuestGICVersion()

var qemuPaths = map[string]string{
QemuVirt: defaultQemuPath,
Expand All @@ -37,7 +38,9 @@ var kernelParams = []Param{
}

var kernelRootParams = []Param{
{"root", "/dev/vda1"},
{"root", "/dev/pmem0p1"},
{"rootflags", "data=ordered,errors=remount-ro rw"},
{"rootfstype", "ext4"},
}

var supportedQemuMachines = []govmmQemu.Machine{
Expand Down Expand Up @@ -160,3 +163,29 @@ func (q *qemuArm64) bridges(number uint32) []types.PCIBridge {
func (q *qemuArm64) appendBridges(devices []govmmQemu.Device, bridges []types.PCIBridge) []govmmQemu.Device {
return genericAppendBridges(devices, bridges, q.machineType)
}

func (q *qemuArm64) appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
imageFile, err := os.Open(path)
if err != nil {
return nil, err
}
defer imageFile.Close()

imageStat, err := imageFile.Stat()
if err != nil {
return nil, err
}

object := govmmQemu.Object{
Driver: govmmQemu.NVDIMM,
Type: govmmQemu.MemoryBackendFile,
DeviceID: "nv0",
ID: "mem0",
MemPath: path,
Size: (uint64)(imageStat.Size()),
}

devices = append(devices, object)

return devices, nil
}

0 comments on commit e75d40e

Please sign in to comment.