162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2012 ARM Ltd.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef __ASM_SPARSEMEM_H
662306a36Sopenharmony_ci#define __ASM_SPARSEMEM_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define MAX_PHYSMEM_BITS	CONFIG_ARM64_PA_BITS
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci/*
1162306a36Sopenharmony_ci * Section size must be at least 512MB for 64K base
1262306a36Sopenharmony_ci * page size config. Otherwise it will be less than
1362306a36Sopenharmony_ci * MAX_ORDER and the build process will fail.
1462306a36Sopenharmony_ci */
1562306a36Sopenharmony_ci#ifdef CONFIG_ARM64_64K_PAGES
1662306a36Sopenharmony_ci#define SECTION_SIZE_BITS 29
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#else
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/*
2162306a36Sopenharmony_ci * Section size must be at least 128MB for 4K base
2262306a36Sopenharmony_ci * page size config. Otherwise PMD based huge page
2362306a36Sopenharmony_ci * entries could not be created for vmemmap mappings.
2462306a36Sopenharmony_ci * 16K follows 4K for simplicity.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci#define SECTION_SIZE_BITS 27
2762306a36Sopenharmony_ci#endif /* CONFIG_ARM64_64K_PAGES */
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#endif
30