Mike Rapoport (Microsoft)
4267739cab
arch, mm: consolidate initialization of SPARSE memory model
...
Every architecture calls sparse_init() during setup_arch() although the
data structures created by sparse_init() are not used until the
initialization of the core MM.
Beside the code duplication, calling sparse_init() from architecture
specific code causes ordering differences of vmemmap and HVO
initialization on different architectures.
Move the call to sparse_init() from architecture specific code to
free_area_init() to ensure that vmemmap and HVO initialization order is
always the same.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport (Microsoft) <[email protected] >
Cc: Alexander Gordeev <[email protected] >
Cc: Alex Shi <[email protected] >
Cc: Andreas Larsson <[email protected] >
Cc: "Borislav Petkov (AMD)" <[email protected] >
Cc: Catalin Marinas <[email protected] >
Cc: David Hildenbrand <[email protected] >
Cc: David S. Miller <[email protected] >
Cc: Dinh Nguyen <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Guo Ren <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: Huacai Chen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Johannes Berg <[email protected] >
Cc: John Paul Adrian Glaubitz <[email protected] >
Cc: Jonathan Corbet <[email protected] >
Cc: Klara Modin <[email protected] >
Cc: Liam Howlett <[email protected] >
Cc: Lorenzo Stoakes <[email protected] >
Cc: Magnus Lindholm <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Hocko <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Muchun Song <[email protected] >
Cc: Oscar Salvador <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Pratyush Yadav <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: "Ritesh Harjani (IBM)" <[email protected] >
Cc: Russell King <[email protected] >
Cc: Stafford Horne <[email protected] >
Cc: Suren Baghdasaryan <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Vasily Gorbik <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Will Deacon <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2026-01-26 20:02:18 -08:00
Mike Rapoport (Microsoft)
d49004c5f0
arch, mm: consolidate initialization of nodes, zones and memory map
...
To initialize node, zone and memory map data structures every architecture
calls free_area_init() during setup_arch() and passes it an array of zone
limits.
Beside code duplication it creates "interesting" ordering cases between
allocation and initialization of hugetlb and the memory map. Some
architectures allocate hugetlb pages very early in setup_arch() in certain
cases, some only create hugetlb CMA areas in setup_arch() and sometimes
hugetlb allocations happen mm_core_init().
With arch_zone_limits_init() helper available now on all architectures it
is no longer necessary to call free_area_init() from architecture setup
code. Rather core MM initialization can call arch_zone_limits_init() in a
single place.
This allows to unify ordering of hugetlb vs memory map allocation and
initialization.
Remove the call to free_area_init() from architecture specific code and
place it in a new mm_core_init_early() function that is called immediately
after setup_arch().
After this refactoring it is possible to consolidate hugetlb allocations
and eliminate differences in ordering of hugetlb and memory map
initialization among different architectures.
As the first step of this consolidation move hugetlb_bootmem_alloc() to
mm_core_early_init().
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport (Microsoft) <[email protected] >
Cc: Alexander Gordeev <[email protected] >
Cc: Alex Shi <[email protected] >
Cc: Andreas Larsson <[email protected] >
Cc: "Borislav Petkov (AMD)" <[email protected] >
Cc: Catalin Marinas <[email protected] >
Cc: David Hildenbrand <[email protected] >
Cc: David S. Miller <[email protected] >
Cc: Dinh Nguyen <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Guo Ren <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: Huacai Chen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Johannes Berg <[email protected] >
Cc: John Paul Adrian Glaubitz <[email protected] >
Cc: Jonathan Corbet <[email protected] >
Cc: Klara Modin <[email protected] >
Cc: Liam Howlett <[email protected] >
Cc: Lorenzo Stoakes <[email protected] >
Cc: Magnus Lindholm <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Hocko <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Muchun Song <[email protected] >
Cc: Oscar Salvador <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Pratyush Yadav <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: "Ritesh Harjani (IBM)" <[email protected] >
Cc: Russell King <[email protected] >
Cc: Stafford Horne <[email protected] >
Cc: Suren Baghdasaryan <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Vasily Gorbik <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Will Deacon <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2026-01-26 20:02:18 -08:00
Mike Rapoport (Microsoft)
37318eb97f
csky: introduce arch_zone_limits_init()
...
Move calculations of zone limits to a dedicated arch_zone_limits_init()
function.
Later MM core will use this function as an architecture specific callback
during nodes and zones initialization and thus there won't be a need to
call free_area_init() from every architecture.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport (Microsoft) <[email protected] >
Acked-by: Guo Ren <[email protected] >
Cc: Alexander Gordeev <[email protected] >
Cc: Alex Shi <[email protected] >
Cc: Andreas Larsson <[email protected] >
Cc: "Borislav Petkov (AMD)" <[email protected] >
Cc: Catalin Marinas <[email protected] >
Cc: David Hildenbrand <[email protected] >
Cc: David S. Miller <[email protected] >
Cc: Dinh Nguyen <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: Huacai Chen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Johannes Berg <[email protected] >
Cc: John Paul Adrian Glaubitz <[email protected] >
Cc: Jonathan Corbet <[email protected] >
Cc: Klara Modin <[email protected] >
Cc: Liam Howlett <[email protected] >
Cc: Lorenzo Stoakes <[email protected] >
Cc: Magnus Lindholm <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Hocko <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Muchun Song <[email protected] >
Cc: Oscar Salvador <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Pratyush Yadav <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: "Ritesh Harjani (IBM)" <[email protected] >
Cc: Russell King <[email protected] >
Cc: Stafford Horne <[email protected] >
Cc: Suren Baghdasaryan <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Vasily Gorbik <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Will Deacon <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2026-01-26 20:02:14 -08:00
Mike Rapoport (Microsoft)
2b1d532e10
csky: move setup_initrd() to setup.c
...
Memory used by initrd should be reserved as soon as possible before
there any memblock allocations that might overwrite that memory.
This will also help with pulling out memblock_free_all() to the generic
code and reducing code duplication in arch::mem_init().
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport (Microsoft) <[email protected] >
Acked-by: Guo Ren (csky) <[email protected] >
Cc: Alexander Gordeev <[email protected] >
Cc: Andreas Larsson <[email protected] >
Cc: Andy Lutomirski <[email protected] >
Cc: Ard Biesheuvel <[email protected] >
Cc: Arnd Bergmann <[email protected] >
Cc: Borislav Betkov <[email protected] >
Cc: Catalin Marinas <[email protected] >
Cc: Dave Hansen <[email protected] >
Cc: David S. Miller <[email protected] >
Cc: Dinh Nguyen <[email protected] >
Cc: Geert Uytterhoeven <[email protected] >
Cc: Gerald Schaefer <[email protected] >
Cc: Heiko Carstens <[email protected] >
Cc: Helge Deller <[email protected] >
Cc: Huacai Chen <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: Jiaxun Yang <[email protected] >
Cc: Johannes Berg <[email protected] >
Cc: John Paul Adrian Glaubitz <[email protected] >
Cc: Madhavan Srinivasan <[email protected] >
Cc: Mark Brown <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: Russel King <[email protected] >
Cc: Stafford Horne <[email protected] >
Cc: Thomas Bogendoerfer <[email protected] >
Cc: Thomas Gleinxer <[email protected] >
Cc: Vasily Gorbik <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Will Deacon <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2025-03-17 22:06:51 -07:00
Usama Arif
b2473a3597
of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify
...
__pa() is only intended to be used for linear map addresses and using
it for initial_boot_params which is in fixmap for arm64 will give an
incorrect value. Hence save the physical address when it is known at
boot time when calling early_init_dt_scan for arm64 and use it at kexec
time instead of converting the virtual address using __pa().
Note that arm64 doesn't need the FDT region reserved in the DT as the
kernel explicitly reserves the passed in FDT. Therefore, only a debug
warning is fixed with this change.
Reported-by: Breno Leitao <[email protected] >
Suggested-by: Mark Rutland <[email protected] >
Signed-off-by: Usama Arif <[email protected] >
Fixes: ac10be5cdb ("arm64: Use common of_kexec_alloc_and_setup_fdt()")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring (Arm) <[email protected] >
2024-10-29 15:32:45 -05:00
Arnd Bergmann
fd90410e9d
vgacon, arch/*: remove unused screen_info definitions
...
A number of architectures either kept the screen_info definition for
historical purposes as it used to be required by the generic VT code, or
they copied it from another architecture in order to build the VGA console
driver in an allmodconfig build. The mips definition is used by some
platforms, but the initialization on jazz is not needed.
Now that vgacon no longer builds on these architectures, remove the
stale definitions and initializations.
Reviewed-by: Javier Martinez Canillas <[email protected] >
Reviewed-by: Thomas Zimmermann <[email protected] >
Reviewed-by: Philippe Mathieu-Daudé <[email protected] >
Acked-by: Dinh Nguyen <[email protected] >
Acked-by: Max Filippov <[email protected] >
Acked-by: Palmer Dabbelt <[email protected] >
Acked-by: Guo Ren <[email protected] >
Acked-by: Helge Deller <[email protected] >
Signed-off-by: Arnd Bergmann <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2023-10-17 10:17:02 +02:00
Guo Ren
f54af50d7b
csky: Correct position of _stext
...
Correct position of _stext to prevent check_kernel_text_object
warning [1].
[1] https://lore.kernel.org/linux-csky/YfLpNkmlvoR8iPcq@ls3530/
Signed-off-by: Guo Ren <[email protected] >
Signed-off-by: Guo Ren <[email protected] >
Cc: Helge Deller <[email protected] >
2022-07-22 21:36:14 -04:00
Kefeng Wang
79886ddced
csky: convert to setup_initial_init_mm()
...
Use setup_initial_init_mm() helper to simplify code.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kefeng Wang <[email protected] >
Acked-by: Guo Ren <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2021-07-08 11:48:21 -07:00
Guo Ren
0c8a32eed1
csky: Add memory layout 2.5G(user):1.5G(kernel)
...
There are two ways for translating va to pa for csky:
- Use TLB(Translate Lookup Buffer) and PTW (Page Table Walk)
- Use SSEG0/1 (Simple Segment Mapping)
We use tlb mapping 0-2G and 3G-4G virtual address area and SSEG0/1
are for 2G-2.5G and 2.5G-3G translation. We could disable SSEG0
to use 2G-2.5G as TLB user mapping.
Signed-off-by: Guo Ren <[email protected] >
2021-01-12 09:52:40 +08:00
Christoph Hellwig
0b1abd1fb7
dma-mapping: merge <linux/dma-contiguous.h> into <linux/dma-map-ops.h>
...
Merge dma-contiguous.h into dma-map-ops.h, after removing the comment
describing the contiguous allocator into kernel/dma/contigous.c.
Signed-off-by: Christoph Hellwig <[email protected] >
2020-10-06 07:07:04 +02:00
Mike Rapoport
8f4693f0e0
csky: simplify detection of memory zone boundaries
...
The free_area_init() function only requires the definition of maximal PFN
for each of the supported zone rater than calculation of actual zone sizes
and the sizes of the holes between the zones.
After removal of CONFIG_HAVE_MEMBLOCK_NODE_MAP the free_area_init() is
available to all architectures.
Using this function instead of free_area_init_node() simplifies the zone
detection.
Signed-off-by: Mike Rapoport <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Tested-by: Hoan Tran <[email protected] > [arm64]
Cc: Baoquan He <[email protected] >
Cc: Brian Cain <[email protected] >
Cc: Catalin Marinas <[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: "James E.J. Bottomley" <[email protected] >
Cc: Jonathan Corbet <[email protected] >
Cc: Ley Foon Tan <[email protected] >
Cc: Mark Salter <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Max Filippov <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Hocko <[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: Tony Luck <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Yoshinori Sato <[email protected] >
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected] >
2020-06-03 20:09:43 -07:00
Guo Ren
aefd9461d3
csky: Fixup cpu speculative execution to IO area
...
For the memory size ( > 512MB, < 1GB), the MSA setting is:
- SSEG0: PHY_START , PHY_START + 512MB
- SSEG1: PHY_START + 512MB, PHY_START + 1GB
But the real memory is no more than 1GB, there is a gap between the
end size of memory and border of 1GB. CPU could speculatively
execute to that gap and if the gap of the bus couldn't respond to
the CPU request, then the crash will happen.
Now make the setting with:
- SSEG0: PHY_START , PHY_START + 512MB (no change)
- SSEG1: Disabled (We use highmem to use the memory of 512MB~1GB)
We also deprecated zhole_szie[] settings, it's only used by arm
style CPUs. All memory gap should use Reserved setting of dts in
csky system.
Signed-off-by: Guo Ren <[email protected] >
2020-04-03 12:40:07 +08:00
Guo Ren
d46869aaab
csky: Add setup_initrd check code
...
We should give some necessary check for initrd just like other
architectures and it seems that setup_initrd() could be a common
code for all architectures.
Signed-off-by: Guo Ren <[email protected] >
2020-02-21 15:43:25 +08:00
Guo Ren
f136008f31
csky: Separate fixaddr_init from highmem
...
After fixaddr_init is separated from highmem, we could use tcm
without highmem selected. (610 (abiv1) don't support highmem,
but it could use tcm now.)
Signed-off-by: Guo Ren <[email protected] >
2020-02-21 15:43:24 +08:00
Arvind Sankar
fb3e7a6220
arch/csky/setup: Drop dummy_con initialization
...
con_init in tty/vt.c will now set conswitchp to dummy_con if it's unset.
Drop it from arch setup code.
Signed-off-by: Arvind Sankar <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2020-01-14 15:29:16 +01:00
Guo Ren
683fafebf9
csky: Use va_pa_offset instead of phys_offset
...
The name of phys_offset is so common for global export and it may
conflict with some local name. So change phys_offset to va_pa_offset
which also used by riscv.
Also use __pa() and __va() instead of using phys_offset directly.
Signed-off-by: Guo Ren <[email protected] >
Cc: Arnd Bergmann <[email protected] >
2019-04-22 13:44:57 +08:00
Guo Ren
205353fa06
csky: Support vmlinux bootup with MMU off
...
Modify SETUP_MMU macro to fit on both MMU-on or MMU-off enviornment
and vmlinux could bootup from MMU off enviornment for some cases.
Unify the style of _start and _start_smp_secondary in head.S to make
head.S looks more concise and easy to understand.
Signed-off-by: Guo Ren <[email protected] >
Cc: Arnd Bergmann <[email protected] >
2019-04-22 13:44:57 +08:00
Guo Ren
f62e31623d
csky: Support dynamic start physical address
...
Before this patch csky-linux need CONFIG_RAM_BASE to determine start
physical address. Now we use phys_offset variable to replace the macro
of PHYS_OFFSET and we setup phys_offset with real physical address which
is determined during startup in head.S.
With this patch we needn't re-compile kernel for different start
physical address. ie: 0x0 / 0xc0000000 start physical address could use
the same vmlinux, be care different start address must be 512MB aligned.
Signed-off-by: Guo Ren <[email protected] >
Cc: Arnd Bergmann <[email protected] >
2019-04-22 13:44:57 +08:00
Mike Rapoport
aca52c3983
mm: remove CONFIG_HAVE_MEMBLOCK
...
All architecures use memblock for early memory management. There is no need
for the CONFIG_HAVE_MEMBLOCK configuration option.
[[email protected] : of/fdt: fixup #ifdefs]
Link: http://lkml.kernel.org/r/20180919103457.GA20545@rapoport-lnx
[[email protected] : csky: fixups after bootmem removal]
Link: http://lkml.kernel.org/r/20180926112744.GC4628@rapoport-lnx
[[email protected] : remove stale #else and the code it protects]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport <[email protected] >
Acked-by: Michal Hocko <[email protected] >
Tested-by: Jonathan Cameron <[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 Kroah-Hartman <[email protected] >
Cc: Guan Xuetao <[email protected] >
Cc: Ingo Molnar <[email protected] >
Cc: "James E.J. Bottomley" <[email protected] >
Cc: Jonas Bonn <[email protected] >
Cc: Jonathan Corbet <[email protected] >
Cc: Ley Foon Tan <[email protected] >
Cc: Mark Salter <[email protected] >
Cc: Martin Schwidefsky <[email protected] >
Cc: Matt Turner <[email protected] >
Cc: Michael Ellerman <[email protected] >
Cc: Michal Simek <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Paul Burton <[email protected] >
Cc: Richard Kuo <[email protected] >
Cc: Richard Weinberger <[email protected] >
Cc: Rich Felker <[email protected] >
Cc: Russell King <[email protected] >
Cc: Serge Semin <[email protected] >
Cc: Thomas Gleixner <[email protected] >
Cc: Tony Luck <[email protected] >
Cc: Vineet Gupta <[email protected] >
Cc: Yoshinori Sato <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2018-10-31 08:54:15 -07:00
Guo Ren
9143a9359d
csky: Kernel booting
...
This patch add boot code. Thx boot params is all in dtb and it's
the only way to let kernel get bootloader param information.
Signed-off-by: Guo Ren <[email protected] >
Reviewed-by: Arnd Bergmann <[email protected] >
2018-10-25 23:36:19 +08:00