1bd104e6dSAnshuman Khandual /* SPDX-License-Identifier: GPL-2.0+ */ 2bd104e6dSAnshuman Khandual /* 3bd104e6dSAnshuman Khandual * SVM helper functions 4bd104e6dSAnshuman Khandual * 5bd104e6dSAnshuman Khandual * Copyright 2018 Anshuman Khandual, IBM Corporation. 6bd104e6dSAnshuman Khandual */ 7bd104e6dSAnshuman Khandual 8bd104e6dSAnshuman Khandual #ifndef _ASM_POWERPC_SVM_H 9bd104e6dSAnshuman Khandual #define _ASM_POWERPC_SVM_H 10bd104e6dSAnshuman Khandual 11bd104e6dSAnshuman Khandual #ifdef CONFIG_PPC_SVM 12bd104e6dSAnshuman Khandual 13bd104e6dSAnshuman Khandual static inline bool is_secure_guest(void) 14bd104e6dSAnshuman Khandual { 15bd104e6dSAnshuman Khandual return mfmsr() & MSR_S; 16bd104e6dSAnshuman Khandual } 17bd104e6dSAnshuman Khandual 18*eae9eec4SThiago Jung Bauermann void __init svm_swiotlb_init(void); 19*eae9eec4SThiago Jung Bauermann 20d5394c05SAnshuman Khandual void dtl_cache_ctor(void *addr); 21d5394c05SAnshuman Khandual #define get_dtl_cache_ctor() (is_secure_guest() ? dtl_cache_ctor : NULL) 22d5394c05SAnshuman Khandual 23bd104e6dSAnshuman Khandual #else /* CONFIG_PPC_SVM */ 24bd104e6dSAnshuman Khandual 25bd104e6dSAnshuman Khandual static inline bool is_secure_guest(void) 26bd104e6dSAnshuman Khandual { 27bd104e6dSAnshuman Khandual return false; 28bd104e6dSAnshuman Khandual } 29bd104e6dSAnshuman Khandual 30*eae9eec4SThiago Jung Bauermann static inline void svm_swiotlb_init(void) {} 31*eae9eec4SThiago Jung Bauermann 32d5394c05SAnshuman Khandual #define get_dtl_cache_ctor() NULL 33d5394c05SAnshuman Khandual 34bd104e6dSAnshuman Khandual #endif /* CONFIG_PPC_SVM */ 35bd104e6dSAnshuman Khandual #endif /* _ASM_POWERPC_SVM_H */ 36