mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
KVM: SVM: sync TPR value to V_TPR field in the VMCB
This patch adds syncing of the lapic.tpr field to the V_TPR field of the VMCB. With this change we can safely remove the CR8 read intercept. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
parent
bbf45ba57e
commit
649d68643e
1 changed files with 16 additions and 2 deletions
|
@ -486,8 +486,7 @@ static void init_vmcb(struct vcpu_svm *svm)
|
||||||
|
|
||||||
control->intercept_cr_read = INTERCEPT_CR0_MASK |
|
control->intercept_cr_read = INTERCEPT_CR0_MASK |
|
||||||
INTERCEPT_CR3_MASK |
|
INTERCEPT_CR3_MASK |
|
||||||
INTERCEPT_CR4_MASK |
|
INTERCEPT_CR4_MASK;
|
||||||
INTERCEPT_CR8_MASK;
|
|
||||||
|
|
||||||
control->intercept_cr_write = INTERCEPT_CR0_MASK |
|
control->intercept_cr_write = INTERCEPT_CR0_MASK |
|
||||||
INTERCEPT_CR3_MASK |
|
INTERCEPT_CR3_MASK |
|
||||||
|
@ -1621,6 +1620,19 @@ static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
struct vcpu_svm *svm = to_svm(vcpu);
|
||||||
|
u64 cr8;
|
||||||
|
|
||||||
|
if (!irqchip_in_kernel(vcpu->kvm))
|
||||||
|
return;
|
||||||
|
|
||||||
|
cr8 = kvm_get_cr8(vcpu);
|
||||||
|
svm->vmcb->control.int_ctl &= ~V_TPR_MASK;
|
||||||
|
svm->vmcb->control.int_ctl |= cr8 & V_TPR_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
||||||
{
|
{
|
||||||
struct vcpu_svm *svm = to_svm(vcpu);
|
struct vcpu_svm *svm = to_svm(vcpu);
|
||||||
|
@ -1630,6 +1642,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
||||||
|
|
||||||
pre_svm_run(svm);
|
pre_svm_run(svm);
|
||||||
|
|
||||||
|
sync_lapic_to_cr8(vcpu);
|
||||||
|
|
||||||
save_host_msrs(vcpu);
|
save_host_msrs(vcpu);
|
||||||
fs_selector = read_fs();
|
fs_selector = read_fs();
|
||||||
gs_selector = read_gs();
|
gs_selector = read_gs();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue