From: Joerg Roedel Date: Thu, 2 Apr 2015 11:33:19 +0000 (+0200) Subject: Merge branches 'iommu/fixes', 'x86/vt-d', 'x86/amd', 'arm/smmu', 'arm/tegra' and... X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7f65ef01e131650d455875598099cd06fea6096b;p=linux-beck.git Merge branches 'iommu/fixes', 'x86/vt-d', 'x86/amd', 'arm/smmu', 'arm/tegra' and 'core' into next Conflicts: drivers/iommu/amd_iommu.c drivers/iommu/tegra-gart.c drivers/iommu/tegra-smmu.c --- 7f65ef01e131650d455875598099cd06fea6096b diff --cc drivers/iommu/amd_iommu.c index 48882c126245,48882c126245,aa710b095f1a,48882c126245,48882c126245,e8c412dcac21..e43d48956dea --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.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) diff --cc drivers/iommu/tegra-gart.c index c48da057dbb1,c48da057dbb1,c48da057dbb1,c48da057dbb1,5f3b68c26b83,fc588a1ffeef..37e708fdbb5a --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@@@@@@ -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; @@@@@@@ -216,27 -216,27 -216,27 -216,27 -206,40 -228,37 +218,48 @@@@@@@ out 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, diff --cc drivers/iommu/tegra-smmu.c index 6e134c7c227f,6e134c7c227f,6e134c7c227f,6e134c7c227f,76887a73b47a,720829724d86..c845d99ecf6b --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@@@@@@ -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);