blob: 4617a2bf123ca2802e8b44b0ba3c379576722cb5 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
H. Peter Anvin1965aae2008-10-22 22:26:29 -07002#ifndef _ASM_X86_SPARSEMEM_H
3#define _ASM_X86_SPARSEMEM_H
Thomas Gleixner8a423ff2008-01-30 13:30:37 +01004
5#ifdef CONFIG_SPARSEMEM
6/*
7 * generic non-linear memory support:
8 *
9 * 1) we will not split memory into more chunks than will fit into the flags
10 * field of the struct page
11 *
12 * SECTION_SIZE_BITS 2^n: size of each section
13 * MAX_PHYSADDR_BITS 2^n: max size of physical address space
14 * MAX_PHYSMEM_BITS 2^n: how much memory we can have in that space
15 *
16 */
17
Thomas Gleixner96a388d2007-10-11 11:20:03 +020018#ifdef CONFIG_X86_32
Thomas Gleixner8a423ff2008-01-30 13:30:37 +010019# ifdef CONFIG_X86_PAE
Jeremy Fitzhardingefb8e8372008-03-27 17:28:39 -070020# define SECTION_SIZE_BITS 29
Thomas Gleixner8a423ff2008-01-30 13:30:37 +010021# define MAX_PHYSADDR_BITS 36
22# define MAX_PHYSMEM_BITS 36
23# else
24# define SECTION_SIZE_BITS 26
25# define MAX_PHYSADDR_BITS 32
26# define MAX_PHYSMEM_BITS 32
27# endif
28#else /* CONFIG_X86_32 */
29# define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */
Kirill A. Shutemov162434e2018-02-14 14:16:54 +030030# define MAX_PHYSADDR_BITS (pgtable_l5_enabled ? 52 : 44)
31# define MAX_PHYSMEM_BITS (pgtable_l5_enabled ? 52 : 46)
Thomas Gleixner8a423ff2008-01-30 13:30:37 +010032#endif
33
34#endif /* CONFIG_SPARSEMEM */
H. Peter Anvin1965aae2008-10-22 22:26:29 -070035#endif /* _ASM_X86_SPARSEMEM_H */