1
0
Fork 0
vfio-win10/roles/win10/templates/hooks/qemu

43 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
prepare() {
systemctl start win10-usb
# https://github.com/gnif/vendor-reset/issues/46#issuecomment-992282166
{% for pci_device_id in pci_device_ids %}
{% if pci_device_id.fix_reset_method|default(False) %}
echo 'device_specific' >'/sys/bus/pci/devices/{{ pci_device_id.domain }}:{{ pci_device_id.bus }}:{{ pci_device_id.slot }}.{{ pci_device_id.function }}/reset_method'
{% endif %}
{% endfor %}
vfio-isolate -u /tmp/win10.undo \
irq-affinity mask C0-15 \
cpuset-modify --cpus C16-19 /system.slice \
cpuset-modify --cpus C16-19 /user.slice \
cpu-governor performance C0-19
# drop-caches \
# compact-memory \
# for _ in $(seq 10); do
# assign hugepages
# sysctl -w vm.nr_overcommit_hugepages=8192 && break
# sleep 1
# done
# sleep 10
}
release() {
systemctl stop win10-usb
vfio-isolate restore /tmp/win10.undo
# sysctl -w vm.nr_overcommit_hugepages=0
}
if [ "$1" == "win10" ]; then
if [ "$2" == "prepare" ]; then
prepare
fi
if [ "$2" == "release" ]; then
release
fi
fi