Skip to content

Commit 1ed8c20

Browse files
committed
docs: add PCI passthrough removal instructions
1 parent 8eb1139 commit 1ed8c20

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

docs/compute.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,54 @@ This kernel parameter is not retained when you upgrade an XCP-ng host [using the
103103

104104
`[root@xen ~]# xe vm-start uuid=<vm uuid>`
105105

106+
## PCI Passthrough Removal
107+
To remove a PCI device that has been attached to a VM via PCI passthrough:
108+
109+
### 1. List PCI Devices with `lspci`
110+
_This is to make sure you remove the correct PCI device_
111+
```
112+
[root@xen ~]# lspci
113+
...
114+
04:01.0 Ethernet controller: Intel Corporation 82541PI Gigabit Ethernet Controller (rev 05)
115+
```
116+
117+
### 2. Make sure your VM has halted
118+
```
119+
[root@xen ~]# xe vm-list uuid=<vm uuid>
120+
...
121+
uuid ( RO) : 740e9485-8e1a-da89-2561-d75bcede3fc9
122+
name-label ( RW): VM with PCI Passthrough
123+
power-state ( RO): halted
124+
```
125+
126+
### 3. Confirm the VM has the list of attached PCI devices
127+
Run
128+
`xe vm-param-list uuid=<vm uuid> | grep -i other-config`
129+
```
130+
[root@xen ~]# xe vm-param-list uuid=740e9485-8e1a-da89-2561-d75bcede3fc9 | grep -i other-config
131+
other-config (MRW): pci: 0/0000:04:01.0; base_template_name: Other install media; import_task: OpaqueRef:46e1e0db-f7fa-4131-8539-0f82f0336d7c; mac_seed: ebd99219-9881-b965-610e-342087ec6606; install-methods: cdrom
132+
```
133+
> If you have multiple devices, note down their PCI addresses as you may have to add them back after removing your device.
134+
135+
### 4. Remove the PCI device from the VM config using `vm-param-remove`
136+
Run `xe vm-param-remove param-name=other-config param-key=pci uuid=<vm uuid>`.
137+
```
138+
[root@xen ~]# xe vm-param-remove param-name=other-config param-key=pci uuid=740e9485-8e1a-da89-2561-d75bcede3fc9
139+
```
140+
141+
### 5. Confirm the PCI device is no longer attached
142+
Run `xe vm-param-list uuid=<vm uuid> | grep -i other-config` again.
143+
```
144+
[root@xen ~]# xe vm-param-list uuid=740e9485-8e1a-da89-2561-d75bcede3fc9 | grep -i other-config
145+
other-config (MRW): base_template_name: Other install media; import_task: OpaqueRef:46e1e0db-f7fa-4131-8539-0f82f0336d7c; mac_seed: ebd99219-9881-b965-610e-342087ec6606; install-methods: cdrom
146+
```
147+
> At this point, if you had multiple devices and they were removed, you should add them back again using the `vm-param-set` command`.
148+
149+
You can now attach the device to another VM or add it back to the `dom0` control domain.
150+
151+
### 6. Reattach PCI device to control domain
152+
Run `/opt/xensource/libexec/xen-cmdline --delete-dom0 xen-pciback.hide`
153+
106154
## GPU Passthrough
107155
To passthrough a complete graphics card to a VM (not virtualize it into multiple virtual vGPUs, which is different, see the vGPU section below), just follow the regular PCI passthrough instructions, no special steps are needed. Most Nvidia and AMD video cards should work without issue.
108156

0 commit comments

Comments
 (0)