Skip to content

Commit e11a935

Browse files
committed
Merge tag 'for-5.19/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc architecture updates from Helge Deller: "Minor cleanups and code optimizations, e.g.: - improvements in assembly statements in the tmpalias code path - added some additionals compile time checks - drop some unneccesary assembler DMA syncs" * tag 'for-5.19/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Drop __ARCH_WANT_OLD_READDIR and __ARCH_WANT_SYS_OLDUMOUNT parisc: Optimize tmpalias function calls parisc: Add dep_safe() macro to deposit a register in 32- and 64-kernels parisc: Fix wrong comment for shr macro parisc: Prevent ldil() to sign-extend into upper 32 bits parisc: Don't hardcode assembler bit definitions in tmpalias code parisc: Don't enforce DMA completion order in cache flushes parisc: video: fbdev: stifb: Add sti_dump_font() to dump STI font
2 parents 1ff7bc3 + 72acadf commit e11a935

File tree

9 files changed

+86
-100
lines changed

9 files changed

+86
-100
lines changed

arch/parisc/include/asm/assembly.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
depd,z \r, 63-(\sa), 64-(\sa), \t
144144
.endm
145145

146-
/* Shift Right - note the r and t can NOT be the same! */
146+
/* Shift Right for 32-bit. Clobbers upper 32-bit on PA2.0. */
147147
.macro shr r, sa, t
148148
extru \r, 31-(\sa), 32-(\sa), \t
149149
.endm
@@ -174,6 +174,16 @@
174174
#endif
175175
.endm
176176

177+
/* The depw instruction leaves the most significant 32 bits of the
178+
* target register in an undefined state on PA 2.0 systems. */
179+
.macro dep_safe i, p, len, t
180+
#ifdef CONFIG_64BIT
181+
depd \i, 32+(\p), \len, \t
182+
#else
183+
depw \i, \p, \len, \t
184+
#endif
185+
.endm
186+
177187
/* load 32-bit 'value' into 'reg' compensating for the ldil
178188
* sign-extension when running in wide mode.
179189
* WARNING!! neither 'value' nor 'reg' can be expressions

arch/parisc/include/asm/cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void parisc_setup_cache_timing(void);
5454
#define asm_io_sync() asm volatile("sync" \
5555
ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \
5656
ALTERNATIVE(ALT_COND_NO_IOC_FDC, INSN_NOP) :::"memory")
57+
#define asm_syncdma() asm volatile("syncdma" :::"memory")
5758

5859
#endif /* ! __ASSEMBLY__ */
5960

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/include/asm/unistd.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
142142
}
143143

144144
#define __ARCH_WANT_NEW_STAT
145-
#define __ARCH_WANT_OLD_READDIR
146145
#define __ARCH_WANT_STAT64
147146
#define __ARCH_WANT_SYS_ALARM
148147
#define __ARCH_WANT_SYS_GETHOSTNAME
@@ -156,7 +155,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
156155
#define __ARCH_WANT_SYS_FADVISE64
157156
#define __ARCH_WANT_SYS_GETPGRP
158157
#define __ARCH_WANT_SYS_NICE
159-
#define __ARCH_WANT_SYS_OLDUMOUNT
160158
#define __ARCH_WANT_SYS_SIGPENDING
161159
#define __ARCH_WANT_SYS_SIGPROCMASK
162160
#define __ARCH_WANT_SYS_FORK

arch/parisc/kernel/cache.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,9 @@ void invalidate_kernel_vmap_range(void *vaddr, int size)
754754
unsigned long start = (unsigned long)vaddr;
755755
unsigned long end = start + size;
756756

