pipewire occupies devices preventing driver unbinding
I have recently moved to Wayland/SwayWM and as part of the transition I have set up pipewire/xdg-desktop-portal-wlr and the whole lot to screenshare.
I have a VM where I tend to assign/bind a graphics card using VFIO/OVMF and it stopped working after the move (completely freezes libvirtd when I tried booting). After fair amount of debugging I realized that stopping pipewire fixes this problem. The reason seems to be following device:
01:00.1 Audio device: NVIDIA Corporation TU104 HD Audio Controller (rev a1) Subsystem: Gigabyte Technology Co., Ltd TU104 HD Audio Controller Flags: fast devsel, IRQ 17 Memory at 65080000 (32-bit, non-prefetchable) [size=16K] Capabilities:  Power Management version 3 Capabilities:  MSI: Enable- Count=1/1 Maskable- 64bit+ Capabilities:  Express Endpoint, MSI 00 Capabilities:  Advanced Error Reporting Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel
This was not a problem with pulseaudio but pipewire seems to keep things occupied in a way that the:
echo 0000:01:00.1 > /sys/bus/pci/devices/0000:01:00.1/driver/unbind
Just freezes... Until I run:
systemctl --user stop pipewire
After which it completes succesfully. I don't want to blacklist snd_hda_intel since that's used for my usual sound card (I will try disabling in asoundrc).
If there's more information I can provide let me know. Ideally pipewire would not block unbinding of the kernel driver.
I tested this with pipewire 0.3.15