@@ -150,6 +150,10 @@ type features struct {
150
150
// e.g. "Available netdev backend types:\nsocket\nhubport\ntap\nuser\nvde\nbridge\vhost-user\n"
151
151
// Not machine-readable, but checking strings.Contains() should be fine.
152
152
NetdevHelp []byte
153
+ // MachineHelp is the output of `qemu-system-x86_64 -machine help`
154
+ // e.g. "Supported machines are:\nakita...\n...virt-6.2...\n...virt-7.0...\n...\n"
155
+ // Not machine-readable, but checking strings.Contains() should be fine.
156
+ MachineHelp []byte
153
157
}
154
158
155
159
func inspectFeatures (exe string ) (* features , error ) {
@@ -181,6 +185,19 @@ func inspectFeatures(exe string) (*features, error) {
181
185
f .NetdevHelp = stderr .Bytes ()
182
186
}
183
187
}
188
+
189
+ cmd = exec .Command (exe , "-machine" , "help" )
190
+ cmd .Stdout = & stdout
191
+ cmd .Stderr = & stderr
192
+ if err := cmd .Run (); err != nil {
193
+ logrus .Warnf ("failed to run %v: stdout=%q, stderr=%q" , cmd .Args , stdout .String (), stderr .String ())
194
+ } else {
195
+ f .MachineHelp = stdout .Bytes ()
196
+ if len (f .MachineHelp ) == 0 {
197
+ f .MachineHelp = stderr .Bytes ()
198
+ }
199
+ }
200
+
184
201
return & f , nil
185
202
}
186
203
@@ -220,7 +237,15 @@ func Cmdline(cfg Config) (string, []string, error) {
220
237
args = appendArgsIfNoConflict (args , "-machine" , "q35,accel=" + accel )
221
238
}
222
239
case limayaml .AARCH64 :
223
- args = appendArgsIfNoConflict (args , "-machine" , "virt,accel=" + accel + ",highmem=off" )
240
+ machine := "virt,accel=" + accel
241
+ // QEMU >= 7.0 requires highmem=off NOT to be set, otherwise fails with "Addressing limited to 32 bits, but memory exceeds it by 1073741824 bytes"
242
+ // 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)"
243
+ // https://github.com/lima-vm/lima/issues/680
244
+ // https://github.com/lima-vm/lima/pull/24
245
+ if ! strings .Contains (string (features .MachineHelp ), "virt-7.0" ) {
246
+ machine += ",highmem=off"
247
+ }
248
+ args = appendArgsIfNoConflict (args , "-machine" , machine )
224
249
}
225
250
226
251
// SMP
0 commit comments