Thomas Gleixner
1eb0616c2d
xtensa/mm/highmem: Make generic kmap_atomic() work correctly
...
The conversion to the generic kmap_atomic() implementation missed the fact
that xtensa's fixmap works bottom up while all other implementations work
top down. There is no real reason why xtensa needs to work that way.
Cure it by:
- Using the generic fix_to_virt()/virt_to_fix() functions which work top
down
- Adjusting the mapping defines
- Using the generic index calculation for the non cache aliasing case
- Making the cache colour offset reverse so the effective index is correct
While at it, remove the outdated and misleading comment above the fixmap
enum which originates from the initial copy&pasta of this code from i386.
[ Max: Fixed the off by one in the index calculation ]
Fixes: 629ed3f7da ("xtensa/mm/highmem: Switch to generic kmap atomic")
Reported-by: Max Filippov <[email protected] >
Signed-off-by: Thomas Gleixner <[email protected] >
Signed-off-by: Max Filippov <[email protected] >
Signed-off-by: Thomas Gleixner <[email protected] >
Tested-by: Max Filippov <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
2020-11-16 21:19:24 +01:00
Thomas Gleixner
629ed3f7da
xtensa/mm/highmem: Switch to generic kmap atomic
...
No reason having the same code in every architecture
Signed-off-by: Thomas Gleixner <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
2020-11-06 23:14:57 +01:00
Mike Rapoport
65fddcfca8
mm: reorder includes after introduction of linux/pgtable.h
...
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 <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Brian Cain <[email protected] >
Cc: Catalin Marinas <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Greentime Hu <[email protected] >
Cc: Greg Ungerer <[email protected] >
Cc: Guan Xuetao <[email protected] >
Cc: Guo Ren <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Ley Foon Tan <[email protected] >
Cc: Mark Salter <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Nick Hu <[email protected] >
Cc: Paul Walmsley <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: Rich Felker <[email protected] >
Cc: Russell King <[email protected] >
Cc: Stafford Horne <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Tony Luck <[email protected] >
Cc: Vincent Chen <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Yoshinori Sato <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-09 09:39:13 -07:00
Mike Rapoport
ca5999fde0
mm: introduce include/linux/pgtable.h
...
The include/linux/pgtable.h is going to be the home of generic page table
manipulation functions.
Start with moving asm-generic/pgtable.h to include/linux/pgtable.h and
make the latter include asm/pgtable.h.
Signed-off-by: Mike Rapoport <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Brian Cain <[email protected] >
Cc: Catalin Marinas <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Greentime Hu <[email protected] >
Cc: Greg Ungerer <[email protected] >
Cc: Guan Xuetao <[email protected] >
Cc: Guo Ren <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Ley Foon Tan <[email protected] >
Cc: Mark Salter <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Nick Hu <[email protected] >
Cc: Paul Walmsley <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: Rich Felker <[email protected] >
Cc: Russell King <[email protected] >
Cc: Stafford Horne <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Tony Luck <[email protected] >
Cc: Vincent Chen <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Will Deacon <[email protected] >
Cc: Yoshinori Sato <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-09 09:39:13 -07:00
Ira Weiny
abca2500c0
arch/kunmap_atomic: consolidate duplicate code
...
Every single architecture (including !CONFIG_HIGHMEM) calls...
pagefault_enable();
preempt_enable();
... before returning from __kunmap_atomic(). Lift this code into the
kunmap_atomic() macro.
While we are at it rename __kunmap_atomic() to kunmap_atomic_high() to
be consistent.
[[email protected] : don't enable pagefault/preempt twice]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected] : coding style fixes]
Signed-off-by: Ira Weiny <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Christoph Hellwig <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Benjamin Herrenschmidt <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Christian König <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: Dan Williams <[email protected] >
Cc: Dave Hansen <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: "H. Peter Anvin" <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Guenter Roeck <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-04 19:06:22 -07:00
Ira Weiny
78b6d91ec7
arch/kmap_atomic: consolidate duplicate code
...
Every arch has the same code to ensure atomic operations and a check for
!HIGHMEM page.
Remove the duplicate code by defining a core kmap_atomic() which only
calls the arch specific kmap_atomic_high() when the page is high memory.
[[email protected] : coding style fixes]
Signed-off-by: Ira Weiny <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Christoph Hellwig <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Benjamin Herrenschmidt <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Christian König <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: Dan Williams <[email protected] >
Cc: Dave Hansen <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: "H. Peter Anvin" <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-04 19:06:22 -07:00
Ira Weiny
e23c45976f
arch/kunmap: remove duplicate kunmap implementations
...
All architectures do exactly the same thing for kunmap(); remove all the
duplicate definitions and lift the call to the core.
This also has the benefit of changing kmap_unmap() on a number of
architectures to be an inline call rather than an actual function.
[[email protected] : fix CONFIG_HIGHMEM=n build on various architectures]
Signed-off-by: Ira Weiny <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Christoph Hellwig <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Benjamin Herrenschmidt <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Christian König <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: Dan Williams <[email protected] >
Cc: Dave Hansen <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: "H. Peter Anvin" <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-04 19:06:22 -07:00
Ira Weiny
525aaf9bad
arch/kmap: remove redundant arch specific kmaps
...
The kmap code for all the architectures is almost 100% identical.
Lift the common code to the core. Use ARCH_HAS_KMAP_FLUSH_TLB to indicate
if an arch defines kmap_flush_tlb() and call if if needed.
This also has the benefit of changing kmap() on a number of architectures
to be an inline call rather than an actual function.
Signed-off-by: Ira Weiny <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Christoph Hellwig <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Benjamin Herrenschmidt <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Christian König <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: Dan Williams <[email protected] >
Cc: Dave Hansen <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: "H. Peter Anvin" <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-04 19:06:22 -07:00
Ira Weiny
2159687248
arch/xtensa: move kmap build bug out of the way
...
Move the kmap() build bug to kmap_init() to facilitate patches to lift
kmap() to the core.
Signed-off-by: Ira Weiny <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Christoph Hellwig <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Benjamin Herrenschmidt <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Christian König <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: Dan Williams <[email protected] >
Cc: Dave Hansen <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: "H. Peter Anvin" <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-04 19:06:22 -07:00
Ira Weiny
01c4b788e0
arch/kmap: remove BUG_ON()
...
Patch series "Remove duplicated kmap code", v3.
The kmap infrastructure has been copied almost verbatim to every
architecture. This series consolidates obvious duplicated code by
defining core functions which call into the architectures only when
needed.
Some of the k[un]map_atomic() implementations have some similarities but
the similarities were not sufficient to warrant further changes.
In addition we remove a duplicate implementation of kmap() in DRM.
This patch (of 15):
Replace the use of BUG_ON(in_interrupt()) in the kmap() and kunmap() in
favor of might_sleep().
Besides the benefits of might_sleep(), this normalizes the implementations
such that they can be made generic in subsequent patches.
Signed-off-by: Ira Weiny <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Reviewed-by: Dan Williams <[email protected] >
Reviewed-by: Christoph Hellwig <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Christian König <[email protected] >
Cc: Daniel Vetter <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: Benjamin Herrenschmidt <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: "H. Peter Anvin" <[email protected] >
Cc: Dave Hansen <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Max Filippov <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-04 19:06:22 -07:00
Max Filippov
1af1e8a39d
xtensa: move fixmap and kmap just above the KSEG
...
The virtual address space between the page table and the VMALLOC region
is big enough to host KASAN shadow map and there's enough space between
the VMALLOC area and KSEG for the fixmap and kmap.
Move fixmap and kmap to the gap between VMALLOC area and KSEG, just
above the KSEG. Reorder entries in the kernel memory layout printing
code. Drop duplicate PGTABLE_START definition, use
XCHAL_PAGE_TABLE_VADDR instead.
Signed-off-by: Max Filippov <[email protected] >
2017-12-16 22:37:12 -08:00
Max Filippov
d39af90265
xtensa: add alternative kernel memory layouts
...
MMUv3 is able to support low memory bigger than 128MB.
Implement 256MB and 512MB KSEG layouts:
- add Kconfig selector for KSEG layout;
- add KSEG base address, size and alignment definitions to
arch/xtensa/include/asm/kmem_layout.h;
- use new definitions in TLB initialization;
- add build time memory map consistency checks.
See Documentation/xtensa/mmu.txt for the details of new memory layouts.
Signed-off-by: Max Filippov <[email protected] >
2016-07-24 06:33:58 +03:00
Max Filippov
ff009ab6d4
xtensa: fix kmap_prot definition
...
Replace PAGE_KERNEL with PAGE_KERNEL_EXEC to allow copy_to_user_page
invalidate icache for pages mapped with kmap.
Cc: [email protected]
Signed-off-by: Max Filippov <[email protected] >
2014-12-09 03:22:57 +03:00
Max Filippov
8504b503df
xtensa: support aliasing cache in kmap
...
Define ARCH_PKMAP_COLORING and provide corresponding macro definitions
on cores with aliasing data cache.
Instead of single last_pkmap_nr maintain an array last_pkmap_nr_arr of
pkmap counters for each page color. Make sure that kmap maps physical
page at virtual address with color matching its physical address.
Signed-off-by: Max Filippov <[email protected] >
2014-08-14 11:59:22 +04:00
Max Filippov
6555910065
xtensa: add HIGHMEM support
...
Introduce fixmap area just below the vmalloc region. Use it for atomic
mapping of high memory pages.
High memory on cores with cache aliasing is not supported and is still
to be implemented. Fail build for such configurations for now.
Signed-off-by: Max Filippov <[email protected] >
2014-04-06 21:29:21 +04:00
Chris Zankel
c4c4594b00
xtensa: clean up files to make them code-style compliant
...
Remove heading and trailing spaces, trim trailing lines, and wrap lines
that are longer than 80 characters.
Signed-off-by: Chris Zankel <[email protected] >
2012-12-18 21:10:25 -08:00
Chris Zankel
367b8112fe
xtensa: move headers files to arch/xtensa/include
...
Move all header files for xtensa to arch/xtensa/include and platform and
variant header files to the appropriate arch/xtensa/platforms/ and
arch/xtensa/variants/ directories.
Moving the files gets also rid of all uses of symlinks in the Makefile.
This has been completed already for the majority of the architectures
and xtensa is one out of six missing.
Signed-off-by: Sam Ravnborg <[email protected] >
Signed-off-by: Chris Zankel <[email protected] >
2008-11-06 10:25:09 -08:00