Skip to content

Commit b2ebf30

Browse files
kkaprolatastro
authored andcommitted
qemu: move vfio-pci before serial console
1 parent 6dab9a7 commit b2ebf30

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

lib/runners/qemu.nix

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,21 @@ lib.warnIf (mem == 2048) ''
197197

198198
"-chardev" "stdio,id=stdio,signal=off"
199199
"-device" "virtio-rng-${devType}"
200-
] ++
200+
])
201+
+ " " + # Move vfio-pci outside of escapeShellArgs
202+
lib.concatStringsSep " " (lib.concatMap ({ bus, path, qemu,... }: {
203+
pci = [
204+
"-device" "vfio-pci,host=${path},multifunction=on${
205+
# Allow to pass additional arguments to pci device
206+
lib.optionalString (qemu.deviceExtraArgs != null) ",${qemu.deviceExtraArgs}"
207+
}"
208+
];
209+
usb = [
210+
"-device" "usb-host,${path}"
211+
];
212+
}.${bus}) devices)
213+
+ " " +
214+
lib.escapeShellArgs(
201215
builtins.concatMap (fwCfgOption: ["-fw_cfg" fwCfgOption]) fwCfgOptions ++
202216
lib.optionals serialConsole [
203217
"-serial" "chardev:stdio"
@@ -241,7 +255,7 @@ lib.warnIf (mem == 2048) ''
241255
lib.optionals (user != null) [ "-user" user ] ++
242256
lib.optionals (socket != null) [ "-qmp" "unix:${socket},server,nowait" ] ++
243257
lib.optionals balloon [
244-
"-device" ("virtio-balloon,free-page-reporting=on,id=balloon0" + lib.optionalString (deflateOnOOM) ",deflate-on-oom=on")
258+
"-device" ("virtio-balloon,free-page-reporting=on,id=balloon0" + lib.optionalString (deflateOnOOM) ",deflate-on-oom=on")
245259
] ++
246260
builtins.concatMap ({ image, letter, serial, direct, readOnly, ... }:
247261
[ "-drive"
@@ -328,19 +342,7 @@ lib.warnIf (mem == 2048) ''
328342
]
329343
++
330344
extraArgs
331-
)
332-
+ " " + # Move vfio-pci outside of
333-
lib.concatStringsSep " " (lib.concatMap ({ bus, path, qemu,... }: {
334-
pci = [
335-
"-device" "vfio-pci,host=${path},multifunction=on${
336-
# Allow to pass additional arguments to pci device
337-
lib.optionalString (qemu.deviceExtraArgs != null) ",${qemu.deviceExtraArgs}"
338-
}"
339-
];
340-
usb = [
341-
"-device" "usb-host,${path}"
342-
];
343-
}.${bus}) devices);
345+
);
344346

345347
canShutdown = socket != null;
346348

0 commit comments

Comments
 (0)