virtio-iommu: Implement attach/detach command
commitcfb42188b24d5904f82cd609185847a1168226e3
authorEric Auger <eric.auger@redhat.com>
Fri, 14 Feb 2020 13:27:38 +0000 (14 14:27 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 27 Feb 2020 08:46:10 +0000 (27 03:46 -0500)
tree261f5241d0011ed8bd76fb9531753a0a8e3713a9
parent5442b854eaf921588e24d5711640ab71e59cb1b8
virtio-iommu: Implement attach/detach command

This patch implements the endpoint attach/detach to/from
a domain.

Domain and endpoint internal datatypes are introduced.
Both are stored in RB trees. The domain owns a list of
endpoints attached to it. Also helpers to get/put
end points and domains are introduced.

As for the IOMMU memory regions, a callback is called on
PCI bus enumeration that initializes for a given device
on the bus hierarchy an IOMMU memory region. The PCI bus
hierarchy is stored locally in IOMMUPciBus and IOMMUDevice
objects.

At the time of the enumeration, the bus number may not be
computed yet.

So operations that will need to retrieve the IOMMUdevice
and its IOMMU memory region from the bus number and devfn,
once the bus number is garanteed to be frozen, use an array
of IOMMUPciBus, lazily populated.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20200214132745.23392-4-eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/trace-events
hw/virtio/virtio-iommu.c
include/hw/virtio/virtio-iommu.h