From: Jian Zhou <jianjay.zhou@huawei.com>
To: <kvm@vger.kernel.org>, <pbonzini@redhat.com>, <gleb@kernel.org>,
<tglx@linutronix.de>, <mingo@redhat.com>, <hpa@zytor.com>,
<x86@kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <herongguang.he@huawei.com>, <zhang.zhanghailiang@huawei.com>,
<weidong.huang@huawei.com>, <peter.huangpeng@huawei.com>,
Jian Zhou <jianjay.zhou@huawei.com>
Subject: [PATCH v2 1/4] KVM: X86: Add arrays to save/restore LBR MSRs
Date: Fri, 23 Oct 2015 16:47:00 +0800 [thread overview]
Message-ID: <1445590023-2012-2-git-send-email-jianjay.zhou@huawei.com> (raw)
In-Reply-To: <1445590023-2012-1-git-send-email-jianjay.zhou@huawei.com>
Add arrays in kvm_vcpu_arch struct to save/restore
LBR MSRs at vm exit/entry time.
Add new hooks to set/get DEBUGCTLMSR and LBR MSRs.
Signed-off-by: Jian Zhou <jianjay.zhou@huawei.com>
Signed-off-by: Stephen He <herongguang.he@huawei.com>
---
arch/x86/include/asm/kvm_host.h | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3a36ee7..dc2c120 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -376,6 +376,12 @@ struct kvm_vcpu_hv {
u64 hv_vapic;
};
+struct msr_data {
+ bool host_initiated;
+ u32 index;
+ u64 data;
+};
+
struct kvm_vcpu_arch {
/*
* rip and regs accesses must go through
@@ -516,6 +522,15 @@ struct kvm_vcpu_arch {
unsigned long eff_db[KVM_NR_DB_REGS];
unsigned long guest_debug_dr7;
+ int lbr_status;
+ int lbr_used;
+
+ struct lbr_msr {
+ unsigned nr;
+ struct msr_data guest[MAX_NUM_LBR_MSRS];
+ struct msr_data host[MAX_NUM_LBR_MSRS];
+ }lbr_msr;
+
u64 mcg_cap;
u64 mcg_status;
u64 mcg_ctl;
@@ -728,12 +743,6 @@ struct kvm_vcpu_stat {
struct x86_instruction_info;
-struct msr_data {
- bool host_initiated;
- u32 index;
- u64 data;
-};
-
struct kvm_lapic_irq {
u32 vector;
u16 delivery_mode;
@@ -887,6 +896,11 @@ struct kvm_x86_ops {
gfn_t offset, unsigned long mask);
/* pmu operations of sub-arch */
const struct kvm_pmu_ops *pmu_ops;
+
+ int (*set_debugctlmsr)(struct kvm_vcpu *vcpu, u64 value);
+ u64 (*get_debugctlmsr)(void);
+ void (*set_lbr_msr)(struct kvm_vcpu *vcpu, u32 msr, u64 data);
+ u64 (*get_lbr_msr)(struct kvm_vcpu *vcpu, u32 msr);
};
struct kvm_arch_async_pf {
--
1.7.12.4
next prev parent reply other threads:[~2015-10-23 8:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 8:46 [PATCH v2 0/4] KVM: VMX: enable LBR virtualization Jian Zhou
2015-10-23 8:47 ` Jian Zhou [this message]
2015-10-23 8:47 ` [PATCH v2 2/4] KVM: X86: LBR MSRs of supported CPU types Jian Zhou
2015-10-23 8:47 ` [PATCH v2 3/4] KVM: X86: Migration is supported Jian Zhou
2015-10-23 9:15 [PATCH v2 0/4] KVM: VMX: enable LBR virtualization Jian Zhou
2015-10-23 9:15 ` [PATCH v2 1/4] KVM: X86: Add arrays to save/restore LBR MSRs Jian Zhou
2015-10-23 12:14 ` kbuild test robot
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=1445590023-2012-2-git-send-email-jianjay.zhou@huawei.com \
--to=jianjay.zhou@huawei.com \
--cc=gleb@kernel.org \
--cc=herongguang.he@huawei.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=tglx@linutronix.de \
--cc=weidong.huang@huawei.com \
--cc=x86@kernel.org \
--cc=zhang.zhanghailiang@huawei.com \
/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®