757+
/* Ensure DMA is complete */
758+
asm_syncdma();
759+
757760
if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) &&
758761
(unsigned long)size >= parisc_cache_flush_threshold) {
759762
flush_tlb_kernel_range(start, end);

arch/parisc/kernel/entry.S

Lines changed: 9 additions & 13 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
@@ -565,13 +566,8 @@
565566
.macro do_alias spc,tmp,tmp1,va,pte,prot,fault,patype
566567
cmpib,COND(<>),n 0,\spc,\fault
567568
ldil L%(TMPALIAS_MAP_START),\tmp
568-
#if defined(CONFIG_64BIT) && (TMPALIAS_MAP_START >= 0x80000000)
569-
/* on LP64, ldi will sign extend into the upper 32 bits,
570-
* which is behaviour we don't want */
571-
depdi 0,31,32,\tmp
572-
#endif
573569
copy \va,\tmp1
574-
depi 0,31,23,\tmp1
570+
depi_safe 0,31,TMPALIAS_SIZE_BITS+1,\tmp1
575571
cmpb,COND(<>),n \tmp,\tmp1,\fault
576572
mfctl %cr19,\tmp /* iir */
577573
/* get the opcode (first six bits) into \tmp */
@@ -604,13 +600,13 @@
604600
* OK, it is in the temp alias region, check whether "from" or "to".
605601
* Check "subtle" note in pacache.S re: r23/r26.
606602
*/
607-
#ifdef CONFIG_64BIT
608-
extrd,u,*= \va,41,1,%r0
609-
#else
610-
extrw,u,= \va,9,1,%r0
611-
#endif
603+
extrw,u,= \va,31-TMPALIAS_SIZE_BITS,1,%r0
612604
or,COND(tr) %r23,%r0,\pte
613605
or %r26,%r0,\pte
606+
607+
/* convert phys addr in \pte (from r23 or r26) to tlb insert format */
608+
SHRREG \pte,PAGE_SHIFT+PAGE_ADD_SHIFT-5, \pte
609+
depi_safe _PAGE_SIZE_ENCODING_DEFAULT, 31,5, \pte
614610
.endm
615611

616612

arch/parisc/kernel/pacache.S

Lines changed: 15 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ fdoneloop2:
300300
fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */
301301

302302
fdsync:
303-
syncdma
304303
sync
305304
mtsm %r22 /* restore I-bit */
306305
89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
@@ -488,6 +487,8 @@ ENDPROC_CFI(copy_page_asm)
488487
* parisc chip designers that there will not ever be a parisc
489488
* chip with a larger alias boundary (Never say never :-) ).
490489
*
490+
* Yah, what about the PA8800 and PA8900 processors?
491+
*
491492
* Subtle: the dtlb miss handlers support the temp alias region by
492493
* "knowing" that if a dtlb miss happens within the temp alias
493494
* region it must have occurred while in clear_user_page. Since
@@ -499,19 +500,10 @@ ENDPROC_CFI(copy_page_asm)
499500
* miss on the translation, the dtlb miss handler inserts the
500501
* translation into the tlb using these values:
501502
*
502-
* %r26 physical page (shifted for tlb insert) of "to" translation
503-
* %r23 physical page (shifted for tlb insert) of "from" translation
503+
* %r26 physical address of "to" translation
504+
* %r23 physical address of "from" translation
504505
*/
505506

506-
/* Drop prot bits and convert to page addr for iitlbt and idtlbt */
507-
#define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
508-
.macro convert_phys_for_tlb_insert20 phys
509-
extrd,u \phys, 56-PAGE_ADD_SHIFT, 32-PAGE_ADD_SHIFT, \phys
510-
#if _PAGE_SIZE_ENCODING_DEFAULT
511-
depdi _PAGE_SIZE_ENCODING_DEFAULT, 63, (63-58), \phys
512-
#endif
513-
.endm
514-
515507
/*
516508
* copy_user_page_asm() performs a page copy using mappings
517509
* equivalent to the user page mappings. It can be used to
@@ -540,24 +532,10 @@ ENTRY_CFI(copy_user_page_asm)
540532
sub %r25, %r1, %r23
541533

542534
ldil L%(TMPALIAS_MAP_START), %r28
543-
#ifdef CONFIG_64BIT
544-
#if (TMPALIAS_MAP_START >= 0x80000000)
545-
depdi 0, 31,32, %r28 /* clear any sign extension */
546-
#endif
547-
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
548-
convert_phys_for_tlb_insert20 %r23 /* convert phys addr to tlb insert format */
549-
depd %r24,63,22, %r28 /* Form aliased virtual address 'to' */
550-
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
551-
copy %r28, %r29
552-
depdi 1, 41,1, %r29 /* Form aliased virtual address 'from' */
553-
#else
554-
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
555-
extrw,u %r23, 24,25, %r23 /* convert phys addr to tlb insert format */
556-
depw %r24, 31,22, %r28 /* Form aliased virtual address 'to' */
557-
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 */
558537
copy %r28, %r29
559-
depwi 1, 9,1, %r29 /* Form aliased virtual address 'from' */
560-
#endif
538+
depi_safe 1, 31-TMPALIAS_SIZE_BITS,1, %r29 /* Form aliased virtual address 'from' */
561539

562540
/* Purge any old translations */
563541

@@ -687,18 +665,8 @@ ENTRY_CFI(clear_user_page_asm)
687665
tophys_r1 %r26
688666

689667
ldil L%(TMPALIAS_MAP_START), %r28
690-
#ifdef CONFIG_64BIT
691-
#if (TMPALIAS_MAP_START >= 0x80000000)
692-
depdi 0, 31,32, %r28 /* clear any sign extension */
693-
#endif
694-
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
695-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
696-
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
697-
#else
698-
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
699-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
700-
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
701-
#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 */
702670

