Re: [PATCH v8 20/24] iommu: Require a default_domain for all iommu drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 03, 2023 at 12:21:59AM +0300, Dmitry Baryshkov wrote:
> On Wed, 13 Sept 2023 at 16:45, Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
> >
> > At this point every iommu driver will cause a default_domain to be
> > selected, so we can finally remove this gap from the core code.
> >
> > The following table explains what each driver supports and what the
> > resulting default_domain will be:
> >
> >                                         ops->defaut_domain
> >                     IDENTITY   DMA  PLATFORM    v      ARM32          dma-iommu  ARCH
> > amd/iommu.c             Y       Y                       N/A             either
> > apple-dart.c            Y       Y                       N/A             either
> > arm-smmu.c              Y       Y                       IDENTITY        either
> > qcom_iommu.c            G       Y                       IDENTITY        either
> > arm-smmu-v3.c           Y       Y                       N/A             either
> > exynos-iommu.c          G       Y                       IDENTITY        either
> > fsl_pamu_domain.c                       Y       Y       N/A             N/A     PLATFORM
> > intel/iommu.c           Y       Y                       N/A             either
> > ipmmu-vmsa.c            G       Y                       IDENTITY        either
> > msm_iommu.c             G                               IDENTITY        N/A
> 
> Unfortunately this patch breaks msm_iommu platforms. This driver
> doesn't select ARM_DMA_USE_IOMMU, so iommu_get_default_domain_type()
> returns 0, bus_iommu_probe() fails with -ENODEV.
> If I make MSM_IOMMU select ARM_DMA_USE_IOMMU, then GPU probing fails
> with -EBUSY.

Oh, OK.

Does this fix it?

diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index cdc7b730192a35..f7ef081c33dcb2 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -685,10 +685,16 @@ irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id)
 	return 0;
 }
 
+static int msm_iommu_def_domain_type(struct device *dev)
+{
+	return IOMMU_DOMAIN_IDENTITY;
+}
+
 static struct iommu_ops msm_iommu_ops = {
 	.identity_domain = &msm_iommu_identity_domain,
 	.domain_alloc_paging = msm_iommu_domain_alloc_paging,
 	.probe_device = msm_iommu_probe_device,
+	.def_domain_type = msm_iommu_def_domain_type,
 	.device_group = generic_device_group,
 	.pgsize_bitmap = MSM_IOMMU_PGSIZES,
 	.of_xlate = qcom_iommu_of_xlate,



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux