Skip to content

Commit b6717d3

Browse files
committed
KVM: x86: Stuff vCPU's PAT with default value at RESET, not creation
Move the stuffing of the vCPU's PAT to the architectural "default" value from kvm_arch_vcpu_create() to kvm_vcpu_reset(), guarded by !init_event, to better capture that the default value is the value "Following Power-up or Reset". E.g. setting PAT only during creation would break if KVM were to expose a RESET ioctl() to userspace (which is unlikely, but that's not a good reason to have unintuitive code). No functional change. Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Reviewed-by: Kai Huang <kai.huang@intel.com> Reviewed-by: Jim Mattson <jmattson@google.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20240605231918.2915961-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent beb2e44 commit b6717d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12260,8 +12260,6 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
1226012260
vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
1226112261
vcpu->arch.reserved_gpa_bits = kvm_vcpu_reserved_gpa_bits_raw(vcpu);
1226212262

12263-
vcpu->arch.pat = MSR_IA32_CR_PAT_DEFAULT;
12264-
1226512263
kvm_async_pf_hash_reset(vcpu);
1226612264

1226712265
vcpu->arch.perf_capabilities = kvm_caps.supported_perf_cap;
@@ -12427,6 +12425,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
1242712425
if (!init_event) {
1242812426
vcpu->arch.smbase = 0x30000;
1242912427

12428+
vcpu->arch.pat = MSR_IA32_CR_PAT_DEFAULT;
12429+
1243012430
vcpu->arch.msr_misc_features_enables = 0;
1243112431
vcpu->arch.ia32_misc_enable_msr = MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL |
1243212432
MSR_IA32_MISC_ENABLE_BTS_UNAVAIL;

0 commit comments

Comments
 (0)