]> git.baikalelectronics.ru Git - kernel.git/commitdiff
arch/kmap: don't hard code kmap_prot values
authorIra Weiny <ira.weiny@intel.com>
Thu, 4 Jun 2020 23:47:54 +0000 (16:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jun 2020 02:06:22 +0000 (19:06 -0700)
To support kmap_atomic_prot() on all architectures each arch must support
protections passed in to them.

Change csky, mips, nds32 and xtensa to use their global constant kmap_prot
rather than a hard coded value which was equal.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Helge Deller <deller@gmx.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20200507150004.1423069-10-ira.weiny@intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/csky/mm/highmem.c
arch/mips/mm/highmem.c
arch/nds32/mm/highmem.c
arch/xtensa/mm/highmem.c

index 0aafbbbe651cb05582d0d7b8d3f4b3af26bb4a65..f4311669b5bb6a8c76d62c8911580a35b4961d16 100644 (file)
@@ -32,7 +32,7 @@ void *kmap_atomic_high(struct page *page)
 #ifdef CONFIG_DEBUG_HIGHMEM
        BUG_ON(!pte_none(*(kmap_pte - idx)));
 #endif
-       set_pte(kmap_pte-idx, mk_pte(page, PAGE_KERNEL));
+       set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
        flush_tlb_one((unsigned long)vaddr);
 
        return (void *)vaddr;
index 73ef4004fe5fab576795f03118d9e8d609061f32..96a486777a181ad26c9c6b48d88df91161974fa1 100644 (file)
@@ -29,7 +29,7 @@ void *kmap_atomic_high(struct page *page)
 #ifdef CONFIG_DEBUG_HIGHMEM
        BUG_ON(!pte_none(*(kmap_pte - idx)));
 #endif
-       set_pte(kmap_pte-idx, mk_pte(page, PAGE_KERNEL));
+       set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
        local_flush_tlb_one((unsigned long)vaddr);
 
        return (void*) vaddr;
index d25c815fda213471e1886a463dc08f3cc7e3ab2b..b11b88956353e8b5fa0644cdaef155d61b493cac 100644 (file)
@@ -21,7 +21,7 @@ void *kmap_atomic_high(struct page *page)
 
        idx = type + KM_TYPE_NR * smp_processor_id();
        vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-       pte = (page_to_pfn(page) << PAGE_SHIFT) | (PAGE_KERNEL);
+       pte = (page_to_pfn(page) << PAGE_SHIFT) | (kmap_prot);
        ptep = pte_offset_kernel(pmd_off_k(vaddr), vaddr);
        set_pte(ptep, pte);
 
index 4de323e4368292f094c8aa2f752b8691599f2d10..50168b09510ad93d9f97f8f5b7a2a61b00a13674 100644 (file)
@@ -48,7 +48,7 @@ void *kmap_atomic_high(struct page *page)
 #ifdef CONFIG_DEBUG_HIGHMEM
        BUG_ON(!pte_none(*(kmap_pte + idx)));
 #endif
-       set_pte(kmap_pte + idx, mk_pte(page, PAGE_KERNEL_EXEC));
+       set_pte(kmap_pte + idx, mk_pte(page, kmap_prot));
 
        return (void *)vaddr;
 }