Commit 1a59c539 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 3c968887 0b74ecdf
...@@ -403,7 +403,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents, ...@@ -403,7 +403,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents,
unsigned int s_length = sg_dma_len(s); unsigned int s_length = sg_dma_len(s);
unsigned int s_dma_len = s->length; unsigned int s_dma_len = s->length;
s->offset = s_offset; s->offset += s_offset;
s->length = s_length; s->length = s_length;
sg_dma_address(s) = dma_addr + s_offset; sg_dma_address(s) = dma_addr + s_offset;
dma_addr += s_dma_len; dma_addr += s_dma_len;
...@@ -422,7 +422,7 @@ static void __invalidate_sg(struct scatterlist *sg, int nents) ...@@ -422,7 +422,7 @@ static void __invalidate_sg(struct scatterlist *sg, int nents)
for_each_sg(sg, s, nents, i) { for_each_sg(sg, s, nents, i) {
if (sg_dma_address(s) != DMA_ERROR_CODE) if (sg_dma_address(s) != DMA_ERROR_CODE)
s->offset = sg_dma_address(s); s->offset += sg_dma_address(s);
if (sg_dma_len(s)) if (sg_dma_len(s))
s->length = sg_dma_len(s); s->length = sg_dma_len(s);
sg_dma_address(s) = DMA_ERROR_CODE; sg_dma_address(s) = DMA_ERROR_CODE;
......
...@@ -2458,7 +2458,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) ...@@ -2458,7 +2458,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
} }
/* register PCI DMA alias device */ /* register PCI DMA alias device */
if (req_id != dma_alias && dev_is_pci(dev)) { if (dev_is_pci(dev) && req_id != dma_alias) {
tmp = dmar_insert_one_dev_info(iommu, PCI_BUS_NUM(dma_alias), tmp = dmar_insert_one_dev_info(iommu, PCI_BUS_NUM(dma_alias),
dma_alias & 0xff, NULL, domain); dma_alias & 0xff, NULL, domain);
......
...@@ -848,6 +848,7 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) ...@@ -848,6 +848,7 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
if (!group->default_domain) { if (!group->default_domain) {
group->default_domain = __iommu_domain_alloc(dev->bus, group->default_domain = __iommu_domain_alloc(dev->bus,
IOMMU_DOMAIN_DMA); IOMMU_DOMAIN_DMA);
if (!group->domain)
group->domain = group->default_domain; group->domain = group->default_domain;
} }
......
...@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu) ...@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
int i; int i;
for (i = 0; i < iommu->num_mmu; i++) for (i = 0; i < iommu->num_mmu; i++)
active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
RK_MMU_STATUS_STALL_ACTIVE; RK_MMU_STATUS_STALL_ACTIVE);
return active; return active;
} }
...@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu) ...@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
int i; int i;
for (i = 0; i < iommu->num_mmu; i++) for (i = 0; i < iommu->num_mmu; i++)
enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) & enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
RK_MMU_STATUS_PAGING_ENABLED; RK_MMU_STATUS_PAGING_ENABLED);
return enable; return enable;
} }
......
...@@ -195,9 +195,7 @@ struct iommu_ops { ...@@ -195,9 +195,7 @@ struct iommu_ops {
/* Get the number of windows per domain */ /* Get the number of windows per domain */
u32 (*domain_get_windows)(struct iommu_domain *domain); u32 (*domain_get_windows)(struct iommu_domain *domain);
#ifdef CONFIG_OF_IOMMU
int (*of_xlate)(struct device *dev, struct of_phandle_args *args); int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
#endif
unsigned long pgsize_bitmap; unsigned long pgsize_bitmap;
void *priv; void *priv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment