Message ID | 20240529171236.32002-4-Jonathan.Cameron@huawei.com |
---|---|
State | New, archived |
Headers | show |
Series | arm64/memblock: Handling of CXL Fixed Memory Windows. | expand |
On Wed, May 29, 2024 at 06:12:31PM +0100, Jonathan Cameron wrote: > For CXL CFMWS regions, need to add memblocks that may not be > in the system memory map so that their nid can be queried later. > Add a function to make this easy to do. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > include/linux/memblock.h | 2 ++ > mm/memblock.c | 11 +++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > index c7d518a54359..9ac1ed8c3293 100644 > --- a/include/linux/memblock.h > +++ b/include/linux/memblock.h > @@ -113,6 +113,8 @@ static inline void memblock_discard(void) {} > void memblock_allow_resize(void); > int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid, > enum memblock_flags flags); > +int memblock_add_reserved_node(phys_addr_t base, phys_addr_t size, int nid, > + enum memblock_flags flags); > int memblock_add(phys_addr_t base, phys_addr_t size); > int memblock_remove(phys_addr_t base, phys_addr_t size); > int memblock_phys_free(phys_addr_t base, phys_addr_t size); > diff --git a/mm/memblock.c b/mm/memblock.c > index 5498d5ea70b4..8d02f75ec186 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -714,6 +714,17 @@ int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size, > return memblock_add_range(&memblock.memory, base, size, nid, flags); > } > > +int __init_memblock memblock_add_reserved_node(phys_addr_t base, phys_addr_t size, > + int nid, enum memblock_flags flags) > +{ > + phys_addr_t end = base + size - 1; > + > + memblock_dbg("%s: [%pa-%pa] nid=%d flags=%x %pS\n", __func__, > + &base, &end, nid, flags, (void *)_RET_IP_); > + > + return memblock_add_range(&memblock.reserved, base, size, nid, flags); > +} > + > /** > * memblock_add - add new memblock region > * @base: base address of the new region > -- > 2.39.2 > Tested-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index c7d518a54359..9ac1ed8c3293 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -113,6 +113,8 @@ static inline void memblock_discard(void) {} void memblock_allow_resize(void); int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid, enum memblock_flags flags); +int memblock_add_reserved_node(phys_addr_t base, phys_addr_t size, int nid, + enum memblock_flags flags); int memblock_add(phys_addr_t base, phys_addr_t size); int memblock_remove(phys_addr_t base, phys_addr_t size); int memblock_phys_free(phys_addr_t base, phys_addr_t size); diff --git a/mm/memblock.c b/mm/memblock.c index 5498d5ea70b4..8d02f75ec186 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -714,6 +714,17 @@ int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size, return memblock_add_range(&memblock.memory, base, size, nid, flags); } +int __init_memblock memblock_add_reserved_node(phys_addr_t base, phys_addr_t size, + int nid, enum memblock_flags flags) +{ + phys_addr_t end = base + size - 1; + + memblock_dbg("%s: [%pa-%pa] nid=%d flags=%x %pS\n", __func__, + &base, &end, nid, flags, (void *)_RET_IP_); + + return memblock_add_range(&memblock.reserved, base, size, nid, flags); +} + /** * memblock_add - add new memblock region * @base: base address of the new region
For CXL CFMWS regions, need to add memblocks that may not be in the system memory map so that their nid can be queried later. Add a function to make this easy to do. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> --- include/linux/memblock.h | 2 ++ mm/memblock.c | 11 +++++++++++ 2 files changed, 13 insertions(+)