Message ID | 1489608329-7275-7-git-send-email-olekstysh@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 15.03.17 at 21:05, <olekstysh@gmail.com> wrote: > --- a/xen/drivers/passthrough/iommu.c > +++ b/xen/drivers/passthrough/iommu.c > @@ -129,7 +129,7 @@ static void __init parse_iommu_param(char *s) > } while ( ss ); > } > > -int iommu_domain_init(struct domain *d) > +int iommu_domain_init(struct domain *d, bool_t use_iommu) You properly use "false" above, so why bool_t (instead of just bool) here? Jan
On Wed, Mar 22, 2017 at 5:48 PM, Jan Beulich <JBeulich@suse.com> wrote: >>>> On 15.03.17 at 21:05, <olekstysh@gmail.com> wrote: >> --- a/xen/drivers/passthrough/iommu.c >> +++ b/xen/drivers/passthrough/iommu.c >> @@ -129,7 +129,7 @@ static void __init parse_iommu_param(char *s) >> } while ( ss ); >> } >> >> -int iommu_domain_init(struct domain *d) >> +int iommu_domain_init(struct domain *d, bool_t use_iommu) > > You properly use "false" above, so why bool_t (instead of just bool) > here? Indeed, will use bool. > > Jan >
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index bb327da..bab62ee 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -550,7 +550,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, ASSERT(config != NULL); /* p2m_init relies on some value initialized by the IOMMU subsystem */ - if ( (rc = iommu_domain_init(d)) != 0 ) + if ( (rc = iommu_domain_init(d, false)) != 0 ) goto fail; if ( (rc = p2m_init(d)) != 0 ) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 479aee6..8ef4160 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -646,7 +646,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, if ( (rc = init_domain_irq_mapping(d)) != 0 ) goto fail; - if ( (rc = iommu_domain_init(d)) != 0 ) + if ( (rc = iommu_domain_init(d, false)) != 0 ) goto fail; } spin_lock_init(&d->arch.e820_lock); diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 115698f..6c17c59 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -129,7 +129,7 @@ static void __init parse_iommu_param(char *s) } while ( ss ); } -int iommu_domain_init(struct domain *d) +int iommu_domain_init(struct domain *d, bool_t use_iommu) { struct domain_iommu *hd = dom_iommu(d); int ret = 0; @@ -142,7 +142,14 @@ int iommu_domain_init(struct domain *d) return 0; hd->platform_ops = iommu_get_ops(); - return hd->platform_ops->init(d); + ret = hd->platform_ops->init(d); + if ( ret ) + return ret; + + if ( use_iommu && !is_hardware_domain(d) ) + ret = iommu_construct(d); + + return ret; } static void __hwdom_init check_hwdom_reqs(struct domain *d) diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 0446ed3..ab68ae2 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -56,7 +56,7 @@ int iommu_setup(void); int iommu_add_device(struct pci_dev *pdev); int iommu_enable_device(struct pci_dev *pdev); int iommu_remove_device(struct pci_dev *pdev); -int iommu_domain_init(struct domain *d); +int iommu_domain_init(struct domain *d, bool_t use_iommu); void iommu_hwdom_init(struct domain *d); void iommu_domain_destroy(struct domain *d); int deassign_device(struct domain *d, u16 seg, u8 bus, u8 devfn);