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

powerpc/mm/radix: Add checks in slice code to catch radix usage

Radix doesn't need slice support. Catch incorrect usage of slice code
when radix is enabled.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Aneesh Kumar K.V and committed by
Michael Ellerman
764041e0 d8c476ee

+16
+16
arch/powerpc/mm/slice.c
··· 395 395 396 396 /* Sanity checks */ 397 397 BUG_ON(mm->task_size == 0); 398 + VM_BUG_ON(radix_enabled()); 398 399 399 400 slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize); 400 401 slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d\n", ··· 569 568 unsigned char *hpsizes; 570 569 int index, mask_index; 571 570 571 + /* 572 + * Radix doesn't use slice, but can get enabled along with MMU_SLICE 573 + */ 574 + if (radix_enabled()) { 575 + #ifdef CONFIG_PPC_64K_PAGES 576 + return MMU_PAGE_64K; 577 + #else 578 + return MMU_PAGE_4K; 579 + #endif 580 + } 572 581 if (addr < SLICE_LOW_TOP) { 573 582 u64 lpsizes; 574 583 lpsizes = mm->context.low_slices_psize; ··· 616 605 617 606 slice_dbg("slice_set_user_psize(mm=%p, psize=%d)\n", mm, psize); 618 607 608 + VM_BUG_ON(radix_enabled()); 619 609 spin_lock_irqsave(&slice_convert_lock, flags); 620 610 621 611 old_psize = mm->context.user_psize; ··· 661 649 { 662 650 struct slice_mask mask = slice_range_to_mask(start, len); 663 651 652 + VM_BUG_ON(radix_enabled()); 664 653 slice_convert(mm, mask, psize); 665 654 } 666 655 ··· 690 677 { 691 678 struct slice_mask mask, available; 692 679 unsigned int psize = mm->context.user_psize; 680 + 681 + if (radix_enabled()) 682 + return 0; 693 683 694 684 mask = slice_range_to_mask(addr, len); 695 685 available = slice_mask_for_size(mm, psize);