diff --git a/playbook.yml b/playbook.yml index 6c97301..49b1bd4 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,10 +1,26 @@ - hosts: all, localhost become: yes vars: - pcie_device_ids: - - '8086:15b8' # Intel Corporation Ethernet Connection (2) I219-V + vfio_pci_ids: + # - '8086:15b8' # Intel Corporation Ethernet Connection (2) I219-V - '1002:731f' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5700 / 5700 XT] - '1002:ab38' # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio + pci_device_ids: + # Intel Corporation Ethernet Connection (2) I219-V + # - domain: '0000' + # bus: '00' + # slot: '1f' + # function: '6' + # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5700 / 5700 XT] + - domain: '0000' + bus: '03' + slot: '00' + function: '0' + # Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio + - domain: '0000' + bus: '03' + slot: '00' + function: '1' usb_device_ids: - '054c:05c4' # Sony Corp. DualShock 4 [CUH-ZCT1x] - '046d:c539' # Logitech, Inc. USB Receiver diff --git a/roles/win10/tasks/main.yml b/roles/win10/tasks/main.yml index 7afcfb8..66e2ec9 100644 --- a/roles/win10/tasks/main.yml +++ b/roles/win10/tasks/main.yml @@ -3,11 +3,12 @@ name: - qemu - libvirt + - bridge-utils - ovmf - virt-manager - python-evdev - python-pyudev - # - vendor-reset-dkms-git + - vendor-reset-dkms-git notify: - restart libvirtd.service - restart virtlogd.socket @@ -24,7 +25,7 @@ state: directory - name: install qemu hook - copy: + template: src: hooks/qemu dest: /etc/libvirt/hooks/qemu mode: '755' diff --git a/roles/win10/files/hooks/qemu b/roles/win10/templates/hooks/qemu similarity index 71% rename from roles/win10/files/hooks/qemu rename to roles/win10/templates/hooks/qemu index 143478e..98aa6d7 100755 --- a/roles/win10/files/hooks/qemu +++ b/roles/win10/templates/hooks/qemu @@ -2,6 +2,11 @@ prepare() { systemctl start win10-usb + + # https://github.com/gnif/vendor-reset/issues/46#issuecomment-992282166 + {% for pci_device_id in pci_device_ids %} + 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' + {% endfor %} vfio-isolate -u /tmp/win10.undo \ drop-caches \ diff --git a/roles/win10/templates/modprobe/vfio.conf.j2 b/roles/win10/templates/modprobe/vfio.conf.j2 index 3f20484..06673b9 100644 --- a/roles/win10/templates/modprobe/vfio.conf.j2 +++ b/roles/win10/templates/modprobe/vfio.conf.j2 @@ -1 +1 @@ -options vfio-pci ids={{ ','.join(pcie_device_ids) }} +options vfio-pci ids={{ ','.join(vfio_pci_ids) }} diff --git a/roles/win10/templates/win10.xml b/roles/win10/templates/win10.xml index bb31c68..ef1d92a 100644 --- a/roles/win10/templates/win10.xml +++ b/roles/win10/templates/win10.xml @@ -77,7 +77,7 @@ destroy - restart + destroy destroy @@ -166,58 +166,26 @@
- + + + + + + + + + - - - - - - - -
-