mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
65fddcfca8
The replacement of <asm/pgrable.h> with <linux/pgtable.h> made the include of the latter in the middle of asm includes. Fix this up with the aid of the below script and manual adjustments here and there. import sys import re if len(sys.argv) is not 3: print "USAGE: %s <file> <header>" % (sys.argv[0]) sys.exit(1) hdr_to_move="#include <linux/%s>" % sys.argv[2] moved = False in_hdrs = False with open(sys.argv[1], "r") as f: lines = f.readlines() for _line in lines: line = _line.rstrip(' ') if line == hdr_to_move: continue if line.startswith("#include <linux/"): in_hdrs = True elif not moved and in_hdrs: moved = True print hdr_to_move print line Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Cain <bcain@codeaurora.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chris Zankel <chris@zankel.net> Cc: "David S. Miller" <davem@davemloft.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Greentime Hu <green.hu@gmail.com> Cc: Greg Ungerer <gerg@linux-m68k.org> Cc: Guan Xuetao <gxt@pku.edu.cn> Cc: Guo Ren <guoren@kernel.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Helge Deller <deller@gmx.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Ley Foon Tan <ley.foon.tan@intel.com> Cc: Mark Salter <msalter@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Matt Turner <mattst88@gmail.com> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Simek <monstr@monstr.eu> Cc: Nick Hu <nickhu@andestech.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Richard Weinberger <richard@nod.at> Cc: Rich Felker <dalias@libc.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Stafford Horne <shorne@gmail.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: Vincent Chen <deanbo422@gmail.com> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Will Deacon <will@kernel.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Link: http://lkml.kernel.org/r/20200514170327.31389-4-rppt@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
86 lines
1.8 KiB
ArmAsm
86 lines
1.8 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2015 Russell King
|
|
*
|
|
* This assembly is required to safely remap the physical address space
|
|
* for Keystone 2
|
|
*/
|
|
#include <linux/linkage.h>
|
|
#include <linux/pgtable.h>
|
|
#include <asm/asm-offsets.h>
|
|
#include <asm/cp15.h>
|
|
#include <asm/memory.h>
|
|
|
|
.section ".idmap.text", "ax"
|
|
|
|
#define L1_ORDER 3
|
|
#define L2_ORDER 3
|
|
|
|
ENTRY(lpae_pgtables_remap_asm)
|
|
stmfd sp!, {r4-r8, lr}
|
|
|
|
mrc p15, 0, r8, c1, c0, 0 @ read control reg
|
|
bic ip, r8, #CR_M @ disable caches and MMU
|
|
mcr p15, 0, ip, c1, c0, 0
|
|
dsb
|
|
isb
|
|
|
|
/* Update level 2 entries covering the kernel */
|
|
ldr r6, =(_end - 1)
|
|
add r7, r2, #0x1000
|
|
add r6, r7, r6, lsr #SECTION_SHIFT - L2_ORDER
|
|
add r7, r7, #PAGE_OFFSET >> (SECTION_SHIFT - L2_ORDER)
|
|
1: ldrd r4, r5, [r7]
|
|
adds r4, r4, r0
|
|
adc r5, r5, r1
|
|
strd r4, r5, [r7], #1 << L2_ORDER
|
|
cmp r7, r6
|
|
bls 1b
|
|
|
|
/* Update level 2 entries for the boot data */
|
|
add r7, r2, #0x1000
|
|
add r7, r7, r3, lsr #SECTION_SHIFT - L2_ORDER
|
|
bic r7, r7, #(1 << L2_ORDER) - 1
|
|
ldrd r4, r5, [r7]
|
|
adds r4, r4, r0
|
|
adc r5, r5, r1
|
|
strd r4, r5, [r7], #1 << L2_ORDER
|
|
ldrd r4, r5, [r7]
|
|
adds r4, r4, r0
|
|
adc r5, r5, r1
|
|
strd r4, r5, [r7]
|
|
|
|
/* Update level 1 entries */
|
|
mov r6, #4
|
|
mov r7, r2
|
|
2: ldrd r4, r5, [r7]
|
|
adds r4, r4, r0
|
|
adc r5, r5, r1
|
|
strd r4, r5, [r7], #1 << L1_ORDER
|
|
subs r6, r6, #1
|
|
bne 2b
|
|
|
|
mrrc p15, 0, r4, r5, c2 @ read TTBR0
|
|
adds r4, r4, r0 @ update physical address
|
|
adc r5, r5, r1
|
|
mcrr p15, 0, r4, r5, c2 @ write back TTBR0
|
|
mrrc p15, 1, r4, r5, c2 @ read TTBR1
|
|
adds r4, r4, r0 @ update physical address
|
|
adc r5, r5, r1
|
|
mcrr p15, 1, r4, r5, c2 @ write back TTBR1
|
|
|
|
dsb
|
|
|
|
mov ip, #0
|
|
mcr p15, 0, ip, c7, c5, 0 @ I+BTB cache invalidate
|
|
mcr p15, 0, ip, c8, c7, 0 @ local_flush_tlb_all()
|
|
dsb
|
|
isb
|
|
|
|
mcr p15, 0, r8, c1, c0, 0 @ re-enable MMU
|
|
dsb
|
|
isb
|
|
|
|
ldmfd sp!, {r4-r8, pc}
|
|
ENDPROC(lpae_pgtables_remap_asm)
|