kernel: bump to 4.9.105
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-4.9 / 810-iommu-support-layerscape.patch
index 657a38fece19cc7ad01d534d5f540ade881ed229..b9faa504b686934110894c2819e71756d1fd92b5 100644 (file)
@@ -1,9 +1,9 @@
-From 152f316e7829f6aeb3a36009e7e5ec0f1d97d770 Mon Sep 17 00:00:00 2001
+From 0a6c701f92e1aa368c44632fa0985e92703354ed Mon Sep 17 00:00:00 2001
 From: Yangbo Lu <yangbo.lu@nxp.com>
-Date: Wed, 27 Sep 2017 10:33:26 +0800
-Subject: [PATCH] iommu: support layerscape
+Date: Wed, 17 Jan 2018 15:35:48 +0800
+Subject: [PATCH 22/30] iommu: support layerscape
 
-This is a integrated patch for layerscape smmu support.
+This is an integrated patch for layerscape smmu support.
 
 Signed-off-by: Eric Auger <eric.auger@redhat.com>
 Signed-off-by: Robin Murphy <robin.murphy@arm.com>
@@ -12,7 +12,7 @@ Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
 ---
  drivers/iommu/amd_iommu.c    |  56 ++++++----
- drivers/iommu/arm-smmu-v3.c  | 117 ++++++++++++++-------
+ drivers/iommu/arm-smmu-v3.c  | 111 ++++++++++++++------
  drivers/iommu/arm-smmu.c     | 100 +++++++++++++++---
  drivers/iommu/dma-iommu.c    | 242 ++++++++++++++++++++++++++++++++++++-------
  drivers/iommu/intel-iommu.c  |  92 ++++++++++++----
@@ -21,7 +21,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  drivers/iommu/mtk_iommu_v1.c |   2 +
  include/linux/dma-iommu.h    |  11 ++
  include/linux/iommu.h        |  55 +++++++---
- 10 files changed, 739 insertions(+), 157 deletions(-)
+ 10 files changed, 739 insertions(+), 151 deletions(-)
 
 --- a/drivers/iommu/amd_iommu.c
 +++ b/drivers/iommu/amd_iommu.c
@@ -246,16 +246,16 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
        /* Restrict the stage to what we can actually support */
        if (!(smmu->features & ARM_SMMU_FEAT_TRANS_S1))
                smmu_domain->stage = ARM_SMMU_DOMAIN_S2;
