On Wed, Mar 12, 2025 at 01:24:32PM +0100, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > On 10/12/24 09:55, Isaku Yamahata wrote: > > Add guest_tsc_protected member to struct kvm_arch_vcpu and prohibit > > changing TSC offset/multiplier when guest_tsc_protected is true. > > Thanks Isaku! To match the behavior of the SEV-SNP patches, this is > also needed, which I have added to kvm-coco-queue: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index dc2f14a6d8a1..ccde7c2b2248 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -3919,7 +3925,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > case MSR_IA32_TSC: > if (msr_info->host_initiated) { > kvm_synchronize_tsc(vcpu, &data); > - } else { > + } else if (!vcpu->arch.guest_tsc_protected) { > u64 adj = kvm_compute_l1_tsc_offset(vcpu, data) - vcpu->arch.l1_tsc_offset; > adjust_tsc_offset_guest(vcpu, adj); > vcpu->arch.ia32_tsc_adjust_msr += adj; Thank you for catching this. This looks good. -- Isaku Yamahata <isaku.yamahata@xxxxxxxxx>