@@ -155,6 +155,9 @@ type features struct {
155
155
// e.g. "Supported machines are:\nakita...\n...virt-6.2...\n...virt-7.0...\n...\n"
156
156
// Not machine-readable, but checking strings.Contains() should be fine.
157
157
MachineHelp []byte
158
+
159
+ // VersionGEQ7 is true when the QEMU version seems v7.0.0 or later
160
+ VersionGEQ7 bool
158
161
}
159
162
160
163
func inspectFeatures (exe string ) (* features , error ) {
@@ -198,6 +201,7 @@ func inspectFeatures(exe string) (*features, error) {
198
201
f .MachineHelp = stderr .Bytes ()
199
202
}
200
203
}
204
+ f .VersionGEQ7 = strings .Contains (string (f .MachineHelp ), "-7.0" )
201
205
202
206
return & f , nil
203
207
}
@@ -218,8 +222,7 @@ func showDarwinARM64HVFQEMU620Warning(exe, accel string, features *features) {
218
222
if accel != "hvf" {
219
223
return
220
224
}
221
- if strings .Contains (string (features .MachineHelp ), "virt-7.0" ) {
222
- // QEMU 7.0.0 or later
225
+ if features .VersionGEQ7 {
223
226
return
224
227
}
225
228
if exeFull , err := exec .LookPath (exe ); err == nil {
@@ -285,7 +288,7 @@ func Cmdline(cfg Config) (string, []string, error) {
285
288
// QEMU < 7.0 requires highmem=off to be set, otherwise fails with "VCPU supports less PA bits (36) than requested by the memory map (40)"
286
289
// https://github.com/lima-vm/lima/issues/680
287
290
// https://github.com/lima-vm/lima/pull/24
288
- if ! strings . Contains ( string ( features .MachineHelp ), "virt-7.0" ) {
291
+ if ! features .VersionGEQ7 {
289
292
machine += ",highmem=off"
290
293
}
291
294
args = appendArgsIfNoConflict (args , "-machine" , machine )
0 commit comments