-@@ -1578,7 +1593,7 @@ static __le64 *arm_smmu_get_step_for_sid
+@@ -1580,7 +1595,7 @@ static __le64 *arm_smmu_get_step_for_sid
        return step;
  }
  
 -static int arm_smmu_install_ste_for_dev(struct iommu_fwspec *fwspec)
 +static void arm_smmu_install_ste_for_dev(struct iommu_fwspec *fwspec)
  {
-       int i;
+       int i, j;
        struct arm_smmu_master_data *master = fwspec->iommu_priv;
-@@ -1590,17 +1605,14 @@ static int arm_smmu_install_ste_for_dev(
+@@ -1599,17 +1614,14 @@ static int arm_smmu_install_ste_for_dev(
  
                arm_smmu_write_strtab_ent(smmu, sid, step, &master->ste);
        }
@@ -275,7 +275,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  }
  
  static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
-@@ -1619,7 +1631,7 @@ static int arm_smmu_attach_dev(struct io
+@@ -1628,7 +1640,7 @@ static int arm_smmu_attach_dev(struct io
        ste = &master->ste;
  
        /* Already attached to a different domain? */
@@ -284,7 +284,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
                arm_smmu_detach_dev(dev);
  
        mutex_lock(&smmu_domain->init_mutex);
-@@ -1640,10 +1652,12 @@ static int arm_smmu_attach_dev(struct io
+@@ -1649,10 +1661,12 @@ static int arm_smmu_attach_dev(struct io
                goto out_unlock;
        }
  
@@ -300,7 +300,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
                ste->s1_cfg = &smmu_domain->s1_cfg;
                ste->s2_cfg = NULL;
                arm_smmu_write_ctx_desc(smmu, ste->s1_cfg);
-@@ -1652,10 +1666,7 @@ static int arm_smmu_attach_dev(struct io
+@@ -1661,10 +1675,7 @@ static int arm_smmu_attach_dev(struct io
                ste->s2_cfg = &smmu_domain->s2_cfg;
        }
  
@@ -312,7 +312,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  out_unlock:
        mutex_unlock(&smmu_domain->init_mutex);
        return ret;
-@@ -1703,6 +1714,9 @@ arm_smmu_iova_to_phys(struct iommu_domai
+@@ -1712,6 +1723,9 @@ arm_smmu_iova_to_phys(struct iommu_domai
        struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
        struct io_pgtable_ops *ops = smmu_domain->pgtbl_ops;
  
@@ -322,7 +322,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
        if (!ops)
                return 0;
  
-@@ -1801,7 +1815,7 @@ static void arm_smmu_remove_device(struc
+@@ -1810,7 +1824,7 @@ static void arm_smmu_remove_device(struc
                return;
  
        master = fwspec->iommu_priv;
@@ -331,7 +331,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
                arm_smmu_detach_dev(dev);
        iommu_group_remove_device(dev);
        kfree(master);
-@@ -1830,6 +1844,9 @@ static int arm_smmu_domain_get_attr(stru
+@@ -1839,6 +1853,9 @@ static int arm_smmu_domain_get_attr(stru
  {
        struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
  
@@ -341,7 +341,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
        switch (attr) {
        case DOMAIN_ATTR_NESTING:
                *(int *)data = (smmu_domain->stage == ARM_SMMU_DOMAIN_NESTED);
-@@ -1845,6 +1862,9 @@ static int arm_smmu_domain_set_attr(stru
+@@ -1854,6 +1871,9 @@ static int arm_smmu_domain_set_attr(stru
        int ret = 0;
        struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
  
@@ -351,7 +351,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
        mutex_lock(&smmu_domain->init_mutex);
  
        switch (attr) {
-@@ -1874,6 +1894,31 @@ static int arm_smmu_of_xlate(struct devi
+@@ -1883,6 +1903,31 @@ static int arm_smmu_of_xlate(struct devi
        return iommu_fwspec_add_ids(dev, args->args, 1);
  }
  
@@ -383,7 +383,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  static struct iommu_ops arm_smmu_ops = {
        .capable                = arm_smmu_capable,
        .domain_alloc           = arm_smmu_domain_alloc,
-@@ -1889,6 +1934,8 @@ static struct iommu_ops arm_smmu_ops = {
+@@ -1898,6 +1943,8 @@ static struct iommu_ops arm_smmu_ops = {
        .domain_get_attr        = arm_smmu_domain_get_attr,
        .domain_set_attr        = arm_smmu_domain_set_attr,
        .of_xlate               = arm_smmu_of_xlate,
@@ -995,7 +995,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  };
  
  struct dmar_atsr_unit {
-@@ -4250,27 +4251,40 @@ static inline void init_iommu_pm_ops(voi
+@@ -4251,27 +4252,40 @@ static inline void init_iommu_pm_ops(voi
  int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg)
  {
        struct acpi_dmar_reserved_memory *rmrr;
@@ -1041,7 +1041,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  }
  
  static struct dmar_atsr_unit *dmar_find_atsr(struct acpi_dmar_atsr *atsr)
-@@ -4484,6 +4498,7 @@ static void intel_iommu_free_dmars(void)
+@@ -4485,6 +4499,7 @@ static void intel_iommu_free_dmars(void)
        list_for_each_entry_safe(rmrru, rmrr_n, &dmar_rmrr_units, list) {
                list_del(&rmrru->list);
                dmar_free_dev_scope(&rmrru->devices, &rmrru->devices_cnt);
@@ -1049,7 +1049,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
                kfree(rmrru);
        }
  
-@@ -5219,6 +5234,45 @@ static void intel_iommu_remove_device(st
+@@ -5220,6 +5235,45 @@ static void intel_iommu_remove_device(st
        iommu_device_unlink(iommu->iommu_dev, dev);
  }
  
@@ -1095,7 +1095,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
  #ifdef CONFIG_INTEL_IOMMU_SVM
  #define MAX_NR_PASID_BITS (20)
  static inline unsigned long intel_iommu_get_pts(struct intel_iommu *iommu)
-@@ -5349,19 +5403,21 @@ struct intel_iommu *intel_svm_device_to_
+@@ -5350,19 +5404,21 @@ struct intel_iommu *intel_svm_device_to_
  #endif /* CONFIG_INTEL_IOMMU_SVM */
  
  static const struct iommu_ops intel_iommu_ops = {