From: Dongxiao Xu <dongxiao.xu@intel.com>
To: xen-devel@lists.xen.org
Cc: eddie.dong@intel.com, jun.nakajima@intel.com
Subject: [PATCH v2 08/11] nested vmx: enable "Virtualize APIC accesses" feature for L1 VMM
Date: Wed, 5 Dec 2012 21:02:11 +0800 [thread overview]
Message-ID: <1354712534-31338-9-git-send-email-dongxiao.xu@intel.com> (raw)
In-Reply-To: <1354712534-31338-1-git-send-email-dongxiao.xu@intel.com>
If the "Virtualize APIC accesses" feature is enabled, we need to sync
the APIC-access address from virtual vvmcs into shadow vmcs when doing
virtual_vmentry.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
xen/arch/x86/hvm/vmx/vvmx.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index e4ce466..ae553bb 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -554,6 +554,24 @@ void nvmx_update_exception_bitmap(struct vcpu *v, unsigned long value)
set_shadow_control(v, EXCEPTION_BITMAP, value);
}
+static void nvmx_update_apic_access_address(struct vcpu *v)
+{
+ struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
+ u64 apic_gpfn, apic_mfn;
+ u32 ctrl;
+ void *apic_va;
+
+ ctrl = __n2_secondary_exec_control(v);
+ if ( ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES )
+ {
+ apic_gpfn = __get_vvmcs(nvcpu->nv_vvmcx, APIC_ACCESS_ADDR) >> PAGE_SHIFT;
+ apic_va = hvm_map_guest_frame_ro(apic_gpfn);
+ apic_mfn = virt_to_mfn(apic_va);
+ __vmwrite(APIC_ACCESS_ADDR, (apic_mfn << PAGE_SHIFT));
+ hvm_unmap_guest_frame(apic_va);
+ }
+}
+
static void __clear_current_vvmcs(struct vcpu *v)
{
struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
@@ -761,6 +779,7 @@ static void load_shadow_control(struct vcpu *v)
nvmx_update_exit_control(v, vmx_vmexit_control);
nvmx_update_entry_control(v);
vmx_update_exception_bitmap(v);
+ nvmx_update_apic_access_address(v);
}
static void load_shadow_guest_state(struct vcpu *v)
@@ -1350,7 +1369,8 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
break;
case MSR_IA32_VMX_PROCBASED_CTLS2:
/* 1-seetings */
- data = SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING;
+ data = SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING |
+ SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
/* 0-settings */
tmp = 0;
data = (data << 32) | tmp;
@@ -1680,6 +1700,11 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
break;
}
+ case EXIT_REASON_APIC_ACCESS:
+ ctrl = __n2_secondary_exec_control(v);
+ if ( ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES )
+ nvcpu->nv_vmexit_pending = 1;
+ break;
default:
gdprintk(XENLOG_WARNING, "Unknown nested vmexit reason %x.\n",
exit_reason);
--
1.7.1
next prev parent reply other threads:[~2012-12-05 13:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 13:02 [PATCH v2 00/11] nested vmx: bug fixes and feature enabling Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 01/11] nested vmx: emulate MSR bitmaps Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 02/11] nested vmx: use literal name instead of hard numbers Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 03/11] nested vmx: expose bit 55 of IA32_VMX_BASIC_MSR to guest VMM Dongxiao Xu
2012-12-05 16:31 ` Jan Beulich
2012-12-05 13:02 ` [PATCH v2 04/11] nested vmx: fix rflags status in virtual vmexit Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 05/11] nested vmx: fix handling of RDTSC Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 06/11] nested vmx: fix DR access VM exit Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 07/11] nested vmx: enable IA32E mode while do VM entry Dongxiao Xu
2012-12-05 13:02 ` Dongxiao Xu [this message]
2012-12-05 13:02 ` [PATCH v2 09/11] nested vmx: enable PAUSE and RDPMC exiting for L1 VMM Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 10/11] nested vmx: fix interrupt delivery to L2 guest Dongxiao Xu
2012-12-05 13:02 ` [PATCH v2 11/11] nested vmx: check host ability when intercept MSR read Dongxiao Xu
2012-12-05 16:33 ` [PATCH v2 00/11] nested vmx: bug fixes and feature enabling Jan Beulich
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=1354712534-31338-9-git-send-email-dongxiao.xu@intel.com \
--to=dongxiao.xu@intel.com \
--cc=eddie.dong@intel.com \
--cc=jun.nakajima@intel.com \
--cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).