hw/virtio/virtio-iommu-pci: Enforce the device is plugged on the root bus
commite72cfabf4ef2f0031e5d0b8129fb1533d383654d
authorEric Auger <eric.auger@redhat.com>
Wed, 12 Oct 2022 16:34:48 +0000 (12 12:34 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 7 Nov 2022 18:12:19 +0000 (7 13:12 -0500)
tree571fd505f728bdbe77ded72561f4c1c8f4cb5ef3
parent882877fc359d24e1563065c5c3887096317ca1ae
hw/virtio/virtio-iommu-pci: Enforce the device is plugged on the root bus

In theory the virtio-iommu-pci could be plugged anywhere in the PCIe
topology and as long as the dt/acpi info are properly built this should
work. However at the moment we fail to do that because the
virtio-iommu-pci BDF is not computed at plug time and in that case
vms->virtio_iommu_bdf gets an incorrect value.

For instance if the virtio-iommu-pci is plugged onto a pcie root port
and the virtio-iommu protects a virtio-block-pci device the guest does
not boot.

So let's do not pretend we do support this case and fail the initialize()
if we detect the virtio-iommu-pci is plugged anywhere else than on the
root bus. Anyway this ability is not needed.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20221012163448.121368-1-eric.auger@redhat.com>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-iommu-pci.c