Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * AMD Memory Encryption Support
0004  *
0005  * Copyright (C) 2016 Advanced Micro Devices, Inc.
0006  *
0007  * Author: Tom Lendacky <thomas.lendacky@amd.com>
0008  */
0009 
0010 #ifndef __MEM_ENCRYPT_H__
0011 #define __MEM_ENCRYPT_H__
0012 
0013 #ifndef __ASSEMBLY__
0014 
0015 #ifdef CONFIG_ARCH_HAS_MEM_ENCRYPT
0016 
0017 #include <asm/mem_encrypt.h>
0018 
0019 #endif  /* CONFIG_ARCH_HAS_MEM_ENCRYPT */
0020 
0021 #ifdef CONFIG_AMD_MEM_ENCRYPT
0022 /*
0023  * The __sme_set() and __sme_clr() macros are useful for adding or removing
0024  * the encryption mask from a value (e.g. when dealing with pagetable
0025  * entries).
0026  */
0027 #define __sme_set(x)        ((x) | sme_me_mask)
0028 #define __sme_clr(x)        ((x) & ~sme_me_mask)
0029 #else
0030 #define __sme_set(x)        (x)
0031 #define __sme_clr(x)        (x)
0032 #endif
0033 
0034 #endif  /* __ASSEMBLY__ */
0035 
0036 #endif  /* __MEM_ENCRYPT_H__ */