mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
32a0de886e
For architectures that enable ARCH_HAS_SET_MEMORY having the ability to verify that a page is mapped in the kernel direct map can be useful regardless of hibernation. Add RISC-V implementation of kernel_page_present(), update its forward declarations and stubs to be a part of set_memory API and remove ugly ifdefery in inlcude/linux/mm.h around current declarations of kernel_page_present(). Link: https://lkml.kernel.org/r/20201109192128.960-5-rppt@kernel.org Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Andy Lutomirski <luto@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Christoph Lameter <cl@linux.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Hildenbrand <david@redhat.com> Cc: David Rientjes <rientjes@google.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Len Brown <len.brown@intel.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Pavel Machek <pavel@ucw.cz> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright 2017, Michael Ellerman, IBM Corporation.
|
|
*/
|
|
#ifndef _LINUX_SET_MEMORY_H_
|
|
#define _LINUX_SET_MEMORY_H_
|
|
|
|
#ifdef CONFIG_ARCH_HAS_SET_MEMORY
|
|
#include <asm/set_memory.h>
|
|
#else
|
|
static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
|
|
static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
|
|
static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
|
|
static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
|
|
#endif
|
|
|
|
#ifndef CONFIG_ARCH_HAS_SET_DIRECT_MAP
|
|
static inline int set_direct_map_invalid_noflush(struct page *page)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int set_direct_map_default_noflush(struct page *page)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline bool kernel_page_present(struct page *page)
|
|
{
|
|
return true;
|
|
}
|
|
#endif
|
|
|
|
#ifndef set_mce_nospec
|
|
static inline int set_mce_nospec(unsigned long pfn, bool unmap)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#ifndef clear_mce_nospec
|
|
static inline int clear_mce_nospec(unsigned long pfn)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#ifndef CONFIG_ARCH_HAS_MEM_ENCRYPT
|
|
static inline int set_memory_encrypted(unsigned long addr, int numpages)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int set_memory_decrypted(unsigned long addr, int numpages)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */
|
|
|
|
#endif /* _LINUX_SET_MEMORY_H_ */
|