Skip to content

Commit 1bb7f7d

Browse files
committed
Introduce fboff to disable framebuffer
1 parent 3ae5fa5 commit 1bb7f7d

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ cat /etc/pve/qemu-server/204.conf
203203

204204
### 2.7. `pci_remove` and `pci_rescan`
205205

206-
In the reverse of 2.6, sometimes host will actually hold some memory in PCI device's address space, and prevent that space being handled by vfio-pci driver. One common example is `simplefb` allocating `BOOTFB` in [boot GPU's address space](https://github.com/torvalds/linux/blob/7e57714cd0ad2d5bb90e50b5096a0e671dec1ef3/drivers/firmware/sysfb_simplefb.c#L115) despite setting `video=simplefb:off` in kernel cmdline. A [hack](https://github.com/furkanmustafa/forcefully-remove-bootfb) exists but it is [not guranteed to work for everyone](https://github.com/SRH1605/forcefully-remove-bootfb/pull/1#issuecomment-1054073276). As such one can unbind and rebind the PCI device to free up the entire address space allocated for the device, indirectly getting rid of the offending memory allocation.
206+
In a reverse scenario of 2.6, sometimes host will actually hold some memory in PCI device's address space, and prevent that space being handled by vfio-pci driver and thus the VM. One common example is `simplefb` allocating `BOOTFB` in [boot GPU's address space](https://github.com/torvalds/linux/blob/7e57714cd0ad2d5bb90e50b5096a0e671dec1ef3/drivers/firmware/sysfb_simplefb.c#L115) despite setting `video=simplefb:off` in kernel cmdline. A [hack](https://github.com/furkanmustafa/forcefully-remove-bootfb) exists but it is [not guranteed to work for everyone](https://github.com/SRH1605/forcefully-remove-bootfb/pull/1#issuecomment-1054073276). As such one can unbind and rebind the PCI device to free up the entire address space allocated for the device, indirectly getting rid of the offending memory allocation. However, this won't work on all memory allocation. For memory occupied by `efifb`/`simplefb`, please see below.
207207

208208
The difference between this set of commands and `pci_unbind`/`pci_rebind` is that this set runs before VM is started (need to have all the memory availabe before passthrough), while `pci_unbind`/`pci_rebind` happens after VM is stopped (so we know VGA is no longer in use and can be given back to the host).
209209

@@ -215,6 +215,20 @@ cat /etc/pve/qemu-server/204.conf
215215
#pci_rescan
216216
```
217217

218+
### 2.8. `fboff`
219+
220+
In addition to the `BOOTFB` issue, many users need to specify `video=efifb:off` or equivalent kernel parameter. However, [not everyone can use that](https://www.reddit.com/r/VFIO/comments/ks7ve3/alternative_to_efifboff/) in their workflow. As such, `fboff` can be used as an alternative to kernel parameter.
221+
222+
```yaml
223+
cat /etc/pve/qemu-server/204.conf
224+
225+
## free memory used by simplefb.0
226+
#fboff simplefb.0
227+
## alternatively..
228+
#fboff efifb.0
229+
#fboff vesafb.0
230+
```
231+
218232
### 3. Legacy features
219233

220234
These are features that are no really longer needed to achieve a good latency in a VM.

exec-cmds

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,18 @@ exec_qm_depends() {
109109
qm start "$1"
110110
}
111111

112+
exec_fboff() {
113+
echo "Disabling $1 to prepare to pass GPU to VM$VMID"
114+
echo "$1" > /sys/bus/platform/devices/$1/driver/unbind
115+
}
116+
112117
exec_cmds() {
113118
while read CMD ARG1 ARG2 ARG3 REST; do
114119
case "$CMD" in
120+
"#fboff")
121+
if_action pre-start exec_fboff "$ARG1"
122+
;;
123+
115124
"#pci_remove")
116125
if_action pre-start exec_pci_unbind "$ARG1" "$ARG2" "$ARG3"
117126
;;

0 commit comments

Comments
 (0)