Mike Rapoport
974b9b2c68
mm: consolidate pte_index() and pte_offset_*() definitions
...
All architectures define pte_index() as
(address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)
and all architectures define pte_offset_kernel() as an entry in the array
of PTEs indexed by the pte_index().
For the most architectures the pte_offset_kernel() implementation relies
on the availability of pmd_page_vaddr() that converts a PMD entry value to
the virtual address of the page containing PTEs array.
Let's move x86 definitions of the PTE accessors to the generic place in
<linux/pgtable.h> and then simply drop the respective definitions from the
other architectures.
The architectures that didn't provide pmd_page_vaddr() are updated to have
that defined.
The generic implementation of pte_offset_kernel() can be overridden by an
architecture and alpha makes use of this because it has special ordering
requirements for its version of pte_offset_kernel().
[[email protected] : v2]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected] : update]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected] : update]
Link: http://lkml.kernel.org/r/[email protected]
[[email protected] : fix x86 warning]
[[email protected] : fix powerpc build]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport <[email protected] >
Signed-off-by: Stephen Rothwell <[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:14 -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
Mike Rapoport
9f4e70379f
nios2: add support for folded p4d page tables
...
Implement primitives necessary for the 4th level folding, add walks of p4d
level where appropriate and remove usage of __ARCH_USE_5LEVEL_HACK.
Signed-off-by: Mike Rapoport <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Benjamin Herrenschmidt <[email protected] >
Cc: Brian Cain <[email protected] >
Cc: Catalin Marinas <[email protected] >
Cc: Christophe Leroy <[email protected] >
Cc: Fenghua Yu <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Guan Xuetao <[email protected] >
Cc: James Morse <[email protected] >
Cc: Jonas Bonn <[email protected] >
Cc: Julien Thierry <[email protected] >
Cc: Ley Foon Tan <[email protected] >
Cc: Marc Zyngier <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Paul Mackerras <[email protected] >
Cc: Rich Felker <[email protected] >
Cc: Russell King <[email protected] >
Cc: Stafford Horne <[email protected] >
Cc: Stefan Kristiansson <[email protected] >
Cc: Suzuki K Poulose <[email protected] >
Cc: Tony Luck <[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-04 19:06:21 -07:00
Anshuman Khandual
78e7c5af08
mm/special: create generic fallbacks for pte_special() and pte_mkspecial()
...
Currently there are many platforms that dont enable ARCH_HAS_PTE_SPECIAL
but required to define quite similar fallback stubs for special page
table entry helpers such as pte_special() and pte_mkspecial(), as they
get build in generic MM without a config check. This creates two
generic fallback stub definitions for these helpers, eliminating much
code duplication.
mips platform has a special case where pte_special() and pte_mkspecial()
visibility is wider than what ARCH_HAS_PTE_SPECIAL enablement requires.
This restricts those symbol visibility in order to avoid redefinitions
which is now exposed through this new generic stubs and subsequent build
failure. arm platform set_pte_at() definition needs to be moved into a
C file just to prevent a build failure.
[[email protected] : use defined(CONFIG_ARCH_HAS_PTE_SPECIAL) in mips per Thomas]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Anshuman Khandual <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Acked-by: Guo Ren <[email protected] > [csky]
Acked-by: Geert Uytterhoeven <[email protected] > [m68k]
Acked-by: Stafford Horne <[email protected] > [openrisc]
Acked-by: Helge Deller <[email protected] > [parisc]
Cc: Richard Henderson <[email protected] >
Cc: Ivan Kokshaysky <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Russell King <[email protected] >
Cc: Brian Cain <[email protected] >
Cc: Tony Luck <[email protected] >
Cc: Fenghua Yu <[email protected] >
Cc: Sam Creasey <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Ralf Baechle <[email protected] >
Cc: Paul Burton <[email protected] >
Cc: Nick Hu <[email protected] >
Cc: Greentime Hu <[email protected] >
Cc: Vincent Chen <[email protected] >
Cc: Ley Foon Tan <[email protected] >
Cc: Jonas Bonn <[email protected] >
Cc: Stefan Kristiansson <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: "David S. Miller" <[email protected] >
Cc: Jeff Dike <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: Anton Ivanov <[email protected] >
Cc: Guan Xuetao <[email protected] >
Cc: Chris Zankel <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-04-10 15:36:21 -07:00
Mike Rapoport
782de70c42
mm: consolidate pgtable_cache_init() and pgd_cache_init()
...
Both pgtable_cache_init() and pgd_cache_init() are used to initialize kmem
cache for page table allocations on several architectures that do not use
PAGE_SIZE tables for one or more levels of the page table hierarchy.
Most architectures do not implement these functions and use __weak default
NOP implementation of pgd_cache_init(). Since there is no such default
for pgtable_cache_init(), its empty stub is duplicated among most
architectures.
Rename the definitions of pgd_cache_init() to pgtable_cache_init() and
drop empty stubs of pgtable_cache_init().
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport <[email protected] >
Acked-by: Will Deacon <[email protected] > [arm64]
Acked-by: Thomas Gleixner <[email protected] > [x86]
Cc: Catalin Marinas <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Borislav Petkov <[email protected] >
Cc: Matthew Wilcox <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2019-09-24 15:54:09 -07:00
Nicholas Piggin
0b5754b986
nios2: pte_clear does not need to flush TLB
...
Signed-off-by: Nicholas Piggin <[email protected] >
Signed-off-by: Ley Foon Tan <[email protected] >
2019-03-07 05:29:35 +08:00
Kirill A. Shutemov
9849a5697d
arch, mm: convert all architectures to use 5level-fixup.h
...
If an architecture uses 4level-fixup.h we don't need to do anything as
it includes 5level-fixup.h.
If an architecture uses pgtable-nop*d.h, define __ARCH_USE_5LEVEL_HACK
before inclusion of the header. It makes asm-generic code to use
5level-fixup.h.
If an architecture has 4-level paging or folds levels on its own,
include 5level-fixup.h directly.
Signed-off-by: Kirill A. Shutemov <[email protected] >
Acked-by: Michal Hocko <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2017-03-09 11:48:47 -08:00
Ard Biesheuvel
046982c760
nios2: use correct void* return type for page_to_virt()
...
To align with other architectures, the expression produced by expanding
the macro page_to_virt() should be of type void*, since it returns a
virtual address. Fix that, and also fix up an instance where page_to_virt
was expected to return 'unsigned long', and drop another instance that was
entirely unused (page_to_bus)
Acked-by: Andrew Morton <[email protected] >
Signed-off-by: Ard Biesheuvel <[email protected] >
Signed-off-by: Will Deacon <[email protected] >
2016-04-22 10:08:26 +01:00
Kirill A. Shutemov
d016bf7ece
mm: make FIRST_USER_ADDRESS unsigned long on all archs
...
LKP has triggered a compiler warning after my recent patch "mm: account
pmd page tables to the process":
mm/mmap.c: In function 'exit_mmap':
>> mm/mmap.c:2857:2: warning: right shift count >= width of type [enabled by default]
The code:
> 2857 WARN_ON(mm_nr_pmds(mm) >
2858 round_up(FIRST_USER_ADDRESS, PUD_SIZE) >> PUD_SHIFT);
In this, on tile, we have FIRST_USER_ADDRESS defined as 0. round_up() has
the same type -- int. PUD_SHIFT.
I think the best way to fix it is to define FIRST_USER_ADDRESS as unsigned
long. On every arch for consistency.
Signed-off-by: Kirill A. Shutemov <[email protected] >
Reported-by: Wu Fengguang <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2015-02-11 17:06:03 -08:00
Kirill A. Shutemov
3ee802ead2
nios2: drop _PAGE_FILE and pte_file()-related helpers
...
We've replaced remap_file_pages(2) implementation with emulation. Nobody
creates non-linear mapping anymore.
Signed-off-by: Kirill A. Shutemov <[email protected] >
Cc: Ley Foon Tan <[email protected] >
Reviewed-by: Tobias Klauser <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2015-02-10 14:30:32 -08:00
Ley Foon Tan
cbd15b3fad
nios2: Page table management
...
This patch adds support for page table management.
Signed-off-by: Ley Foon Tan <[email protected] >
2014-12-08 12:55:53 +08:00