Merge branches 'iommu/fixes', 'x86/vt-d', 'x86/amd', 'arm/smmu', 'arm/tegra' and...
authorJoerg Roedel <jroedel@suse.de>
Thu, 2 Apr 2015 11:33:19 +0000 (13:33 +0200)
committerJoerg Roedel <jroedel@suse.de>
Thu, 2 Apr 2015 11:33:19 +0000 (13:33 +0200)
Conflicts:
drivers/iommu/amd_iommu.c
drivers/iommu/tegra-gart.c
drivers/iommu/tegra-smmu.c

1  2  3  4  5  6 
drivers/iommu/amd_iommu.c
drivers/iommu/amd_iommu_types.h
drivers/iommu/arm-smmu.c
drivers/iommu/intel-iommu.c
drivers/iommu/ipmmu-vmsa.c
drivers/iommu/tegra-gart.c
drivers/iommu/tegra-smmu.c

@@@@@@@ -3380,9 -3380,9 -3374,8 -3380,9 -3380,9 -3386,9 +3380,8 @@@@@@@ static size_t amd_iommu_unmap(struct io
      static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
                                          dma_addr_t iova)
      {
-----   struct protection_domain *domain = dom->priv;
-- --   unsigned long offset_mask;
-- --   phys_addr_t paddr;
+++++   struct protection_domain *domain = to_pdomain(dom);
     -  unsigned long offset_mask;
     -  phys_addr_t paddr;
++ +++  unsigned long offset_mask, pte_pgsize;
        u64 *pte, __pte;
      
        if (domain->mode == PAGE_MODE_NONE)
Simple merge
Simple merge
Simple merge
Simple merge
@@@@@@@ -156,20 -156,20 -156,20 -156,20 -156,10 -166,21 +166,11 @@@@@@@ static inline bool gart_iova_range_vali
      static int gart_iommu_attach_dev(struct iommu_domain *domain,
                                 struct device *dev)
      {
----    struct gart_device *gart;
    -   struct gart_device *gart = domain->priv;
+++++   struct gart_domain *gart_domain = to_gart_domain(domain);
     -  struct gart_device *gart;
++++++  struct gart_device *gart = gart_domain->gart;
        struct gart_client *client, *c;
        int err = 0;
      
---- -  gart = gart_handle;
---- -  if (!gart)
---- -          return -EINVAL;
----    domain->priv = gart;
     -  gart_domain->gart = gart;
---- -
---- -  domain->geometry.aperture_start = gart->iovmm_base;
---- -  domain->geometry.aperture_end   = gart->iovmm_base +
---- -                                  gart->page_count * GART_PAGE_SIZE - 1;
---- -  domain->geometry.force_aperture = true;
---- -
        client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL);
        if (!client)
                return -ENOMEM;
        spin_unlock(&gart->client_lock);
      }
      
----- static int gart_iommu_domain_init(struct iommu_domain *domain)
+++++ static struct iommu_domain *gart_iommu_domain_alloc(unsigned type)
      {
----    return 0;
----  }
+++++   struct gart_domain *gart_domain;
++++ +  struct gart_device *gart;
      
----  static void gart_iommu_domain_destroy(struct iommu_domain *domain)
----  {
----    struct gart_device *gart = domain->priv;
+++++   if (type != IOMMU_DOMAIN_UNMANAGED)
+++++           return NULL;
    + 
++++ +  gart = gart_handle;
     +  if (!gart)
----            return;
    -           return -EINVAL;
++++++          return NULL;
     +
----    spin_lock(&gart->client_lock);
----    if (!list_empty(&gart->client)) {
----            struct gart_client *c;
    -   domain->priv = gart;
+++++   gart_domain = kzalloc(sizeof(*gart_domain), GFP_KERNEL);
+++++   if (!gart_domain)
+++++           return NULL;
++++  
    -   domain->geometry.aperture_start = gart->iovmm_base;
    -   domain->geometry.aperture_end = gart->iovmm_base +
++++++  gart_domain->gart = gart;
++++++  gart_domain->domain.geometry.aperture_start = gart->iovmm_base;
++++++  gart_domain->domain.geometry.aperture_end = gart->iovmm_base +
++++ +                                  gart->page_count * GART_PAGE_SIZE - 1;
    -   domain->geometry.force_aperture = true;
++++++  gart_domain->domain.geometry.force_aperture = true;
++++ +
    -   return 0;
+++++   return &gart_domain->domain;
++++  }
++++  
    - static void gart_iommu_domain_destroy(struct iommu_domain *domain)
+++++ static void gart_iommu_domain_free(struct iommu_domain *domain)
++++  {
    -   struct gart_device *gart = domain->priv;
    - 
    -   if (!gart)
    -           return;
+++++   struct gart_domain *gart_domain = to_gart_domain(domain);
+++++   struct gart_device *gart = gart_domain->gart;
++++  
    -   spin_lock(&gart->client_lock);
    -   if (!list_empty(&gart->client)) {
    -           struct gart_client *c;
+++++   if (gart) {
+++++           spin_lock(&gart->client_lock);
+++++           if (!list_empty(&gart->client)) {
+++++                   struct gart_client *c;
      
-----           list_for_each_entry(c, &gart->client, list)
-----                   gart_iommu_detach_dev(domain, c->dev);
+++++                   list_for_each_entry(c, &gart->client, list)
+++++                           gart_iommu_detach_dev(domain, c->dev);
+++++           }
+++++           spin_unlock(&gart->client_lock);
        }
-----   spin_unlock(&gart->client_lock);
-----   domain->priv = NULL;
+++++ 
+++++   kfree(gart_domain);
      }
      
      static int gart_iommu_map(struct iommu_domain *domain, unsigned long iova,
@@@@@@@ -264,14 -264,14 -264,14 -264,14 -265,19 -271,12 +272,17 @@@@@@@ static struct iommu_domain *tegra_smmu_
        for (i = 0; i < SMMU_NUM_PDE; i++)
                pd[i] = 0;
      
-----   domain->priv = as;
    - 
++++ +  /* setup aperture */
    -   domain->geometry.aperture_start = 0;
    -   domain->geometry.aperture_end = 0xffffffff;
    -   domain->geometry.force_aperture = true;
++++++  as->domain.geometry.aperture_start = 0;
++++++  as->domain.geometry.aperture_end = 0xffffffff;
++++++  as->domain.geometry.force_aperture = true;
     +
-----   return 0;
+++++   return &as->domain;
      }
      
----- static void tegra_smmu_domain_destroy(struct iommu_domain *domain)
+++++ static void tegra_smmu_domain_free(struct iommu_domain *domain)
      {
-----   struct tegra_smmu_as *as = domain->priv;
+++++   struct tegra_smmu_as *as = to_smmu_as(domain);
      
        /* TODO: free page directory and page tables */
        ClearPageReserved(as->pd);