1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Confidential Computing Platform Capability checks
5 * Copyright (C) 2021 Advanced Micro Devices, Inc.
7 * Author: Tom Lendacky <thomas.lendacky@amd.com>
10 #ifndef _LINUX_CC_PLATFORM_H
11 #define _LINUX_CC_PLATFORM_H
13 #include <linux/types.h>
14 #include <linux/stddef.h>
17 * enum cc_attr - Confidential computing attributes
19 * These attributes represent confidential computing features that are
24 * @CC_ATTR_MEM_ENCRYPT: Memory encryption is active
26 * The platform/OS is running with active memory encryption. This
27 * includes running either as a bare-metal system or a hypervisor
28 * and actively using memory encryption or as a guest/virtual machine
29 * and actively using memory encryption.
31 * Examples include SME, SEV and SEV-ES.
36 * @CC_ATTR_HOST_MEM_ENCRYPT: Host memory encryption is active
38 * The platform/OS is running as a bare-metal system or a hypervisor
39 * and actively using memory encryption.
41 * Examples include SME.
43 CC_ATTR_HOST_MEM_ENCRYPT,
46 * @CC_ATTR_GUEST_MEM_ENCRYPT: Guest memory encryption is active
48 * The platform/OS is running as a guest/virtual machine and actively
49 * using memory encryption.
51 * Examples include SEV and SEV-ES.
53 CC_ATTR_GUEST_MEM_ENCRYPT,
56 * @CC_ATTR_GUEST_STATE_ENCRYPT: Guest state encryption is active
58 * The platform/OS is running as a guest/virtual machine and actively
59 * using memory encryption and register state encryption.
61 * Examples include SEV-ES.
63 CC_ATTR_GUEST_STATE_ENCRYPT,
66 * @CC_ATTR_GUEST_UNROLL_STRING_IO: String I/O is implemented with
69 * The platform/OS is running as a guest/virtual machine and uses
70 * IN/OUT instructions in place of string I/O.
72 * Examples include TDX guest & SEV.
74 CC_ATTR_GUEST_UNROLL_STRING_IO,
77 * @CC_ATTR_HOTPLUG_DISABLED: Hotplug is not supported or disabled.
79 * The platform/OS is running as a guest/virtual machine does not
80 * support CPU hotplug feature.
82 * Examples include TDX Guest.
84 CC_ATTR_HOTPLUG_DISABLED,
87 #ifdef CONFIG_ARCH_HAS_CC_PLATFORM
90 * cc_platform_has() - Checks if the specified cc_attr attribute is active
91 * @attr: Confidential computing attribute to check
93 * The cc_platform_has() function will return an indicator as to whether the
94 * specified Confidential Computing attribute is currently active.
96 * Context: Any context
98 * * TRUE - Specified Confidential Computing attribute is active
99 * * FALSE - Specified Confidential Computing attribute is not active
101 bool cc_platform_has(enum cc_attr attr);
103 #else /* !CONFIG_ARCH_HAS_CC_PLATFORM */
105 static inline bool cc_platform_has(enum cc_attr attr) { return false; }
107 #endif /* CONFIG_ARCH_HAS_CC_PLATFORM */
109 #endif /* _LINUX_CC_PLATFORM_H */