提交 2ad67141 编写于 作者: T Tushar Dave 提交者: David S. Miller

SPARC64: Fix sun4v DMA panic

64bit DMA only supported on sun4v equipped with ATU IOMMU HW.
'Commit b02c2b0b ("sparc: remove arch specific dma_supported
implementations")' introduced a code that incorrectly allow
dma_supported() to succeed for 64bit dma mask even if system doesn't
have ATU IOMMU. This results into panic.

Fix it.
Reported-by: NMeelis Roos <mroos@linux.ee>
Signed-off-by: NTushar Dave <tushar.n.dave@oracle.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3b06b1a7
...@@ -673,12 +673,14 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, ...@@ -673,12 +673,14 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
static int dma_4v_supported(struct device *dev, u64 device_mask) static int dma_4v_supported(struct device *dev, u64 device_mask)
{ {
struct iommu *iommu = dev->archdata.iommu; struct iommu *iommu = dev->archdata.iommu;
u64 dma_addr_mask; u64 dma_addr_mask = iommu->dma_addr_mask;
if (device_mask > DMA_BIT_MASK(32) && iommu->atu) if (device_mask > DMA_BIT_MASK(32)) {
dma_addr_mask = iommu->atu->dma_addr_mask; if (iommu->atu)
else dma_addr_mask = iommu->atu->dma_addr_mask;
dma_addr_mask = iommu->dma_addr_mask; else
return 0;
}
if ((device_mask & dma_addr_mask) == dma_addr_mask) if ((device_mask & dma_addr_mask) == dma_addr_mask)
return 1; return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册