Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: FirstName LastName <vannapurve@google.com>
To: seanjc@google.com, pbonzini@redhat.com, dave.hansen@linux.intel.com
Cc: rick.p.edgecombe@intel.com, dapeng1.mi@linux.intel.com,
	mizhang@google.com,  jmattson@google.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	 Vishal Annapurve <vannapurve@google.com>
Subject: [PATCH 1/2] KVM: x86: Move the default arch state init before vm_init() call
Date: Tue,  5 May 2026 01:41:17 +0000	[thread overview]
Message-ID: <20260505014118.3783476-2-vannapurve@google.com> (raw)
In-Reply-To: <20260505014118.3783476-1-vannapurve@google.com>

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


  reply	other threads:[~2026-05-05  1:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05  1:41 [PATCH 0/2] KVM: TDX: Disable PMU virtualization for TDX VMs FirstName LastName
2026-05-05  1:41 ` FirstName LastName [this message]
2026-05-05  1:41 ` [PATCH 2/2] KVM: TDX: Disable pmu " FirstName LastName
2026-05-06 23:03   ` Sean Christopherson
2026-05-06 23:39     ` Vishal Annapurve
2026-05-06 23:56     ` Huang, Kai
2026-05-07  0:40       ` Vishal Annapurve
2026-05-07 14:24         ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260505014118.3783476-2-vannapurve@google.com \
    --to=vannapurve@google.com \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mizhang@google.com \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox