[PATCH v7 080/120] x86/sgx: Move unused CPUID(0x12) symbols

"Ahmed S. Darwish" <[email protected]> Thu, 28 May 2026 17:38:42 +0200
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Kernel CPUID(0x12) call sites have been converted to the CPUID parser API.
They should no longer issue manual CPUID queries on their own.

Remove all symbols previously used for manual CPUID(0x12) enumeration
move them to the SGX selftests where they are still needed.

Signed-off-by: Ahmed S. Darwish <[email protected]>
---
 arch/x86/include/asm/sgx.h            | 10 ++--------
 tools/testing/selftests/sgx/defines.h |  9 +++++++++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h
index 04958459a7ca..bbd68fc0f839 100644
--- a/arch/x86/include/asm/sgx.h
+++ b/arch/x86/include/asm/sgx.h
@@ -16,16 +16,10 @@
  * together for better readability.  The architectural definitions come first.
  */
 
-/* The SGX specific CPUID function. */
-#define SGX_CPUID		0x12
-/* EPC enumeration. */
+/* First CPUID(0x12) subleaf for EPC enumeration */
 #define SGX_CPUID_EPC		2
-/* An invalid EPC section, i.e. the end marker. */
-#define SGX_CPUID_EPC_INVALID	0x0
-/* A valid EPC section. */
+/* Valid subleaf EPC section */
 #define SGX_CPUID_EPC_SECTION	0x1
-/* The bitmask for the EPC section type. */
-#define SGX_CPUID_EPC_MASK	GENMASK(3, 0)
 
 enum sgx_encls_function {
 	ECREATE		= 0x00,
diff --git a/tools/testing/selftests/sgx/defines.h b/tools/testing/selftests/sgx/defines.h
index 402f8787a71c..e1ab3b36e827 100644
--- a/tools/testing/selftests/sgx/defines.h
+++ b/tools/testing/selftests/sgx/defines.h
@@ -20,6 +20,15 @@
 #include "../../../../arch/x86/include/asm/enclu.h"
 #include "../../../../arch/x86/include/uapi/asm/sgx.h"
 
+/* The SGX specific CPUID function */
+#define SGX_CPUID		0x12
+
+/* An invalid EPC section, i.e. the end marker */
+#define SGX_CPUID_EPC_INVALID	0x0
+
+/* The bitmask for the EPC section type */
+#define SGX_CPUID_EPC_MASK	GENMASK(3, 0)
+
 enum encl_op_type {
 	ENCL_OP_PUT_TO_BUFFER,
 	ENCL_OP_GET_FROM_BUFFER,
-- 
2.54.0