@@ -500,19 +500,10 @@ ENDPROC_CFI(copy_page_asm)
500500 * miss on the translation, the dtlb miss handler inserts the
501501 * translation into the tlb using these values:
502502 *
503- * %r26 physical page (shifted for tlb insert) of "to" translation
504- * %r23 physical page (shifted for tlb insert) of "from" translation
503+ * %r26 physical address of "to" translation
504+ * %r23 physical address of "from" translation
505505 */
506506
507- /* Drop prot bits and convert to page addr for iitlbt and idtlbt */
508- #define PAGE_ADD_SHIFT (PAGE_SHIFT-12 )
509- .macro convert_phys_for_tlb_insert20 phys
510- extrd,u \phys, 56 -PAGE_ADD_SHIFT, 32 -PAGE_ADD_SHIFT, \phys
511- #if _PAGE_SIZE_ENCODING_DEFAULT
512- depdi _PAGE_SIZE_ENCODING_DEFAULT, 63 , (63 -58 ), \phys
513- #endif
514- .endm
515-
516507 /*
517508 * copy_user_page_asm() performs a page copy using mappings
518509 * equivalent to the user page mappings. It can be used to
@@ -541,24 +532,10 @@ ENTRY_CFI(copy_user_page_asm)
541532 sub %r25, %r1, %r23
542533
543534 ldil L%(TMPALIAS_MAP_START), %r28
544- #ifdef CONFIG_64BIT
545- #if (TMPALIAS_MAP_START >= 0x80000000 )
546- depdi 0 , 31 ,32 , %r28 /* clear any sign extension */
547- #endif
548- convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
549- convert_phys_for_tlb_insert20 %r23 /* convert phys addr to tlb insert format */
550- depd %r24,63 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
551- depdi 0 , 63 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
552- copy %r28, %r29
553- depdi 1 , 63 -TMPALIAS_SIZE_BITS,1 , %r29 /* Form aliased virtual address 'from' */
554- #else
555- extrw,u %r26, 24 ,25 , %r26 /* convert phys addr to tlb insert format */
556- extrw,u %r23, 24 ,25 , %r23 /* convert phys addr to tlb insert format */
557- depw %r24, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
558- depwi 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
535+ dep_safe %r24, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
536+ depi_safe 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
559537 copy %r28, %r29
560- depwi 1 , 31 -TMPALIAS_SIZE_BITS,1 , %r29 /* Form aliased virtual address 'from' */
561- #endif
538+ depi_safe 1 , 31 -TMPALIAS_SIZE_BITS,1 , %r29 /* Form aliased virtual address 'from' */
562539
563540 /* Purge any old translations */
564541
@@ -688,18 +665,8 @@ ENTRY_CFI(clear_user_page_asm)
688665 tophys_r1 %r26
689666
690667 ldil L%(TMPALIAS_MAP_START), %r28
691- #ifdef CONFIG_64BIT
692- #if (TMPALIAS_MAP_START >= 0x80000000 )
693- depdi 0 , 31 ,32 , %r28 /* clear any sign extension */
694- #endif
695- convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
696- depd %r25, 63 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
697- depdi 0 , 63 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
698- #else
699- extrw,u %r26, 24 ,25 , %r26 /* convert phys addr to tlb insert format */
700- depw %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
701- depwi 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
702- #endif
668+ dep_safe %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
669+ depi_safe 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
703670
704671 /* Purge any old translation */
705672
@@ -764,18 +731,8 @@ ENDPROC_CFI(clear_user_page_asm)
764731
765732ENTRY_CFI(flush_dcache_page_asm)
766733 ldil L%(TMPALIAS_MAP_START), %r28
767- #ifdef CONFIG_64BIT
768- #if (TMPALIAS_MAP_START >= 0x80000000 )
769- depdi 0 , 31 ,32 , %r28 /* clear any sign extension */
770- #endif
771- convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
772- depd %r25, 63 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
773- depdi 0 , 63 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
774- #else
775- extrw,u %r26, 24 ,25 , %r26 /* convert phys addr to tlb insert format */
776- depw %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
777- depwi 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
778- #endif
734+ dep_safe %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
735+ depi_safe 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
779736
780737 /* Purge any old translation */
781738
@@ -823,18 +780,8 @@ ENDPROC_CFI(flush_dcache_page_asm)
823780
824781ENTRY_CFI(purge_dcache_page_asm)
825782 ldil L%(TMPALIAS_MAP_START), %r28
826- #ifdef CONFIG_64BIT
827- #if (TMPALIAS_MAP_START >= 0x80000000 )
828- depdi 0 , 31 ,32 , %r28 /* clear any sign extension */
829- #endif
830- convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
831- depd %r25, 63 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
832- depdi 0 , 63 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
833- #else
834- extrw,u %r26, 24 ,25 , %r26 /* convert phys addr to tlb insert format */
835- depw %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
836- depwi 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
837- #endif
783+ dep_safe %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
784+ depi_safe 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
838785
839786 /* Purge any old translation */
840787
@@ -882,18 +829,8 @@ ENDPROC_CFI(purge_dcache_page_asm)
882829
883830ENTRY_CFI(flush_icache_page_asm)
884831 ldil L%(TMPALIAS_MAP_START), %r28
885- #ifdef CONFIG_64BIT
886- #if (TMPALIAS_MAP_START >= 0x80000000 )
887- depdi 0 , 31 ,32 , %r28 /* clear any sign extension */
888- #endif
889- convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
890- depd %r25, 63 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
891- depdi 0 , 63 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
892- #else
893- extrw,u %r26, 24 ,25 , %r26 /* convert phys addr to tlb insert format */
894- depw %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
895- depwi 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
896- #endif
832+ dep_safe %r25, 31 ,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
833+ depi_safe 0 , 31 ,PAGE_SHIFT, %r28 /* Clear any offset bits */
897834
898835 /* Purge any old translation. Note that the FIC instruction
899836 * may use either the instruction or data TLB. Given that we
0 commit comments