All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/RFT PATCH 0/5] consolidate "System RAM" resources setup
@ 2021-05-31 12:29 ` Mike Rapoport
  0 siblings, 0 replies; 42+ messages in thread
From: Mike Rapoport @ 2021-05-31 12:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Catalin Marinas, Christian Borntraeger,
	David Hildenbrand, Heiko Carstens, Mike Rapoport, Mike Rapoport,
	Russell King, Thomas Bogendoerfer, Vasily Gorbik, Will Deacon,
	linux-arm-kernel, linux-mips, linux-mm, linux-s390

From: Mike Rapoport <rppt@linux.ibm.com>

Hi,

There are several architectures that use very similar code for setup if
"System RAM" resources under iomem_resource tree and requesting memory
resources corresponding to the kernel code, data etc.

The flow for resources setup iterates over memory regions registered in
memblock, adds a resource for each region as "System RAM" and than
registers the areas used by the kernel image and, optionally, the crash
kernel area, as children of the "System RAM" resources.

The notable differences are:
* arm/arm64 use [__text, __init_begin] range for kernel code resource and
  [_sdata, _end] range for kernel data, while most other architectures use
  more fine grained ranges.
* arm has "System RAM (boot alias)" that do not seem useful for any other
  architecture
* arm64 has special treatment for NOMAP areas and all the areas reserved in
  memblock
* s390 has crashk_res in parallel with the "System RAM" resource, but it
  seems it was required some time ago but no longer actually needed.

These patches use s390 implementation of the resource setup as the basis
and then switch MIPS, arm and arm64 to use it with modifications required
to support each architecture. 

The generic code loops over all memblock.memory regions, adds the NOMAP
regions as "reserved" iomem resources and "normal" regions as "System RAM"
iomem resrouces, reserves the areas occupied by the kernel code, rodata,
data and bss, if there is crash kernel resource it is also reserved.

In addition, if an architectures selects
CONFIG_ARCH_WANT_RESERVE_MEMBLOCK_RESERVED_REGIONS (bad name, but I could
not find a better one) the memblock.reserved regions are registered as
"reserved" resources in iomem_resource.

It would be also possible to convert other architectures (e.g, RISC-V and
sh) to use the common infrastructure.

Mike Rapoport (5):
  s390: make crashk_res resource a child of "System RAM"
  memblock: introduce generic memblock_setup_resources()
  arm: switch to generic memblock_setup_resources()
  MIPS: switch to generic memblock_setup_resources
  arm64: switch to generic memblock_setup_resources()

 arch/Kconfig              |   7 ++
 arch/arm/kernel/setup.c   |  37 +----------
 arch/arm64/Kconfig        |   1 +
 arch/arm64/kernel/setup.c | 101 +----------------------------
 arch/mips/kernel/setup.c  |  78 ++--------------------
 arch/s390/kernel/setup.c  |  86 +------------------------
 include/linux/memblock.h  |   2 +
 mm/memblock.c             | 132 ++++++++++++++++++++++++++++++++++++++
 8 files changed, 151 insertions(+), 293 deletions(-)


base-commit: c4681547bcce777daf576925a966ffa824edd09d
-- 
2.28.0


^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2021-06-03 10:34 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 12:29 [RFC/RFT PATCH 0/5] consolidate "System RAM" resources setup Mike Rapoport
2021-05-31 12:29 ` Mike Rapoport
2021-05-31 12:29 ` [RFC/RFT PATCH 1/5] s390: make crashk_res resource a child of "System RAM" Mike Rapoport
2021-05-31 12:29   ` Mike Rapoport
2021-06-01  8:45   ` David Hildenbrand
2021-06-01  8:45     ` David Hildenbrand
2021-06-01  9:02     ` David Hildenbrand
2021-06-01  9:02       ` David Hildenbrand
2021-06-02  6:25       ` Mike Rapoport
2021-06-02  6:25         ` Mike Rapoport
2021-06-01 13:18   ` Gerald Schaefer
2021-06-01 13:18     ` Gerald Schaefer
2021-06-02  6:54     ` Mike Rapoport
2021-06-02  6:54       ` Mike Rapoport
2021-05-31 12:29 ` [RFC/RFT PATCH 2/5] memblock: introduce generic memblock_setup_resources() Mike Rapoport
2021-05-31 12:29   ` Mike Rapoport
2021-06-01 13:54   ` Russell King (Oracle)
2021-06-01 13:54     ` Russell King (Oracle)
2021-06-02  8:33     ` Mike Rapoport
2021-06-02  8:33       ` Mike Rapoport
2021-06-02 10:15       ` Russell King (Oracle)
2021-06-02 10:15         ` Russell King (Oracle)
2021-06-02 13:54         ` Mike Rapoport
2021-06-02 13:54           ` Mike Rapoport
2021-06-02 15:51           ` Russell King (Oracle)
2021-06-02 15:51             ` Russell King (Oracle)
2021-06-02 18:43             ` Mike Rapoport
2021-06-02 18:43               ` Mike Rapoport
2021-06-02 20:15               ` Russell King (Oracle)
2021-06-02 20:15                 ` Russell King (Oracle)
2021-06-03 10:32                 ` Mike Rapoport
2021-06-03 10:32                   ` Mike Rapoport
2021-05-31 12:29 ` [RFC/RFT PATCH 3/5] arm: switch to " Mike Rapoport
2021-05-31 12:29   ` Mike Rapoport
2021-05-31 12:29 ` [RFC/RFT PATCH 4/5] MIPS: switch to generic memblock_setup_resources Mike Rapoport
2021-05-31 12:29   ` Mike Rapoport
2021-05-31 12:29 ` [RFC/RFT PATCH 5/5] arm64: switch to generic memblock_setup_resources() Mike Rapoport
2021-05-31 12:29   ` Mike Rapoport
2021-06-01 13:44 ` [RFC/RFT PATCH 0/5] consolidate "System RAM" resources setup Russell King (Oracle)
2021-06-01 13:44   ` Russell King (Oracle)
2021-06-02  7:05   ` Mike Rapoport
2021-06-02  7:05     ` Mike Rapoport

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.