1
0
Fork 0

IOMMU Fixes for Linux v4.6-rc2 with:

- 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
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJXB7a7AAoJECvwRC2XARrjib0P/2U5k9+atF/rw/Fuk+boZUNe
 46A/aeISnAuoJu4fEid74HV0FkCz1B1y0LnHiadTuiF1ei1Ou9xwmQUDqosP5S9z
 MRhoicYmpQZ/Xkj0FZ0Ahl5NLOXQrre7iazJpWXR0r8owl3tXfSJhIkpqsxZVcxk
 nj/FaJCp94HAyTuYLjM8AipkZpMpGBLxfMr0DsVkFEj/Jh/DIpT7Nwd5yc5Gpc5g
 f7ojiX9km8eudwy1pKEM3Uh4slBbc7VLi4oibN6xDhtpXPfRsexfro8aqxT3A9j1
 9CVfL+RPK8EqJzjpVZCvTTbvYlSms4Jz4jClssObMTu9xXtA94z3kBDyp3oxzKwI
 JdPmNa4VEqSY+isFzab/JYaLaj4PxASFNiki6mQM7yaErRZoXYp78RbaI14Cz47l
 TrCmAuzMFKQ4abvrcO+aWmZxw8jzXJ4B+kNS92uR/jwJ4uK2G30AbVGIASgI4JAf
 HDhctNLZC0Ym4r+mqTDOVpWyuni7e4PinokH26HBBYZH40OkeP8pqLI+0Oyoi/67
 g2rutnpvmXO5q9sS9Zs+RgdRfyybBoDUqwZRFTzAORvVlh81ChNhpb/f/Jx7wxSM
 26walAx2bm254AgvacQ1E58tBdBeNereENvRPv4FZ3Yxxb4kYufHfo2by1i786Xs
 2b20kX/0SxSqaVJUYPGl
 =hCLk
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2016-04-09 10:23:45 -07:00
commit 1a59c53920
5 changed files with 9 additions and 10 deletions

View file

@ -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_dma_len = s->length;
s->offset = s_offset;
s->offset += s_offset;
s->length = s_length;
sg_dma_address(s) = dma_addr + s_offset;
dma_addr += s_dma_len;
@ -422,7 +422,7 @@ static void __invalidate_sg(struct scatterlist *sg, int nents)
for_each_sg(sg, s, nents, i) {
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))
s->length = sg_dma_len(s);
sg_dma_address(s) = DMA_ERROR_CODE;

View file

@ -2458,7 +2458,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
}
/* 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),
dma_alias & 0xff, NULL, domain);

View file

@ -848,7 +848,8 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
if (!group->default_domain) {
group->default_domain = __iommu_domain_alloc(dev->bus,
IOMMU_DOMAIN_DMA);
group->domain = group->default_domain;
if (!group->domain)
group->domain = group->default_domain;
}
ret = iommu_group_add_device(group, dev);

View file

@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
RK_MMU_STATUS_STALL_ACTIVE;
active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
RK_MMU_STATUS_STALL_ACTIVE);
return active;
}
@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
RK_MMU_STATUS_PAGING_ENABLED;
enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
RK_MMU_STATUS_PAGING_ENABLED);
return enable;
}

View file

@ -195,9 +195,7 @@ struct iommu_ops {
/* Get the number of windows per domain */
u32 (*domain_get_windows)(struct iommu_domain *domain);
#ifdef CONFIG_OF_IOMMU
int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
#endif
unsigned long pgsize_bitmap;
void *priv;