[POWERPC] Cell IOMMU: n_pte_pages is in 4K page units, not IOMMU_PAGE_SIZE
We use n_pte_pages to calculate the stride through the page tables, but we also use it to set the NPPT value in the segment table entry. That is defined as the number of 4K pages per segment, so we should calculate it as such regardless of the IOMMU page size. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Родитель
7d432ff1b7
Коммит
3d3e6da17d
|
@ -348,9 +348,8 @@ static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu,
|
||||||
ptab = page_address(page);
|
ptab = page_address(page);
|
||||||
memset(ptab, 0, ptab_size);
|
memset(ptab, 0, ptab_size);
|
||||||
|
|
||||||
/* number of pages needed for a page table */
|
/* number of 4K pages needed for a page table */
|
||||||
n_pte_pages = (pages_per_segment *
|
n_pte_pages = (pages_per_segment * sizeof(unsigned long)) >> 12;
|
||||||
sizeof(unsigned long)) >> IOMMU_PAGE_SHIFT;
|
|
||||||
|
|
||||||
pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n",
|
pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n",
|
||||||
__FUNCTION__, iommu->nid, iommu->stab, ptab,
|
__FUNCTION__, iommu->nid, iommu->stab, ptab,
|
||||||
|
@ -377,8 +376,8 @@ static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu,
|
||||||
pr_debug("\toverlap at %d, skipping\n", i);
|
pr_debug("\toverlap at %d, skipping\n", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
iommu->stab[i] = reg | (__pa(ptab) + n_pte_pages *
|
iommu->stab[i] = reg | (__pa(ptab) + (n_pte_pages << 12) *
|
||||||
IOMMU_PAGE_SIZE * (i - start_seg));
|
(i - start_seg));
|
||||||
pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]);
|
pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче