Message ID | e3438655021a0ca0c7ef5903b9250c4b4c285d82.1600114548.git.thomas.lendacky@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | SEV-ES hypervisor support | expand |
On Mon, Sep 14, 2020 at 03:15:38PM -0500, Tom Lendacky wrote: > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 5e5f1e8fed3a..6e445a76b691 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -1109,6 +1109,12 @@ unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu) > } > EXPORT_SYMBOL_GPL(kvm_get_cr8); > > +int kvm_track_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) > +{ > + return kvm_set_cr8(vcpu, cr8); I'm guessing this was added to achieve consistency at the SVM call sites. With the previously suggested changes, kvm_track_cr8() can simply be dropped. > +} > +EXPORT_SYMBOL_GPL(kvm_track_cr8); > + > static void kvm_update_dr0123(struct kvm_vcpu *vcpu) > { > int i; > -- > 2.28.0 >
On 9/14/20 5:19 PM, Sean Christopherson wrote: > On Mon, Sep 14, 2020 at 03:15:38PM -0500, Tom Lendacky wrote: >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index 5e5f1e8fed3a..6e445a76b691 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -1109,6 +1109,12 @@ unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu) >> } >> EXPORT_SYMBOL_GPL(kvm_get_cr8); >> >> +int kvm_track_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) >> +{ >> + return kvm_set_cr8(vcpu, cr8); > > I'm guessing this was added to achieve consistency at the SVM call sites. > With the previously suggested changes, kvm_track_cr8() can simply be > dropped. Yup. Thanks, Tom > >> +} >> +EXPORT_SYMBOL_GPL(kvm_track_cr8); >> + >> static void kvm_update_dr0123(struct kvm_vcpu *vcpu) >> { >> int i; >> -- >> 2.28.0 >>
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index e4fd2600ecf6..790659494aae 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1434,6 +1434,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); int kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8); int kvm_track_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); int kvm_track_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); +int kvm_track_cr8(struct kvm_vcpu *vcpu, unsigned long cr8); int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val); int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val); unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu); diff --git a/arch/x86/include/uapi/asm/svm.h b/arch/x86/include/uapi/asm/svm.h index ea88789d71f2..60830088e8e3 100644 --- a/arch/x86/include/uapi/asm/svm.h +++ b/arch/x86/include/uapi/asm/svm.h @@ -203,6 +203,7 @@ { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, \ { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, \ { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, \ + { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, \ { SVM_EXIT_NPF, "npf" }, \ { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index ec5efa1d4344..b35c2de1130c 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -2426,6 +2426,9 @@ static int cr_trap(struct vcpu_svm *svm) case 4: kvm_track_cr4(&svm->vcpu, svm->vmcb->control.exit_info_1); break; + case 8: + kvm_track_cr8(&svm->vcpu, svm->vmcb->control.exit_info_1); + break; default: WARN(1, "unhandled CR%d write trap", cr); kvm_queue_exception(&svm->vcpu, UD_VECTOR); @@ -2980,6 +2983,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = { [SVM_EXIT_EFER_WRITE_TRAP] = efer_trap, [SVM_EXIT_CR0_WRITE_TRAP] = cr_trap, [SVM_EXIT_CR4_WRITE_TRAP] = cr_trap, + [SVM_EXIT_CR8_WRITE_TRAP] = cr_trap, [SVM_EXIT_NPF] = npf_interception, [SVM_EXIT_RSM] = rsm_interception, [SVM_EXIT_AVIC_INCOMPLETE_IPI] = avic_incomplete_ipi_interception, diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 5e5f1e8fed3a..6e445a76b691 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1109,6 +1109,12 @@ unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu) } EXPORT_SYMBOL_GPL(kvm_get_cr8); +int kvm_track_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) +{ + return kvm_set_cr8(vcpu, cr8); +} +EXPORT_SYMBOL_GPL(kvm_track_cr8); + static void kvm_update_dr0123(struct kvm_vcpu *vcpu) { int i;