diff mbox

[Xen-devel,v2,15/21] xen/passthrough: Call arch_iommu_domain_destroy before calling iommu_teardown

Message ID 1406818852-31856-16-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall July 31, 2014, 3 p.m. UTC
arch_iommu_domain_destroy contains specific architecture code.

On x86, this code will clean up the ioport_list which is not used in
both iommu (i.e AMD & x86) drivers.

On ARM, the toolstack may not have deassign every device to the guest.
Therefore, we have to go through the device list and removing them before
asking the IOMMU drivers to release memory for this domain. This is done
by iommu_dt_domain_destroy which is called by arch_iommu_domain_destroy.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Jan Beulich <jbeulich@suse.com>

---
    I didn't change this patch as I wasn't sure what was the conclusion of
    the discussion on the RFC
---
 xen/drivers/passthrough/iommu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Beulich Aug. 1, 2014, 9 a.m. UTC | #1
>>> On 31.07.14 at 17:00, <julien.grall@linaro.org> wrote:
> arch_iommu_domain_destroy contains specific architecture code.
> 
> On x86, this code will clean up the ioport_list which is not used in
> both iommu (i.e AMD & x86) drivers.
> 
> On ARM, the toolstack may not have deassign every device to the guest.
> Therefore, we have to go through the device list and removing them before
> asking the IOMMU drivers to release memory for this domain. This is done
> by iommu_dt_domain_destroy which is called by arch_iommu_domain_destroy.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Cc: Jan Beulich <jbeulich@suse.com>
> 
> ---
>     I didn't change this patch as I wasn't sure what was the conclusion of
>     the discussion on the RFC

My perspective hasn't changed. And rather than leaving hunting down
that previous discussion in the list archives to every one of those who
read this, you could have included a reference here.

Jan
diff mbox

Patch

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 65479d6..2953ede 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -219,10 +219,10 @@  void iommu_domain_destroy(struct domain *d)
     if ( !iommu_enabled || !hd->platform_ops )
         return;
 
+    arch_iommu_domain_destroy(d);
+
     if ( need_iommu(d) )
         iommu_teardown(d);
-
-    arch_iommu_domain_destroy(d);
 }
 
 int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn,