All of lore.kernel.org
 help / color / mirror / Atom feed
* [intel-tdx:tdx_kvm_dev-2025-04-01 116/175] arch/x86/kvm/vmx/vmx.c:8531 vmx_hardware_setup() warn: inconsistent indenting
@ 2025-04-02 14:35 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-04-02 14:35 UTC (permalink / raw)
  To: Yan Zhao; +Cc: oe-kbuild-all, Paolo Bonzini

tree:   https://github.com/intel/tdx.git tdx_kvm_dev-2025-04-01
head:   4dd797afe5bccb7a36475aae9df8f71eabb7676a
commit: c9c1e20b4c7d60fa084b3257525d21a49fe651a1 [116/175] KVM: x86: Introduce Intel specific quirk KVM_X86_QUIRK_IGNORE_GUEST_PAT
config: i386-randconfig-r071-20250402 (https://download.01.org/0day-ci/archive/20250402/202504022242.Bi5MYGyU-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504022242.Bi5MYGyU-lkp@intel.com/

smatch warnings:
arch/x86/kvm/vmx/vmx.c:8531 vmx_hardware_setup() warn: inconsistent indenting

vim +8531 arch/x86/kvm/vmx/vmx.c

  8407	
  8408		if (!cpu_has_vmx_ple()) {
  8409			ple_gap = 0;
  8410			ple_window = 0;
  8411			ple_window_grow = 0;
  8412			ple_window_max = 0;
  8413			ple_window_shrink = 0;
  8414		}
  8415	
  8416		if (!cpu_has_vmx_apicv())
  8417			enable_apicv = 0;
  8418		if (!enable_apicv)
  8419			vt_x86_ops.sync_pir_to_irr = NULL;
  8420	
  8421		if (!enable_apicv || !cpu_has_vmx_ipiv())
  8422			enable_ipiv = false;
  8423	
  8424		if (cpu_has_vmx_tsc_scaling())
  8425			kvm_caps.has_tsc_control = true;
  8426	
  8427		kvm_caps.max_tsc_scaling_ratio = KVM_VMX_TSC_MULTIPLIER_MAX;
  8428		kvm_caps.tsc_scaling_ratio_frac_bits = 48;
  8429		kvm_caps.has_bus_lock_exit = cpu_has_vmx_bus_lock_detection();
  8430		kvm_caps.has_notify_vmexit = cpu_has_notify_vmexit();
  8431	
  8432		set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */
  8433	
  8434		if (enable_ept)
  8435			kvm_mmu_set_ept_masks(enable_ept_ad_bits,
  8436					      cpu_has_vmx_ept_execute_only());
  8437	
  8438		/*
  8439		 * Setup shadow_me_value/shadow_me_mask to include MKTME KeyID
  8440		 * bits to shadow_zero_check.
  8441		 */
  8442		vmx_setup_me_spte_mask();
  8443	
  8444		kvm_configure_mmu(enable_ept, 0, vmx_get_max_ept_level(),
  8445				  ept_caps_to_lpage_level(vmx_capability.ept));
  8446	
  8447		/*
  8448		 * Only enable PML when hardware supports PML feature, and both EPT
  8449		 * and EPT A/D bit features are enabled -- PML depends on them to work.
  8450		 */
  8451		if (!enable_ept || !enable_ept_ad_bits || !cpu_has_vmx_pml())
  8452			enable_pml = 0;
  8453	
  8454		if (!cpu_has_vmx_preemption_timer())
  8455			enable_preemption_timer = false;
  8456	
  8457		if (enable_preemption_timer) {
  8458			u64 use_timer_freq = 5000ULL * 1000 * 1000;
  8459	
  8460			cpu_preemption_timer_multi =
  8461				vmx_misc_preemption_timer_rate(vmcs_config.misc);
  8462	
  8463			if (tsc_khz)
  8464				use_timer_freq = (u64)tsc_khz * 1000;
  8465			use_timer_freq >>= cpu_preemption_timer_multi;
  8466	
  8467			/*
  8468			 * KVM "disables" the preemption timer by setting it to its max
  8469			 * value.  Don't use the timer if it might cause spurious exits
  8470			 * at a rate faster than 0.1 Hz (of uninterrupted guest time).
  8471			 */
  8472			if (use_timer_freq > 0xffffffffu / 10)
  8473				enable_preemption_timer = false;
  8474		}
  8475	
  8476		if (!enable_preemption_timer) {
  8477			vt_x86_ops.set_hv_timer = NULL;
  8478			vt_x86_ops.cancel_hv_timer = NULL;
  8479		}
  8480	
  8481		kvm_caps.supported_mce_cap |= MCG_LMCE_P;
  8482		kvm_caps.supported_mce_cap |= MCG_CMCI_P;
  8483	
  8484		if (pt_mode != PT_MODE_SYSTEM && pt_mode != PT_MODE_HOST_GUEST)
  8485			return -EINVAL;
  8486		if (!enable_ept || !enable_pmu || !cpu_has_vmx_intel_pt())
  8487			pt_mode = PT_MODE_SYSTEM;
  8488		if (pt_mode == PT_MODE_HOST_GUEST)
  8489			vt_init_ops.handle_intel_pt_intr = vmx_handle_intel_pt_intr;
  8490		else
  8491			vt_init_ops.handle_intel_pt_intr = NULL;
  8492	
  8493		setup_default_sgx_lepubkeyhash();
  8494	
  8495		if (nested) {
  8496			nested_vmx_setup_ctls_msrs(&vmcs_config, vmx_capability.ept);
  8497	
  8498			r = nested_vmx_hardware_setup(kvm_vmx_exit_handlers);
  8499			if (r)
  8500				return r;
  8501		}
  8502	
  8503		vmx_set_cpu_caps();
  8504	
  8505		r = alloc_kvm_area();
  8506		if (r && nested)
  8507			nested_vmx_hardware_unsetup();
  8508	
  8509		kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
  8510	
  8511		/*
  8512		 * On Intel CPUs that lack self-snoop feature, letting the guest control
  8513		 * memory types may result in unexpected behavior. So always ignore guest
  8514		 * PAT on those CPUs and map VM as writeback, not allowing userspace to
  8515		 * disable the quirk.
  8516		 *
  8517		 * On certain Intel CPUs (e.g. SPR, ICX), though self-snoop feature is
  8518		 * supported, UC is slow enough to cause issues with some older guests (e.g.
  8519		 * an old version of bochs driver uses ioremap() instead of ioremap_wc() to
  8520		 * map the video RAM, causing wayland desktop to fail to get started
  8521		 * correctly). To avoid breaking those older guests that rely on KVM to force
  8522		 * memory type to WB, provide KVM_X86_QUIRK_IGNORE_GUEST_PAT to preserve the
  8523		 * safer (for performance) default behavior.
  8524		 *
  8525		 * On top of this, non-coherent DMA devices need the guest to flush CPU
  8526		 * caches properly.  This also requires honoring guest PAT, and is forced
  8527		 * independent of the quirk in vmx_ignore_guest_pat().
  8528		 */
  8529		if (!static_cpu_has(X86_FEATURE_SELFSNOOP))
  8530			kvm_caps.supported_quirks &= ~KVM_X86_QUIRK_IGNORE_GUEST_PAT;
> 8531	       kvm_caps.inapplicable_quirks &= ~KVM_X86_QUIRK_IGNORE_GUEST_PAT;
  8532		return r;
  8533	}
  8534	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-02 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 14:35 [intel-tdx:tdx_kvm_dev-2025-04-01 116/175] arch/x86/kvm/vmx/vmx.c:8531 vmx_hardware_setup() warn: inconsistent indenting kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.