703671
/* Purge any old translation */
704672

@@ -763,18 +731,8 @@ ENDPROC_CFI(clear_user_page_asm)
763731

764732
ENTRY_CFI(flush_dcache_page_asm)
765733
ldil L%(TMPALIAS_MAP_START), %r28
766-
#ifdef CONFIG_64BIT
767-
#if (TMPALIAS_MAP_START >= 0x80000000)
768-
depdi 0, 31,32, %r28 /* clear any sign extension */
769-
#endif
770-
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
771-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
772-
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
773-
#else
774-
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
775-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
776-
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
777-
#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 */
778736

779737
/* Purge any old translation */
780738

@@ -822,18 +780,8 @@ ENDPROC_CFI(flush_dcache_page_asm)
822780

823781
ENTRY_CFI(purge_dcache_page_asm)
824782
ldil L%(TMPALIAS_MAP_START), %r28
825-
#ifdef CONFIG_64BIT
826-
#if (TMPALIAS_MAP_START >= 0x80000000)
827-
depdi 0, 31,32, %r28 /* clear any sign extension */
828-
#endif
829-
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
830-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
831-
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
832-
#else
833-
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
834-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
835-
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
836-
#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 */
837785

838786
/* Purge any old translation */
839787

@@ -881,18 +829,8 @@ ENDPROC_CFI(purge_dcache_page_asm)
881829

882830
ENTRY_CFI(flush_icache_page_asm)
883831
ldil L%(TMPALIAS_MAP_START), %r28
884-
#ifdef CONFIG_64BIT
885-
#if (TMPALIAS_MAP_START >= 0x80000000)
886-
depdi 0, 31,32, %r28 /* clear any sign extension */
887-
#endif
888-
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
889-
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
890-
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
891-
#else
892-
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
893-
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
894-
depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */
895-
#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 */
896834

897835
/* Purge any old translation. Note that the FIC instruction
898836
* may use either the instruction or data TLB. Given that we
@@ -1098,7 +1036,6 @@ ENTRY_CFI(flush_kernel_dcache_range_asm)
10981036

10991037
sync
11001038
89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
1101-
syncdma
11021039
bv %r0(%r2)
11031040
nop
11041041
ENDPROC_CFI(flush_kernel_dcache_range_asm)
@@ -1140,7 +1077,6 @@ ENTRY_CFI(purge_kernel_dcache_range_asm)
11401077

11411078
sync
11421079
89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP)
1143-
syncdma
11441080
bv %r0(%r2)
11451081
nop
11461082
ENDPROC_CFI(purge_kernel_dcache_range_asm)

arch/parisc/mm/init.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,12 @@ void __init mem_init(void)
555555
BUILD_BUG_ON(PT_INITIAL > PTRS_PER_PGD);
556556
#endif
557557

558+
#ifdef CONFIG_64BIT
559+
/* avoid ldil_%L() asm statements to sign-extend into upper 32-bits */
560+
BUILD_BUG_ON(__PAGE_OFFSET >= 0x80000000);
561+
BUILD_BUG_ON(TMPALIAS_MAP_START >= 0x80000000);
562+
#endif
563+
558564
high_memory = __va((max_pfn << PAGE_SHIFT));
559565
set_max_mapnr(max_low_pfn);
560566
memblock_free_all();

drivers/video/console/sticore.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,26 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
549549
}
550550
#endif
551551

552+
static void sti_dump_font(struct sti_cooked_font *font)
553+
{
554+
#ifdef STI_DUMP_FONT
555+
unsigned char *p = (unsigned char *)font->raw;
556+
int n;
557+
558+
p += sizeof(struct sti_rom_font);
559+
pr_debug(" w %d h %d bpc %d\n", font->width, font->height,
560+
font->raw->bytes_per_char);
561+
562+
for (n = 0; n < 256 * font->raw->bytes_per_char; n += 16, p += 16) {
563+
pr_debug(" 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,"
564+
" 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,"
565+
" 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
566+
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8],
567+
p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
568+
}
569+
#endif
570+
}
571+
552572
static int sti_search_font(struct sti_cooked_rom *rom, int height, int width)
553573
{
554574
struct sti_cooked_font *font;
@@ -796,6 +816,7 @@ static int sti_read_rom(int wordmode, struct sti_struct *sti,
796816
sti->font->width = sti->font->raw->width;
797817
sti->font->height = sti->font->raw->height;
798818
sti_font_convert_bytemode(sti, sti->font);
819+
sti_dump_font(sti->font);
799820

800821
sti->sti_mem_request = raw->sti_mem_req;
801822
sti->graphics_id[0] = raw->graphics_id[0];

0 commit comments

Comments
 (0)