Skip to content

Commit 1a59c53

Browse files
committed
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
2 parents 3c96888 + 0b74ecd commit 1a59c53

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

drivers/iommu/dma-iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents,
403403
unsigned int s_length = sg_dma_len(s);
404404
unsigned int s_dma_len = s->length;
405405

406-
s->offset = s_offset;
406+
s->offset += s_offset;
407407
s->length = s_length;
408408
sg_dma_address(s) = dma_addr + s_offset;
409409
dma_addr += s_dma_len;
@@ -422,7 +422,7 @@ static void __invalidate_sg(struct scatterlist *sg, int nents)
422422

423423
for_each_sg(sg, s, nents, i) {
424424
if (sg_dma_address(s) != DMA_ERROR_CODE)
425-
s->offset = sg_dma_address(s);
425+
s->offset += sg_dma_address(s);
426426
if (sg_dma_len(s))
427427
s->length = sg_dma_len(s);
428428
sg_dma_address(s) = DMA_ERROR_CODE;

drivers/iommu/intel-iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
24582458
}
24592459

24602460
/* 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) {
24622462
tmp = dmar_insert_one_dev_info(iommu, PCI_BUS_NUM(dma_alias),
24632463
dma_alias & 0xff, NULL, domain);
24642464

drivers/iommu/iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,8 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
848848
if (!group->default_domain) {
849849
group->default_domain = __iommu_domain_alloc(dev->bus,
850850
IOMMU_DOMAIN_DMA);
851-
group->domain = group->default_domain;
851+
if (!group->domain)
852+
group->domain = group->default_domain;
852853
}
853854

854855
ret = iommu_group_add_device(group, dev);

drivers/iommu/rockchip-iommu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
315315
int i;
316316

317317
for (i = 0; i < iommu->num_mmu; i++)
318-
active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
319-
RK_MMU_STATUS_STALL_ACTIVE;
318+
active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
319+
RK_MMU_STATUS_STALL_ACTIVE);
320320

321321
return active;
322322
}
@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
327327
int i;
328328

329329
for (i = 0; i < iommu->num_mmu; i++)
330-
enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
331-
RK_MMU_STATUS_PAGING_ENABLED;
330+
enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
331+
RK_MMU_STATUS_PAGING_ENABLED);
332332

333333
return enable;
334334
}

include/linux/iommu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ struct iommu_ops {
195195
/* Get the number of windows per domain */
196196
u32 (*domain_get_windows)(struct iommu_domain *domain);
197197

198-
#ifdef CONFIG_OF_IOMMU
199198
int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
200-
#endif
201199

202200
unsigned long pgsize_bitmap;
203201
void *priv;

0 commit comments

Comments
 (0)