[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86_emulate: Allow writeback-avoidance optimisation to be defeated by
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1203605427 0 # Node ID f1a107ec62b6e8829981ff05fb988047174de479 # Parent 221b2680ffe5481eaa0469e6992866113e2e071f x86_emulate: Allow writeback-avoidance optimisation to be defeated by the caller. This is used in cases where the writeback may be to an MMIO region with side effects (the APIC EOI register is the main example of this). Also fix up build of the x86_emulate user-space test harness. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- tools/tests/test_x86_emulator.c | 1 + xen/arch/x86/hvm/emulate.c | 1 + xen/arch/x86/mm.c | 1 + xen/arch/x86/mm/shadow/common.c | 1 + xen/arch/x86/x86_emulate.c | 4 +++- xen/include/asm-x86/x86_emulate.h | 27 +++++++++++++++------------ 6 files changed, 22 insertions(+), 13 deletions(-) diff -r 221b2680ffe5 -r f1a107ec62b6 tools/tests/test_x86_emulator.c --- a/tools/tests/test_x86_emulator.c Thu Feb 21 10:30:57 2008 +0000 +++ b/tools/tests/test_x86_emulator.c Thu Feb 21 14:50:27 2008 +0000 @@ -118,6 +118,7 @@ int main(int argc, char **argv) #endif ctxt.regs = ®s; + ctxt.force_writeback = 0; ctxt.addr_size = 32; ctxt.sp_size = 32; diff -r 221b2680ffe5 -r f1a107ec62b6 xen/arch/x86/hvm/emulate.c --- a/xen/arch/x86/hvm/emulate.c Thu Feb 21 10:30:57 2008 +0000 +++ b/xen/arch/x86/hvm/emulate.c Thu Feb 21 14:50:27 2008 +0000 @@ -722,6 +722,7 @@ void hvm_emulate_prepare( struct cpu_user_regs *regs) { hvmemul_ctxt->ctxt.regs = regs; + hvmemul_ctxt->ctxt.force_writeback = 1; hvmemul_ctxt->seg_reg_accessed = 0; hvmemul_ctxt->seg_reg_dirty = 0; hvmemul_get_seg_reg(x86_seg_cs, hvmemul_ctxt); diff -r 221b2680ffe5 -r f1a107ec62b6 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu Feb 21 10:30:57 2008 +0000 +++ b/xen/arch/x86/mm.c Thu Feb 21 14:50:27 2008 +0000 @@ -3671,6 +3671,7 @@ int ptwr_do_page_fault(struct vcpu *v, u goto bail; ptwr_ctxt.ctxt.regs = regs; + ptwr_ctxt.ctxt.force_writeback = 0; ptwr_ctxt.ctxt.addr_size = ptwr_ctxt.ctxt.sp_size = is_pv_32on64_domain(d) ? 32 : BITS_PER_LONG; ptwr_ctxt.cr2 = addr; diff -r 221b2680ffe5 -r f1a107ec62b6 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Thu Feb 21 10:30:57 2008 +0000 +++ b/xen/arch/x86/mm/shadow/common.c Thu Feb 21 14:50:27 2008 +0000 @@ -385,6 +385,7 @@ struct x86_emulate_ops *shadow_init_emul unsigned long addr; sh_ctxt->ctxt.regs = regs; + sh_ctxt->ctxt.force_writeback = 0; if ( !is_hvm_vcpu(v) ) { diff -r 221b2680ffe5 -r f1a107ec62b6 xen/arch/x86/x86_emulate.c --- a/xen/arch/x86/x86_emulate.c Thu Feb 21 10:30:57 2008 +0000 +++ b/xen/arch/x86/x86_emulate.c Thu Feb 21 14:50:27 2008 +0000 @@ -24,6 +24,7 @@ #ifndef __XEN__ #include <stddef.h> #include <stdint.h> +#include <string.h> #include <public/xen.h> #else #include <xen/config.h> @@ -1983,7 +1984,8 @@ x86_emulate( } break; case OP_MEM: - if ( !(d & Mov) && (dst.orig_val == dst.val) ) + if ( !(d & Mov) && (dst.orig_val == dst.val) && + !ctxt->force_writeback ) /* nothing to do */; else if ( lock_prefix ) rc = ops->cmpxchg( diff -r 221b2680ffe5 -r f1a107ec62b6 xen/include/asm-x86/x86_emulate.h --- a/xen/include/asm-x86/x86_emulate.h Thu Feb 21 10:30:57 2008 +0000 +++ b/xen/include/asm-x86/x86_emulate.h Thu Feb 21 14:50:27 2008 +0000 @@ -56,17 +56,17 @@ enum x86_segment { * segment descriptor. It happens to match the format of an AMD SVM VMCB. */ typedef union segment_attributes { - u16 bytes; + uint16_t bytes; struct { - u16 type:4; /* 0; Bit 40-43 */ - u16 s: 1; /* 4; Bit 44 */ - u16 dpl: 2; /* 5; Bit 45-46 */ - u16 p: 1; /* 7; Bit 47 */ - u16 avl: 1; /* 8; Bit 52 */ - u16 l: 1; /* 9; Bit 53 */ - u16 db: 1; /* 10; Bit 54 */ - u16 g: 1; /* 11; Bit 55 */ + uint16_t type:4; /* 0; Bit 40-43 */ + uint16_t s: 1; /* 4; Bit 44 */ + uint16_t dpl: 2; /* 5; Bit 45-46 */ + uint16_t p: 1; /* 7; Bit 47 */ + uint16_t avl: 1; /* 8; Bit 52 */ + uint16_t l: 1; /* 9; Bit 53 */ + uint16_t db: 1; /* 10; Bit 54 */ + uint16_t g: 1; /* 11; Bit 55 */ } fields; } __attribute__ ((packed)) segment_attributes_t; @@ -75,10 +75,10 @@ typedef union segment_attributes { * Again, this happens to match the format of an AMD SVM VMCB. */ struct segment_register { - u16 sel; + uint16_t sel; segment_attributes_t attr; - u32 limit; - u64 base; + uint32_t limit; + uint64_t base; } __attribute__ ((packed)); /* @@ -368,6 +368,9 @@ struct x86_emulate_ctxt /* Stack pointer width in bits (16, 32 or 64). */ unsigned int sp_size; + + /* Set this if writes may have side effects. */ + int force_writeback; }; /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |