Re: [PATCHv2 6/6] KVM: VMX: handle IO when emulation is due to #GP in real mode.

2012-12-22 Thread Avi Kivity
Alex Williamson redhat.com> writes: > Thanks for finding the right fix Gleb. This originally came about from > an experiment in lazily mapping assigned device MMIO BARs. That's > something I think might still have value for conserving memory slots, > but now I have to be aware of this bug. Tha

[PATCH 5/7] KVM: x86 emulator: convert NOT, NEG to fastop

2012-12-22 Thread Avi Kivity
Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 58cccb3..88579fa 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2001,17 +2001,8 @

[PATCH 7/7] KVM: x86 emulator: convert basic ALU ops to fastop

2012-12-22 Thread Avi Kivity
Opcodes: TEST CMP ADD ADC SUB SBB XOR OR AND Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 112 +++-- 1 file changed, 34 insertions(+), 78 deletions(-) diff --git a/arch/

[PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Avi Kivity
We emulate arithmetic opcodes by executing a "similar" (same operation, different operands) on the cpu. This ensures accurate emulation, esp. wrt. eflags. However, the prologue and epilogue around the opcode is fairly long, consisting of a switch (for the operand size) and code to load and save t

[PATCH 2/7] KVM: x86 emulator: Support for declaring single operand fastops

2012-12-22 Thread Avi Kivity
Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 25 + 1 file changed, 25 insertions(+) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index cdf7b97..9859df6 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -24,6 +24,7 @@ #include "

[PATCH 0/7] Streamline arithmetic instruction emulation

2012-12-22 Thread Avi Kivity
The current arithmetic instruction emulation is fairly clumsy: after decode, each instruction gets a switch (size), and for every size we fetch the operands, prepare flags, emulate the instruction, then store back the flags and operands. This patchset simplifies things by moving everything into co

[PATCH 4/7] KVM: x86 emulator: mark CMP, CMPS, SCAS, TEST as NoWrite

2012-12-22 Thread Avi Kivity
Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 9dfbd07..58cccb3 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3020,16 +3020,

[PATCH 6/7] KVM: x86 emulator: add macros for defining 2-operand fastop emulation

2012-12-22 Thread Avi Kivity
Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 88579fa..8f650d7 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -458,6 +458,17 @@ static void invalidat

[PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag

2012-12-22 Thread Avi Kivity
Instead of disabling writeback via OP_NONE, just specify NoWrite. Signed-off-by: Avi Kivity --- arch/x86/kvm/emulate.c | 4 1 file changed, 4 insertions(+) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 9859df6..9dfbd07 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86

[PATCH] KVM: PPC: Book3S HV: Fix compilation without CONFIG_PPC_POWERNV

2012-12-22 Thread Andreas Schwab
Fixes this build breakage: arch/powerpc/kvm/book3s_hv_ras.c: In function ‘kvmppc_realmode_mc_power7’: arch/powerpc/kvm/book3s_hv_ras.c:126:23: error: ‘struct paca_struct’ has no member named ‘opal_mc_evt’ Signed-off-by: Andreas Schwab --- arch/powerpc/kvm/book3s_hv_ras.c | 4 1 file chang

Re: [PATCH 2/7] KVM: VMX: relax check for CS register in rmode_segment_valid()

2012-12-22 Thread Marcelo Tosatti
On Sat, Dec 22, 2012 at 09:02:41AM +0200, Gleb Natapov wrote: > On Fri, Dec 21, 2012 at 09:17:16PM -0200, Marcelo Tosatti wrote: > > On Wed, Dec 12, 2012 at 07:10:50PM +0200, Gleb Natapov wrote: > > > rmode_segment_valid() checks if segment descriptor can be used to enter > > > vm86 mode. VMX spec

Re: [PATCH 2/7] KVM: VMX: relax check for CS register in rmode_segment_valid()

2012-12-22 Thread Marcelo Tosatti
On Sat, Dec 22, 2012 at 12:55:43PM -0200, Marcelo Tosatti wrote: > On Sat, Dec 22, 2012 at 09:02:41AM +0200, Gleb Natapov wrote: > > On Fri, Dec 21, 2012 at 09:17:16PM -0200, Marcelo Tosatti wrote: > > > On Wed, Dec 12, 2012 at 07:10:50PM +0200, Gleb Natapov wrote: > > > > rmode_segment_valid() che

Re: [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag

2012-12-22 Thread Gleb Natapov
On Sat, Dec 22, 2012 at 02:26:53PM +0200, Avi Kivity wrote: > Instead of disabling writeback via OP_NONE, just specify NoWrite. > > Signed-off-by: Avi Kivity > --- > arch/x86/kvm/emulate.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate

Re: [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag

2012-12-22 Thread Avi Kivity
On Sat, Dec 22, 2012 at 5:11 PM, Gleb Natapov wrote: >> #define X2(x...) x, x >> #define X3(x...) X2(x), x >> @@ -1584,6 +1585,9 @@ static int writeback(struct x86_emulate_ctxt *ctxt) >> { >> int rc; >> >> + if (ctxt->d & NoWrite) >> + return X86EMUL_CONTINUE; >> + > Why n

Re: [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag

2012-12-22 Thread Gleb Natapov
On Sat, Dec 22, 2012 at 05:28:00PM +0200, Avi Kivity wrote: > On Sat, Dec 22, 2012 at 5:11 PM, Gleb Natapov wrote: > >> #define X2(x...) x, x > >> #define X3(x...) X2(x), x > >> @@ -1584,6 +1585,9 @@ static int writeback(struct x86_emulate_ctxt *ctxt) > >> { > >> int rc; > >> > >> + i

Re: [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag

2012-12-22 Thread Avi Kivity
On Sat, Dec 22, 2012 at 5:39 PM, Gleb Natapov wrote: > On Sat, Dec 22, 2012 at 05:28:00PM +0200, Avi Kivity wrote: >> On Sat, Dec 22, 2012 at 5:11 PM, Gleb Natapov wrote: >> >> #define X2(x...) x, x >> >> #define X3(x...) X2(x), x >> >> @@ -1584,6 +1585,9 @@ static int writeback(struct x86_emul

Re: [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag

2012-12-22 Thread Avi Kivity
On Sat, Dec 22, 2012 at 5:45 PM, Avi Kivity wrote: > On Sat, Dec 22, 2012 at 5:39 PM, Gleb Natapov wrote: >> On Sat, Dec 22, 2012 at 05:28:00PM +0200, Avi Kivity wrote: >>> On Sat, Dec 22, 2012 at 5:11 PM, Gleb Natapov wrote: >>> >> #define X2(x...) x, x >>> >> #define X3(x...) X2(x), x >>> >>

Re: [PATCH 3/7] KVM: x86 emulator: introduce NoWrite flag

2012-12-22 Thread Gleb Natapov
On Sat, Dec 22, 2012 at 05:51:08PM +0200, Avi Kivity wrote: > On Sat, Dec 22, 2012 at 5:45 PM, Avi Kivity wrote: > > On Sat, Dec 22, 2012 at 5:39 PM, Gleb Natapov wrote: > >> On Sat, Dec 22, 2012 at 05:28:00PM +0200, Avi Kivity wrote: > >>> On Sat, Dec 22, 2012 at 5:11 PM, Gleb Natapov wrote: >

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Gleb Natapov
On Sat, Dec 22, 2012 at 02:26:51PM +0200, Avi Kivity wrote: > We emulate arithmetic opcodes by executing a "similar" (same operation, > different operands) on the cpu. This ensures accurate emulation, esp. wrt. > eflags. However, the prologue and epilogue around the opcode is fairly long, > consi

Re: [user question] Opinions about running Windows in KVM

2012-12-22 Thread Marc Haber
On Thu, Dec 20, 2012 at 01:24:20PM -0500, Cole Robinson wrote: > On 12/20/2012 12:56 PM, Marc Haber wrote: > > I installed the spice-guest-tools-0.2.exe, and set the VGA model to > > "qxl" in virt-manager. I had to bcdedit -set loadoptions > > DDISABLE_INTEGRITY_CHECKS and bcdedit -set TESTSIGNING

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Avi Kivity
On Sat, Dec 22, 2012 at 7:00 PM, Gleb Natapov wrote: > On Sat, Dec 22, 2012 at 02:26:51PM +0200, Avi Kivity wrote: >> + >> +/* >> + * fastop functions have a special calling convention: >> + * >> + * dst:[rdx]:rax (in/out) > May be I miss something obvious but I do not see why rdx is here. M

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Gleb Natapov
On Sat, Dec 22, 2012 at 07:42:55PM +0200, Avi Kivity wrote: > On Sat, Dec 22, 2012 at 7:00 PM, Gleb Natapov wrote: > > On Sat, Dec 22, 2012 at 02:26:51PM +0200, Avi Kivity wrote: > >> + > >> +/* > >> + * fastop functions have a special calling convention: > >> + * > >> + * dst:[rdx]:rax (in/o

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Avi Kivity
On Sat, Dec 22, 2012 at 8:01 PM, Gleb Natapov wrote: > On Sat, Dec 22, 2012 at 07:42:55PM +0200, Avi Kivity wrote: >> On Sat, Dec 22, 2012 at 7:00 PM, Gleb Natapov wrote: >> > On Sat, Dec 22, 2012 at 02:26:51PM +0200, Avi Kivity wrote: >> >> + >> >> +/* >> >> + * fastop functions have a special c

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Gleb Natapov
On Sat, Dec 22, 2012 at 08:07:30PM +0200, Avi Kivity wrote: > On Sat, Dec 22, 2012 at 8:01 PM, Gleb Natapov wrote: > > On Sat, Dec 22, 2012 at 07:42:55PM +0200, Avi Kivity wrote: > >> On Sat, Dec 22, 2012 at 7:00 PM, Gleb Natapov wrote: > >> > On Sat, Dec 22, 2012 at 02:26:51PM +0200, Avi Kivity

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Avi Kivity
On Sat, Dec 22, 2012 at 8:11 PM, Gleb Natapov wrote: > On Sat, Dec 22, 2012 at 08:07:30PM +0200, Avi Kivity wrote: >> On Sat, Dec 22, 2012 at 8:01 PM, Gleb Natapov wrote: >> > On Sat, Dec 22, 2012 at 07:42:55PM +0200, Avi Kivity wrote: >> >> On Sat, Dec 22, 2012 at 7:00 PM, Gleb Natapov wrote: >

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Gleb Natapov
On Sat, Dec 22, 2012 at 08:18:14PM +0200, Avi Kivity wrote: > On Sat, Dec 22, 2012 at 8:11 PM, Gleb Natapov wrote: > > On Sat, Dec 22, 2012 at 08:07:30PM +0200, Avi Kivity wrote: > >> On Sat, Dec 22, 2012 at 8:01 PM, Gleb Natapov wrote: > >> > On Sat, Dec 22, 2012 at 07:42:55PM +0200, Avi Kivity

Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

2012-12-22 Thread Avi Kivity
On Sat, Dec 22, 2012 at 8:44 PM, Gleb Natapov wrote: > On Sat, Dec 22, 2012 at 08:18:14PM +0200, Avi Kivity wrote: >> > No, I was just truing to make sure I am not missing something :) >> > Wouldn't we have to have separate fastop() function to handle rax/rdx >> > output instructions? >> >> No. A