Skip to contentSkip to conversation

x86/virt/tdx: Make TDX host depend on X86_MCE

PATCH In review Kai Huang 2 participants 2 messages Dec 13, 2023 x86

lore
Share & tools
lore

Kai Huang

author
#0 lore raw

PATCH 1/1 x86/virt/tdx: Make TDX host depend on X86_MCE

A build failure was reported that when INTEL_TDX_HOST is enabled but X86_MCE is not, the tdx_dump_mce_info() function fails to link:

ld: vmlinux.o: in function `tdx_dump_mce_info':
...: undefined reference to mce_is_memory_error' ...: undefined reference to mce_usable_address'

The reason is in such configuration, despite there's no caller of tdx_dump_mce_info() it is still built and there's no implementation for the two "mce_*()" functions.

Make INTEL_TDX_HOST depend on X86_MCE to fix.

It makes sense to enable MCE support for the TDX host anyway. Because the only way that TDX has to report integrity errors is an MCE, and it is not good to silently ignore such MCE. The TDX spec also suggests the host VMM is expected to implement the MCE handler.

Note it also makes sense to make INTEL_TDX_HOST select X86_MCE but this generates "recursive dependency detected!" error in the Kconfig.

---
 arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
index 01cdb16acff6..92c03cb99b3e 100644
@@ -1974,6 +1974,7 @@ config INTEL_TDX_HOST
 	select ARCH_KEEP_MEMBLOCK
 	depends on CONTIG_ALLOC
 	depends on !KEXEC_CORE
+	depends on X86_MCE
 	help
 	  Intel Trust Domain Extensions (TDX) protects guest VMs from malicious
 	  host and certain physical attacks.  This option enables necessary TDX
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Kai Huang

A build failure was reported that when INTEL_TDX_HOST is enabled but X86_MCE is not, the tdx_dump_mce_info() function fails to link:

ld: vmlinux.o: in function `tdx_dump_mce_info':
...: undefined reference to mce_is_memory_error' ...: undefined reference to mce_usable_address'

The reason is in such configuration, despite there's no caller of tdx_dump_mce_info() it is still built and there's no implementation for the two "mce_*()" functions.

Make INTEL_TDX_HOST depend on X86_MCE to fix.

It makes sense to enable MCE support for the TDX host anyway. Because the only way that TDX has to report integrity errors is an MCE, and it is not good to silently ignore such MCE. The TDX spec also suggests the host VMM is expected to implement the MCE handler.

Quoted 8 lines

Note it also makes sense to make INTEL_TDX_HOST select X86_MCE but this generates "recursive dependency detected!" error in the Kconfig.

Signature · 1 line
  Kiryl Shutsemau / Kirill A. Shutemov