9 #include <linux/random.h>
10 #include <linux/kernel.h>
14 #include <asm/cacheflush.h>
15 #include <asm/pgtable.h>
16 #include <asm/kdebug.h>
27 #elif defined(CONFIG_X86_PAE)
35 #define PAGE_CPA_TEST __pgprot(_PAGE_CPA_TEST)
49 long i, expected, missed = 0;
73 "%lx level %d but not PSE %Lx\n",
85 if (addr < s->min_exec)
93 " 4k %lu large %lu gb %lu x %lu[%lx-%lx] miss %lu\n",
102 max_pfn_mapped, expected);
112 static int pageattr_test(
void)
121 unsigned long test_addr;
126 bm =
vzalloc((max_pfn_mapped + 7) / 8);
132 failed += print_split(&
sa);
135 for (i = 0; i <
NTEST; i++) {
140 len[
i] =
min_t(
unsigned long, len[i], max_pfn_mapped - pfn - 1);
148 for (k = 0; k < len[
i]; k++) {
170 if (!addr[i] || !pte || !k) {
176 err = change_page_attr_set(&test_addr, len[i],
PAGE_CPA_TEST, 0);
183 if (!pte || !pte_testbit(*pte) ||
pte_huge(*pte)) {
197 failed += print_split(&
sb);
199 for (i = 0; i <
NTEST; i++) {
209 err = change_page_attr_clear(&test_addr, len[i],
PAGE_CPA_TEST, 0);
215 if (!pte || pte_testbit(*pte)) {
223 failed += print_split(&
sc);
236 static int do_pageattr_test(
void *
__unused)
240 if (pageattr_test() < 0)
248 static int start_pageattr_test(
void)