Make sure we grab a reference on the subsystem when a VF is realized. Otherwise, the subsytem will be unrealized automatically when the VFs are unregistered and unreffed. This fixes a latent bug but was not exposed until commit08f6328480
("pcie: Release references of virtual functions"). This was then fixed (or rather, hidden) by commitc613ad2512
("pcie_sriov: Do not manually unrealize"), but that was then reverted (due to other issues) in commitb0fdaee5d1
, exposing the bug yet again. Cc: qemu-stable@nongnu.org Fixes:08f6328480
("pcie: Release references of virtual functions") Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>