The toolstack may not have deassigned every device used by a guest.
Therefore we have to go through the device list and remove them before
asking the IOMMU drivers to release memory for this domain.
This can be done by moving the call to the release function when we
relinquish the resources. The IOMMU part will be destroyed later when
the domain is freed.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Signed-off-by: Robert VanVossen <robert.vanvossen@dornerworks.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
switch ( d->arch.relmem )
{
case RELMEM_not_started:
+ ret = iommu_release_dt_devices(d);
+ if ( ret )
+ return ret;
+
d->arch.relmem = RELMEM_xen;
/* Fallthrough */
void arch_iommu_domain_destroy(struct domain *d)
{
- iommu_dt_domain_destroy(d);
}
int arch_iommu_populate_page_table(struct domain *d)
return 0;
}
-void iommu_dt_domain_destroy(struct domain *d)
+int iommu_release_dt_devices(struct domain *d)
{
struct hvm_iommu *hd = domain_hvm_iommu(d);
struct dt_device_node *dev, *_dev;
{
rc = iommu_deassign_dt_device(d, dev);
if ( rc )
+ {
dprintk(XENLOG_ERR, "Failed to deassign %s in domain %u\n",
dt_node_full_name(dev), d->domain_id);
+ return rc;
+ }
}
+
+ return 0;
}
int iommu_assign_dt_device(struct domain *d, struct dt_device_node *dev);
int iommu_deassign_dt_device(struct domain *d, struct dt_device_node *dev);
int iommu_dt_domain_init(struct domain *d);
-void iommu_dt_domain_destroy(struct domain *d);
+int iommu_release_dt_devices(struct domain *d);
#endif /* HAS_DEVICE_TREE */