Skip to content

Commit ebbf56b

Browse files
committed
1 parent 4be1eb4 commit ebbf56b

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Configuration options](./options.md)
66
- [Network interfaces](./interfaces.md)
77
- [Shared directories](./shares.md)
8+
- [Device pass-through](./devices.md)
89
- [CPU emulation](./cpu-emulation.md)
910
- [Output options](./output-options.md)
1011
- [MicroVM options reference ⚙️](./microvm-options.md)

doc/src/devices.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Device pass-through
2+
3+
PCI and USB pass-through is supported on some hypervisors. Permission
4+
setup is automatic for declared `"pci'` devices, but manual for
5+
`"usb"` devices.
6+
7+
## Example PCI pass-through
8+
9+
Guest example:
10+
11+
```nix
12+
microvm.devices = [ {
13+
bus = "pci";
14+
path = "0000:06:00.1";
15+
} {
16+
bus = "pci";
17+
path = "0000:06:10.4";
18+
} ];
19+
```
20+
21+
Permission setup on the host is provided by systemd template unit
22+
23+
24+
## Example USB pass-through
25+
26+
### In the guest
27+
28+
```nix
29+
microvm.devices = [
30+
# RTL2838UHIDIR
31+
# Realtek Semiconductor Corp. RTL2838 DVB-T
32+
{ bus = "usb"; path = "vendorid=0x0bda,productid=0x2838"; }
33+
# Sonoff Zigbee 3.0 USB Dongle Plus
34+
# Silicon Labs CP210x UART Bridge
35+
{ bus = "usb"; path = "vendorid=0x10c4,productid=0xea60"; }
36+
];
37+
```
38+
39+
### On the host
40+
41+
USB device paths are not directly translatable to udev rules. Setup
42+
permissions yourself:
43+
44+
```nix
45+
services.udev.extraRules = ''
46+
# RTL2838UHIDIR
47+
# Realtek Semiconductor Corp. RTL2838 DVB-T
48+
SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="2838", GROUP="kvm"
49+
# Sonoff Zigbee 3.0 USB Dongle Plus
50+
# Silicon Labs CP210x UART Bridge
51+
SUBSYSTEM=="usb", ATTR{idVendor}=="10c4", ATTR{idProduct}=="ea60", GROUP="kvm"
52+
'';
53+
```

0 commit comments

Comments
 (0)