Skip to content
Snippets Groups Projects
Select Git revision
  • ecd60532e060e45c63c57ecf1c8549b1d656d34d
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

mcf_pgalloc.h

Blame
    • Greg Ungerer's avatar
      ecd60532
      m68k: fix "bad page state" oops on ColdFire boot · ecd60532
      Greg Ungerer authored
      
      Booting a ColdFire m68k core with MMU enabled causes a "bad page state"
      oops since commit 1d40a5ea ("mm: mark pages in use for page tables"):
      
       BUG: Bad page state in process sh  pfn:01ce2
       page:004fefc8 count:0 mapcount:-1024 mapping:00000000 index:0x0
       flags: 0x0()
       raw: 00000000 00000000 00000000 fffffbff 00000000 00000100 00000200 00000000
       raw: 039c4000
       page dumped because: nonzero mapcount
       Modules linked in:
       CPU: 0 PID: 22 Comm: sh Not tainted 4.17.0-07461-g1d40a5ea01d5 #13
      
      Fix by calling pgtable_page_dtor() in our __pte_free_tlb() code path,
      so that the PG_table flag is cleared before we free the pte page.
      
      Note that I had to change the type of pte_free() to be static from
      extern. Otherwise you get a lot of warnings like this:
      
      ./arch/m68k/include/asm/mcf_pgalloc.h:80:2: warning: ‘pgtable_page_dtor’ is static but used in inline function ‘pte_free’ which is not static
        pgtable_page_dtor(page);
        ^
      
      And making it static is consistent with our use of this in the other
      m68k pgalloc definitions of pte_free().
      
      Signed-off-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
      CC: Matthew Wilcox <willy@infradead.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      ecd60532
      History
      m68k: fix "bad page state" oops on ColdFire boot
      Greg Ungerer authored
      
      Booting a ColdFire m68k core with MMU enabled causes a "bad page state"
      oops since commit 1d40a5ea ("mm: mark pages in use for page tables"):
      
       BUG: Bad page state in process sh  pfn:01ce2
       page:004fefc8 count:0 mapcount:-1024 mapping:00000000 index:0x0
       flags: 0x0()
       raw: 00000000 00000000 00000000 fffffbff 00000000 00000100 00000200 00000000
       raw: 039c4000
       page dumped because: nonzero mapcount
       Modules linked in:
       CPU: 0 PID: 22 Comm: sh Not tainted 4.17.0-07461-g1d40a5ea01d5 #13
      
      Fix by calling pgtable_page_dtor() in our __pte_free_tlb() code path,
      so that the PG_table flag is cleared before we free the pte page.
      
      Note that I had to change the type of pte_free() to be static from
      extern. Otherwise you get a lot of warnings like this:
      
      ./arch/m68k/include/asm/mcf_pgalloc.h:80:2: warning: ‘pgtable_page_dtor’ is static but used in inline function ‘pte_free’ which is not static
        pgtable_page_dtor(page);
        ^
      
      And making it static is consistent with our use of this in the other
      m68k pgalloc definitions of pte_free().
      
      Signed-off-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
      CC: Matthew Wilcox <willy@infradead.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    sun3_pgalloc.h 1.41 KiB
    /* SPDX-License-Identifier: GPL-2.0 */
    /* sun3_pgalloc.h --
     * reorganization around 2.3.39, routines moved from sun3_pgtable.h
     *
     *
     * 02/27/2002 -- Modified to support "highpte" implementation in 2.5.5 (Sam)
     *
     * moved 1/26/2000 Sam Creasey
     */
    
    #ifndef _SUN3_PGALLOC_H
    #define _SUN3_PGALLOC_H
    
    #include <asm/tlb.h>
    
    #include <asm-generic/pgalloc.h>	/* for pte_{alloc,free}_one */
    
    extern const char bad_pmd_string[];
    
    #define __pte_free_tlb(tlb,pte,addr)			\
    do {							\
    	pgtable_pte_page_dtor(pte);			\
    	tlb_remove_page((tlb), pte);			\
    } while (0)
    
    static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
    {
    	pmd_val(*pmd) = __pa((unsigned long)pte);
    }
    
    static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page)
    {
    	pmd_val(*pmd) = __pa((unsigned long)page_address(page));
    }
    #define pmd_pgtable(pmd) pmd_page(pmd)
    
    /*
     * allocating and freeing a pmd is trivial: the 1-entry pmd is
     * inside the pgd, so has no extra memory associated with it.
     */
    #define pmd_free(mm, x)			do { } while (0)
    
    static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
    {
            free_page((unsigned long) pgd);
    }
    
    static inline pgd_t * pgd_alloc(struct mm_struct *mm)
    {
         pgd_t *new_pgd;
    
         new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL);
         memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
         memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT));
         return new_pgd;
    }
    
    #endif /* SUN3_PGALLOC_H */