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

43 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2019-10-12 22:55:19 +00:00
#!/bin/bash
2020-08-21 20:19:00 +00:00
prepare() {
2021-03-04 22:03:16 +00:00
systemctl start win10-usb
2022-01-31 14:16:38 +00:00
# https://github.com/gnif/vendor-reset/issues/46#issuecomment-992282166
{% for pci_device_id in pci_device_ids %}
2022-12-07 05:26:33 +00:00
{% if pci_device_id.fix_reset_method|default(False) %}
2022-01-31 14:16:38 +00:00
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'
2022-12-07 05:26:33 +00:00
{% endif %}
2022-01-31 14:16:38 +00:00
{% endfor %}
2021-03-04 22:03:16 +00:00
vfio-isolate -u /tmp/win10.undo \
2022-12-07 05:26:33 +00:00
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 \
2020-08-21 20:19:00 +00:00
2022-12-07 05:26:33 +00:00
# for _ in $(seq 10); do
2022-12-01 19:13:04 +00:00
# assign hugepages
2022-12-07 05:26:33 +00:00
# sysctl -w vm.nr_overcommit_hugepages=8192 && break
# sleep 1
# done
2022-08-30 04:40:49 +00:00
# sleep 10
2020-08-21 20:19:00 +00:00
}
release() {
2021-03-04 22:03:16 +00:00
systemctl stop win10-usb
2021-11-21 07:09:25 +00:00
vfio-isolate restore /tmp/win10.undo
2022-08-30 04:40:49 +00:00
# sysctl -w vm.nr_overcommit_hugepages=0
2020-08-21 20:19:00 +00:00
}
2019-10-12 22:55:19 +00:00
if [ "$1" == "win10" ]; then
if [ "$2" == "prepare" ]; then
2020-08-21 20:19:00 +00:00
prepare
2019-10-12 22:55:19 +00:00
fi
if [ "$2" == "release" ]; then
2020-08-21 20:19:00 +00:00
release
2019-10-12 22:55:19 +00:00
fi
fi