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

powerpc/powernv: Use it_page_shift for TCE invalidation

This fixes IODA1/2 to use it_page_shift as it may be bigger than 4K.

This changes involved constant values to use "ull" modifier.

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
b0376c9b 5b972592

+9 -7
+9 -7
arch/powerpc/platforms/powernv/pci-ioda.c
··· 513 513 (__be64 __iomem *)pe->tce_inval_reg_phys : 514 514 (__be64 __iomem *)tbl->it_index; 515 515 unsigned long start, end, inc; 516 + const unsigned shift = tbl->it_page_shift; 516 517 517 518 start = __pa(startp); 518 519 end = __pa(endp); 519 520 520 521 /* BML uses this case for p6/p7/galaxy2: Shift addr and put in node */ 521 522 if (tbl->it_busno) { 522 - start <<= 12; 523 - end <<= 12; 524 - inc = 128 << 12; 523 + start <<= shift; 524 + end <<= shift; 525 + inc = 128ull << shift; 525 526 start |= tbl->it_busno; 526 527 end |= tbl->it_busno; 527 528 } else if (tbl->it_type & TCE_PCI_SWINV_PAIR) { ··· 560 559 __be64 __iomem *invalidate = rm ? 561 560 (__be64 __iomem *)pe->tce_inval_reg_phys : 562 561 (__be64 __iomem *)tbl->it_index; 562 + const unsigned shift = tbl->it_page_shift; 563 563 564 564 /* We'll invalidate DMA address in PE scope */ 565 - start = 0x2ul << 60; 565 + start = 0x2ull << 60; 566 566 start |= (pe->pe_number & 0xFF); 567 567 end = start; 568 568 569 569 /* Figure out the start, end and step */ 570 570 inc = tbl->it_offset + (((u64)startp - tbl->it_base) / sizeof(u64)); 571 - start |= (inc << 12); 571 + start |= (inc << shift); 572 572 inc = tbl->it_offset + (((u64)endp - tbl->it_base) / sizeof(u64)); 573 - end |= (inc << 12); 574 - inc = (0x1ul << 12); 573 + end |= (inc << shift); 574 + inc = (0x1ull << shift); 575 575 mb(); 576 576 577 577 while (start <= end) {