qubes/ext/pci: implement pci-no-strict-reset/BDF feature

Instead of old per-VM flag 'pci_strictreset', now implement this as
per-device flag using features. To not fail on particular device
assignment set 'pci-no-strict-reset/DEVICE-BDF' to True. For
example 'pci-no-strict-reset/00:1b.0'.

QubesOS/qubes-issues#2257
This commit is contained in:
Marek Marczykowski-Górecki 2016-09-03 20:29:14 +02:00
parent 4d327fbc95
commit 93e88e0c22
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
3 changed files with 8 additions and 3 deletions

View File

@ -231,7 +231,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
self.bind_pci_to_pciback(vm.app, device)
vm.libvirt_domain.attachDevice(
vm.app.env.get_template('libvirt/devices/pci.xml').render(
device=device))
device=device, vm=vm))
except subprocess.CalledProcessError as e:
vm.log.exception('Failed to attach PCI device {!r} on the fly,'
' changes will be seen after VM restart.'.format(
@ -261,7 +261,7 @@ class PCIDeviceExtension(qubes.ext.Extension):
user='root', input='00:{}'.format(vmdev))
vm.libvirt_domain.detachDevice(
vm.app.env.get_template('libvirt/devices/pci.xml').render(
device=device))
device=device, vm=vm))
except (subprocess.CalledProcessError, libvirt.libvirtError) as e:
vm.log.exception('Failed to detach PCI device {!r} on the fly,'
' changes will be seen after VM restart.'.format(

View File

@ -50,6 +50,7 @@ class TC_00_Devices_PCI(qubes.tests.SystemTestsMixin,
label='red',
)
self.vm.create_on_disk()
self.vm.features['pci-no-strict-reset/' + pcidev] = True
self.app.save()
def test_000_list(self):

View File

@ -1,4 +1,8 @@
<hostdev type="pci" managed="yes">
<hostdev type="pci" managed="yes"
{% if vm.features.get('pci-no-strict-reset/' + device.ident, False) %}
nostrictreset="yes"
{% endif %}
>
<source>
<address
bus="0x{{ device.bus }}"