support hardware accel for more machine types
parent
e1517954fb
commit
f99096fbcc
|
@ -339,7 +339,7 @@ func (d *Driver) Start() error {
|
|||
machineType := d.MachineType
|
||||
if runtime.GOOS == "darwin" {
|
||||
// highmem=off needed, see https://patchwork.kernel.org/project/qemu-devel/patch/20201126215017.41156-9-agraf@csgraf.de/#23800615 for details
|
||||
machineType += ",accel=hvf,highmem=off"
|
||||
machineType += ",highmem=off"
|
||||
}
|
||||
startCmd = append(startCmd,
|
||||
"-M", machineType,
|
||||
|
@ -379,6 +379,13 @@ func (d *Driver) Start() error {
|
|||
}
|
||||
}
|
||||
|
||||
// hardware acceleration is important, it increases performance by 10x
|
||||
if runtime.GOOS == "darwin" {
|
||||
startCmd = append(startCmd, "-accel", "hvf")
|
||||
} else if runtime.GOOS == "linux" {
|
||||
startCmd = append(startCmd, "-accel", "kvm")
|
||||
}
|
||||
|
||||
startCmd = append(startCmd,
|
||||
"-m", fmt.Sprintf("%d", d.Memory),
|
||||
"-smp", fmt.Sprintf("%d", d.CPU),
|
||||
|
|
|
@ -68,7 +68,6 @@ func qemuFirmwarePath() (string, error) {
|
|||
arch := runtime.GOARCH
|
||||
// For macOS, find the correct brew installation path for qemu firmware
|
||||
if runtime.GOOS == "darwin" {
|
||||
//return "/opt/homebrew/Cellar/qemu/6.2.0_1/share/qemu/edk2-aarch64-code.fd", nil
|
||||
p := "/usr/local/Cellar/qemu"
|
||||
fw := "share/qemu/edk2-x86_64-code.fd"
|
||||
if arch == "arm64" {
|
||||
|
@ -86,6 +85,7 @@ func qemuFirmwarePath() (string, error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch arch {
|
||||
case "amd64":
|
||||
return "/usr/share/OVMF/OVMF_CODE.fd", nil
|
||||
|
|
Loading…
Reference in New Issue