mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-09-06 09:21:28 +00:00
Merge pull request #2162 from arm64b/qemu-for-aarch64
ARM64: Remove the hardcode of virtual machine type
This commit is contained in:
@@ -349,12 +349,27 @@ func buildQemuCmdline(config QemuConfig) (QemuConfig, []string) {
|
|||||||
qemuArgs = append(qemuArgs, "-device", "virtio-rng-pci")
|
qemuArgs = append(qemuArgs, "-device", "virtio-rng-pci")
|
||||||
qemuArgs = append(qemuArgs, "-smp", config.CPUs)
|
qemuArgs = append(qemuArgs, "-smp", config.CPUs)
|
||||||
qemuArgs = append(qemuArgs, "-m", config.Memory)
|
qemuArgs = append(qemuArgs, "-m", config.Memory)
|
||||||
|
// Need to specify the vcpu type when running qemu on arm64 platform, for security reason,
|
||||||
|
// the vcpu should be "host" instead of other names such as "cortex-a53"...
|
||||||
|
if config.Arch == "aarch64" {
|
||||||
|
qemuArgs = append(qemuArgs, "-cpu", "host")
|
||||||
|
}
|
||||||
|
|
||||||
if config.KVM {
|
if config.KVM {
|
||||||
qemuArgs = append(qemuArgs, "-enable-kvm")
|
qemuArgs = append(qemuArgs, "-enable-kvm")
|
||||||
qemuArgs = append(qemuArgs, "-machine", "q35,accel=kvm:tcg")
|
// Remove the hardcode of virtual machine type for x86, since we will
|
||||||
|
// support aarch64 in future
|
||||||
|
if config.Arch == "aarch64" {
|
||||||
|
qemuArgs = append(qemuArgs, "-machine", "virt")
|
||||||
|
} else {
|
||||||
|
qemuArgs = append(qemuArgs, "-machine", "q35,accel=kvm:tcg")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
qemuArgs = append(qemuArgs, "-machine", "q35")
|
if config.Arch == "aarch64" {
|
||||||
|
qemuArgs = append(qemuArgs, "-machine", "virt")
|
||||||
|
} else {
|
||||||
|
qemuArgs = append(qemuArgs, "-machine", "q35")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, d := range config.Disks {
|
for i, d := range config.Disks {
|
||||||
|
Reference in New Issue
Block a user