Skip to content

Commit 5035b23

Browse files
danglin44hdeller
authored andcommitted
parisc: Also flush data TLB in flush_icache_page_asm
This is the second issue I noticed in reviewing the parisc TLB code. The fic instruction may use either the instruction or data TLB in flushing the instruction cache. Thus, on machines with a split TLB, we should also flush the data TLB after setting up the temporary alias registers. Although this has no functional impact, I changed the pdtlb and pitlb instructions to consistently use the index register %r0. These instructions do not support integer displacements. Tested on rp3440 and c8000. Signed-off-by: John David Anglin <[email protected]> Cc: <[email protected]> # v3.16+ Signed-off-by: Helge Deller <[email protected]>
1 parent c0452fb commit 5035b23

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

arch/parisc/kernel/pacache.S

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fitmanyloop: /* Loop if LOOP >= 2 */
9696

9797
fitmanymiddle: /* Loop if LOOP >= 2 */
9898
addib,COND(>) -1, %r31, fitmanymiddle /* Adjusted inner loop decr */
99-
pitlbe 0(%sr1, %r28)
99+
pitlbe %r0(%sr1, %r28)
100100
pitlbe,m %arg1(%sr1, %r28) /* Last pitlbe and addr adjust */
101101
addib,COND(>) -1, %r29, fitmanymiddle /* Middle loop decr */
102102
copy %arg3, %r31 /* Re-init inner loop count */
@@ -139,7 +139,7 @@ fdtmanyloop: /* Loop if LOOP >= 2 */
139139

140140
fdtmanymiddle: /* Loop if LOOP >= 2 */
141141
addib,COND(>) -1, %r31, fdtmanymiddle /* Adjusted inner loop decr */
142-
pdtlbe 0(%sr1, %r28)
142+
pdtlbe %r0(%sr1, %r28)
143143
pdtlbe,m %arg1(%sr1, %r28) /* Last pdtlbe and addr adjust */
144144
addib,COND(>) -1, %r29, fdtmanymiddle /* Middle loop decr */
145145
copy %arg3, %r31 /* Re-init inner loop count */
@@ -626,12 +626,12 @@ ENTRY_CFI(copy_user_page_asm)
626626
/* Purge any old translations */
627627

628628
#ifdef CONFIG_PA20
629-
pdtlb,l 0(%r28)
630-
pdtlb,l 0(%r29)
629+
pdtlb,l %r0(%r28)
630+
pdtlb,l %r0(%r29)
631631
#else
632632
tlb_lock %r20,%r21,%r22
633-
pdtlb 0(%r28)
634-
pdtlb 0(%r29)
633+
pdtlb %r0(%r28)
634+
pdtlb %r0(%r29)
635635
tlb_unlock %r20,%r21,%r22
636636
#endif
637637

@@ -774,10 +774,10 @@ ENTRY_CFI(clear_user_page_asm)
774774
/* Purge any old translation */
775775

776776
#ifdef CONFIG_PA20
777-
pdtlb,l 0(%r28)
777+
pdtlb,l %r0(%r28)
778778
#else
779779
tlb_lock %r20,%r21,%r22
780-
pdtlb 0(%r28)
780+
pdtlb %r0(%r28)
781781
tlb_unlock %r20,%r21,%r22
782782
#endif
783783

@@ -858,10 +858,10 @@ ENTRY_CFI(flush_dcache_page_asm)
858858
/* Purge any old translation */
859859

860860
#ifdef CONFIG_PA20
861-
pdtlb,l 0(%r28)
861+
pdtlb,l %r0(%r28)
862862
#else
863863
tlb_lock %r20,%r21,%r22
864-
pdtlb 0(%r28)
864+
pdtlb %r0(%r28)
865865
tlb_unlock %r20,%r21,%r22
866866
#endif
867867

@@ -898,10 +898,10 @@ ENTRY_CFI(flush_dcache_page_asm)
898898
sync
899899

900900
#ifdef CONFIG_PA20
901-
pdtlb,l 0(%r25)
901+
pdtlb,l %r0(%r25)
902902
#else
903903
tlb_lock %r20,%r21,%r22
904-
pdtlb 0(%r25)
904+
pdtlb %r0(%r25)
905905
tlb_unlock %r20,%r21,%r22
906906
#endif
907907

@@ -931,13 +931,18 @@ ENTRY_CFI(flush_icache_page_asm)
931931
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
932932
#endif
933933

934-
/* Purge any old translation */
934+
/* Purge any old translation. Note that the FIC instruction
935+
* may use either the instruction or data TLB. Given that we
936+
* have a flat address space, it's not clear which TLB will be
937+
* used. So, we purge both entries. */
935938

936939
#ifdef CONFIG_PA20
940+
pdtlb,l %r0(%r28)
937941
pitlb,l %r0(%sr4,%r28)
938942
#else
939943
tlb_lock %r20,%r21,%r22
940-
pitlb (%sr4,%r28)
944+
pdtlb %r0(%r28)
945+
pitlb %r0(%sr4,%r28)
941946
tlb_unlock %r20,%r21,%r22
942947
#endif
943948

@@ -976,10 +981,12 @@ ENTRY_CFI(flush_icache_page_asm)
976981
sync
977982

978983
#ifdef CONFIG_PA20
984+
pdtlb,l %r0(%r28)
979985
pitlb,l %r0(%sr4,%r25)
980986
#else
981987
tlb_lock %r20,%r21,%r22
982-
pitlb (%sr4,%r25)
988+
pdtlb %r0(%r28)
989+
pitlb %r0(%sr4,%r25)
983990
tlb_unlock %r20,%r21,%r22
984991
#endif
985992

0 commit comments

Comments
 (0)