Hi Paolo, I love your patch! Yet something to improve: [auto build test ERROR on kvm/queue] [also build test ERROR on next-20220930] [cannot apply to mst-vhost/linux-next linus/master v6.0-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Paolo-Bonzini/KVM-x86-allow-compiling-out-SMM-support/20220930-012220 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue config: i386-randconfig-a002 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/cc73a769dae68cad03e5f075d8b09aac79cd0125 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Paolo-Bonzini/KVM-x86-allow-compiling-out-SMM-support/20220930-012220 git checkout cc73a769dae68cad03e5f075d8b09aac79cd0125 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): >> arch/x86/kvm/smm.c:503:21: error: unused variable 'cr4' [-Werror,-Wunused-variable] unsigned long cr0, cr4, efer; ^ >> arch/x86/kvm/smm.c:503:26: error: unused variable 'efer' [-Werror,-Wunused-variable] unsigned long cr0, cr4, efer; ^ 2 errors generated. vim +/cr4 +503 arch/x86/kvm/smm.c cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 499 cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 500 int emulator_leave_smm(struct x86_emulate_ctxt *ctxt) cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 501 { cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 502 struct kvm_vcpu *vcpu = ctxt->vcpu; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 @503 unsigned long cr0, cr4, efer; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 504 char buf[512]; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 505 u64 smbase; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 506 int ret; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 507 cc73a769dae68c Paolo Bonzini 2022-09-29 508 smbase = vcpu->arch.smbase; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 509 cc73a769dae68c Paolo Bonzini 2022-09-29 510 ret = kvm_vcpu_read_guest(vcpu, smbase + 0xfe00, buf, sizeof(buf)); cc73a769dae68c Paolo Bonzini 2022-09-29 511 if (ret < 0) cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 512 return X86EMUL_UNHANDLEABLE; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 513 cc73a769dae68c Paolo Bonzini 2022-09-29 514 if ((vcpu->arch.hflags & HF_SMM_INSIDE_NMI_MASK) == 0) cc73a769dae68c Paolo Bonzini 2022-09-29 515 static_call(kvm_x86_set_nmi_mask)(vcpu, false); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 516 cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 517 kvm_smm_changed(vcpu, false); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 518 cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 519 /* cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 520 * Get back to real mode, to prepare a safe state in which to load cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 521 * CR0/CR3/CR4/EFER. It's all a bit more complicated if the vCPU cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 522 * supports long mode. cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 523 */ cc73a769dae68c Paolo Bonzini 2022-09-29 524 #ifdef CONFIG_X86_64 cc73a769dae68c Paolo Bonzini 2022-09-29 525 if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) { cc73a769dae68c Paolo Bonzini 2022-09-29 526 struct kvm_segment cs_desc; cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 527 cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 528 /* Zero CR4.PCIDE before CR0.PG. */ cc73a769dae68c Paolo Bonzini 2022-09-29 529 cr4 = kvm_read_cr4(vcpu); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 530 if (cr4 & X86_CR4_PCIDE) cc73a769dae68c Paolo Bonzini 2022-09-29 531 kvm_set_cr4(vcpu, cr4 & ~X86_CR4_PCIDE); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 532 cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 533 /* A 32-bit code segment is required to clear EFER.LMA. */ cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 534 memset(&cs_desc, 0, sizeof(cs_desc)); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 535 cs_desc.type = 0xb; cc73a769dae68c Paolo Bonzini 2022-09-29 536 cs_desc.s = cs_desc.g = cs_desc.present = 1; cc73a769dae68c Paolo Bonzini 2022-09-29 537 kvm_set_segment(vcpu, &cs_desc, VCPU_SREG_CS); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 538 } cc73a769dae68c Paolo Bonzini 2022-09-29 539 #endif cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 540 cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 541 /* For the 64-bit case, this will clear EFER.LMA. */ cc73a769dae68c Paolo Bonzini 2022-09-29 542 cr0 = kvm_read_cr0(vcpu); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 543 if (cr0 & X86_CR0_PE) cc73a769dae68c Paolo Bonzini 2022-09-29 544 kvm_set_cr0(vcpu, cr0 & ~(X86_CR0_PG | X86_CR0_PE)); cc6eb1e4699ff9 Paolo Bonzini 2022-09-29 545 -- 0-DAY CI Kernel Test Service https://01.org/lkp