Since PCI devices have to be attached on bootup, attaching has to happen
with the ``--persistant`` option.
For example, if ``00_1a.0`` is the BDF of the device you want to attach
to the “work” domain, you would do this:
..code:: bash
qvm-pci attach work dom0:00_1a.0 --persistent
Possible Issues
---------------
Visit the :doc:`PCI Troubleshooting guide </user/troubleshooting/pci-troubleshooting>` to
see issues that may arise due to PCI devices and how to troubleshoot
them.
Additional Attach Options
-------------------------
Attaching a PCI device through the commandline offers additional
options, specifiable via the ``--option``/``-o`` option. (Yes, confusing
wording, there’s an `issue for that <https://github.com/QubesOS/qubes-issues/issues/4530>`__.)
``qvm-pci`` exposes two additional options. Both are intended to fix
device or driver specific issues, but both come with :ref:`heavy security implications <user/security-in-qubes/device-handling-security:pci security>`! **Make sure you understand them before continuing!**
no-strict-reset
^^^^^^^^^^^^^^^
Do not require PCI device to be reset before attaching it to another VM.
This may leak usage data even without malicious intent!
usage example:
..code:: bash
qvm-pci a work dom0:00_1a.0 --persistent -o no-strict-reset=true
permissive
^^^^^^^^^^
Allow write access to full PCI config space instead of whitelisted
registers. This increases attack surface and possibility of `side channel attacks <https://en.wikipedia.org/wiki/Side-channel_attack>`__.
usage example:
..code:: bash
qvm-pci a work dom0:00_1a.0 --persistent -o permissive=true
Bringing PCI Devices Back to dom0
---------------------------------
By default, when a device is detached from a VM (or when a VM with an
attached PCI device is shut down), the device is *not* automatically
attached back to dom0.
This is an intended feature.
A device which was previously attached to a VM less trusted than dom0
(which, in Qubes, is *all* of them) could attack dom0 if it were
automatically reattached there.
In order to re-enable the device in dom0, either:
- Reboot the physical machine. (Best practice)
or
- Go to the sysfs (``/sys/bus/pci``), find the right device, detach it
from the pciback driver, and attach it back to the original driver.
Replace ``<BDF>`` with your full device, for example