Lines Matching +full:1 +full:p
45 mips_xpa_disabled = 1; in xpa_disable()
47 return 1; in xpa_disable()
103 return 1; in use_bbit_insns()
114 return 1; in use_lwx_insns()
131 i += 1; /* Kernel use starts at the top and works down. */ in scratchpad_offset()
162 label_second_part = 1,
201 static void uasm_bgezl_hazard(u32 **p, struct uasm_reloc **r, int instance) in uasm_bgezl_hazard() argument
205 uasm_il_bgezl(p, r, 0, label_tlbw_hazard_0 + instance); in uasm_bgezl_hazard()
212 static void uasm_bgezl_label(struct uasm_label **l, u32 **p, int instance) in uasm_bgezl_label() argument
216 uasm_build_label(l, *p, label_tlbw_hazard_0 + instance); in uasm_bgezl_label()
269 pr_debug("\t.word\t0x%08x\t\t# %p\n", handler[i], &handler[i]); in dump_handler()
341 return -1; in allocate_kscratch()
345 kscratch_used_mask |= (1 << r); in allocate_kscratch()
355 static struct work_registers build_get_work_registers(u32 **p) in build_get_work_registers() argument
361 UASM_i_MTC0(p, 1, c0_kscratch(), scratch_reg); in build_get_work_registers()
364 r.r3 = 1; in build_get_work_registers()
368 if (num_possible_cpus() > 1) { in build_get_work_registers()
370 UASM_i_CPUID_MFC0(p, K0, SMP_CPUID_REG); in build_get_work_registers()
371 UASM_i_SRL_SAFE(p, K0, K0, SMP_CPUID_REGSHIFT); in build_get_work_registers()
374 UASM_i_SLL(p, K0, K0, ilog2(sizeof(struct tlb_reg_save))); in build_get_work_registers()
376 UASM_i_LA(p, K1, (long)&handler_reg_save); in build_get_work_registers()
377 UASM_i_ADDU(p, K0, K0, K1); in build_get_work_registers()
379 UASM_i_LA(p, K0, (long)&handler_reg_save); in build_get_work_registers()
381 /* K0 now points to save area, save $1 and $2 */ in build_get_work_registers()
382 UASM_i_SW(p, 1, offsetof(struct tlb_reg_save, a), K0); in build_get_work_registers()
383 UASM_i_SW(p, 2, offsetof(struct tlb_reg_save, b), K0); in build_get_work_registers()
386 r.r2 = 1; in build_get_work_registers()
391 static void build_restore_work_registers(u32 **p) in build_restore_work_registers() argument
394 uasm_i_ehb(p); in build_restore_work_registers()
395 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); in build_restore_work_registers()
398 /* K0 already points to save area, restore $1 and $2 */ in build_restore_work_registers()
399 UASM_i_LW(p, 1, offsetof(struct tlb_reg_save, a), K0); in build_restore_work_registers()
400 UASM_i_LW(p, 2, offsetof(struct tlb_reg_save, b), K0); in build_restore_work_registers()
414 u32 *p; in build_r3000_tlb_refill_handler() local
417 p = tlb_handler; in build_r3000_tlb_refill_handler()
419 uasm_i_mfc0(&p, K0, C0_BADVADDR); in build_r3000_tlb_refill_handler()
420 uasm_i_lui(&p, K1, uasm_rel_hi(pgdc)); /* cp0 delay */ in build_r3000_tlb_refill_handler()
421 uasm_i_lw(&p, K1, uasm_rel_lo(pgdc), K1); in build_r3000_tlb_refill_handler()
422 uasm_i_srl(&p, K0, K0, 22); /* load delay */ in build_r3000_tlb_refill_handler()
423 uasm_i_sll(&p, K0, K0, 2); in build_r3000_tlb_refill_handler()
424 uasm_i_addu(&p, K1, K1, K0); in build_r3000_tlb_refill_handler()
425 uasm_i_mfc0(&p, K0, C0_CONTEXT); in build_r3000_tlb_refill_handler()
426 uasm_i_lw(&p, K1, 0, K1); /* cp0 delay */ in build_r3000_tlb_refill_handler()
427 uasm_i_andi(&p, K0, K0, 0xffc); /* load delay */ in build_r3000_tlb_refill_handler()
428 uasm_i_addu(&p, K1, K1, K0); in build_r3000_tlb_refill_handler()
429 uasm_i_lw(&p, K0, 0, K1); in build_r3000_tlb_refill_handler()
430 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_refill_handler()
431 uasm_i_mtc0(&p, K0, C0_ENTRYLO0); in build_r3000_tlb_refill_handler()
432 uasm_i_mfc0(&p, K1, C0_EPC); /* cp0 delay */ in build_r3000_tlb_refill_handler()
433 uasm_i_tlbwr(&p); /* cp0 delay */ in build_r3000_tlb_refill_handler()
434 uasm_i_jr(&p, K1); in build_r3000_tlb_refill_handler()
435 uasm_i_rfe(&p); /* branch delay */ in build_r3000_tlb_refill_handler()
437 if (p > tlb_handler + 32) in build_r3000_tlb_refill_handler()
441 (unsigned int)(p - tlb_handler)); in build_r3000_tlb_refill_handler()
480 static void __maybe_unused build_tlb_probe_entry(u32 **p) in build_tlb_probe_entry() argument
488 uasm_i_nop(p); in build_tlb_probe_entry()
489 uasm_i_tlbp(p); in build_tlb_probe_entry()
493 uasm_i_tlbp(p); in build_tlb_probe_entry()
498 void build_tlb_write_entry(u32 **p, struct uasm_label **l, in build_tlb_write_entry() argument
511 uasm_i_ehb(p); in build_tlb_write_entry()
512 tlbw(p); in build_tlb_write_entry()
527 uasm_bgezl_hazard(p, r, hazard_instance); in build_tlb_write_entry()
528 tlbw(p); in build_tlb_write_entry()
529 uasm_bgezl_label(l, p, hazard_instance); in build_tlb_write_entry()
531 uasm_i_nop(p); in build_tlb_write_entry()
536 uasm_i_nop(p); in build_tlb_write_entry()
537 tlbw(p); in build_tlb_write_entry()
538 uasm_i_nop(p); in build_tlb_write_entry()
543 uasm_i_nop(p); /* QED specifies 2 nops hazard */ in build_tlb_write_entry()
544 uasm_i_nop(p); /* QED specifies 2 nops hazard */ in build_tlb_write_entry()
545 tlbw(p); in build_tlb_write_entry()
553 uasm_i_nop(p); in build_tlb_write_entry()
554 tlbw(p); in build_tlb_write_entry()
579 uasm_i_nop(p); in build_tlb_write_entry()
581 tlbw(p); in build_tlb_write_entry()
585 uasm_i_nop(p); in build_tlb_write_entry()
586 uasm_i_nop(p); in build_tlb_write_entry()
587 uasm_i_nop(p); in build_tlb_write_entry()
588 uasm_i_nop(p); in build_tlb_write_entry()
589 tlbw(p); in build_tlb_write_entry()
597 uasm_i_nop(p); in build_tlb_write_entry()
598 uasm_i_nop(p); in build_tlb_write_entry()
599 tlbw(p); in build_tlb_write_entry()
600 uasm_i_nop(p); in build_tlb_write_entry()
601 uasm_i_nop(p); in build_tlb_write_entry()
607 uasm_i_nop(p); in build_tlb_write_entry()
608 uasm_i_nop(p); in build_tlb_write_entry()
609 tlbw(p); in build_tlb_write_entry()
613 tlbw(p); in build_tlb_write_entry()
614 uasm_i_nop(p); in build_tlb_write_entry()
625 static __maybe_unused void build_convert_pte_to_entrylo(u32 **p, in build_convert_pte_to_entrylo() argument
635 UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL)); in build_convert_pte_to_entrylo()
637 UASM_i_SRL(p, reg, reg, ilog2(_PAGE_NO_EXEC)); in build_convert_pte_to_entrylo()
638 UASM_i_ROTR(p, reg, reg, in build_convert_pte_to_entrylo()
643 uasm_i_dsrl_safe(p, reg, reg, ilog2(_PAGE_GLOBAL)); in build_convert_pte_to_entrylo()
645 UASM_i_SRL(p, reg, reg, ilog2(_PAGE_GLOBAL)); in build_convert_pte_to_entrylo()
652 static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, in build_restore_pagemask() argument
662 uasm_i_ehb(p); in build_restore_pagemask()
666 uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16); in build_restore_pagemask()
667 uasm_i_ori(p, tmp, tmp, PM_DEFAULT_MASK & 0xffff); in build_restore_pagemask()
668 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
669 uasm_il_b(p, r, lid); in build_restore_pagemask()
671 uasm_i_ori(p, tmp, 0, PM_DEFAULT_MASK); in build_restore_pagemask()
672 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
673 uasm_il_b(p, r, lid); in build_restore_pagemask()
675 uasm_i_mtc0(p, 0, C0_PAGEMASK); in build_restore_pagemask()
676 uasm_il_b(p, r, lid); in build_restore_pagemask()
679 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); in build_restore_pagemask()
681 UASM_i_LW(p, 1, scratchpad_offset(0), 0); in build_restore_pagemask()
685 uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16); in build_restore_pagemask()
686 uasm_i_ori(p, tmp, tmp, PM_DEFAULT_MASK & 0xffff); in build_restore_pagemask()
687 uasm_il_b(p, r, lid); in build_restore_pagemask()
688 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
690 uasm_i_ori(p, tmp, 0, PM_DEFAULT_MASK); in build_restore_pagemask()
691 uasm_il_b(p, r, lid); in build_restore_pagemask()
692 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_restore_pagemask()
694 uasm_il_b(p, r, lid); in build_restore_pagemask()
695 uasm_i_mtc0(p, 0, C0_PAGEMASK); in build_restore_pagemask()
700 static void build_huge_tlb_write_entry(u32 **p, struct uasm_label **l, in build_huge_tlb_write_entry() argument
707 uasm_i_lui(p, tmp, PM_HUGE_MASK >> 16); in build_huge_tlb_write_entry()
708 uasm_i_ori(p, tmp, tmp, PM_HUGE_MASK & 0xffff); in build_huge_tlb_write_entry()
709 uasm_i_mtc0(p, tmp, C0_PAGEMASK); in build_huge_tlb_write_entry()
711 build_tlb_write_entry(p, l, r, wmode); in build_huge_tlb_write_entry()
713 build_restore_pagemask(p, r, tmp, label_leave, restore_scratch); in build_huge_tlb_write_entry()
720 build_is_huge_pte(u32 **p, struct uasm_reloc **r, unsigned int tmp, in build_is_huge_pte() argument
723 UASM_i_LW(p, tmp, 0, pmd); in build_is_huge_pte()
725 uasm_il_bbit1(p, r, tmp, ilog2(_PAGE_HUGE), lid); in build_is_huge_pte()
727 uasm_i_andi(p, tmp, tmp, _PAGE_HUGE); in build_is_huge_pte()
728 uasm_il_bnez(p, r, tmp, lid); in build_is_huge_pte()
732 static void build_huge_update_entries(u32 **p, unsigned int pte, in build_huge_update_entries() argument
750 uasm_i_lui(p, tmp, HPAGE_SIZE >> (7 + 16)); in build_huge_update_entries()
752 build_convert_pte_to_entrylo(p, pte); in build_huge_update_entries()
753 UASM_i_MTC0(p, pte, C0_ENTRYLO0); /* load it */ in build_huge_update_entries()
756 UASM_i_ADDIU(p, pte, pte, HPAGE_SIZE >> 7); in build_huge_update_entries()
758 UASM_i_ADDU(p, pte, pte, tmp); in build_huge_update_entries()
760 UASM_i_MTC0(p, pte, C0_ENTRYLO1); /* load it */ in build_huge_update_entries()
763 static void build_huge_handler_tail(u32 **p, struct uasm_reloc **r, in build_huge_handler_tail() argument
770 UASM_i_SC(p, pte, 0, ptr); in build_huge_handler_tail()
771 uasm_il_beqz(p, r, pte, label_tlb_huge_update); in build_huge_handler_tail()
772 UASM_i_LW(p, pte, 0, ptr); /* Needed because SC killed our PTE */ in build_huge_handler_tail()
774 UASM_i_SW(p, pte, 0, ptr); in build_huge_handler_tail()
779 UASM_i_MFC0(p, ptr, C0_ENTRYHI); in build_huge_handler_tail()
780 uasm_i_ori(p, ptr, ptr, MIPS_ENTRYHI_EHINV); in build_huge_handler_tail()
781 UASM_i_MTC0(p, ptr, C0_ENTRYHI); in build_huge_handler_tail()
782 build_tlb_write_entry(p, l, r, tlb_indexed); in build_huge_handler_tail()
784 uasm_i_xori(p, ptr, ptr, MIPS_ENTRYHI_EHINV); in build_huge_handler_tail()
785 UASM_i_MTC0(p, ptr, C0_ENTRYHI); in build_huge_handler_tail()
786 build_huge_update_entries(p, pte, ptr); in build_huge_handler_tail()
787 build_huge_tlb_write_entry(p, l, r, pte, tlb_random, 0); in build_huge_handler_tail()
792 build_huge_update_entries(p, pte, ptr); in build_huge_handler_tail()
793 build_huge_tlb_write_entry(p, l, r, pte, tlb_indexed, 0); in build_huge_handler_tail()
802 void build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, in build_get_pmde64() argument
811 uasm_i_dmfc0(p, tmp, C0_BADVADDR); in build_get_pmde64()
825 uasm_i_dsrl_safe(p, ptr, tmp, PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3); in build_get_pmde64()
826 uasm_il_bnez(p, r, ptr, label_vmalloc); in build_get_pmde64()
828 uasm_il_bltz(p, r, tmp, label_vmalloc); in build_get_pmde64()
832 if (pgd_reg != -1) { in build_get_pmde64()
835 UASM_i_MFC0(p, ptr, C0_PWBASE); in build_get_pmde64()
837 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); in build_get_pmde64()
843 UASM_i_MFC0(p, ptr, C0_CONTEXT); in build_get_pmde64()
846 uasm_i_dins(p, ptr, 0, 0, 23); in build_get_pmde64()
848 /* 1 0 1 0 1 << 6 xkphys cached */ in build_get_pmde64()
849 uasm_i_ori(p, ptr, ptr, 0x540); in build_get_pmde64()
850 uasm_i_drotr(p, ptr, ptr, 11); in build_get_pmde64()
852 UASM_i_CPUID_MFC0(p, ptr, SMP_CPUID_REG); in build_get_pmde64()
853 uasm_i_dsrl_safe(p, ptr, ptr, SMP_CPUID_PTRSHIFT); in build_get_pmde64()
854 UASM_i_LA_mostly(p, tmp, pgdc); in build_get_pmde64()
855 uasm_i_daddu(p, ptr, ptr, tmp); in build_get_pmde64()
856 uasm_i_dmfc0(p, tmp, C0_BADVADDR); in build_get_pmde64()
857 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr); in build_get_pmde64()
859 UASM_i_LA_mostly(p, ptr, pgdc); in build_get_pmde64()
860 uasm_i_ld(p, ptr, uasm_rel_lo(pgdc), ptr); in build_get_pmde64()
864 uasm_l_vmalloc_done(l, *p); in build_get_pmde64()
867 uasm_i_dsrl_safe(p, tmp, tmp, PGDIR_SHIFT - 3); in build_get_pmde64()
869 uasm_i_andi(p, tmp, tmp, (PTRS_PER_PGD - 1)<<3); in build_get_pmde64()
870 uasm_i_daddu(p, ptr, ptr, tmp); /* add in pgd offset */ in build_get_pmde64()
872 uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pmde64()
873 uasm_i_ld(p, ptr, 0, ptr); /* get pud pointer */ in build_get_pmde64()
874 uasm_i_dsrl_safe(p, tmp, tmp, PUD_SHIFT - 3); /* get pud offset in bytes */ in build_get_pmde64()
875 uasm_i_andi(p, tmp, tmp, (PTRS_PER_PUD - 1) << 3); in build_get_pmde64()
876 uasm_i_daddu(p, ptr, ptr, tmp); /* add in pud offset */ in build_get_pmde64()
879 uasm_i_dmfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pmde64()
880 uasm_i_ld(p, ptr, 0, ptr); /* get pmd pointer */ in build_get_pmde64()
881 uasm_i_dsrl_safe(p, tmp, tmp, PMD_SHIFT-3); /* get pmd offset in bytes */ in build_get_pmde64()
882 uasm_i_andi(p, tmp, tmp, (PTRS_PER_PMD - 1)<<3); in build_get_pmde64()
883 uasm_i_daddu(p, ptr, ptr, tmp); /* add in pmd offset */ in build_get_pmde64()
893 build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, in build_get_pgd_vmalloc64() argument
903 uasm_l_vmalloc(l, *p); in build_get_pgd_vmalloc64()
907 uasm_il_bltz(p, r, bvaddr, label_vmalloc_done); in build_get_pgd_vmalloc64()
908 uasm_i_lui(p, ptr, uasm_rel_hi(swpd)); in build_get_pgd_vmalloc64()
909 did_vmalloc_branch = 1; in build_get_pgd_vmalloc64()
912 uasm_il_bgez(p, r, bvaddr, label_large_segbits_fault); in build_get_pgd_vmalloc64()
917 uasm_il_b(p, r, label_vmalloc_done); in build_get_pgd_vmalloc64()
918 uasm_i_lui(p, ptr, uasm_rel_hi(swpd)); in build_get_pgd_vmalloc64()
920 UASM_i_LA_mostly(p, ptr, swpd); in build_get_pgd_vmalloc64()
921 uasm_il_b(p, r, label_vmalloc_done); in build_get_pgd_vmalloc64()
923 uasm_i_addiu(p, ptr, ptr, uasm_rel_lo(swpd)); in build_get_pgd_vmalloc64()
925 uasm_i_daddiu(p, ptr, ptr, uasm_rel_lo(swpd)); in build_get_pgd_vmalloc64()
929 uasm_l_large_segbits_fault(l, *p); in build_get_pgd_vmalloc64()
932 uasm_i_ehb(p); in build_get_pgd_vmalloc64()
946 UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); in build_get_pgd_vmalloc64()
947 uasm_i_jr(p, ptr); in build_get_pgd_vmalloc64()
951 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); in build_get_pgd_vmalloc64()
953 UASM_i_LW(p, 1, scratchpad_offset(0), 0); in build_get_pgd_vmalloc64()
955 uasm_i_nop(p); in build_get_pgd_vmalloc64()
966 void build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) in build_get_pgde32() argument
968 if (pgd_reg != -1) { in build_get_pgde32()
970 uasm_i_mfc0(p, ptr, c0_kscratch(), pgd_reg); in build_get_pgde32()
971 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pgde32()
977 uasm_i_mfc0(p, ptr, SMP_CPUID_REG); in build_get_pgde32()
978 UASM_i_LA_mostly(p, tmp, pgdc); in build_get_pgde32()
979 uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT); in build_get_pgde32()
980 uasm_i_addu(p, ptr, tmp, ptr); in build_get_pgde32()
982 UASM_i_LA_mostly(p, ptr, pgdc); in build_get_pgde32()
984 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ in build_get_pgde32()
985 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); in build_get_pgde32()
987 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ in build_get_pgde32()
988 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2); in build_get_pgde32()
989 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */ in build_get_pgde32()
995 static void build_adjust_context(u32 **p, unsigned int ctx) in build_adjust_context() argument
997 unsigned int shift = 4 - (PTE_T_LOG2 + 1) + PAGE_SHIFT - 12; in build_adjust_context()
998 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1); in build_adjust_context()
1017 UASM_i_SRL(p, ctx, ctx, shift); in build_adjust_context()
1018 uasm_i_andi(p, ctx, ctx, mask); in build_adjust_context()
1021 void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) in build_get_ptep() argument
1032 UASM_i_LW(p, ptr, 0, ptr); in build_get_ptep()
1033 GET_CONTEXT(p, tmp); /* get context reg */ in build_get_ptep()
1037 GET_CONTEXT(p, tmp); /* get context reg */ in build_get_ptep()
1038 UASM_i_LW(p, ptr, 0, ptr); in build_get_ptep()
1042 build_adjust_context(p, tmp); in build_get_ptep()
1043 UASM_i_ADDU(p, ptr, ptr, tmp); /* add in offset */ in build_get_ptep()
1047 void build_update_entries(u32 **p, unsigned int tmp, unsigned int ptep) in build_update_entries() argument
1059 uasm_i_lw(p, tmp, pte_off_even, ptep); /* even pte */ in build_update_entries()
1060 UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); in build_update_entries()
1061 UASM_i_MTC0(p, tmp, C0_ENTRYLO0); in build_update_entries()
1064 uasm_i_lw(p, tmp, 0, ptep); in build_update_entries()
1065 uasm_i_ext(p, tmp, tmp, 0, 24); in build_update_entries()
1066 uasm_i_mthc0(p, tmp, C0_ENTRYLO0); in build_update_entries()
1069 uasm_i_lw(p, tmp, pte_off_odd, ptep); /* odd pte */ in build_update_entries()
1070 UASM_i_ROTR(p, tmp, tmp, ilog2(_PAGE_GLOBAL)); in build_update_entries()
1071 UASM_i_MTC0(p, tmp, C0_ENTRYLO1); in build_update_entries()
1074 uasm_i_lw(p, tmp, sizeof(pte_t), ptep); in build_update_entries()
1075 uasm_i_ext(p, tmp, tmp, 0, 24); in build_update_entries()
1076 uasm_i_mthc0(p, tmp, C0_ENTRYLO1); in build_update_entries()
1081 UASM_i_LW(p, tmp, pte_off_even, ptep); /* get even pte */ in build_update_entries()
1082 UASM_i_LW(p, ptep, pte_off_odd, ptep); /* get odd pte */ in build_update_entries()
1084 build_tlb_probe_entry(p); in build_update_entries()
1085 build_convert_pte_to_entrylo(p, tmp); in build_update_entries()
1087 UASM_i_MTC0(p, 0, C0_ENTRYLO0); in build_update_entries()
1088 UASM_i_MTC0(p, tmp, C0_ENTRYLO0); /* load it */ in build_update_entries()
1089 build_convert_pte_to_entrylo(p, ptep); in build_update_entries()
1091 uasm_i_mfc0(p, tmp, C0_INDEX); in build_update_entries()
1093 UASM_i_MTC0(p, 0, C0_ENTRYLO1); in build_update_entries()
1094 UASM_i_MTC0(p, ptep, C0_ENTRYLO1); /* load it */ in build_update_entries()
1105 build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, in build_fast_tlb_refill_handler() argument
1112 const int scratch = 1; /* Our extra working register */ in build_fast_tlb_refill_handler()
1119 UASM_i_MFC0(p, tmp, C0_BADVADDR); in build_fast_tlb_refill_handler()
1121 if (pgd_reg != -1) in build_fast_tlb_refill_handler()
1122 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); in build_fast_tlb_refill_handler()
1124 UASM_i_MFC0(p, ptr, C0_CONTEXT); in build_fast_tlb_refill_handler()
1127 UASM_i_MTC0(p, scratch, c0_kscratch(), c0_scratch_reg); in build_fast_tlb_refill_handler()
1129 UASM_i_SW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1131 uasm_i_dsrl_safe(p, scratch, tmp, in build_fast_tlb_refill_handler()
1133 uasm_il_bnez(p, r, scratch, label_vmalloc); in build_fast_tlb_refill_handler()
1135 if (pgd_reg == -1) { in build_fast_tlb_refill_handler()
1136 vmalloc_branch_delay_filled = 1; in build_fast_tlb_refill_handler()
1138 uasm_i_dins(p, ptr, 0, 0, 23); in build_fast_tlb_refill_handler()
1141 if (pgd_reg != -1) in build_fast_tlb_refill_handler()
1142 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg); in build_fast_tlb_refill_handler()
1144 UASM_i_MFC0(p, ptr, C0_CONTEXT); in build_fast_tlb_refill_handler()
1146 UASM_i_MFC0(p, tmp, C0_BADVADDR); in build_fast_tlb_refill_handler()
1149 UASM_i_MTC0(p, scratch, c0_kscratch(), c0_scratch_reg); in build_fast_tlb_refill_handler()
1151 UASM_i_SW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1153 if (pgd_reg == -1) in build_fast_tlb_refill_handler()
1155 uasm_i_dins(p, ptr, 0, 0, 23); in build_fast_tlb_refill_handler()
1157 uasm_il_bltz(p, r, tmp, label_vmalloc); in build_fast_tlb_refill_handler()
1160 if (pgd_reg == -1) { in build_fast_tlb_refill_handler()
1161 vmalloc_branch_delay_filled = 1; in build_fast_tlb_refill_handler()
1162 /* 1 0 1 0 1 << 6 xkphys cached */ in build_fast_tlb_refill_handler()
1163 uasm_i_ori(p, ptr, ptr, 0x540); in build_fast_tlb_refill_handler()
1164 uasm_i_drotr(p, ptr, ptr, 11); in build_fast_tlb_refill_handler()
1175 uasm_i_dsrl_safe(p, scratch, tmp, PGDIR_SHIFT - 3); in build_fast_tlb_refill_handler()
1177 uasm_l_vmalloc_done(l, *p); in build_fast_tlb_refill_handler()
1187 uasm_i_dsrl_safe(p, scratch, tmp, PGDIR_SHIFT - 3); in build_fast_tlb_refill_handler()
1190 GET_CONTEXT(p, tmp); /* get context reg */ in build_fast_tlb_refill_handler()
1192 uasm_i_andi(p, scratch, scratch, (PTRS_PER_PGD - 1) << 3); in build_fast_tlb_refill_handler()
1195 UASM_i_LWX(p, LOC_PTEP, scratch, ptr); in build_fast_tlb_refill_handler()
1197 uasm_i_daddu(p, ptr, ptr, scratch); /* add in pgd offset */ in build_fast_tlb_refill_handler()
1198 uasm_i_ld(p, LOC_PTEP, 0, ptr); /* get pmd pointer */ in build_fast_tlb_refill_handler()
1203 uasm_i_dsrl_safe(p, scratch, tmp, PUD_SHIFT - 3); in build_fast_tlb_refill_handler()
1204 uasm_i_andi(p, scratch, scratch, (PTRS_PER_PUD - 1) << 3); in build_fast_tlb_refill_handler()
1207 UASM_i_LWX(p, ptr, scratch, ptr); in build_fast_tlb_refill_handler()
1209 uasm_i_daddu(p, ptr, ptr, scratch); /* add in pmd offset */ in build_fast_tlb_refill_handler()
1210 UASM_i_LW(p, ptr, 0, ptr); in build_fast_tlb_refill_handler()
1218 uasm_i_dsrl_safe(p, scratch, tmp, PMD_SHIFT - 3); in build_fast_tlb_refill_handler()
1219 uasm_i_andi(p, scratch, scratch, (PTRS_PER_PMD - 1) << 3); in build_fast_tlb_refill_handler()
1220 GET_CONTEXT(p, tmp); /* get context reg */ in build_fast_tlb_refill_handler()
1223 UASM_i_LWX(p, scratch, scratch, ptr); in build_fast_tlb_refill_handler()
1225 uasm_i_daddu(p, ptr, ptr, scratch); /* add in pmd offset */ in build_fast_tlb_refill_handler()
1226 UASM_i_LW(p, scratch, 0, ptr); in build_fast_tlb_refill_handler()
1230 build_adjust_context(p, tmp); in build_fast_tlb_refill_handler()
1233 uasm_il_bbit1(p, r, scratch, ilog2(_PAGE_HUGE), label_tlb_huge_update); in build_fast_tlb_refill_handler()
1240 uasm_i_nop(p); in build_fast_tlb_refill_handler()
1248 UASM_i_LWX(p, even, scratch, tmp); in build_fast_tlb_refill_handler()
1249 UASM_i_ADDIU(p, tmp, tmp, sizeof(pte_t)); in build_fast_tlb_refill_handler()
1250 UASM_i_LWX(p, odd, scratch, tmp); in build_fast_tlb_refill_handler()
1252 UASM_i_ADDU(p, ptr, scratch, tmp); /* add in offset */ in build_fast_tlb_refill_handler()
1255 UASM_i_LW(p, even, 0, ptr); /* get even pte */ in build_fast_tlb_refill_handler()
1256 UASM_i_LW(p, odd, sizeof(pte_t), ptr); /* get odd pte */ in build_fast_tlb_refill_handler()
1259 uasm_i_drotr(p, even, even, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1260 UASM_i_MTC0(p, even, C0_ENTRYLO0); /* load it */ in build_fast_tlb_refill_handler()
1261 uasm_i_drotr(p, odd, odd, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1263 uasm_i_dsrl_safe(p, even, even, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1264 UASM_i_MTC0(p, even, C0_ENTRYLO0); /* load it */ in build_fast_tlb_refill_handler()
1265 uasm_i_dsrl_safe(p, odd, odd, ilog2(_PAGE_GLOBAL)); in build_fast_tlb_refill_handler()
1267 UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */ in build_fast_tlb_refill_handler()
1270 uasm_i_ehb(p); in build_fast_tlb_refill_handler()
1271 UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg); in build_fast_tlb_refill_handler()
1272 build_tlb_write_entry(p, l, r, tlb_random); in build_fast_tlb_refill_handler()
1273 uasm_l_leave(l, *p); in build_fast_tlb_refill_handler()
1274 rv.restore_scratch = 1; in build_fast_tlb_refill_handler()
1276 build_tlb_write_entry(p, l, r, tlb_random); in build_fast_tlb_refill_handler()
1277 uasm_l_leave(l, *p); in build_fast_tlb_refill_handler()
1278 UASM_i_LW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1280 UASM_i_LW(p, scratch, scratchpad_offset(0), 0); in build_fast_tlb_refill_handler()
1281 build_tlb_write_entry(p, l, r, tlb_random); in build_fast_tlb_refill_handler()
1282 uasm_l_leave(l, *p); in build_fast_tlb_refill_handler()
1283 rv.restore_scratch = 1; in build_fast_tlb_refill_handler()
1286 uasm_i_eret(p); /* return from trap */ in build_fast_tlb_refill_handler()
1301 u32 *p = tlb_handler; in build_r4000_tlb_refill_handler() local
1315 htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1, in build_r4000_tlb_refill_handler()
1329 uasm_i_dmfc0(&p, K0, C0_BADVADDR); in build_r4000_tlb_refill_handler()
1330 uasm_i_dmfc0(&p, K1, C0_ENTRYHI); in build_r4000_tlb_refill_handler()
1331 uasm_i_xor(&p, K0, K0, K1); in build_r4000_tlb_refill_handler()
1332 uasm_i_dsrl_safe(&p, K1, K0, 62); in build_r4000_tlb_refill_handler()
1333 uasm_i_dsrl_safe(&p, K0, K0, 12 + 1); in build_r4000_tlb_refill_handler()
1334 uasm_i_dsll_safe(&p, K0, K0, 64 + 12 + 1 - segbits); in build_r4000_tlb_refill_handler()
1335 uasm_i_or(&p, K0, K0, K1); in build_r4000_tlb_refill_handler()
1336 uasm_il_bnez(&p, &r, K0, label_leave); in build_r4000_tlb_refill_handler()
1341 build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */ in build_r4000_tlb_refill_handler()
1343 build_get_pgde32(&p, K0, K1); /* get pgd in K1 */ in build_r4000_tlb_refill_handler()
1347 build_is_huge_pte(&p, &r, K0, K1, label_tlb_huge_update); in build_r4000_tlb_refill_handler()
1350 build_get_ptep(&p, K0, K1); in build_r4000_tlb_refill_handler()
1351 build_update_entries(&p, K0, K1); in build_r4000_tlb_refill_handler()
1352 build_tlb_write_entry(&p, &l, &r, tlb_random); in build_r4000_tlb_refill_handler()
1353 uasm_l_leave(&l, p); in build_r4000_tlb_refill_handler()
1354 uasm_i_eret(&p); /* return from trap */ in build_r4000_tlb_refill_handler()
1357 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_refill_handler()
1359 UASM_i_LW(&p, htlb_info.huge_pte, 0, K1); in build_r4000_tlb_refill_handler()
1360 build_huge_update_entries(&p, htlb_info.huge_pte, K1); in build_r4000_tlb_refill_handler()
1361 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, in build_r4000_tlb_refill_handler()
1366 build_get_pgd_vmalloc64(&p, &l, &r, K0, K1, vmalloc_mode); in build_r4000_tlb_refill_handler()
1381 if ((p - tlb_handler) > 64) in build_r4000_tlb_refill_handler()
1388 uasm_copy_handler(relocs, labels, tlb_handler, p, f); in build_r4000_tlb_refill_handler()
1389 final_len = p - tlb_handler; in build_r4000_tlb_refill_handler()
1392 if (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 1) in build_r4000_tlb_refill_handler()
1393 || (((p - tlb_handler) > (MIPS64_REFILL_INSNS * 2) - 3) in build_r4000_tlb_refill_handler()
1401 if ((p - tlb_handler) <= MIPS64_REFILL_INSNS) { in build_r4000_tlb_refill_handler()
1403 uasm_copy_handler(relocs, labels, tlb_handler, p, f); in build_r4000_tlb_refill_handler()
1404 final_len = p - tlb_handler; in build_r4000_tlb_refill_handler()
1424 split < p - MIPS64_REFILL_INSNS) in build_r4000_tlb_refill_handler()
1425 ov = 1; in build_r4000_tlb_refill_handler()
1440 if (uasm_insn_has_bdelay(relocs, split - 1)) in build_r4000_tlb_refill_handler()
1455 split, split + 1, f); in build_r4000_tlb_refill_handler()
1456 uasm_move_labels(labels, f, f + 1, -1); in build_r4000_tlb_refill_handler()
1463 uasm_copy_handler(relocs, labels, split, p, final_handler); in build_r4000_tlb_refill_handler()
1465 (p - split); in build_r4000_tlb_refill_handler()
1494 pgd_i = PGDIR_SHIFT; /* 1st level PGD */ in setup_pw()
1509 pwctl = 1 << 30; /* Set PWDirExt */ in setup_pw()
1513 write_c0_pwsize(1 << 30 | pgd_w << 24 | pmd_w << 12 | pt_w << 6 | pte_w); in setup_pw()
1516 write_c0_pwsize(1 << 30 | pgd_w << 24 | pt_w << 6 | pte_w); in setup_pw()
1520 pwctl |= (1 << 6 | psn); in setup_pw()
1524 kscratch_used_mask |= (1 << 7); /* KScratch6 is used for KPGD */ in setup_pw()
1529 u32 *p = tlb_handler; in build_loongson3_tlb_refill_handler() local
1538 uasm_i_dmfc0(&p, K0, C0_BADVADDR); in build_loongson3_tlb_refill_handler()
1539 uasm_i_dsrl_safe(&p, K1, K0, PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3); in build_loongson3_tlb_refill_handler()
1540 uasm_il_beqz(&p, &r, K1, label_vmalloc); in build_loongson3_tlb_refill_handler()
1541 uasm_i_nop(&p); in build_loongson3_tlb_refill_handler()
1543 uasm_il_bgez(&p, &r, K0, label_large_segbits_fault); in build_loongson3_tlb_refill_handler()
1544 uasm_i_nop(&p); in build_loongson3_tlb_refill_handler()
1545 uasm_l_vmalloc(&l, p); in build_loongson3_tlb_refill_handler()
1548 uasm_i_dmfc0(&p, K1, C0_PGD); in build_loongson3_tlb_refill_handler()
1550 uasm_i_lddir(&p, K0, K1, 3); /* global page dir */ in build_loongson3_tlb_refill_handler()
1552 uasm_i_lddir(&p, K1, K0, 1); /* middle page dir */ in build_loongson3_tlb_refill_handler()
1554 uasm_i_ldpte(&p, K1, 0); /* even */ in build_loongson3_tlb_refill_handler()
1555 uasm_i_ldpte(&p, K1, 1); /* odd */ in build_loongson3_tlb_refill_handler()
1556 uasm_i_tlbwr(&p); in build_loongson3_tlb_refill_handler()
1560 uasm_i_lui(&p, K0, PM_DEFAULT_MASK >> 16); in build_loongson3_tlb_refill_handler()
1561 uasm_i_ori(&p, K0, K0, PM_DEFAULT_MASK & 0xffff); in build_loongson3_tlb_refill_handler()
1562 uasm_i_mtc0(&p, K0, C0_PAGEMASK); in build_loongson3_tlb_refill_handler()
1564 uasm_i_ori(&p, K0, 0, PM_DEFAULT_MASK); in build_loongson3_tlb_refill_handler()
1565 uasm_i_mtc0(&p, K0, C0_PAGEMASK); in build_loongson3_tlb_refill_handler()
1567 uasm_i_mtc0(&p, 0, C0_PAGEMASK); in build_loongson3_tlb_refill_handler()
1570 uasm_i_eret(&p); in build_loongson3_tlb_refill_handler()
1573 uasm_l_large_segbits_fault(&l, p); in build_loongson3_tlb_refill_handler()
1574 UASM_i_LA(&p, K1, (unsigned long)tlb_do_page_fault_0); in build_loongson3_tlb_refill_handler()
1575 uasm_i_jr(&p, K1); in build_loongson3_tlb_refill_handler()
1576 uasm_i_nop(&p); in build_loongson3_tlb_refill_handler()
1591 u32 *p = (u32 *)msk_isa16_mode((ulong)tlbmiss_handler_setup_pgd); in build_setup_pgd() local
1596 memset(p, 0, tlbmiss_handler_setup_pgd_end - (char *)p); in build_setup_pgd()
1601 if (pgd_reg == -1) { in build_setup_pgd()
1612 UASM_i_SRA(&p, a1, a0, 29); in build_setup_pgd()
1613 UASM_i_ADDIU(&p, a1, a1, 4); in build_setup_pgd()
1614 uasm_il_bnez(&p, &r, a1, label_tlbl_goaround1); in build_setup_pgd()
1615 uasm_i_nop(&p); in build_setup_pgd()
1616 uasm_i_dinsm(&p, a0, 0, 29, 64 - 29); in build_setup_pgd()
1617 uasm_l_tlbl_goaround1(&l, p); in build_setup_pgd()
1618 UASM_i_SLL(&p, a0, a0, 11); in build_setup_pgd()
1619 UASM_i_MTC0(&p, a0, C0_CONTEXT); in build_setup_pgd()
1620 uasm_i_jr(&p, 31); in build_setup_pgd()
1621 uasm_i_ehb(&p); in build_setup_pgd()
1625 UASM_i_MTC0(&p, a0, C0_PWBASE); in build_setup_pgd()
1627 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); in build_setup_pgd()
1628 uasm_i_jr(&p, 31); in build_setup_pgd()
1629 uasm_i_ehb(&p); in build_setup_pgd()
1634 UASM_i_CPUID_MFC0(&p, a1, SMP_CPUID_REG); in build_setup_pgd()
1635 UASM_i_SRL_SAFE(&p, a1, a1, SMP_CPUID_PTRSHIFT); in build_setup_pgd()
1636 UASM_i_LA_mostly(&p, a2, pgdc); in build_setup_pgd()
1637 UASM_i_ADDU(&p, a2, a2, a1); in build_setup_pgd()
1638 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2); in build_setup_pgd()
1640 UASM_i_LA_mostly(&p, a2, pgdc); in build_setup_pgd()
1641 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2); in build_setup_pgd()
1645 if (pgd_reg != -1) { in build_setup_pgd()
1646 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); in build_setup_pgd()
1647 uasm_i_jr(&p, 31); in build_setup_pgd()
1648 uasm_i_ehb(&p); in build_setup_pgd()
1650 uasm_i_jr(&p, 31); in build_setup_pgd()
1651 uasm_i_nop(&p); in build_setup_pgd()
1654 if (p >= (u32 *)tlbmiss_handler_setup_pgd_end) in build_setup_pgd()
1659 (unsigned int)(p - (u32 *)tlbmiss_handler_setup_pgd)); in build_setup_pgd()
1666 iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) in iPTE_LW() argument
1671 uasm_i_lld(p, pte, 0, ptr); in iPTE_LW()
1674 UASM_i_LL(p, pte, 0, ptr); in iPTE_LW()
1678 uasm_i_ld(p, pte, 0, ptr); in iPTE_LW()
1681 UASM_i_LW(p, pte, 0, ptr); in iPTE_LW()
1686 iPTE_SW(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr, in iPTE_SW() argument
1693 uasm_i_lui(p, scratch, swmode >> 16); in iPTE_SW()
1694 uasm_i_or(p, pte, pte, scratch); in iPTE_SW()
1697 uasm_i_ori(p, pte, pte, mode); in iPTE_SW()
1703 uasm_i_scd(p, pte, 0, ptr); in iPTE_SW()
1706 UASM_i_SC(p, pte, 0, ptr); in iPTE_SW()
1709 uasm_il_beqzl(p, r, pte, label_smp_pgtable_change); in iPTE_SW()
1711 uasm_il_beqz(p, r, pte, label_smp_pgtable_change); in iPTE_SW()
1716 uasm_i_ll(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1717 uasm_i_ori(p, pte, pte, hwmode); in iPTE_SW()
1719 uasm_i_sc(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1720 uasm_il_beqz(p, r, pte, label_smp_pgtable_change); in iPTE_SW()
1722 uasm_i_lw(p, pte, 0, ptr); in iPTE_SW()
1724 uasm_i_nop(p); in iPTE_SW()
1726 uasm_i_nop(p); in iPTE_SW()
1731 uasm_i_sd(p, pte, 0, ptr); in iPTE_SW()
1734 UASM_i_SW(p, pte, 0, ptr); in iPTE_SW()
1738 uasm_i_lw(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1739 uasm_i_ori(p, pte, pte, hwmode); in iPTE_SW()
1741 uasm_i_sw(p, pte, sizeof(pte_t) / 2, ptr); in iPTE_SW()
1742 uasm_i_lw(p, pte, 0, ptr); in iPTE_SW()
1754 build_pte_present(u32 **p, struct uasm_reloc **r, in build_pte_present() argument
1762 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_PRESENT), lid); in build_pte_present()
1763 uasm_i_nop(p); in build_pte_present()
1766 uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); in build_pte_present()
1769 uasm_i_andi(p, t, cur, 1); in build_pte_present()
1770 uasm_il_beqz(p, r, t, lid); in build_pte_present()
1773 iPTE_LW(p, pte, ptr); in build_pte_present()
1777 uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); in build_pte_present()
1780 uasm_i_andi(p, t, cur, in build_pte_present()
1782 uasm_i_xori(p, t, t, _PAGE_PRESENT >> _PAGE_PRESENT_SHIFT); in build_pte_present()
1783 uasm_il_bnez(p, r, t, lid); in build_pte_present()
1786 iPTE_LW(p, pte, ptr); in build_pte_present()
1792 build_make_valid(u32 **p, struct uasm_reloc **r, unsigned int pte, in build_make_valid() argument
1797 iPTE_SW(p, r, pte, ptr, mode, scratch); in build_make_valid()
1805 build_pte_writable(u32 **p, struct uasm_reloc **r, in build_pte_writable() argument
1813 uasm_i_srl(p, t, cur, _PAGE_PRESENT_SHIFT); in build_pte_writable()
1816 uasm_i_andi(p, t, cur, in build_pte_writable()
1818 uasm_i_xori(p, t, t, in build_pte_writable()
1820 uasm_il_bnez(p, r, t, lid); in build_pte_writable()
1823 iPTE_LW(p, pte, ptr); in build_pte_writable()
1825 uasm_i_nop(p); in build_pte_writable()
1832 build_make_write(u32 **p, struct uasm_reloc **r, unsigned int pte, in build_make_write() argument
1838 iPTE_SW(p, r, pte, ptr, mode, scratch); in build_make_write()
1846 build_pte_modifiable(u32 **p, struct uasm_reloc **r, in build_pte_modifiable() argument
1851 uasm_il_bbit0(p, r, pte, ilog2(_PAGE_WRITE), lid); in build_pte_modifiable()
1852 uasm_i_nop(p); in build_pte_modifiable()
1855 uasm_i_srl(p, t, pte, _PAGE_WRITE_SHIFT); in build_pte_modifiable()
1856 uasm_i_andi(p, t, t, 1); in build_pte_modifiable()
1857 uasm_il_beqz(p, r, t, lid); in build_pte_modifiable()
1860 iPTE_LW(p, pte, ptr); in build_pte_modifiable()
1876 build_r3000_pte_reload_tlbwi(u32 **p, unsigned int pte, unsigned int tmp) in build_r3000_pte_reload_tlbwi() argument
1878 uasm_i_mtc0(p, pte, C0_ENTRYLO0); /* cp0 delay */ in build_r3000_pte_reload_tlbwi()
1879 uasm_i_mfc0(p, tmp, C0_EPC); /* cp0 delay */ in build_r3000_pte_reload_tlbwi()
1880 uasm_i_tlbwi(p); in build_r3000_pte_reload_tlbwi()
1881 uasm_i_jr(p, tmp); in build_r3000_pte_reload_tlbwi()
1882 uasm_i_rfe(p); /* branch delay */ in build_r3000_pte_reload_tlbwi()
1892 build_r3000_tlb_reload_write(u32 **p, struct uasm_label **l, in build_r3000_tlb_reload_write() argument
1896 uasm_i_mfc0(p, tmp, C0_INDEX); in build_r3000_tlb_reload_write()
1897 uasm_i_mtc0(p, pte, C0_ENTRYLO0); /* cp0 delay */ in build_r3000_tlb_reload_write()
1898 uasm_il_bltz(p, r, tmp, label_r3000_write_probe_fail); /* cp0 delay */ in build_r3000_tlb_reload_write()
1899 uasm_i_mfc0(p, tmp, C0_EPC); /* branch delay */ in build_r3000_tlb_reload_write()
1900 uasm_i_tlbwi(p); /* cp0 delay */ in build_r3000_tlb_reload_write()
1901 uasm_i_jr(p, tmp); in build_r3000_tlb_reload_write()
1902 uasm_i_rfe(p); /* branch delay */ in build_r3000_tlb_reload_write()
1903 uasm_l_r3000_write_probe_fail(l, *p); in build_r3000_tlb_reload_write()
1904 uasm_i_tlbwr(p); /* cp0 delay */ in build_r3000_tlb_reload_write()
1905 uasm_i_jr(p, tmp); in build_r3000_tlb_reload_write()
1906 uasm_i_rfe(p); /* branch delay */ in build_r3000_tlb_reload_write()
1910 build_r3000_tlbchange_handler_head(u32 **p, unsigned int pte, in build_r3000_tlbchange_handler_head() argument
1915 uasm_i_mfc0(p, pte, C0_BADVADDR); in build_r3000_tlbchange_handler_head()
1916 uasm_i_lui(p, ptr, uasm_rel_hi(pgdc)); /* cp0 delay */ in build_r3000_tlbchange_handler_head()
1917 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); in build_r3000_tlbchange_handler_head()
1918 uasm_i_srl(p, pte, pte, 22); /* load delay */ in build_r3000_tlbchange_handler_head()
1919 uasm_i_sll(p, pte, pte, 2); in build_r3000_tlbchange_handler_head()
1920 uasm_i_addu(p, ptr, ptr, pte); in build_r3000_tlbchange_handler_head()
1921 uasm_i_mfc0(p, pte, C0_CONTEXT); in build_r3000_tlbchange_handler_head()
1922 uasm_i_lw(p, ptr, 0, ptr); /* cp0 delay */ in build_r3000_tlbchange_handler_head()
1923 uasm_i_andi(p, pte, pte, 0xffc); /* load delay */ in build_r3000_tlbchange_handler_head()
1924 uasm_i_addu(p, ptr, ptr, pte); in build_r3000_tlbchange_handler_head()
1925 uasm_i_lw(p, pte, 0, ptr); in build_r3000_tlbchange_handler_head()
1926 uasm_i_tlbp(p); /* load delay */ in build_r3000_tlbchange_handler_head()
1931 u32 *p = (u32 *)handle_tlbl; in build_r3000_tlb_load_handler() local
1935 memset(p, 0, handle_tlbl_end - (char *)p); in build_r3000_tlb_load_handler()
1939 build_r3000_tlbchange_handler_head(&p, K0, K1); in build_r3000_tlb_load_handler()
1940 build_pte_present(&p, &r, K0, K1, -1, label_nopage_tlbl); in build_r3000_tlb_load_handler()
1941 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_load_handler()
1942 build_make_valid(&p, &r, K0, K1, -1); in build_r3000_tlb_load_handler()
1943 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1); in build_r3000_tlb_load_handler()
1945 uasm_l_nopage_tlbl(&l, p); in build_r3000_tlb_load_handler()
1946 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff); in build_r3000_tlb_load_handler()
1947 uasm_i_nop(&p); in build_r3000_tlb_load_handler()
1949 if (p >= (u32 *)handle_tlbl_end) in build_r3000_tlb_load_handler()
1954 (unsigned int)(p - (u32 *)handle_tlbl)); in build_r3000_tlb_load_handler()
1961 u32 *p = (u32 *)handle_tlbs; in build_r3000_tlb_store_handler() local
1965 memset(p, 0, handle_tlbs_end - (char *)p); in build_r3000_tlb_store_handler()
1969 build_r3000_tlbchange_handler_head(&p, K0, K1); in build_r3000_tlb_store_handler()
1970 build_pte_writable(&p, &r, K0, K1, -1, label_nopage_tlbs); in build_r3000_tlb_store_handler()
1971 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_store_handler()
1972 build_make_write(&p, &r, K0, K1, -1); in build_r3000_tlb_store_handler()
1973 build_r3000_tlb_reload_write(&p, &l, &r, K0, K1); in build_r3000_tlb_store_handler()
1975 uasm_l_nopage_tlbs(&l, p); in build_r3000_tlb_store_handler()
1976 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r3000_tlb_store_handler()
1977 uasm_i_nop(&p); in build_r3000_tlb_store_handler()
1979 if (p >= (u32 *)handle_tlbs_end) in build_r3000_tlb_store_handler()
1984 (unsigned int)(p - (u32 *)handle_tlbs)); in build_r3000_tlb_store_handler()
1991 u32 *p = (u32 *)handle_tlbm; in build_r3000_tlb_modify_handler() local
1995 memset(p, 0, handle_tlbm_end - (char *)p); in build_r3000_tlb_modify_handler()
1999 build_r3000_tlbchange_handler_head(&p, K0, K1); in build_r3000_tlb_modify_handler()
2000 build_pte_modifiable(&p, &r, K0, K1, -1, label_nopage_tlbm); in build_r3000_tlb_modify_handler()
2001 uasm_i_nop(&p); /* load delay */ in build_r3000_tlb_modify_handler()
2002 build_make_write(&p, &r, K0, K1, -1); in build_r3000_tlb_modify_handler()
2003 build_r3000_pte_reload_tlbwi(&p, K0, K1); in build_r3000_tlb_modify_handler()
2005 uasm_l_nopage_tlbm(&l, p); in build_r3000_tlb_modify_handler()
2006 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r3000_tlb_modify_handler()
2007 uasm_i_nop(&p); in build_r3000_tlb_modify_handler()
2009 if (p >= (u32 *)handle_tlbm_end) in build_r3000_tlb_modify_handler()
2014 (unsigned int)(p - (u32 *)handle_tlbm)); in build_r3000_tlb_modify_handler()
2044 build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l, in build_r4000_tlbchange_handler_head() argument
2047 struct work_registers wr = build_get_work_registers(p); in build_r4000_tlbchange_handler_head()
2050 build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */ in build_r4000_tlbchange_handler_head()
2052 build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */ in build_r4000_tlbchange_handler_head()
2061 build_is_huge_pte(p, r, wr.r1, wr.r2, label_tlb_huge_update); in build_r4000_tlbchange_handler_head()
2064 UASM_i_MFC0(p, wr.r1, C0_BADVADDR); in build_r4000_tlbchange_handler_head()
2065 UASM_i_LW(p, wr.r2, 0, wr.r2); in build_r4000_tlbchange_handler_head()
2066 UASM_i_SRL(p, wr.r1, wr.r1, PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2); in build_r4000_tlbchange_handler_head()
2067 uasm_i_andi(p, wr.r1, wr.r1, (PTRS_PER_PTE - 1) << PTE_T_LOG2); in build_r4000_tlbchange_handler_head()
2068 UASM_i_ADDU(p, wr.r2, wr.r2, wr.r1); in build_r4000_tlbchange_handler_head()
2071 uasm_l_smp_pgtable_change(l, *p); in build_r4000_tlbchange_handler_head()
2073 iPTE_LW(p, wr.r1, wr.r2); /* get even pte */ in build_r4000_tlbchange_handler_head()
2075 build_tlb_probe_entry(p); in build_r4000_tlbchange_handler_head()
2078 uasm_i_ehb(p); in build_r4000_tlbchange_handler_head()
2079 uasm_i_mfc0(p, wr.r3, C0_INDEX); in build_r4000_tlbchange_handler_head()
2080 uasm_il_bltz(p, r, wr.r3, label_leave); in build_r4000_tlbchange_handler_head()
2081 uasm_i_nop(p); in build_r4000_tlbchange_handler_head()
2088 build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l, in build_r4000_tlbchange_handler_tail() argument
2092 uasm_i_ori(p, ptr, ptr, sizeof(pte_t)); in build_r4000_tlbchange_handler_tail()
2093 uasm_i_xori(p, ptr, ptr, sizeof(pte_t)); in build_r4000_tlbchange_handler_tail()
2094 build_update_entries(p, tmp, ptr); in build_r4000_tlbchange_handler_tail()
2095 build_tlb_write_entry(p, l, r, tlb_indexed); in build_r4000_tlbchange_handler_tail()
2096 uasm_l_leave(l, *p); in build_r4000_tlbchange_handler_tail()
2097 build_restore_work_registers(p); in build_r4000_tlbchange_handler_tail()
2098 uasm_i_eret(p); /* return from trap */ in build_r4000_tlbchange_handler_tail()
2101 build_get_pgd_vmalloc64(p, l, r, tmp, ptr, not_refill); in build_r4000_tlbchange_handler_tail()
2107 u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbl); in build_r4000_tlb_load_handler() local
2112 memset(p, 0, handle_tlbl_end - (char *)p); in build_r4000_tlb_load_handler()
2119 uasm_i_dmfc0(&p, K0, C0_BADVADDR); in build_r4000_tlb_load_handler()
2120 uasm_i_dmfc0(&p, K1, C0_ENTRYHI); in build_r4000_tlb_load_handler()
2121 uasm_i_xor(&p, K0, K0, K1); in build_r4000_tlb_load_handler()
2122 uasm_i_dsrl_safe(&p, K1, K0, 62); in build_r4000_tlb_load_handler()
2123 uasm_i_dsrl_safe(&p, K0, K0, 12 + 1); in build_r4000_tlb_load_handler()
2124 uasm_i_dsll_safe(&p, K0, K0, 64 + 12 + 1 - segbits); in build_r4000_tlb_load_handler()
2125 uasm_i_or(&p, K0, K0, K1); in build_r4000_tlb_load_handler()
2126 uasm_il_bnez(&p, &r, K0, label_leave); in build_r4000_tlb_load_handler()
2130 wr = build_r4000_tlbchange_handler_head(&p, &l, &r); in build_r4000_tlb_load_handler()
2131 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2133 build_tlb_probe_entry(&p); in build_r4000_tlb_load_handler()
2141 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID), in build_r4000_tlb_load_handler()
2144 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID); in build_r4000_tlb_load_handler()
2145 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround1); in build_r4000_tlb_load_handler()
2147 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2157 uasm_i_tlbr(&p); in build_r4000_tlb_load_handler()
2162 uasm_i_ehb(&p); in build_r4000_tlb_load_handler()
2171 /* Examine entrylo 0 or 1 based on ptr. */ in build_r4000_tlb_load_handler()
2173 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); in build_r4000_tlb_load_handler()
2175 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t)); in build_r4000_tlb_load_handler()
2176 uasm_i_beqz(&p, wr.r3, 8); in build_r4000_tlb_load_handler()
2179 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0); in build_r4000_tlb_load_handler()
2181 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1); in build_r4000_tlb_load_handler()
2183 * If the entryLo (now in wr.r3) is valid (bit 1), RI or in build_r4000_tlb_load_handler()
2187 uasm_il_bbit1(&p, &r, wr.r3, 1, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2188 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2189 uasm_l_tlbl_goaround1(&l, p); in build_r4000_tlb_load_handler()
2191 uasm_i_andi(&p, wr.r3, wr.r3, 2); in build_r4000_tlb_load_handler()
2192 uasm_il_bnez(&p, &r, wr.r3, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2193 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2195 uasm_l_tlbl_goaround1(&l, p); in build_r4000_tlb_load_handler()
2197 build_make_valid(&p, &r, wr.r1, wr.r2, wr.r3); in build_r4000_tlb_load_handler()
2198 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); in build_r4000_tlb_load_handler()
2205 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_load_handler()
2206 iPTE_LW(&p, wr.r1, wr.r2); in build_r4000_tlb_load_handler()
2207 build_pte_present(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbl); in build_r4000_tlb_load_handler()
2208 build_tlb_probe_entry(&p); in build_r4000_tlb_load_handler()
2216 uasm_il_bbit0(&p, &r, wr.r1, ilog2(_PAGE_VALID), in build_r4000_tlb_load_handler()
2219 uasm_i_andi(&p, wr.r3, wr.r1, _PAGE_VALID); in build_r4000_tlb_load_handler()
2220 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2); in build_r4000_tlb_load_handler()
2222 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2232 uasm_i_tlbr(&p); in build_r4000_tlb_load_handler()
2237 uasm_i_ehb(&p); in build_r4000_tlb_load_handler()
2246 /* Examine entrylo 0 or 1 based on ptr. */ in build_r4000_tlb_load_handler()
2248 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); in build_r4000_tlb_load_handler()
2250 uasm_i_andi(&p, wr.r3, wr.r2, sizeof(pte_t)); in build_r4000_tlb_load_handler()
2251 uasm_i_beqz(&p, wr.r3, 8); in build_r4000_tlb_load_handler()
2254 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO0); in build_r4000_tlb_load_handler()
2256 UASM_i_MFC0(&p, wr.r3, C0_ENTRYLO1); in build_r4000_tlb_load_handler()
2258 * If the entryLo (now in wr.r3) is valid (bit 1), RI or in build_r4000_tlb_load_handler()
2262 uasm_il_bbit0(&p, &r, wr.r3, 1, label_tlbl_goaround2); in build_r4000_tlb_load_handler()
2264 uasm_i_andi(&p, wr.r3, wr.r3, 2); in build_r4000_tlb_load_handler()
2265 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2); in build_r4000_tlb_load_handler()
2268 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2273 build_restore_pagemask(&p, &r, wr.r3, label_nopage_tlbl, 0); in build_r4000_tlb_load_handler()
2275 uasm_l_tlbl_goaround2(&l, p); in build_r4000_tlb_load_handler()
2277 uasm_i_ori(&p, wr.r1, wr.r1, (_PAGE_ACCESSED | _PAGE_VALID)); in build_r4000_tlb_load_handler()
2278 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2, 1); in build_r4000_tlb_load_handler()
2281 uasm_l_nopage_tlbl(&l, p); in build_r4000_tlb_load_handler()
2282 build_restore_work_registers(&p); in build_r4000_tlb_load_handler()
2284 if ((unsigned long)tlb_do_page_fault_0 & 1) { in build_r4000_tlb_load_handler()
2285 uasm_i_lui(&p, K0, uasm_rel_hi((long)tlb_do_page_fault_0)); in build_r4000_tlb_load_handler()
2286 uasm_i_addiu(&p, K0, K0, uasm_rel_lo((long)tlb_do_page_fault_0)); in build_r4000_tlb_load_handler()
2287 uasm_i_jr(&p, K0); in build_r4000_tlb_load_handler()
2290 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff); in build_r4000_tlb_load_handler()
2291 uasm_i_nop(&p); in build_r4000_tlb_load_handler()
2293 if (p >= (u32 *)handle_tlbl_end) in build_r4000_tlb_load_handler()
2298 (unsigned int)(p - (u32 *)handle_tlbl)); in build_r4000_tlb_load_handler()
2305 u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbs); in build_r4000_tlb_store_handler() local
2310 memset(p, 0, handle_tlbs_end - (char *)p); in build_r4000_tlb_store_handler()
2314 wr = build_r4000_tlbchange_handler_head(&p, &l, &r); in build_r4000_tlb_store_handler()
2315 build_pte_writable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbs); in build_r4000_tlb_store_handler()
2317 build_tlb_probe_entry(&p); in build_r4000_tlb_store_handler()
2318 build_make_write(&p, &r, wr.r1, wr.r2, wr.r3); in build_r4000_tlb_store_handler()
2319 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); in build_r4000_tlb_store_handler()
2326 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_store_handler()
2327 iPTE_LW(&p, wr.r1, wr.r2); in build_r4000_tlb_store_handler()
2328 build_pte_writable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbs); in build_r4000_tlb_store_handler()
2329 build_tlb_probe_entry(&p); in build_r4000_tlb_store_handler()
2330 uasm_i_ori(&p, wr.r1, wr.r1, in build_r4000_tlb_store_handler()
2332 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2, 1); in build_r4000_tlb_store_handler()
2335 uasm_l_nopage_tlbs(&l, p); in build_r4000_tlb_store_handler()
2336 build_restore_work_registers(&p); in build_r4000_tlb_store_handler()
2338 if ((unsigned long)tlb_do_page_fault_1 & 1) { in build_r4000_tlb_store_handler()
2339 uasm_i_lui(&p, K0, uasm_rel_hi((long)tlb_do_page_fault_1)); in build_r4000_tlb_store_handler()
2340 uasm_i_addiu(&p, K0, K0, uasm_rel_lo((long)tlb_do_page_fault_1)); in build_r4000_tlb_store_handler()
2341 uasm_i_jr(&p, K0); in build_r4000_tlb_store_handler()
2344 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r4000_tlb_store_handler()
2345 uasm_i_nop(&p); in build_r4000_tlb_store_handler()
2347 if (p >= (u32 *)handle_tlbs_end) in build_r4000_tlb_store_handler()
2352 (unsigned int)(p - (u32 *)handle_tlbs)); in build_r4000_tlb_store_handler()
2359 u32 *p = (u32 *)msk_isa16_mode((ulong)handle_tlbm); in build_r4000_tlb_modify_handler() local
2364 memset(p, 0, handle_tlbm_end - (char *)p); in build_r4000_tlb_modify_handler()
2368 wr = build_r4000_tlbchange_handler_head(&p, &l, &r); in build_r4000_tlb_modify_handler()
2369 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm); in build_r4000_tlb_modify_handler()
2371 build_tlb_probe_entry(&p); in build_r4000_tlb_modify_handler()
2373 build_make_write(&p, &r, wr.r1, wr.r2, wr.r3); in build_r4000_tlb_modify_handler()
2374 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); in build_r4000_tlb_modify_handler()
2381 uasm_l_tlb_huge_update(&l, p); in build_r4000_tlb_modify_handler()
2382 iPTE_LW(&p, wr.r1, wr.r2); in build_r4000_tlb_modify_handler()
2383 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm); in build_r4000_tlb_modify_handler()
2384 build_tlb_probe_entry(&p); in build_r4000_tlb_modify_handler()
2385 uasm_i_ori(&p, wr.r1, wr.r1, in build_r4000_tlb_modify_handler()
2387 build_huge_handler_tail(&p, &r, &l, wr.r1, wr.r2, 0); in build_r4000_tlb_modify_handler()
2390 uasm_l_nopage_tlbm(&l, p); in build_r4000_tlb_modify_handler()
2391 build_restore_work_registers(&p); in build_r4000_tlb_modify_handler()
2393 if ((unsigned long)tlb_do_page_fault_1 & 1) { in build_r4000_tlb_modify_handler()
2394 uasm_i_lui(&p, K0, uasm_rel_hi((long)tlb_do_page_fault_1)); in build_r4000_tlb_modify_handler()
2395 uasm_i_addiu(&p, K0, K0, uasm_rel_lo((long)tlb_do_page_fault_1)); in build_r4000_tlb_modify_handler()
2396 uasm_i_jr(&p, K0); in build_r4000_tlb_modify_handler()
2399 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); in build_r4000_tlb_modify_handler()
2400 uasm_i_nop(&p); in build_r4000_tlb_modify_handler()
2402 if (p >= (u32 *)handle_tlbm_end) in build_r4000_tlb_modify_handler()
2407 (unsigned int)(p - (u32 *)handle_tlbm)); in build_r4000_tlb_modify_handler()
2526 config = 1 << MIPS_PWCTL_PWEN_SHIFT; in config_htw_params()
2576 entry &= ~((1 << MIPS_ENTRYLO_PFN_SHIFT) - 1); in check_pabits()