aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-09 13:23:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-09 13:23:45 -0400
commit1a59c53920eed3b2718c07286f1afe8674a7d9e6 (patch)
tree3ec8292d56ad44a2d1c30b8deafae189ce7f1b6d
parent3c9688876ace9ca4cd8630e5fbba8bb28235990a (diff)
parent0b74ecdfbea893ae585bc694136a3f50f5856cfe (diff)
Merge tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull IOMMU fixes from Joerg Roedel: - compile-time fixes (warnings and failures) - a bug in iommu core code which could cause the group->domain pointer to be falsly cleared - fix in scatterlist handling of the ARM common DMA-API code - stall detection fix for the Rockchip IOMMU driver * tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/vt-d: Silence an uninitialized variable warning iommu/rockchip: Fix "is stall active" check iommu: Don't overwrite domain pointer when there is no default_domain iommu/dma: Restore scatterlist offsets correctly iommu: provide of_xlate pointer unconditionally
-rw-r--r--drivers/iommu/dma-iommu.c4
-rw-r--r--drivers/iommu/intel-iommu.c2
-rw-r--r--drivers/iommu/iommu.c3
-rw-r--r--drivers/iommu/rockchip-iommu.c8
-rw-r--r--include/linux/iommu.h2
5 files changed, 9 insertions, 10 deletions
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 72d6182666cb..58f2fe687a24 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -403,7 +403,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents,
403 unsigned int s_length = sg_dma_len(s); 403 unsigned int s_length = sg_dma_len(s);
404 unsigned int s_dma_len = s->length; 404 unsigned int s_dma_len = s->length;
405 405
406 s->offset = s_offset; 406 s->offset += s_offset;
407 s->length = s_length; 407 s->length = s_length;
408 sg_dma_address(s) = dma_addr + s_offset; 408 sg_dma_address(s) = dma_addr + s_offset;
409 dma_addr += s_dma_len; 409 dma_addr += s_dma_len;
@@ -422,7 +422,7 @@ static void __invalidate_sg(struct scatterlist *sg, int nents)
422 422
423 for_each_sg(sg, s, nents, i) { 423 for_each_sg(sg, s, nents, i) {
424 if (sg_dma_address(s) != DMA_ERROR_CODE) 424 if (sg_dma_address(s) != DMA_ERROR_CODE)
425 s->offset = sg_dma_address(s); 425 s->offset += sg_dma_address(s);
426 if (sg_dma_len(s)) 426 if (sg_dma_len(s))
427 s->length = sg_dma_len(s); 427 s->length = sg_dma_len(s);
428 sg_dma_address(s) = DMA_ERROR_CODE; 428 sg_dma_address(s) = DMA_ERROR_CODE;
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a2e1b7f14df2..e1852e845d21 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2458,7 +2458,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
2458 } 2458 }
2459 2459
2460 /* register PCI DMA alias device */ 2460 /* register PCI DMA alias device */
2461 if (req_id != dma_alias && dev_is_pci(dev)) { 2461 if (dev_is_pci(dev) && req_id != dma_alias) {
2462 tmp = dmar_insert_one_dev_info(iommu, PCI_BUS_NUM(dma_alias), 2462 tmp = dmar_insert_one_dev_info(iommu, PCI_BUS_NUM(dma_alias),
2463 dma_alias & 0xff, NULL, domain); 2463 dma_alias & 0xff, NULL, domain);
2464 2464
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index bfd4f7c3b1d8..b9df1411c894 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -848,7 +848,8 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
848 if (!group->default_domain) { 848 if (!group->default_domain) {
849 group->default_domain = __iommu_domain_alloc(dev->bus, 849 group->default_domain = __iommu_domain_alloc(dev->bus,
850 IOMMU_DOMAIN_DMA); 850 IOMMU_DOMAIN_DMA);
851 group->domain = group->default_domain; 851 if (!group->domain)
852 group->domain = group->default_domain;
852 } 853 }
853 854
854 ret = iommu_group_add_device(group, dev); 855 ret = iommu_group_add_device(group, dev);
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index a6f593a0a29e..5710a06c3049 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
315 int i; 315 int i;
316 316
317 for (i = 0; i < iommu->num_mmu; i++) 317 for (i = 0; i < iommu->num_mmu; i++)
318 active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & 318 active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
319 RK_MMU_STATUS_STALL_ACTIVE; 319 RK_MMU_STATUS_STALL_ACTIVE);
320 320
321 return active; 321 return active;
322} 322}
@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
327 int i; 327 int i;
328 328
329 for (i = 0; i < iommu->num_mmu; i++) 329 for (i = 0; i < iommu->num_mmu; i++)
330 enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & 330 enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
331 RK_MMU_STATUS_PAGING_ENABLED; 331 RK_MMU_STATUS_PAGING_ENABLED);
332 332
333 return enable; 333 return enable;
334} 334}
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a5c539fa5d2b..ef7a6ecd8584 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -195,9 +195,7 @@ struct iommu_ops {
195 /* Get the number of windows per domain */ 195 /* Get the number of windows per domain */
196 u32 (*domain_get_windows)(struct iommu_domain *domain); 196 u32 (*domain_get_windows)(struct iommu_domain *domain);
197 197
198#ifdef CONFIG_OF_IOMMU
199 int (*of_xlate)(struct device *dev, struct of_phandle_args *args); 198 int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
200#endif
201 199
202 unsigned long pgsize_bitmap; 200 unsigned long pgsize_bitmap;
203 void *priv; 201 void *priv;