Skip to contentSkip to conversation

mm/memblock: Add memblock_first_region_size() helper

PATCH Superseded Alexander Kuleshov 2 participants 2 messages Aug 27, 2015 – Aug 31, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/memblock: Add 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
#1 lore raw
Quoted 10 lines · On Fri, 28 Aug 2015 01:19:45 +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 +0 -0
@@ -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);

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

Quoted 10 lines
mm/memblock.c +5 -0
 }
 
+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;

We tend to avoid merging functions which have no callers. Some actual callsites should be included in the patch or patch series, please.

This is so we know it's useful, that it's getting runtime tested and to aid review.

--
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>