tree: https://git.kernel.org/pub/scm/virt/kvm/kvm.git kvm-tdx-5.17 head: a50e4531e92e36f185ea32843c149c4703451109 commit: bf2274dac8e8671ae89971ae8c89f4f2f8f13095 [23/141] x86: Flush cache of TDX private memory during kexec() config: i386-tinyconfig (https://download.01.org/0day-ci/archive/20220416/202204160429.53nZyD9a-lkp@xxxxxxxxx/config) compiler: gcc-11 (Debian 11.2.0-19) 11.2.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/virt/kvm/kvm.git/commit/?id=bf2274dac8e8671ae89971ae8c89f4f2f8f13095 git remote add kvm https://git.kernel.org/pub/scm/virt/kvm/kvm.git git fetch --no-tags kvm kvm-tdx-5.17 git checkout bf2274dac8e8671ae89971ae8c89f4f2f8f13095 # save the config file to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): arch/x86/kernel/process.c: In function 'stop_this_cpu': >> arch/x86/kernel/process.c:785:49: error: implicit declaration of function 'platform_has_tdx' [-Werror=implicit-function-declaration] 785 | if ((cpuid_eax(0x8000001f) & BIT(0)) || platform_has_tdx()) | ^~~~~~~~~~~~~~~~ arch/x86/kernel/process.c: At top level: arch/x86/kernel/process.c:903:13: warning: no previous prototype for 'arch_post_acpi_subsys_init' [-Wmissing-prototypes] 903 | void __init arch_post_acpi_subsys_init(void) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/platform_has_tdx +785 arch/x86/kernel/process.c 749 750 void stop_this_cpu(void *dummy) 751 { 752 local_irq_disable(); 753 /* 754 * Remove this CPU: 755 */ 756 set_cpu_online(smp_processor_id(), false); 757 disable_local_APIC(); 758 mcheck_cpu_clear(this_cpu_ptr(&cpu_info)); 759 760 /* 761 * Use wbinvd on processors that support SME. This provides support 762 * for performing a successful kexec when going from SME inactive 763 * to SME active (or vice-versa). The cache must be cleared so that 764 * if there are entries with the same physical address, both with and 765 * without the encryption bit, they don't race each other when flushed 766 * and potentially end up with the wrong entry being committed to 767 * memory. 768 * 769 * Test the CPUID bit directly because the machine might've cleared 770 * X86_FEATURE_SME due to cmdline options. 771 * 772 * In case of kexec, similar to SME, if TDX is ever enabled, the 773 * cachelines of TDX private memory (including PAMTs) used by TDX 774 * module need to be flushed before transiting to the new kernel, 775 * otherwise they may silently corrupt the new kernel. 776 * 777 * Note TDX is enabled on demand at runtime, and enabling TDX has a 778 * state machine protected with a mutex to prevent concurrent calls 779 * from multiple callers. Holding the mutex is required to get the 780 * TDX enabling status, but this function runs in interrupt context. 781 * So to make it simple, always flush cache when platform supports 782 * TDX (detected at boot time), regardless whether TDX is truly 783 * enabled by kernel. 784 */ > 785 if ((cpuid_eax(0x8000001f) & BIT(0)) || platform_has_tdx()) 786 native_wbinvd(); 787 for (;;) { 788 /* 789 * Use native_halt() so that memory contents don't change 790 * (stack usage and variables) after possibly issuing the 791 * native_wbinvd() above. 792 */ 793 native_halt(); 794 } 795 } 796 -- 0-DAY CI Kernel Test Service https://01.org/lkp