diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2008-02-08 00:37:04 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-02-08 03:52:40 -0500 |
commit | 4a8df1507eaeefc9739e3762db606caa08edba98 (patch) | |
tree | e46f928e8b93809a882a5d7bfc12fd890ff1ffa7 /arch/powerpc | |
parent | 0e0b47abb71a2c4aed5895c01f41827dbd8a981c (diff) |
[POWERPC] Fix potential cell IOMMU bug when switching back to default DMA ops
If we get a 64-bit dma mask we switch to the fixed ops and call
cell_dma_dev_setup(). If the driver then switches back to a 32-bit dma
mask for any reason we don't call cell_dma_dev_setup() again, which
has the potential to leave bogus data in dev->archdata.dma_data.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 1f7b25474086..5cdcd3638250 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -841,19 +841,18 @@ static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask) | |||
841 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | 841 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) |
842 | return -EIO; | 842 | return -EIO; |
843 | 843 | ||
844 | if (dma_mask == DMA_BIT_MASK(64)) { | 844 | if (dma_mask == DMA_BIT_MASK(64) && |
845 | if (cell_iommu_get_fixed_address(dev) == OF_BAD_ADDR) | 845 | cell_iommu_get_fixed_address(dev) != OF_BAD_ADDR) |
846 | dev_dbg(dev, "iommu: 64-bit OK, but bad addr\n"); | 846 | { |
847 | else { | 847 | dev_dbg(dev, "iommu: 64-bit OK, using fixed ops\n"); |
848 | dev_dbg(dev, "iommu: 64-bit OK, using fixed ops\n"); | 848 | set_dma_ops(dev, &dma_iommu_fixed_ops); |
849 | set_dma_ops(dev, &dma_iommu_fixed_ops); | ||
850 | cell_dma_dev_setup(dev); | ||
851 | } | ||
852 | } else { | 849 | } else { |
853 | dev_dbg(dev, "iommu: not 64-bit, using default ops\n"); | 850 | dev_dbg(dev, "iommu: not 64-bit, using default ops\n"); |
854 | set_dma_ops(dev, get_pci_dma_ops()); | 851 | set_dma_ops(dev, get_pci_dma_ops()); |
855 | } | 852 | } |
856 | 853 | ||
854 | cell_dma_dev_setup(dev); | ||
855 | |||
857 | *dev->dma_mask = dma_mask; | 856 | *dev->dma_mask = dma_mask; |
858 | 857 | ||
859 | return 0; | 858 | return 0; |