Skip to contentSkip to conversation

mm/memblock: Introduce memblock_first_region_size() helper

PATCH In review Alexander Kuleshov 2 participants 6 messages Sep 1, 2015 – Sep 15, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover mm/memblock: Introduce memblock_first_region_size() helper

Some architectures (like s390, microblaze and etc...) require size
of the first memory region. This patch set provides new memblock_first_region_size() helper for this case and change usage of memblock.memory.regions[0].size on memblock_first_region_size() for the following architectures:

* s390
* microblaze
* arm
* unicore32

Changelog:

v2:

Added changes in the architectures to the patchset.

Alexander Kuleshov (5):
mm/memblock: Introduce memblock_first_region_size() helper s390/setup: use memblock_first_region_size helper microblaze/mm: Use memblock_first_region_size() helper unicore32/mmu: use memblock_first_region_size() helper arm/mmu: Use memblock_first_region_size() helper

 arch/arm/mm/mmu.c         | 2 +-
 arch/microblaze/mm/init.c | 6 +++---
 arch/s390/kernel/setup.c  | 2 +-
 arch/unicore32/mm/mmu.c   | 2 +-
 include/linux/memblock.h  | 1 +
 mm/memblock.c             | 5 +++++
 6 files changed, 12 insertions(+), 6 deletions(-)
Signature · 7 lines
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

PATCH v2 1/5 mm/memblock: Introduce memblock_first_region_size() helper

Some architectures (like s390, microblaze and etc...) require size of the first memory region. This patch provides new memblock_first_region_size() helper for this case.

---
 include/linux/memblock.h | 1 +
 mm/memblock.c            | 5 +++++
 2 files changed, 6 insertions(+)
include/linux/memblock.h +1 -0
index cc4b019..8a481e5 100644
@@ -319,6 +319,7 @@ phys_addr_t memblock_phys_mem_size(void);
 phys_addr_t memblock_mem_size(unsigned long limit_pfn);
 phys_addr_t memblock_start_of_DRAM(void);
 phys_addr_t memblock_end_of_DRAM(void);
+phys_addr_t memblock_first_region_size(void);
 void memblock_enforce_memory_limit(phys_addr_t memory_limit);
 int memblock_is_memory(phys_addr_t addr);
 int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
mm/memblock.c +5 -0
index 87108e7..fb4b7ca 100644
@@ -1463,6 +1463,11 @@ phys_addr_t __init_memblock memblock_end_of_DRAM(void)
 	return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size);
 }
 
+phys_addr_t __init_memblock memblock_first_region_size(void)
+{
+	return memblock.memory.regions[0].size;
+}
+
 void __init memblock_enforce_memory_limit(phys_addr_t limit)
 {
 	phys_addr_t max_addr = (phys_addr_t)ULLONG_MAX;
Signature · 7 lines
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#2 lore raw

mm/memblock.c phys_addr_t __init_memblock memblock_end_of_DRAM(void) · line 1470

Quoted 11 lines · On Tue, 1 Sep 2015 20:27:11 +0600 Alexander Kuleshov <[email protected]>…

Some architectures (like s390, microblaze and etc...) require size of the first memory region. This patch provides new memblock_first_region_size() helper for this case.

...

mm/memblock.c +5 -0
+phys_addr_t __init_memblock memblock_first_region_size(void)
+{
+	return memblock.memory.regions[0].size;
+}
+

Some callers call this from __init code, which is OK.

Other callers call it from an inlined function and I'm too lazy to work out if all the callers of those callers are calling memblock_first_region_size() from a compatible section.

So please either a) demonstrate that all the sectioning is correct (and maintainable!) or b) simply inline memblock_first_region_size()...

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

PATCH v2 2/5 s390/setup: use memblock_first_region_size helper

In reply to Alexander Kuleshov

The 0a11142e commit (mm/memblock: Introduce memblock_first_region_size() helper) introduced memblock_first_region_size() helper for the getting size of the first memblock region. Let's use it instead of directly access to structure.

---
 arch/s390/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/setup.c +1 -1
index ca070d2..69c3859 100644
@@ -563,7 +563,7 @@ static void __init reserve_crashkernel(void)
 	if (rc || crash_size == 0)
 		return;
 
-	if (memblock.memory.regions[0].size < crash_size) {
+	if (memblock_first_region_size() < crash_size) {
 		pr_info("crashkernel reservation failed: %s\n",
 			"first memory chunk must be at least crashkernel size");
 		return;
Signature · 1 line
2.5.0
#4 lore raw

PATCH v2 4/5 unicore32/mmu: use memblock_first_region_size() helper

In reply to Alexander Kuleshov

The 0a11142e commit (mm/memblock: Introduce memblock_first_region_size() helper) introduced memblock_first_region_size() helper for the getting size of the first memblock region. Let's use it instead of directly access to structure.

---
 arch/unicore32/mm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/unicore32/mm/mmu.c +1 -1
index 4f5a532..8cd2d9d 100644
@@ -314,7 +314,7 @@ static inline void prepare_page_table(void)
 	/*
 	 * Find the end of the first block of lowmem.
 	 */
-	end = memblock.memory.regions[0].base + memblock.memory.regions[0].size;
+	end = memblock.memory.regions[0].base + memblock_first_region_size();
 	if (end >= lowmem_limit)
 		end = lowmem_limit;
 
Signature · 1 line
2.5.0
#5 lore raw

PATCH v2 5/5 arm/mmu: Use memblock_first_region_size() helper

In reply to Alexander Kuleshov

The 0a11142e commit (mm/memblock: Introduce memblock_first_region_size() helper) introduced memblock_first_region_size() helper for the getting size of the first memblock region. Let's use it instead of directly access to structure.

---
 arch/arm/mm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/mmu.c +1 -1
index 870838a..fc60882 100644
@@ -1176,7 +1176,7 @@ static inline void prepare_page_table(void)
 	/*
 	 * Find the end of the first block of lowmem.
 	 */
-	end = memblock.memory.regions[0].base + memblock.memory.regions[0].size;
+	end = memblock.memory.regions[0].base + memblock_first_region_size();
 	if (end >= arm_lowmem_limit)
 		end = arm_lowmem_limit;
 
Signature · 1 line
2.5.0