From: Arun Sharma <arun.sharma@intel.com>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH][3/9] Implement the I/O bitmap vm execution control.
Date: Mon, 25 Jul 2005 14:01:01 -0700 [thread overview]
Message-ID: <20050725210101.GA24314@intel.com> (raw)
Implement the I/O bitmap vm execution control.
With this patch, we should not bee seeing any vmexits for debug port
accesses.
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
--- a/xen/arch/x86/domain.c Mon Jul 25 20:44:41 2005
+++ b/xen/arch/x86/domain.c Mon Jul 25 13:48:04 2005
@@ -373,6 +373,14 @@
out:
free_vmcs(vmcs);
+ if(v->arch.arch_vmx.io_bitmap_a != 0) {
+ free_xenheap_pages(v->arch.arch_vmx.io_bitmap_a, get_order(0x1000));
+ v->arch.arch_vmx.io_bitmap_a = 0;
+ }
+ if(v->arch.arch_vmx.io_bitmap_b != 0) {
+ free_xenheap_pages(v->arch.arch_vmx.io_bitmap_b, get_order(0x1000));
+ v->arch.arch_vmx.io_bitmap_b = 0;
+ }
v->arch.arch_vmx.vmcs = 0;
return error;
}
@@ -926,6 +934,14 @@
BUG_ON(v->arch.arch_vmx.vmcs == NULL);
free_vmcs(v->arch.arch_vmx.vmcs);
+ if(v->arch.arch_vmx.io_bitmap_a != 0) {
+ free_xenheap_pages(v->arch.arch_vmx.io_bitmap_a, get_order(0x1000));
+ v->arch.arch_vmx.io_bitmap_a = 0;
+ }
+ if(v->arch.arch_vmx.io_bitmap_b != 0) {
+ free_xenheap_pages(v->arch.arch_vmx.io_bitmap_b, get_order(0x1000));
+ v->arch.arch_vmx.io_bitmap_b = 0;
+ }
v->arch.arch_vmx.vmcs = 0;
free_monitor_pagetable(v);
diff -r 8ce9ac95de9e xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c Mon Jul 25 20:44:41 2005
+++ b/xen/arch/x86/vmx.c Mon Jul 25 13:48:04 2005
@@ -608,11 +608,6 @@
addr = (exit_qualification >> 16) & (0xffff);
else
addr = regs->edx & 0xffff;
-
- if (addr == 0x80) {
- __update_guest_eip(inst_len);
- return;
- }
vio = get_vio(d->domain, d->vcpu_id);
if (vio == 0) {
diff -r 8ce9ac95de9e xen/arch/x86/vmx_vmcs.c
--- a/xen/arch/x86/vmx_vmcs.c Mon Jul 25 20:44:41 2005
+++ b/xen/arch/x86/vmx_vmcs.c Mon Jul 25 13:48:04 2005
@@ -59,9 +59,11 @@
free_xenheap_pages(vmcs, order);
}
-static inline int construct_vmcs_controls(void)
+static inline int construct_vmcs_controls(struct arch_vmx_struct *arch_vmx)
{
int error = 0;
+ void *io_bitmap_a;
+ void *io_bitmap_b;
error |= __vmwrite(PIN_BASED_VM_EXEC_CONTROL,
MONITOR_PIN_BASED_EXEC_CONTROLS);
@@ -72,6 +74,20 @@
error |= __vmwrite(VM_EXIT_CONTROLS, MONITOR_VM_EXIT_CONTROLS);
error |= __vmwrite(VM_ENTRY_CONTROLS, MONITOR_VM_ENTRY_CONTROLS);
+
+ /* need to use 0x1000 instead of PAGE_SIZE */
+ io_bitmap_a = (void*) alloc_xenheap_pages(get_order(0x1000));
+ io_bitmap_b = (void*) alloc_xenheap_pages(get_order(0x1000));
+ memset(io_bitmap_a, 0xff, 0x1000);
+ /* don't bother debug port access */
+ clear_bit(PC_DEBUG_PORT, io_bitmap_a);
+ memset(io_bitmap_b, 0xff, 0x1000);
+
+ error |= __vmwrite(IO_BITMAP_A, (u64) virt_to_phys(io_bitmap_a));
+ error |= __vmwrite(IO_BITMAP_B, (u64) virt_to_phys(io_bitmap_b));
+
+ arch_vmx->io_bitmap_a = io_bitmap_a;
+ arch_vmx->io_bitmap_b = io_bitmap_b;
return error;
}
@@ -432,7 +448,7 @@
(unsigned long) vmcs_phys_ptr);
return -EINVAL;
}
- if ((error = construct_vmcs_controls())) {
+ if ((error = construct_vmcs_controls(arch_vmx))) {
printk("construct_vmcs: construct_vmcs_controls failed\n");
return -EINVAL;
}
diff -r 8ce9ac95de9e xen/include/asm-x86/vmx.h
--- a/xen/include/asm-x86/vmx.h Mon Jul 25 20:44:41 2005
+++ b/xen/include/asm-x86/vmx.h Mon Jul 25 13:48:04 2005
@@ -61,6 +61,7 @@
CPU_BASED_INVDPG_EXITING | \
CPU_BASED_MWAIT_EXITING | \
CPU_BASED_MOV_DR_EXITING | \
+ CPU_BASED_ACTIVATE_IO_BITMAP | \
CPU_BASED_UNCOND_IO_EXITING \
)
diff -r 8ce9ac95de9e xen/include/asm-x86/vmx_vmcs.h
--- a/xen/include/asm-x86/vmx_vmcs.h Mon Jul 25 20:44:41 2005
+++ b/xen/include/asm-x86/vmx_vmcs.h Mon Jul 25 13:48:04 2005
@@ -69,6 +69,8 @@
unsigned long shadow_gs;
};
+#define PC_DEBUG_PORT 0x80
+
struct arch_vmx_struct {
struct vmcs_struct *vmcs; /* VMCS pointer in virtual */
unsigned long flags; /* VMCS flags */
@@ -76,6 +78,7 @@
unsigned long cpu_cr3;
unsigned long cpu_state;
struct msr_state msr_content;
+ void *io_bitmap_a, *io_bitmap_b;
};
#define vmx_schedule_tail(next) \
reply other threads:[~2005-07-25 21:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050725210101.GA24314@intel.com \
--to=arun.sharma@intel.com \
--cc=Ian.Pratt@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.