1*bfebd37eSTom Lendacky // SPDX-License-Identifier: GPL-2.0-only
2*bfebd37eSTom Lendacky /*
3*bfebd37eSTom Lendacky  * Confidential Computing Platform Capability checks
4*bfebd37eSTom Lendacky  *
5*bfebd37eSTom Lendacky  * Copyright (C) 2021 Advanced Micro Devices, Inc.
6*bfebd37eSTom Lendacky  *
7*bfebd37eSTom Lendacky  * Author: Tom Lendacky <thomas.lendacky@amd.com>
8*bfebd37eSTom Lendacky  */
9*bfebd37eSTom Lendacky 
10*bfebd37eSTom Lendacky #include <linux/export.h>
11*bfebd37eSTom Lendacky #include <linux/cc_platform.h>
12*bfebd37eSTom Lendacky 
13*bfebd37eSTom Lendacky #include <asm/machdep.h>
14*bfebd37eSTom Lendacky #include <asm/svm.h>
15*bfebd37eSTom Lendacky 
cc_platform_has(enum cc_attr attr)16*bfebd37eSTom Lendacky bool cc_platform_has(enum cc_attr attr)
17*bfebd37eSTom Lendacky {
18*bfebd37eSTom Lendacky 	switch (attr) {
19*bfebd37eSTom Lendacky 	case CC_ATTR_MEM_ENCRYPT:
20*bfebd37eSTom Lendacky 		return is_secure_guest();
21*bfebd37eSTom Lendacky 
22*bfebd37eSTom Lendacky 	default:
23*bfebd37eSTom Lendacky 		return false;
24*bfebd37eSTom Lendacky 	}
25*bfebd37eSTom Lendacky }
26*bfebd37eSTom Lendacky EXPORT_SYMBOL_GPL(cc_platform_has);
27