summaryrefslogtreecommitdiff
path: root/arch/x86/boot/compressed/pgtable_64.c
blob: b4469a37e9a16ff758c92e6159922c9dbb1b7228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <asm/processor.h>

/*
 * __force_order is used by special_insns.h asm code to force instruction
 * serialization.
 *
 * It is not referenced from the code, but GCC < 5 with -fPIE would fail
 * due to an undefined symbol. Define it to make these ancient GCCs work.
 */
unsigned long __force_order;

int l5_paging_required(void)
{
	/* Check if leaf 7 is supported. */

	if (native_cpuid_eax(0) < 7)
		return 0;

	/* Check if la57 is supported. */
	if (!(native_cpuid_ecx(7) & (1 << (X86_FEATURE_LA57 & 31))))
		return 0;

	/* Check if 5-level paging has already been enabled. */
	if (native_read_cr4() & X86_CR4_LA57)
		return 0;

	return 1;
}