]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - arch/x86/mm/init_32.c
x86 32-bit boot: rename bt_ioremap() to early_ioremap()
[mirror_ubuntu-jammy-kernel.git] / arch / x86 / mm / init_32.c
index 459b384acda9ea40282becd59ba9190fa31ef860..e00c1d7128b1a29a2d01c9a10628231220e2a4f9 100644 (file)
@@ -429,9 +429,11 @@ static void __init pagetable_init (void)
         * Fixed mappings, only the page table structure has to be
         * created - mappings will be set by set_fixmap():
         */
+       early_ioremap_clear();
        vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
        end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK;
        page_table_range_init(vaddr, end, pgd_base);
+       early_ioremap_reset();
 
        permanent_kmaps_init(pgd_base);
 
@@ -535,14 +537,15 @@ int __init set_kernel_exec(unsigned long vaddr, int enable)
 {
        pte_t *pte;
        int ret = 1;
+       int level;
 
        if (!nx_enabled)
                goto out;
 
-       pte = lookup_address(vaddr);
+       pte = lookup_address(vaddr, &level);
        BUG_ON(!pte);
 
-       if (!pte_exec_kernel(*pte))
+       if (!pte_exec(*pte))
                ret = 0;
 
        if (enable)
@@ -799,6 +802,20 @@ void mark_rodata_ro(void)
                change_page_attr(virt_to_page(start),
                                 size >> PAGE_SHIFT, PAGE_KERNEL_RX);
                printk("Write protecting the kernel text: %luk\n", size >> 10);
+
+#ifdef CONFIG_CPA_DEBUG
+               global_flush_tlb();
+
+               printk("Testing CPA: Reverting %lx-%lx\n", start, start+size);
+               change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
+                                PAGE_KERNEL_EXEC);
+               global_flush_tlb();
+
+               printk("Testing CPA: write protecting again\n");
+               change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
+                               PAGE_KERNEL_RX);
+               global_flush_tlb();
+#endif
        }
 #endif
        start += size;
@@ -815,6 +832,18 @@ void mark_rodata_ro(void)
         * of who is the culprit.
         */
        global_flush_tlb();
+
+#ifdef CONFIG_CPA_DEBUG
+       printk("Testing CPA: undo %lx-%lx\n", start, start + size);
+       change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
+                               PAGE_KERNEL);
+       global_flush_tlb();
+
+       printk("Testing CPA: write protecting again\n");
+       change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
+                               PAGE_KERNEL_RO);
+       global_flush_tlb();
+#endif
 }
 #endif