Skip to content

Commit

Permalink
[POWERPC] Use it_offset not pte_offset in cell IOMMU code
Browse files Browse the repository at this point in the history
The cell IOMMU tce build and free routines use pte_offset to convert
the index passed from the generic IOMMU code into a page table offset.

This takes into account the SPIDER_DMA_OFFSET which sets the top bit
of every DMA address.

However it doesn't cater for the IOMMU window starting at a non-zero
address, as the base of the window is not incorporated into pte_offset
at all.

As it turns out tbl->it_offset already contains the value we need, it
takes into account the base of the window and also pte_offset. So use
it instead!

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Michael Ellerman authored and Arnd Bergmann committed Mar 3, 2008
1 parent f9660e8 commit 0d7386e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/cell/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static void tce_build_cell(struct iommu_table *tbl, long index, long npages,
(window->ioid & IOPTE_IOID_Mask);
#endif

io_pte = (unsigned long *)tbl->it_base + (index - window->pte_offset);
io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);

for (i = 0; i < npages; i++, uaddr += IOMMU_PAGE_SIZE)
io_pte[i] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask);
Expand Down Expand Up @@ -232,7 +232,7 @@ static void tce_free_cell(struct iommu_table *tbl, long index, long npages)
| (window->ioid & IOPTE_IOID_Mask);
#endif

io_pte = (unsigned long *)tbl->it_base + (index - window->pte_offset);
io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);

for (i = 0; i < npages; i++)
io_pte[i] = pte;
Expand Down

0 comments on commit 0d7386e

Please sign in to comment.