Skip to content

Commit c64c782

Browse files
danglin44hdeller
authored andcommitted
parisc: Don't hardcode assembler bit definitions in tmpalias code
Remove the hardcoded bit definitions in the tmpalias assembly code. This makes it easy to change the size of the tmpalias region. The alignment of the tmpalias region is reduced from 16 MB to 8 MB. Signed-off-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 1fc7db2 commit c64c782

3 files changed

Lines changed: 40 additions & 22 deletions

File tree

arch/parisc/include/asm/fixmap.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,27 @@
99
*
1010
* All of the values in this file must be <4GB (because of assembly
1111
* loading restrictions). If you place this region anywhere above
12-
* __PAGE_OFFSET, you must adjust the memory map accordingly */
12+
* __PAGE_OFFSET, you must adjust the memory map accordingly
13+
*/
1314

14-
/* The alias region is used in kernel space to do copy/clear to or
15-
* from areas congruently mapped with user space. It is 8MB large
16-
* and must be 16MB aligned */
17-
#define TMPALIAS_MAP_START ((__PAGE_OFFSET) - 16*1024*1024)
15+
/*
16+
* The tmpalias region is used in kernel space to copy/clear/flush data
17+
* from pages congruently mapped with user space. It is comprised of
18+
* a pair regions. The size of these regions is determined by the largest
19+
* cache aliasing boundary for machines that support equivalent aliasing.
20+
*
21+
* The c3750 with PA8700 processor returns an alias value of 11. This
22+
* indicates that it has an alias boundary of 4 MB. It also supports
23+
* non-equivalent aliasing without a performance penalty.
24+
*
25+
* Machines with PA8800/PA8900 processors return an alias value of 0.
26+
* This indicates the alias boundary is unknown and may be larger than
27+
* 16 MB. Non-equivalent aliasing is not supported.
28+
*
29+
* Here we assume the maximum alias boundary is 4 MB.
30+
*/
31+
#define TMPALIAS_SIZE_BITS 22 /* 4 MB */
32+
#define TMPALIAS_MAP_START ((__PAGE_OFFSET) - (2 << TMPALIAS_SIZE_BITS))
1833

1934
#define FIXMAP_SIZE (FIX_BITMAP_COUNT << PAGE_SHIFT)
2035
#define FIXMAP_START (TMPALIAS_MAP_START - FIXMAP_SIZE)

arch/parisc/kernel/entry.S

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,9 @@
554554
extrd,s \pte,63,25,\pte
555555
.endm
556556

557-
/* The alias region is an 8MB aligned 16MB to do clear and
558-
* copy user pages at addresses congruent with the user
557+
/* The alias region is comprised of a pair of 4 MB regions
558+
* aligned to 8 MB. It is used to clear/copy/flush user pages
559+
* using kernel virtual addresses congruent with the user
559560
* virtual address.
560561
*
561562
* To use the alias page, you set %r26 up with the to TLB
@@ -571,7 +572,7 @@
571572
depdi 0,31,32,\tmp
572573
#endif
573574
copy \va,\tmp1
574-
depi 0,31,23,\tmp1
575+
depi_safe 0,31,TMPALIAS_SIZE_BITS+1,\tmp1
575576
cmpb,COND(<>),n \tmp,\tmp1,\fault
576577
mfctl %cr19,\tmp /* iir */
577578
/* get the opcode (first six bits) into \tmp */
@@ -605,9 +606,9 @@
605606
* Check "subtle" note in pacache.S re: r23/r26.
606607
*/
607608
#ifdef CONFIG_64BIT
608-
extrd,u,*= \va,41,1,%r0
609+
extrd,u,*= \va,63-TMPALIAS_SIZE_BITS,1,%r0
609610
#else
610-
extrw,u,= \va,9,1,%r0
611+
extrw,u,= \va,31-TMPALIAS_SIZE_BITS,1,%r0
611612
#endif
612613
or,COND(tr) %r23,%r0,\pte
613614
or %r26,%r0,\pte

arch/parisc/kernel/pacache.S

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ ENDPROC_CFI(copy_page_asm)
487487
* parisc chip designers that there will not ever be a parisc
488488
* chip with a larger alias boundary (Never say never :-) ).
489489
*
490+
* Yah, what about the PA8800 and PA8900 processors?
491+
*
490492
* Subtle: the dtlb miss handlers support the temp alias region by
491493
* "knowing" that if a dtlb miss happens within the temp alias
492494
* region it must have occurred while in clear_user_page. Since
@@ -545,17 +547,17 @@ ENTRY_CFI(copy_user_page_asm)
545547
#endif
546548
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
547549
convert_phys_for_tlb_insert20 %r23 /* convert phys addr to tlb insert format */
548-
depd %r24,63,22, %r28 /* Form aliased virtual address 'to' */
550+
depd %r24,63,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
549551
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
550552
copy %r28, %r29
551-
depdi 1, 41,1, %r29 /* Form aliased virtual address 'from' */
553+
depdi 1, 63-TMPALIAS_SIZE_BITS,1, %r29 /* Form aliased virtual address 'from' */
552554
#else
553555
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
554556
extrw,u %r23, 24,25, %r23 /* convert phys addr to tlb insert format */
555-
depw %r24, 31,22, %r28 /* Form aliased virtual address 'to' */
557+
depw %r24, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
556558
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
557559
copy %r28, %r29
558-
depwi 1, 9,1, %r29 /* Form aliased virtual address 'from' */
560+
depwi 1, 31-TMPALIAS_SIZE_BITS,1, %r29 /* Form aliased virtual address 'from' */
559561
#endif
560562

561563
/* Purge any old translations */
@@ -691,11 +693,11 @@ ENTRY_CFI(clear_user_page_asm)
691693
depdi 0, 31,32, %r28 /* clear any sign extension */
692694
#endif
693695
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
694-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
696+
depd %r25, 63,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
695697
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
696698
#else
697699
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
698-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
700+
depw %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
699701
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
700702
#endif
701703

@@ -767,11 +769,11 @@ ENTRY_CFI(flush_dcache_page_asm)
767769
depdi 0, 31,32, %r28 /* clear any sign extension */
768770
#endif
769771
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
770-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
772+
depd %r25, 63,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
771773
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
772774
#else
773775
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
774-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
776+
depw %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
775777
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
776778
#endif
777779

@@ -826,11 +828,11 @@ ENTRY_CFI(purge_dcache_page_asm)
826828
depdi 0, 31,32, %r28 /* clear any sign extension */
827829
#endif
828830
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
829-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
831+
depd %r25, 63,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
830832
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
831833
#else
832834
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
833-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
835+
depw %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
834836
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
835837
#endif
836838

@@ -885,11 +887,11 @@ ENTRY_CFI(flush_icache_page_asm)
885887
depdi 0, 31,32, %r28 /* clear any sign extension */
886888
#endif
887889
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
888-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
890+
depd %r25, 63,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
889891
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
890892
#else
891893
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
892-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
894+
depw %r25, 31,TMPALIAS_SIZE_BITS, %r28 /* Form aliased virtual address 'to' */
893895
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
894896
#endif
895897

0 commit comments

Comments
 (0)