mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: kvm-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org, Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 24/31] KVM: SVM: sync TPR value to V_TPR field in the VMCB
Date: Mon, 21 Apr 2008 13:29:50 +0300	[thread overview]
Message-ID: <1208773797-7829-25-git-send-email-avi@qumranet.com> (raw)
In-Reply-To: <1208773797-7829-1-git-send-email-avi@qumranet.com>

From: Joerg Roedel <joerg.roedel@amd.com>

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>
---
 arch/x86/kvm/svm.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 3379e13..f8ce36e 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -486,8 +486,7 @@ static void init_vmcb(struct vcpu_svm *svm)
 
 	control->intercept_cr_read = 	INTERCEPT_CR0_MASK |
 					INTERCEPT_CR3_MASK |
-					INTERCEPT_CR4_MASK |
-					INTERCEPT_CR8_MASK;
+					INTERCEPT_CR4_MASK;
 
 	control->intercept_cr_write = 	INTERCEPT_CR0_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)
 {
 	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);
 
+	sync_lapic_to_cr8(vcpu);
+
 	save_host_msrs(vcpu);
 	fs_selector = read_fs();
 	gs_selector = read_gs();
-- 
1.5.5


  parent reply	other threads:[~2008-04-21 10:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-21 10:29 [PATCH 00/31] KVM updates for the 2.6.26 merge window (part IV, last) Avi Kivity
2008-04-21 10:29 ` [PATCH 01/31] KVM: MMU: Don't assume struct page for x86 Avi Kivity
2008-04-21 10:29 ` [PATCH 02/31] KVM: Register ioctl range Avi Kivity
2008-04-21 10:29 ` [PATCH 03/31] KVM: SVM: indent svm_set_cr4 with tabs instead of spaces Avi Kivity
2008-04-21 10:29 ` [PATCH 04/31] KVM: SVM: align shadow CR4.MCE with host Avi Kivity
2008-04-21 10:29 ` [PATCH 05/31] KVM: SVM: add intercept for machine check exception Avi Kivity
2008-04-21 10:29 ` [PATCH 06/31] KVM: Add trace markers Avi Kivity
2008-04-21 10:29 ` [PATCH 07/31] KVM: s390: Stub out kvmtrace Avi Kivity
2008-04-21 10:29 ` [PATCH 08/31] KVM: ia64: " Avi Kivity
2008-04-21 10:29 ` [PATCH 09/31] KVM: Add kvm trace userspace interface Avi Kivity
2008-04-21 10:29 ` [PATCH 10/31] KVM: SVM: do not intercept task switch with NPT Avi Kivity
2008-04-21 10:29 ` [PATCH 11/31] KVM: hlt emulation should take in-kernel APIC/PIT timers into account Avi Kivity
2008-04-21 10:29 ` [PATCH 12/31] KVM: Rename VCPU_MP_STATE_* to KVM_MP_STATE_* Avi Kivity
2008-04-21 10:29 ` [PATCH 13/31] KVM: add ioctls to save/store mpstate Avi Kivity
2008-04-21 10:29 ` [PATCH 14/31] KVM: fix kvm_vcpu_kick vs __vcpu_run race Avi Kivity
2008-04-21 10:29 ` [PATCH 15/31] KVM: SVM: force a new asid when initializing the vmcb Avi Kivity
2008-04-21 10:29 ` [PATCH 16/31] KVM: x86 emulator: initialize src.val and dst.val for register operands Avi Kivity
2008-04-21 10:29 ` [PATCH 17/31] KVM: x86 emulator: fix smsw and lmsw with a memory operand Avi Kivity
2008-04-21 10:29 ` [PATCH 18/31] KVM: x86 emulator: fix lea to really get the effective address Avi Kivity
2008-04-21 10:29 ` [PATCH 19/31] KVM: Rename debugfs_dir to kvm_debugfs_dir Avi Kivity
2008-04-21 10:29 ` [PATCH 20/31] ppc: Export tlb_44x_hwater for KVM Avi Kivity
2008-04-21 10:29 ` [PATCH 21/31] KVM: ppc: Add DCR access information to struct kvm_run Avi Kivity
2008-04-21 10:29 ` [PATCH 22/31] KVM: Add MAINTAINERS entry for PowerPC KVM Avi Kivity
2008-04-21 10:29 ` [PATCH 23/31] KVM: ppc: PowerPC 440 KVM implementation Avi Kivity
2008-04-21 10:29 ` Avi Kivity [this message]
2008-04-21 10:29 ` [PATCH 25/31] KVM: export kvm_lapic_set_tpr() to modules Avi Kivity
2008-04-21 10:29 ` [PATCH 26/31] KVM: SVM: sync V_TPR with LAPIC.TPR if CR8 write intercept is disabled Avi Kivity
2008-04-21 10:29 ` [PATCH 27/31] KVM: SVM: disable CR8 intercept when tpr is not masking interrupts Avi Kivity
2008-04-21 10:29 ` [PATCH 28/31] KVM: SVM: remove now obsolete FIXME comment Avi Kivity
2008-04-21 10:29 ` [PATCH 29/31] KVM: SVM: remove selective CR0 comment Avi Kivity
2008-04-21 10:29 ` [PATCH 30/31] KVM: ppc: Kconfig fixes Avi Kivity
2008-04-21 10:29 ` [PATCH 31/31] KVM: MMU: kvm_pv_mmu_op should not take mmap_sem Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208773797-7829-25-git-send-email-avi@qumranet.com \
    --to=avi@qumranet.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®