David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * SVM helper functions |
| 4 | * |
| 5 | * Copyright 2018 Anshuman Khandual, IBM Corporation. |
| 6 | */ |
| 7 | |
| 8 | #ifndef _ASM_POWERPC_SVM_H |
| 9 | #define _ASM_POWERPC_SVM_H |
| 10 | |
| 11 | #ifdef CONFIG_PPC_SVM |
| 12 | |
| 13 | static inline bool is_secure_guest(void) |
| 14 | { |
| 15 | return mfmsr() & MSR_S; |
| 16 | } |
| 17 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 18 | void __init svm_swiotlb_init(void); |
| 19 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 20 | void dtl_cache_ctor(void *addr); |
| 21 | #define get_dtl_cache_ctor() (is_secure_guest() ? dtl_cache_ctor : NULL) |
| 22 | |
| 23 | #else /* CONFIG_PPC_SVM */ |
| 24 | |
| 25 | static inline bool is_secure_guest(void) |
| 26 | { |
| 27 | return false; |
| 28 | } |
| 29 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 30 | static inline void svm_swiotlb_init(void) {} |
| 31 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 32 | #define get_dtl_cache_ctor() NULL |
| 33 | |
| 34 | #endif /* CONFIG_PPC_SVM */ |
| 35 | #endif /* _ASM_POWERPC_SVM_H */ |