Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/powernv: Add a page size parameter to pnv_pci_setup_iommu_table()

Since a TCE page size can be other than 4K, make it configurable for
P5IOC2 and IODA PHBs.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Alexey Kardashevskiy and committed by
Benjamin Herrenschmidt
8fa5d454 bc32057e

+9 -7
+3 -2
arch/powerpc/platforms/powernv/pci-ioda.c
··· 656 656 /* Setup linux iommu table */ 657 657 tbl = &pe->tce32_table; 658 658 pnv_pci_setup_iommu_table(tbl, addr, TCE32_TABLE_SIZE * segs, 659 - base << 28); 659 + base << 28, IOMMU_PAGE_SHIFT_4K); 660 660 661 661 /* OPAL variant of P7IOC SW invalidated TCEs */ 662 662 swinvp = of_get_property(phb->hose->dn, "ibm,opal-tce-kill", NULL); ··· 786 786 787 787 /* Setup linux iommu table */ 788 788 tbl = &pe->tce32_table; 789 - pnv_pci_setup_iommu_table(tbl, addr, tce_table_size, 0); 789 + pnv_pci_setup_iommu_table(tbl, addr, tce_table_size, 0, 790 + IOMMU_PAGE_SHIFT_4K); 790 791 791 792 /* OPAL variant of PHB3 invalidated TCEs */ 792 793 swinvp = of_get_property(phb->hose->dn, "ibm,opal-tce-kill", NULL);
+2 -1
arch/powerpc/platforms/powernv/pci-p5ioc2.c
··· 172 172 /* Setup TCEs */ 173 173 phb->dma_dev_setup = pnv_pci_p5ioc2_dma_dev_setup; 174 174 pnv_pci_setup_iommu_table(&phb->p5ioc2.iommu_table, 175 - tce_mem, tce_size, 0); 175 + tce_mem, tce_size, 0, 176 + IOMMU_PAGE_SHIFT_4K); 176 177 } 177 178 178 179 void __init pnv_pci_init_p5ioc2_hub(struct device_node *np)
+3 -3
arch/powerpc/platforms/powernv/pci.c
··· 628 628 629 629 void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 630 630 void *tce_mem, u64 tce_size, 631 - u64 dma_offset) 631 + u64 dma_offset, unsigned page_shift) 632 632 { 633 633 tbl->it_blocksize = 16; 634 634 tbl->it_base = (unsigned long)tce_mem; 635 - tbl->it_page_shift = IOMMU_PAGE_SHIFT_4K; 635 + tbl->it_page_shift = page_shift; 636 636 tbl->it_offset = dma_offset >> tbl->it_page_shift; 637 637 tbl->it_index = 0; 638 638 tbl->it_size = tce_size >> 3; ··· 657 657 if (WARN_ON(!tbl)) 658 658 return NULL; 659 659 pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(basep)), 660 - be32_to_cpup(sizep), 0); 660 + be32_to_cpup(sizep), 0, IOMMU_PAGE_SHIFT_4K); 661 661 iommu_init_table(tbl, hose->node); 662 662 iommu_register_group(tbl, pci_domain_nr(hose->bus), 0); 663 663
+1 -1
arch/powerpc/platforms/powernv/pci.h
··· 198 198 int where, int size, u32 val); 199 199 extern void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 200 200 void *tce_mem, u64 tce_size, 201 - u64 dma_offset); 201 + u64 dma_offset, unsigned page_shift); 202 202 extern void pnv_pci_init_p5ioc2_hub(struct device_node *np); 203 203 extern void pnv_pci_init_ioda_hub(struct device_node *np); 204 204 extern void pnv_pci_init_ioda2_phb(struct device_node *np);