aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2015-11-20 04:50:01 -0500
committerHelge Deller <deller@gmx.de>2015-11-22 06:22:43 -0500
commit4182d0cdf853fb044b969318289ae9f451f69c86 (patch)
tree7601eb68a3601c5124cbe511fb3bd0ae90a93af2
parent1f25ad26d65b3740f44d6e03edcd34a5f7b58850 (diff)
parisc: Initialize the fault vector earlier in the boot process.
A fault vector on parisc needs to be 2K aligned. Furthermore the checksum of the fault vector needs to sum up to 0 which is being calculated and written at runtime. Up to now we aligned both PA20 and PA11 fault vectors on the same 4K page in order to easily write the checksum after having mapped the kernel read-only (by mapping this page only as read-write). But when we want to map the kernel text and data on huge pages this makes things harder. So, simplify it by aligning both fault vectors on 2K boundries and write the checksum before we map the page read-only. Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--arch/parisc/kernel/entry.S11
-rw-r--r--arch/parisc/kernel/setup.c3
-rw-r--r--arch/parisc/kernel/traps.c35
3 files changed, 21 insertions, 28 deletions
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index c5ef4081b01d..b2fdc44da0d5 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -646,17 +646,12 @@
646 646
647 647
648 /* 648 /*
649 * Align fault_vector_20 on 4K boundary so that both 649 * Fault_vectors are architecturally required to be aligned on a 2K
650 * fault_vector_11 and fault_vector_20 are on the 650 * boundary
651 * same page. This is only necessary as long as we
652 * write protect the kernel text, which we may stop
653 * doing once we use large page translations to cover
654 * the static part of the kernel address space.
655 */ 651 */
656 652
657 .text 653 .text
658 654 .align 2048
659 .align 4096
660 655
661ENTRY(fault_vector_20) 656ENTRY(fault_vector_20)
662 /* First vector is invalid (0) */ 657 /* First vector is invalid (0) */
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 72a3c658ad7b..f097762d3922 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -377,6 +377,7 @@ arch_initcall(parisc_init);
377void start_parisc(void) 377void start_parisc(void)
378{ 378{
379 extern void start_kernel(void); 379 extern void start_kernel(void);
380 extern void early_trap_init(void);
380 381
381 int ret, cpunum; 382 int ret, cpunum;
382 struct pdc_coproc_cfg coproc_cfg; 383 struct pdc_coproc_cfg coproc_cfg;
@@ -397,6 +398,8 @@ void start_parisc(void)
397 panic("must have an fpu to boot linux"); 398 panic("must have an fpu to boot linux");
398 } 399 }
399 400
401 early_trap_init(); /* initialize checksum of fault_vector */
402
400 start_kernel(); 403 start_kernel();
401 // not reached 404 // not reached
402} 405}
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index b99b39f1da02..553b09855cfd 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -807,7 +807,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
807} 807}
808 808
809 809
810int __init check_ivt(void *iva) 810void __init initialize_ivt(const void *iva)
811{ 811{
812 extern u32 os_hpmc_size; 812 extern u32 os_hpmc_size;
813 extern const u32 os_hpmc[]; 813 extern const u32 os_hpmc[];
@@ -818,8 +818,8 @@ int __init check_ivt(void *iva)
818 u32 *hpmcp; 818 u32 *hpmcp;
819 u32 length; 819 u32 length;
820 820
821 if (strcmp((char *)iva, "cows can fly")) 821 if (strcmp((const char *)iva, "cows can fly"))
822 return -1; 822 panic("IVT invalid");
823 823
824 ivap = (u32 *)iva; 824 ivap = (u32 *)iva;
825 825
@@ -839,28 +839,23 @@ int __init check_ivt(void *iva)
839 check += ivap[i]; 839 check += ivap[i];
840 840
841 ivap[5] = -check; 841 ivap[5] = -check;
842
843 return 0;
844} 842}
845 843
846#ifndef CONFIG_64BIT
847extern const void fault_vector_11;
848#endif
849extern const void fault_vector_20;
850 844
851void __init trap_init(void) 845/* early_trap_init() is called before we set up kernel mappings and
846 * write-protect the kernel */
847void __init early_trap_init(void)
852{ 848{
853 void *iva; 849 extern const void fault_vector_20;
854 850
855 if (boot_cpu_data.cpu_type >= pcxu) 851#ifndef CONFIG_64BIT
856 iva = (void *) &fault_vector_20; 852 extern const void fault_vector_11;
857 else 853 initialize_ivt(&fault_vector_11);
858#ifdef CONFIG_64BIT
859 panic("Can't boot 64-bit OS on PA1.1 processor!");
860#else
861 iva = (void *) &fault_vector_11;
862#endif 854#endif
863 855
864 if (check_ivt(iva)) 856 initialize_ivt(&fault_vector_20);
865 panic("IVT invalid"); 857}
858
859void __init trap_init(void)
860{
866} 861}