mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 14:16:41 +07:00
c9c1083074
The sequence to move over to the Linux trap tables from the firmware ones needs to be more air tight. It turns out that to be %100 safe we do need to be able to translate OBP mappings in our TLB miss handlers early. In order not to eat up a lot of kernel image memory with static page tables, just use the translations array in the OBP TLB miss handlers. That solves the bulk of the problem. Furthermore, to make sure the OBP TLB miss path will work even before the fixed MMU globals are loaded, explicitly load %g1 to TLB_SFSR at the beginning of the i-TLB and d-TLB miss handlers. To ease the OBP TLB miss walking of the prom_trans[] array, we sort it then delete all of the non-OBP entries in there (for example, there are entries for the kernel image itself which we're not interested in at all). We also save about 32K of kernel image size with this change. Not a bad side effect :-) There are still some reasons why trampoline.S can't use the setup_trap_table() yet. The most noteworthy are: 1) OBP boots secondary processors with non-bias'd stack for some reason. This is easily fixed by using a small bootup stack in the kernel image explicitly for this purpose. 2) Doing a firmware call via the normal C call prom_set_trap_table() goes through the whole OBP enter/exit sequence that saves and restores OBP and Linux kernel state in the MMUs. This path unfortunately does a "flush %g6" while loading up the OBP locked TLB entries for the firmware call. If we setup the %g6 in the trampoline.S code properly, that is in the PAGE_OFFSET linear mapping, but we're not on the kernel trap table yet so those addresses won't translate properly. One idea is to do a by-hand firmware call like we do in the early bootup code and elsewhere here in trampoline.S But this fails as well, as aparently the secondary processors are not booted with OBP's special locked TLB entries loaded. These are necessary for the firwmare to processes TLB misses correctly up until the point where we take over the trap table. This does need to be resolved at some point. Signed-off-by: David S. Miller <davem@davemloft.net>
55 lines
1.3 KiB
ArmAsm
55 lines
1.3 KiB
ArmAsm
/* $Id: dtlb_prot.S,v 1.22 2001/04/11 23:40:32 davem Exp $
|
|
* dtlb_prot.S: DTLB protection trap strategy.
|
|
* This is included directly into the trap table.
|
|
*
|
|
* Copyright (C) 1996,1998 David S. Miller (davem@redhat.com)
|
|
* Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
|
|
*/
|
|
|
|
/* Ways we can get here:
|
|
*
|
|
* [TL == 0] 1) User stores to readonly pages.
|
|
* [TL == 0] 2) Nucleus stores to user readonly pages.
|
|
* [TL > 0] 3) Nucleus stores to user readonly stack frame.
|
|
*/
|
|
|
|
/* PROT ** ICACHE line 1: User DTLB protection trap */
|
|
mov TLB_SFSR, %g1
|
|
stxa %g0, [%g1] ASI_DMMU ! Clear FaultValid bit
|
|
membar #Sync ! Synchronize stores
|
|
rdpr %pstate, %g5 ! Move into alt-globals
|
|
wrpr %g5, PSTATE_AG|PSTATE_MG, %pstate
|
|
rdpr %tl, %g1 ! Need a winfixup?
|
|
cmp %g1, 1 ! Trap level >1?
|
|
mov TLB_TAG_ACCESS, %g4 ! For reload of vaddr
|
|
|
|
/* PROT ** ICACHE line 2: More real fault processing */
|
|
bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup
|
|
ldxa [%g4] ASI_DMMU, %g5 ! Put tagaccess in %g5
|
|
ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault
|
|
mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
|
|
/* PROT ** ICACHE line 3: Unused... */
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
|
|
/* PROT ** ICACHE line 4: Unused... */
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|