@@ -61,34 +61,40 @@ var (
61
61
)
62
62
63
63
func defaultCPUType () CPUType {
64
+ // x86_64 + TCG + max was previously unstable until 2021.
65
+ // https://bugzilla.redhat.com/show_bug.cgi?id=1999700
66
+ // https://bugs.launchpad.net/qemu/+bug/1748296
67
+ defaultX8664 := "max"
68
+ if runtime .GOOS == "windows" && runtime .GOARCH == "amd64" {
69
+ // https://github.com/lima-vm/lima/pull/3487#issuecomment-2846253560
70
+ // > #931 intentionally prevented the code from setting it to max when running on Windows,
71
+ // > and kept it at qemu64.
72
+ //
73
+ // TODO: remove this if "max" works with the latest qemu
74
+ defaultX8664 = "qemu64"
75
+ }
64
76
cpuType := map [Arch ]string {
65
- AARCH64 : "cortex-a76" , // available since QEMU 7.1 (Aug 2022)
66
- ARMV7L : "cortex-a7" ,
67
- // Since https://github.com/lima-vm/lima/pull/494, we use qemu64 cpu for better emulation of x86_64.
68
- X8664 : "qemu64" ,
77
+ AARCH64 : "max" ,
78
+ ARMV7L : "max" ,
79
+ X8664 : defaultX8664 ,
69
80
RISCV64 : "max" ,
70
- S390X : "qemu" , // FIXME: what is the right choice for s390x?
81
+ S390X : "max" ,
71
82
}
72
83
for arch := range cpuType {
73
84
if IsNativeArch (arch ) && IsAccelOS () {
74
85
if HasHostCPU () {
75
86
cpuType [arch ] = "host"
76
- } else if HasMaxCPU () {
77
- cpuType [arch ] = "max"
78
87
}
79
88
}
80
89
if arch == X8664 && runtime .GOOS == "darwin" {
81
- switch cpuType [arch ] {
82
- case "host" , "max" :
83
- // disable AVX-512, since it requires trapping instruction faults in guest
84
- // Enterprise Linux requires either v2 (SSE4) or v3 (AVX2), but not yet v4.
85
- cpuType [arch ] += ",-avx512vl"
86
-
87
- // Disable pdpe1gb on Intel Mac
88
- // https://github.com/lima-vm/lima/issues/1485
89
- // https://stackoverflow.com/a/72863744/5167443
90
- cpuType [arch ] += ",-pdpe1gb"
91
- }
90
+ // disable AVX-512, since it requires trapping instruction faults in guest
91
+ // Enterprise Linux requires either v2 (SSE4) or v3 (AVX2), but not yet v4.
92
+ cpuType [arch ] += ",-avx512vl"
93
+
94
+ // Disable pdpe1gb on Intel Mac
95
+ // https://github.com/lima-vm/lima/issues/1485
96
+ // https://stackoverflow.com/a/72863744/5167443
97
+ cpuType [arch ] += ",-pdpe1gb"
92
98
}
93
99
}
94
100
return cpuType
@@ -1273,11 +1279,6 @@ func HasHostCPU() bool {
1273
1279
return false
1274
1280
}
1275
1281
1276
- func HasMaxCPU () bool {
1277
- // windows: WHPX: Unexpected VP exit code 4
1278
- return HasHostCPU ()
1279
- }
1280
-
1281
1282
func IsNativeArch (arch Arch ) bool {
1282
1283
nativeX8664 := arch == X8664 && runtime .GOARCH == "amd64"
1283
1284
nativeAARCH64 := arch == AARCH64 && runtime .GOARCH == "arm64"
0 commit comments