LCOV - code coverage report
Current view: top level - include/linux - set_memory.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 4 0.0 %
Date: 2023-07-19 18:55:55 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: GPL-2.0-only */
       2             : /*
       3             :  * Copyright 2017, Michael Ellerman, IBM Corporation.
       4             :  */
       5             : #ifndef _LINUX_SET_MEMORY_H_
       6             : #define _LINUX_SET_MEMORY_H_
       7             : 
       8             : #ifdef CONFIG_ARCH_HAS_SET_MEMORY
       9             : #include <asm/set_memory.h>
      10             : #else
      11             : static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
      12             : static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
      13             : static inline int set_memory_x(unsigned long addr,  int numpages) { return 0; }
      14             : static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
      15             : #endif
      16             : 
      17             : #ifndef set_memory_rox
      18             : static inline int set_memory_rox(unsigned long addr, int numpages)
      19             : {
      20             :         int ret = set_memory_ro(addr, numpages);
      21             :         if (ret)
      22             :                 return ret;
      23             :         return set_memory_x(addr, numpages);
      24             : }
      25             : #endif
      26             : 
      27             : #ifndef CONFIG_ARCH_HAS_SET_DIRECT_MAP
      28           0 : static inline int set_direct_map_invalid_noflush(struct page *page)
      29             : {
      30           0 :         return 0;
      31             : }
      32           0 : static inline int set_direct_map_default_noflush(struct page *page)
      33             : {
      34           0 :         return 0;
      35             : }
      36             : 
      37             : static inline bool kernel_page_present(struct page *page)
      38             : {
      39             :         return true;
      40             : }
      41             : #else /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */
      42             : /*
      43             :  * Some architectures, e.g. ARM64 can disable direct map modifications at
      44             :  * boot time. Let them overrive this query.
      45             :  */
      46             : #ifndef can_set_direct_map
      47             : static inline bool can_set_direct_map(void)
      48             : {
      49             :         return true;
      50             : }
      51             : #define can_set_direct_map can_set_direct_map
      52             : #endif
      53             : #endif /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */
      54             : 
      55             : #ifdef CONFIG_X86_64
      56             : int set_mce_nospec(unsigned long pfn);
      57             : int clear_mce_nospec(unsigned long pfn);
      58             : #else
      59             : static inline int set_mce_nospec(unsigned long pfn)
      60             : {
      61             :         return 0;
      62             : }
      63             : static inline int clear_mce_nospec(unsigned long pfn)
      64             : {
      65             :         return 0;
      66             : }
      67             : #endif
      68             : 
      69             : #ifndef CONFIG_ARCH_HAS_MEM_ENCRYPT
      70             : static inline int set_memory_encrypted(unsigned long addr, int numpages)
      71             : {
      72             :         return 0;
      73             : }
      74             : 
      75             : static inline int set_memory_decrypted(unsigned long addr, int numpages)
      76             : {
      77             :         return 0;
      78             : }
      79             : #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */
      80             : 
      81             : #endif /* _LINUX_SET_MEMORY_H_ */

Generated by: LCOV version 1.14