Messages in this thread Patch in this message |  | | Date | Tue, 5 May 2026 01:41:17 +0000 | | Subject | [PATCH 1/2] KVM: x86: Move the default arch state init before vm_init() call | | From | FirstName LastName <> |
| |
From: Vishal Annapurve <vannapurve@google.com>
Move the default kvm state initialization before vendor specific vm_init() call to allow vendor specific code to override these defaults.
Next patch will use this update to allow TDX specific vm_init() to override enable_pmu toggle.
Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Vishal Annapurve <vannapurve@google.com> --- arch/x86/kvm/x86.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0a1b63c63d1a..fda842adb58a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -13349,6 +13349,11 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) type == KVM_X86_DEFAULT_VM || type == KVM_X86_SW_PROTECTED_VM; kvm->arch.disabled_quirks = kvm_caps.inapplicable_quirks & kvm_caps.supported_quirks; + kvm->arch.default_tsc_khz = max_tsc_khz ? : tsc_khz; + kvm->arch.apic_bus_cycle_ns = APIC_BUS_CYCLE_NS_DEFAULT; + kvm->arch.guest_can_read_msr_platform_info = true; + kvm->arch.enable_pmu = enable_pmu; + ret = kvm_page_track_init(kvm); if (ret) goto out; @@ -13372,11 +13377,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) pvclock_update_vm_gtod_copy(kvm); raw_spin_unlock_irqrestore(&kvm->arch.tsc_write_lock, flags); - kvm->arch.default_tsc_khz = max_tsc_khz ? : tsc_khz; - kvm->arch.apic_bus_cycle_ns = APIC_BUS_CYCLE_NS_DEFAULT; - kvm->arch.guest_can_read_msr_platform_info = true; - kvm->arch.enable_pmu = enable_pmu; - #if IS_ENABLED(CONFIG_HYPERV) spin_lock_init(&kvm->arch.hv_root_tdp_lock); kvm->arch.hv_root_tdp = INVALID_PAGE; -- 2.54.0.545.g6539524ca2-goog
|  |