Message ID | 1501003615-15274-6-git-send-email-olekstysh@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Oleksandr, On 25/07/17 18:26, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> > > Not every integrated into ARM SoCs IOMMU can share page tables > with the CPU and as the result the iommu_use_hap_pt(d) mustn't > always be true. > Reuse x86's iommu_hap_pt_share flag to indicate whether the IOMMU > page table is shared or not. > > As P2M table must always be shared between the CPU and the SMMU > print an error message and bail out if this flag was previously unset. > > Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> > CC: Julien Grall <julien.grall@arm.com> Reviewed-by: Julien Grall <julien.grall@arm.com> Cheers,
Hi, Julien On Thu, Aug 3, 2017 at 2:23 PM, Julien Grall <julien.grall@arm.com> wrote: > Hi Oleksandr, > > On 25/07/17 18:26, Oleksandr Tyshchenko wrote: >> >> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> >> >> Not every integrated into ARM SoCs IOMMU can share page tables >> with the CPU and as the result the iommu_use_hap_pt(d) mustn't >> always be true. >> Reuse x86's iommu_hap_pt_share flag to indicate whether the IOMMU >> page table is shared or not. >> >> As P2M table must always be shared between the CPU and the SMMU >> print an error message and bail out if this flag was previously unset. >> >> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> >> CC: Julien Grall <julien.grall@arm.com> > > > Reviewed-by: Julien Grall <julien.grall@arm.com> Thank you! > > Cheers, > > -- > Julien Grall
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index 7c313c0..e828308 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -2856,6 +2856,12 @@ static __init int arm_smmu_dt_init(struct dt_device_node *dev, */ dt_device_set_used_by(dev, DOMID_XEN); + if (!iommu_hap_pt_share) { + dev_err(dt_to_dev(dev), + "P2M table must always be shared between the CPU and the SMMU\n"); + return -EINVAL; + } + rc = arm_smmu_device_dt_probe(dev); if (rc) return rc; diff --git a/xen/include/asm-arm/iommu.h b/xen/include/asm-arm/iommu.h index 57d9b1e..2a6bd3d 100644 --- a/xen/include/asm-arm/iommu.h +++ b/xen/include/asm-arm/iommu.h @@ -20,8 +20,8 @@ struct arch_iommu void *priv; }; -/* Always share P2M Table between the CPU and the IOMMU */ -#define iommu_use_hap_pt(d) (1) +/* Not every ARM SoCs IOMMU use the same page-table format as the CPU. */ +#define iommu_use_hap_pt(d) (iommu_hap_pt_share) const struct iommu_ops *iommu_get_ops(void); void __init iommu_set_ops(const struct iommu_ops *ops);