Skip to content

Commit 91ba136

Browse files
avnikastro
authored andcommitted
Bypass shell queting for PCI device ids (crosvm/cloud-hypervisor)
Signed-off-by: Alexander V. Nikolaev <[email protected]>
1 parent c630f37 commit 91ba136

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

lib/runners/cloud-hypervisor.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,14 @@ in {
213213
})
214214
else throw "Unsupported interface type ${type} for Cloud-Hypervisor"
215215
) interfaces)
216-
++
217-
arg "--device" (map ({ bus, path, ... }: {
216+
)
217+
+ " " + # Move vfio-pci outside of
218+
(lib.concatMapStringsSep " "
219+
({ bus, path, ... }: {
218220
pci = "path=/sys/bus/pci/devices/${path}";
219221
usb = throw "USB passthrough is not supported on cloud-hypervisor";
220222
}.${bus}) devices)
221-
++
222-
extraArgs
223-
);
223+
+ " " + lib.escapeShellArgs extraArgs;
224224

225225
canShutdown = socket != null;
226226

lib/runners/crosvm.nix

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,6 @@ in {
127127
# "--net-vq-pairs" (toString vcpu)
128128
# ]
129129
++
130-
builtins.concatMap ({ bus, path, ... }: {
131-
pci = [ "--vfio" "/sys/bus/pci/devices/${path},iommu=viommu" ];
132-
usb = throw "USB passthrough is not supported on crosvm";
133-
}.${bus}) devices
134-
++
135130
lib.optionals (vsock.cid != null) [
136131
"--vsock" (toString vsock.cid)
137132
]
@@ -140,9 +135,13 @@ in {
140135
"--initrd" initrdPath
141136
kernelPath
142137
]
143-
++
144-
extraArgs
145-
);
138+
)
139+
+ " " + # Move vfio-pci outside of
140+
(lib.concatMapStringsSep " " ({ bus, path, ... }: {
141+
pci = [ "--vfio" "/sys/bus/pci/devices/${path},iommu=viommu" ];
142+
usb = throw "USB passthrough is not supported on crosvm";
143+
}.${bus}) devices)
144+
+ " " + lib.escapeShellArgs extraArgs;
146145

147146
canShutdown = socket != null;
148147

0 commit comments

Comments
 (0)