Skip to content
Snippets Groups Projects
Select Git revision
  • 60e50f34b13e9e40763be12aa55f2144d8da514c
  • 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

mmu_context.h

Blame
    • Mike Rapoport's avatar
      60e50f34
      m68k: mm: use pgtable-nopXd instead of 4level-fixup · 60e50f34
      Mike Rapoport authored
      m68k has two or three levels of page tables and can use appropriate
      pgtable-nopXd and folding of the upper layers.
      
      Replace usage of include/asm-generic/4level-fixup.h and explicit
      definitions of __PAGETABLE_PxD_FOLDED in m68k with
      include/asm-generic/pgtable-nopmd.h for two-level configurations and
      with include/asm-generic/pgtable-nopud.h for three-lelve configurations
      and adjust page table manipulation macros and functions accordingly.
      
      [akpm@linux-foundation.org: fix merge glitch]
      [geert@linux-m68k.org: more merge glitch fixes]
      [akpm@linux-foundation.org: s/bad_pgd/bad_pud/, per Mike]
      Link: http://lkml.kernel.org/r/1572938135-31886-6-git-send-email-rppt@kernel.org
      
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
      Cc: Anatoly Pugachev <matorola@gmail.com>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Peter Rosin <peda@axentia.se>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Russell King <rmk+kernel@armlinux.org.uk>
      Cc: Sam Creasey <sammy@sammy.net>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      60e50f34
      History
      m68k: mm: use pgtable-nopXd instead of 4level-fixup
      Mike Rapoport authored
      m68k has two or three levels of page tables and can use appropriate
      pgtable-nopXd and folding of the upper layers.
      
      Replace usage of include/asm-generic/4level-fixup.h and explicit
      definitions of __PAGETABLE_PxD_FOLDED in m68k with
      include/asm-generic/pgtable-nopmd.h for two-level configurations and
      with include/asm-generic/pgtable-nopud.h for three-lelve configurations
      and adjust page table manipulation macros and functions accordingly.
      
      [akpm@linux-foundation.org: fix merge glitch]
      [geert@linux-m68k.org: more merge glitch fixes]
      [akpm@linux-foundation.org: s/bad_pgd/bad_pud/, per Mike]
      Link: http://lkml.kernel.org/r/1572938135-31886-6-git-send-email-rppt@kernel.org
      
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
      Cc: Anatoly Pugachev <matorola@gmail.com>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Peter Rosin <peda@axentia.se>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Russell King <rmk+kernel@armlinux.org.uk>
      Cc: Sam Creasey <sammy@sammy.net>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    pageattr.c 2.26 KiB
    /*
     * Copyright (c) 2014, The Linux Foundation. All rights reserved.
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 and
     * only version 2 as published by the Free Software Foundation.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     */
    #include <linux/mm.h>
    #include <linux/module.h>
    
    #include <asm/pgtable.h>
    #include <asm/tlbflush.h>
    
    struct page_change_data {
    	pgprot_t set_mask;
    	pgprot_t clear_mask;
    };
    
    static int change_page_range(pte_t *ptep, pgtable_t token, unsigned long addr,
    			void *data)
    {
    	struct page_change_data *cdata = data;
    	pte_t pte = *ptep;
    
    	pte = clear_pte_bit(pte, cdata->clear_mask);
    	pte = set_pte_bit(pte, cdata->set_mask);
    
    	set_pte_ext(ptep, pte, 0);
    	return 0;
    }
    
    static int change_memory_common(unsigned long addr, int numpages,
    				pgprot_t set_mask, pgprot_t clear_mask)
    {
    	unsigned long start = addr;
    	unsigned long size = PAGE_SIZE*numpages;
    	unsigned long end = start + size;
    	int ret;
    	struct page_change_data data;
    
    	if (!IS_ALIGNED(addr, PAGE_SIZE)) {
    		start &= PAGE_MASK;
    		end = start + size;
    		WARN_ON_ONCE(1);
    	}
    
    	if (!numpages)
    		return 0;
    
    	if (start < MODULES_VADDR || start >= MODULES_END)
    		return -EINVAL;
    
    	if (end < MODULES_VADDR || start >= MODULES_END)
    		return -EINVAL;
    
    	data.set_mask = set_mask;
    	data.clear_mask = clear_mask;
    
    	ret = apply_to_page_range(&init_mm, start, size, change_page_range,
    					&data);
    
    	flush_tlb_kernel_range(start, end);
    	return ret;
    }
    
    int set_memory_ro(unsigned long addr, int numpages)
    {
    	return change_memory_common(addr, numpages,
    					__pgprot(L_PTE_RDONLY),
    					__pgprot(0));
    }
    
    int set_memory_rw(unsigned long addr, int numpages)
    {
    	return change_memory_common(addr, numpages,
    					__pgprot(0),
    					__pgprot(L_PTE_RDONLY));
    }
    
    int set_memory_nx(unsigned long addr, int numpages)
    {
    	return change_memory_common(addr, numpages,
    					__pgprot(L_PTE_XN),
    					__pgprot(0));
    }
    
    int set_memory_x(unsigned long addr, int numpages)
    {
    	return change_memory_common(addr, numpages,
    					__pgprot(0),
    					__pgprot(L_PTE_XN));
    }