From: "Marcel Apfelbaum" <address@hidden>
To: "Michael S. Tsirkin" <address@hidden>, "Peter Xu" <address@hidden>
Cc: address@hidden, "Paolo Bonzini" <address@hidden>, "yi l liu" <address@hidden>,
"Jintack Lim"
<address@hidden>, "Jason Wang" <address@hidden>, "Alex Williamson"
<address@hidden>
Sent: Thursday, March 2, 2017 7:24:44 AM
Subject: Re: [PATCH v3] intel_iommu: check misordered init when realize
On 03/02/2017 07:13 AM, Michael S. Tsirkin wrote:
On Thu, Mar 02, 2017 at 11:32:18AM +0800, Peter Xu wrote:
Intel vIOMMU devices are created with "-device" parameter, while here
actually we need to make sure the dmar device be created before other
PCI devices (like vfio-pci, virtio-pci ones) so that we know iommu_fn
will be setup correctly before realizations of those PCI devices (it is
legal that PCI device fetch these info during its realization). Now this
ordering yet cannot be achieved elsewhere, and devices will be created
in the order that user specified. We need to avoid that.
This patch tries to detect this kind of misordering issue during init of
VT-d device, then report to guest if misordering happened. In the
future, we can provide something better to solve it, e.g., to support
device init ordering, then we can live without this patch.
Signed-off-by: Peter Xu <address@hidden>
Unfortunately with virtio it's a regression, as it used to
work with iommu. So I'm afraid we need to look into supporting
arbitrary order right now :(
Hi,
A fast way to do it is to initialize iommu with a new keyword, like
-iommu intel-iommu
Or maybe use the existing "-object" somehow ?
From vl.c comments:
"Initial object creation happens before all other
QEMU data types are created.... "
Another idea is to add a third run on QEMU cmd line arguments,
but this would affect the whole system.
However having an ordering system beats all other ideas.