mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
7d8ed162e6
commit 6a9531c3a8
("memblock: fix crash when reserved memory is not
added to memory") introduce the usage of early_pfn_to_nid, which is not
defined in memblock tests.
The original definition of early_pfn_to_nid is defined in mm.h, so let
add this in the corresponding mm.h.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Yajun Deng <yajun.deng@linux.dev>
CC: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/20240402132701.29744-2-richard.weiyang@gmail.com
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
45 lines
973 B
C
45 lines
973 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _TOOLS_LINUX_MM_H
|
|
#define _TOOLS_LINUX_MM_H
|
|
|
|
#include <linux/mmzone.h>
|
|
#include <uapi/linux/const.h>
|
|
|
|
#define PAGE_SHIFT 12
|
|
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
|
|
#define PAGE_MASK (~(PAGE_SIZE - 1))
|
|
|
|
#define PHYS_ADDR_MAX (~(phys_addr_t)0)
|
|
|
|
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
|
|
#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
|
|
|
|
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
|
|
|
|
#define __va(x) ((void *)((unsigned long)(x)))
|
|
#define __pa(x) ((unsigned long)(x))
|
|
|
|
#define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE))
|
|
|
|
#define phys_to_virt phys_to_virt
|
|
static inline void *phys_to_virt(unsigned long address)
|
|
{
|
|
return __va(address);
|
|
}
|
|
|
|
void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid);
|
|
|
|
static inline void totalram_pages_inc(void)
|
|
{
|
|
}
|
|
|
|
static inline void totalram_pages_add(long count)
|
|
{
|
|
}
|
|
|
|
static inline int early_pfn_to_nid(unsigned long pfn)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#endif
|