Skip to content

Commit 6a45716

Browse files
committed
parisc: fix partly 16/64k PAGE_SIZE boot
This patch fixes partly PAGE_SIZEs of 16K or 64K by adjusting the assembler PTE lookup code and the assembler TEMPALIAS code. Furthermore some data alignments for PAGE_SIZE have been limited to 4K (or less) to not waste too much memory with greater page sizes. As a side note, the palo loader can (currently) only handle up to 10 ELF segments which is fixed with tighter aligning as well. My testings indicated that the ldci command in the sba iommu coding needed adjustment by the PAGE_SHIFT value and that the I/O PDIR Page size was only set to 4K for my machine (C3000). All this fixes partly the boot, but there are still quite some caching problems left. Examples are e.g. the symbios logic driver which is failing: sym0: <896> rev 0x7 at pci 0000:00:0f.0 irq 69 sym0: PA-RISC Firmware, ID 7, Fast-40, SE, parity checking CACHE TEST FAILED: DMA error (dstat=0x81).sym0: CACHE INCORRECTLY CONFIGURED. and the tulip network driver which doesn't seem to work correctly either: Sending BOOTP requests .net eth0: Setting full-duplex based on MII#1 link partner capability of 05e1 ..... timed out! Beside those kernel fixes glibc will need fixes too to be able to handle >4K page sizes. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 7f64fb4 commit 6a45716

6 files changed

Lines changed: 52 additions & 25 deletions

File tree

‎arch/parisc/kernel/entry.S‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,15 @@
400400
#if PT_NLEVELS == 3
401401
extru \va,31-ASM_PMD_SHIFT,ASM_BITS_PER_PMD,\index
402402
#else
403+
# if defined(CONFIG_64BIT)
404+
extrd,u \va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
405+
#else
406+
# if PAGE_SIZE > 4096
407+
extru \va,31-ASM_PGDIR_SHIFT,32-ASM_PGDIR_SHIFT,\index
408+
# else
403409
extru \va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
410+
# endif
411+
# endif
404412
#endif
405413
dep %r0,31,PAGE_SHIFT,\pmd /* clear offset */
406414
copy %r0,\pte
@@ -615,7 +623,7 @@
615623

616624
.text
617625

618-
.align PAGE_SIZE
626+
.align 4096
619627

620628
ENTRY(fault_vector_20)
621629
/* First vector is invalid (0) */

‎arch/parisc/kernel/hpmc.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@
5555
* IODC requires 7K byte stack. That leaves 1K byte for os_hpmc.
5656
*/
5757

58-
.align PAGE_SIZE
58+
.align 4096
5959
hpmc_stack:
6060
.block 16384
6161

6262
#define HPMC_IODC_BUF_SIZE 0x8000
6363

64-
.align PAGE_SIZE
64+
.align 4096
6565
hpmc_iodc_buf:
6666
.block HPMC_IODC_BUF_SIZE
6767

‎arch/parisc/kernel/pacache.S‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,15 @@ ENDPROC(copy_page_asm)
563563
* %r23 physical page (shifted for tlb insert) of "from" translation
564564
*/
565565

566+
/* Drop prot bits and convert to page addr for iitlbt and idtlbt */
567+
#define PAGE_ADD_SHIFT (PAGE_SHIFT-12)
568+
.macro convert_phys_for_tlb_insert20 phys
569+
extrd,u \phys, 56-PAGE_ADD_SHIFT, 32-PAGE_ADD_SHIFT, \phys
570+
#if _PAGE_SIZE_ENCODING_DEFAULT
571+
depdi _PAGE_SIZE_ENCODING_DEFAULT, 63, (63-58), \phys
572+
#endif
573+
.endm
574+
566575
/*
567576
* We can't do this since copy_user_page is used to bring in
568577
* file data that might have instructions. Since the data would
@@ -589,15 +598,14 @@ ENTRY(copy_user_page_asm)
589598
sub %r25, %r1, %r23
590599

591600
ldil L%(TMPALIAS_MAP_START), %r28
592-
/* FIXME for different page sizes != 4k */
593601
#ifdef CONFIG_64BIT
594602
#if (TMPALIAS_MAP_START >= 0x80000000)
595603
depdi 0, 31,32, %r28 /* clear any sign extension */
596604
#endif
597-
extrd,u %r26,56,32, %r26 /* convert phys addr to tlb insert format */
598-
extrd,u %r23,56,32, %r23 /* convert phys addr to tlb insert format */
605+
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
606+
convert_phys_for_tlb_insert20 %r23 /* convert phys addr to tlb insert format */
599607
depd %r24,63,22, %r28 /* Form aliased virtual address 'to' */
600-
depdi 0, 63,12, %r28 /* Clear any offset bits */
608+
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
601609
copy %r28, %r29
602610
depdi 1, 41,1, %r29 /* Form aliased virtual address 'from' */
603611
#else
@@ -747,11 +755,10 @@ ENTRY(clear_user_page_asm)
747755
#ifdef CONFIG_64BIT
748756
#if (TMPALIAS_MAP_START >= 0x80000000)
749757
depdi 0, 31,32, %r28 /* clear any sign extension */
750-
/* FIXME: page size dependend */
751758
#endif
752-
extrd,u %r26, 56,32, %r26 /* convert phys addr to tlb insert format */
759+
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
753760
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
754-
depdi 0, 63,12, %r28 /* Clear any offset bits */
761+
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
755762
#else
756763
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
757764
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
@@ -832,11 +839,10 @@ ENTRY(flush_dcache_page_asm)
832839
#ifdef CONFIG_64BIT
833840
#if (TMPALIAS_MAP_START >= 0x80000000)
834841
depdi 0, 31,32, %r28 /* clear any sign extension */
835-
/* FIXME: page size dependend */
836842
#endif
837-
extrd,u %r26, 56,32, %r26 /* convert phys addr to tlb insert format */
843+
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
838844
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
839-
depdi 0, 63,12, %r28 /* Clear any offset bits */
845+
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
840846
#else
841847
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
842848
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
@@ -909,11 +915,10 @@ ENTRY(flush_icache_page_asm)
909915
#ifdef CONFIG_64BIT
910916
#if (TMPALIAS_MAP_START >= 0x80000000)
911917
depdi 0, 31,32, %r28 /* clear any sign extension */
912-
/* FIXME: page size dependend */
913918
#endif
914-
extrd,u %r26, 56,32, %r26 /* convert phys addr to tlb insert format */
919+
convert_phys_for_tlb_insert20 %r26 /* convert phys addr to tlb insert format */
915920
depd %r25, 63,22, %r28 /* Form aliased virtual address 'to' */
916-
depdi 0, 63,12, %r28 /* Clear any offset bits */
921+
depdi 0, 63,PAGE_SHIFT, %r28 /* Clear any offset bits */
917922
#else
918923
extrw,u %r26, 24,25, %r26 /* convert phys addr to tlb insert format */
919924
depw %r25, 31,22, %r28 /* Form aliased virtual address 'to' */
@@ -959,7 +964,7 @@ ENTRY(flush_icache_page_asm)
959964
fic,m %r1(%sr4,%r28)
960965
fic,m %r1(%sr4,%r28)
961966
fic,m %r1(%sr4,%r28)
962-
cmpb,COND(<<) %r28, %r25,1b
967+
cmpb,COND(<<) %r28, %r25,1b
963968
fic,m %r1(%sr4,%r28)
964969

