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 13*eb4713c4SChristophe Leroy #include <asm/reg.h> 14*eb4713c4SChristophe Leroy is_secure_guest(void)15bd104e6dSAnshuman Khandualstatic inline bool is_secure_guest(void) 16bd104e6dSAnshuman Khandual { 17bd104e6dSAnshuman Khandual return mfmsr() & MSR_S; 18bd104e6dSAnshuman Khandual } 19bd104e6dSAnshuman Khandual 20eae9eec4SThiago Jung Bauermann void dtl_cache_ctor(void *addr); 21eae9eec4SThiago Jung Bauermann #define get_dtl_cache_ctor() (is_secure_guest() ? dtl_cache_ctor : NULL) 22d5394c05SAnshuman Khandual 23d5394c05SAnshuman Khandual #else /* CONFIG_PPC_SVM */ 24d5394c05SAnshuman Khandual is_secure_guest(void)25bd104e6dSAnshuman Khandualstatic inline bool is_secure_guest(void) 26bd104e6dSAnshuman Khandual { 27bd104e6dSAnshuman Khandual return false; 28bd104e6dSAnshuman Khandual } 29bd104e6dSAnshuman Khandual 30bd104e6dSAnshuman Khandual #define get_dtl_cache_ctor() NULL 31bd104e6dSAnshuman Khandual 32eae9eec4SThiago Jung Bauermann #endif /* CONFIG_PPC_SVM */ 33eae9eec4SThiago Jung Bauermann #endif /* _ASM_POWERPC_SVM_H */ 34d5394c05SAnshuman Khandual