Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'powerpc-6.6-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

- Fix boot crash with FLATMEM since set_ptes() introduction

- Avoid calling arch_enter/leave_lazy_mmu() in set_ptes()

Thanks to Aneesh Kumar K.V and Erhard Furtner.

* tag 'powerpc-6.6-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/mm: Avoid calling arch_enter/leave_lazy_mmu() in set_ptes
powerpc/mm: Fix boot crash with FLATMEM

+24 -11
+2
arch/powerpc/kernel/setup-common.c
··· 948 948 949 949 /* Parse memory topology */ 950 950 mem_topology_setup(); 951 + /* Set max_mapnr before paging_init() */ 952 + set_max_mapnr(max_pfn); 951 953 952 954 /* 953 955 * Release secondary cpus out of their spinloops at 0x60 now that
-1
arch/powerpc/mm/mem.c
··· 288 288 #endif 289 289 290 290 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); 291 - set_max_mapnr(max_pfn); 292 291 293 292 kasan_late_init(); 294 293
+22 -10
arch/powerpc/mm/pgtable.c
··· 104 104 /* Embedded type MMU with HW exec support. This is a bit more complicated 105 105 * as we don't have two bits to spare for _PAGE_EXEC and _PAGE_HWEXEC so 106 106 * instead we "filter out" the exec permission for non clean pages. 107 + * 108 + * This is also called once for the folio. So only work with folio->flags here. 107 109 */ 108 110 static inline pte_t set_pte_filter(pte_t pte) 109 111 { ··· 192 190 void set_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, 193 191 pte_t pte, unsigned int nr) 194 192 { 195 - /* 196 - * Make sure hardware valid bit is not set. We don't do 197 - * tlb flush for this update. 198 - */ 199 - VM_WARN_ON(pte_hw_valid(*ptep) && !pte_protnone(*ptep)); 200 193 201 194 /* Note: mm->context.id might not yet have been assigned as 202 195 * this context might not have been activated yet when this 203 - * is called. 196 + * is called. Filter the pte value and use the filtered value 197 + * to setup all the ptes in the range. 204 198 */ 205 199 pte = set_pte_filter(pte); 206 200 207 - /* Perform the setting of the PTE */ 208 - arch_enter_lazy_mmu_mode(); 201 + /* 202 + * We don't need to call arch_enter/leave_lazy_mmu_mode() 203 + * because we expect set_ptes to be only be used on not present 204 + * and not hw_valid ptes. Hence there is no translation cache flush 205 + * involved that need to be batched. 206 + */ 209 207 for (;;) { 208 + 209 + /* 210 + * Make sure hardware valid bit is not set. We don't do 211 + * tlb flush for this update. 212 + */ 213 + VM_WARN_ON(pte_hw_valid(*ptep) && !pte_protnone(*ptep)); 214 + 215 + /* Perform the setting of the PTE */ 210 216 __set_pte_at(mm, addr, ptep, pte, 0); 211 217 if (--nr == 0) 212 218 break; 213 219 ptep++; 214 - pte = __pte(pte_val(pte) + (1UL << PTE_RPN_SHIFT)); 215 220 addr += PAGE_SIZE; 221 + /* 222 + * increment the pfn. 223 + */ 224 + pte = pfn_pte(pte_pfn(pte) + 1, pte_pgprot((pte))); 216 225 } 217 - arch_leave_lazy_mmu_mode(); 218 226 } 219 227 220 228 void unmap_kernel_page(unsigned long va)