lkml.org 
[lkml]   [2020]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 23/35] KVM: SVM: Add support for CR4 write traps for an SEV-ES guest
From
Date
On 15/09/20 00:16, Sean Christopherson wrote:
>> +int kvm_track_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
>> +{
>> + unsigned long old_cr4 = kvm_read_cr4(vcpu);
>> + unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE |
>> + X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE;
>> +
>> + if (kvm_x86_ops.set_cr4(vcpu, cr4))
>> + return 1;
> Pretty much all the same comments as EFER and CR0, e.g. call svm_set_cr4()
> directly instead of bouncing through kvm_x86_ops. And with that, this can
> be called __kvm_set_cr4() to be consistent with __kvm_set_cr0().

I agree with calling svm_set_cr4 directly, but then this should be
kvm_post_set_cr4.

Paolo

>> +
>> + if (((cr4 ^ old_cr4) & pdptr_bits) ||
>> + (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE)))
>> + kvm_mmu_reset_context(vcpu);
>> +
>> + if ((cr4 ^ old_cr4) & (X86_CR4_OSXSAVE | X86_CR4_PKE))
>> + kvm_update_cpuid_runtime(vcpu);
>> +
>> + return 0;
>> +}

\
 
 \ /
  Last update: 2020-11-30 19:19    [W:0.111 / U:22.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site