965970
sync

‎arch/parisc/kernel/setup.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ void __init setup_arch(char **cmdline_p)
129129
printk(KERN_INFO "The 32-bit Kernel has started...\n");
130130
#endif
131131

132+
printk(KERN_INFO "Default page size is %dKB.\n", (int)(PAGE_SIZE / 1024));
133+
132134
pdc_console_init();
133135

134136
#ifdef CONFIG_64BIT

‎arch/parisc/kernel/syscall.S‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <asm/thread_info.h>
1616
#include <asm/assembly.h>
1717
#include <asm/processor.h>
18+
#include <asm/cache.h>
1819

1920
#include <linux/linkage.h>
2021

@@ -643,7 +644,7 @@ ENTRY(end_linux_gateway_page)
643644

644645
.section .rodata,"a"
645646

646-
.align PAGE_SIZE
647+
.align 8
647648
/* Light-weight-syscall table */
648649
/* Start of lws table. */
649650
ENTRY(lws_table)
@@ -652,13 +653,13 @@ ENTRY(lws_table)
652653
END(lws_table)
653654
/* End of lws table */
654655

655-
.align PAGE_SIZE
656+
.align 8
656657
ENTRY(sys_call_table)
657658
#include "syscall_table.S"
658659
END(sys_call_table)
659660

660661
#ifdef CONFIG_64BIT
661-
.align PAGE_SIZE
662+
.align 8
662663
ENTRY(sys_call_table64)
663664
#define SYSCALL_TABLE_64BIT
664665
#include "syscall_table.S"
@@ -674,7 +675,7 @@ END(sys_call_table64)
674675
with ldcw.
675676
*/
676677
.section .data
677-
.align PAGE_SIZE
678+
.align L1_CACHE_BYTES
678679
ENTRY(lws_lock_start)
679680
/* lws locks */
680681
.rept 16

‎drivers/parisc/sba_iommu.c‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ sba_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
575575

576576
mtsp(sid,1);
577577
asm("lci 0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba));
578-
pa |= (ci >> 12) & 0xff; /* move CI (8 bits) into lowest byte */
578+
pa |= (ci >> PAGE_SHIFT) & 0xff; /* move CI (8 bits) into lowest byte */
579579

580580
pa |= SBA_PDIR_VALID_BIT; /* set "valid" bit */
581581
*pdir_ptr = cpu_to_le64(pa); /* swap and store into I/O Pdir */
@@ -1376,7 +1376,7 @@ static void
13761376
sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
13771377
{
13781378
u32 iova_space_size, iova_space_mask;
1379-
unsigned int pdir_size, iov_order;
1379+
unsigned int pdir_size, iov_order, tcnfg;
13801380

13811381
/*
13821382
** Determine IOVA Space size from memory size.
@@ -1468,8 +1468,19 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
14681468
WRITE_REG(ioc->ibase | 1, ioc->ioc_hpa+IOC_IBASE);
14691469
WRITE_REG(ioc->imask, ioc->ioc_hpa+IOC_IMASK);
14701470

1471-
/* Set I/O PDIR Page size to 4K */
1472-
WRITE_REG(0, ioc->ioc_hpa+IOC_TCNFG);
1471+
/* Set I/O PDIR Page size to system page size */
1472+
switch (PAGE_SHIFT) {
1473+
case 12: tcnfg = 0; break; /* 4K */
1474+
case 13: tcnfg = 1; break; /* 8K */
1475+
case 14: tcnfg = 2; break; /* 16K */
1476+
case 16: tcnfg = 3; break; /* 64K */
1477+
default:
1478+
panic(__FILE__ "Unsupported system page size %d",
1479+
1 << PAGE_SHIFT);
1480+
break;
1481+
}
1482+
/* Set I/O PDIR Page size to PAGE_SIZE (4k/16k/...) */
1483+
WRITE_REG(tcnfg, ioc->ioc_hpa+IOC_TCNFG);
14731484

14741485
/*
14751486
** Clear I/O TLB of any possible entries.

0 commit comments

Comments
 (0)