]> Git Repo - linux.git/commitdiff
Merge tag 'v6.6-rc7' into core
authorJoerg Roedel <[email protected]>
Thu, 26 Oct 2023 15:05:58 +0000 (17:05 +0200)
committerJoerg Roedel <[email protected]>
Thu, 26 Oct 2023 15:05:58 +0000 (17:05 +0200)
Linux 6.6-rc7

1  2 
drivers/iommu/intel/iommu.c
drivers/iommu/mtk_iommu.c

index 301d42abed3cb999e9c2e14115b9090c1b3c5915,3685ba90ec88e81baac849f1693f507e005f4a21..71c12e15ecd7b32e121f4d1ca25a5418f6c0404b
@@@ -2998,13 -2998,6 +2998,6 @@@ static int iommu_suspend(void
        struct intel_iommu *iommu = NULL;
        unsigned long flag;
  
-       for_each_active_iommu(iommu, drhd) {
-               iommu->iommu_state = kcalloc(MAX_SR_DMAR_REGS, sizeof(u32),
-                                            GFP_KERNEL);
-               if (!iommu->iommu_state)
-                       goto nomem;
-       }
        iommu_flush_all();
  
        for_each_active_iommu(iommu, drhd) {
                raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
        }
        return 0;
- nomem:
-       for_each_active_iommu(iommu, drhd)
-               kfree(iommu->iommu_state);
-       return -ENOMEM;
  }
  
  static void iommu_resume(void)
  
                raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
        }
-       for_each_active_iommu(iommu, drhd)
-               kfree(iommu->iommu_state);
  }
  
  static struct syscore_ops iommu_syscore_ops = {
@@@ -4029,9 -4013,9 +4013,9 @@@ static int blocking_domain_attach_dev(s
  }
  
  static struct iommu_domain blocking_domain = {
 +      .type = IOMMU_DOMAIN_BLOCKED,
        .ops = &(const struct iommu_domain_ops) {
                .attach_dev     = blocking_domain_attach_dev,
 -              .free           = intel_iommu_domain_free
        }
  };
  
@@@ -4041,6 -4025,8 +4025,6 @@@ static struct iommu_domain *intel_iommu
        struct iommu_domain *domain;
  
        switch (type) {
 -      case IOMMU_DOMAIN_BLOCKED:
 -              return &blocking_domain;
        case IOMMU_DOMAIN_DMA:
        case IOMMU_DOMAIN_UNMANAGED:
                dmar_domain = alloc_domain(type);
  
  static void intel_iommu_domain_free(struct iommu_domain *domain)
  {
 -      if (domain != &si_domain->domain && domain != &blocking_domain)
 +      if (domain != &si_domain->domain)
                domain_exit(to_dmar_domain(domain));
  }
  
@@@ -4802,7 -4788,6 +4786,7 @@@ static void *intel_iommu_hw_info(struc
  }
  
  const struct iommu_ops intel_iommu_ops = {
 +      .blocked_domain         = &blocking_domain,
        .capable                = intel_iommu_capable,
        .hw_info                = intel_iommu_hw_info,
        .domain_alloc           = intel_iommu_domain_alloc,
index 19ef50221c93db9f6f10073c0578943c106d8e08,fab6c347ce578ec7c79131a9ceeaab3f41b0aafe..78c8f705383f718443cb9c21f82a88a514e47834
@@@ -262,7 -262,7 +262,7 @@@ struct mtk_iommu_data 
        struct device                   *smicomm_dev;
  
        struct mtk_iommu_bank_data      *bank;
-       struct mtk_iommu_domain         *share_dom; /* For 2 HWs share pgtable */
+       struct mtk_iommu_domain         *share_dom;
  
        struct regmap                   *pericfg;
        struct mutex                    mutex; /* Protect m4u_group/m4u_dom above */
@@@ -643,8 -643,8 +643,8 @@@ static int mtk_iommu_domain_finalise(st
        struct mtk_iommu_domain *share_dom = data->share_dom;
        const struct mtk_iommu_iova_region *region;
  
-       /* Always use share domain in sharing pgtable case */
-       if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE) && share_dom) {
+       /* Share pgtable when 2 MM IOMMU share the pgtable or one IOMMU use multiple iova ranges */
+       if (share_dom) {
                dom->iop = share_dom->iop;
                dom->cfg = share_dom->cfg;
                dom->domain.pgsize_bitmap = share_dom->cfg.pgsize_bitmap;
        /* Update our support page sizes bitmap */
        dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap;
  
-       if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE))
-               data->share_dom = dom;
+       data->share_dom = dom;
  
  update_iova_region:
        /* Update the iova region for this domain */
        return 0;
  }
  
 -static struct iommu_domain *mtk_iommu_domain_alloc(unsigned type)
 +static struct iommu_domain *mtk_iommu_domain_alloc_paging(struct device *dev)
  {
        struct mtk_iommu_domain *dom;
  
 -      if (type != IOMMU_DOMAIN_DMA && type != IOMMU_DOMAIN_UNMANAGED)
 -              return NULL;
 -
        dom = kzalloc(sizeof(*dom), GFP_KERNEL);
        if (!dom)
                return NULL;
@@@ -774,28 -776,6 +773,28 @@@ err_unlock
        return ret;
  }
  
 +static int mtk_iommu_identity_attach(struct iommu_domain *identity_domain,
 +                                   struct device *dev)
 +{
 +      struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
 +      struct mtk_iommu_data *data = dev_iommu_priv_get(dev);
 +
 +      if (domain == identity_domain || !domain)
 +              return 0;
 +
 +      mtk_iommu_config(data, dev, false, 0);
 +      return 0;
 +}
 +
 +static struct iommu_domain_ops mtk_iommu_identity_ops = {
 +      .attach_dev = mtk_iommu_identity_attach,
 +};
 +
 +static struct iommu_domain mtk_iommu_identity_domain = {
 +      .type = IOMMU_DOMAIN_IDENTITY,
 +      .ops = &mtk_iommu_identity_ops,
 +};
 +
  static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova,
                         phys_addr_t paddr, size_t pgsize, size_t pgcount,
                         int prot, gfp_t gfp, size_t *mapped)
@@@ -1015,8 -995,7 +1014,8 @@@ static void mtk_iommu_get_resv_regions(
  }
  
  static const struct iommu_ops mtk_iommu_ops = {
 -      .domain_alloc   = mtk_iommu_domain_alloc,
 +      .identity_domain = &mtk_iommu_identity_domain,
 +      .domain_alloc_paging = mtk_iommu_domain_alloc_paging,
        .probe_device   = mtk_iommu_probe_device,
        .release_device = mtk_iommu_release_device,
        .device_group   = mtk_iommu_device_group,
This page took 0.08796 seconds and 4 git commands to generate.