* [patch 17/60] KVM: x86 emulator: implement movnti mem, reg
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
@ 2007-12-13 6:51 ` Greg KH
2007-12-13 6:51 ` [patch 18/60] KVM: x86 emulator: fix access registers for instructions with ModR/M byte and Mod = 3 Greg KH
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:51 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-DgEjT+Ai2ygdnm+yROfE0A
Cc: Theodore Ts'o, Zwane Mwaikambo,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Justin Forbes,
Domenico Andreoli, Chris Wedgwood, Randy Dunlap, Michael Krufky,
Avi Kivity, Chuck Ebbert, Dave Jones, Chuck Wolber,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
alan-qBU/x9rampVanCEyBjwyrvXRex20P6io
[-- Attachment #1: kvm-x86-emulator-implement-movnti-mem-reg.patch --]
[-- Type: text/plain, Size: 1770 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Sheng Yang <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
patch a012e65aee48379a7a87eadafa74f878b61522b9 in mainline.
Implement emulation of instruction:
movnti m32/m64, r32/r64
opcode: 0x0f 0xc3
Needed to support Linux 2.6.16 as guest (used for mmio).
Signed-off-by: Sheng Yang <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
---
drivers/kvm/x86_emulate.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -198,7 +198,8 @@ static u16 twobyte_table[256] = {
0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov,
DstReg | SrcMem16 | ModRM | Mov,
/* 0xC0 - 0xCF */
- 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, DstMem | SrcReg | ModRM | Mov, 0, 0, 0, ImplicitOps | ModRM,
+ 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xD0 - 0xDF */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xE0 - 0xEF */
@@ -1324,6 +1325,10 @@ twobyte_insn:
dst.bytes = op_bytes;
dst.val = (d & ByteOp) ? (s8) src.val : (s16) src.val;
break;
+ case 0xc3: /* movnti */
+ dst.bytes = op_bytes;
+ dst.val = (op_bytes == 4) ? (u32) src.val : (u64) src.val;
+ break;
}
goto writeback;
--
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 18/60] KVM: x86 emulator: fix access registers for instructions with ModR/M byte and Mod = 3
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-12-13 6:51 ` [patch 17/60] KVM: x86 emulator: implement movnti mem, reg Greg KH
@ 2007-12-13 6:51 ` Greg KH
2007-12-13 6:51 ` [patch 19/60] KVM: x86 emulator: invd instruction Greg KH
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:51 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-DgEjT+Ai2ygdnm+yROfE0A
Cc: Theodore Ts'o, Zwane Mwaikambo,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Justin Forbes,
Domenico Andreoli, Chris Wedgwood, Aurelien Jarno, Randy Dunlap,
Michael Krufky, Avi Kivity, Chuck Ebbert, Dave Jones,
Chuck Wolber, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
alan-qBU/x9rampVanCEyBjwyrvXRex20P6io
[-- Attachment #1: kvm-x86-emulator-fix-access-registers-for-instructions-with-modr-m-byte-and-mod-3.patch --]
[-- Type: text/plain, Size: 1999 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Aurelien Jarno <aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org>
patch 4e62417bf317504c0b85e0d7abd236f334f54eaf in mainline.
The patch belows changes the access type to register from memory for
instructions that are declared as SrcMem or DstMem, but have a
ModR/M byte with Mod = 3.
It fixes (at least) the lmsw and smsw instructions on an AMD64 CPU,
which are needed for FreeBSD.
Signed-off-by: Aurelien Jarno <aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
---
drivers/kvm/x86_emulate.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -773,6 +773,14 @@ done_prefixes:
case SrcMem:
src.bytes = (d & ByteOp) ? 1 : op_bytes;
srcmem_common:
+ /*
+ * For instructions with a ModR/M byte, switch to register
+ * access if Mod = 3.
+ */
+ if ((d & ModRM) && modrm_mod == 3) {
+ src.type = OP_REG;
+ break;
+ }
src.type = OP_MEM;
src.ptr = (unsigned long *)cr2;
if ((rc = ops->read_emulated((unsigned long)src.ptr,
@@ -839,6 +847,15 @@ done_prefixes:
dst.type = OP_MEM;
dst.ptr = (unsigned long *)cr2;
dst.bytes = (d & ByteOp) ? 1 : op_bytes;
+ dst.val = 0;
+ /*
+ * For instructions with a ModR/M byte, switch to register
+ * access if Mod = 3.
+ */
+ if ((d & ModRM) && modrm_mod == 3) {
+ dst.type = OP_REG;
+ break;
+ }
if (d & BitOp) {
unsigned long mask = ~(dst.bytes * 8 - 1);
--
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 19/60] KVM: x86 emulator: invd instruction
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-12-13 6:51 ` [patch 17/60] KVM: x86 emulator: implement movnti mem, reg Greg KH
2007-12-13 6:51 ` [patch 18/60] KVM: x86 emulator: fix access registers for instructions with ModR/M byte and Mod = 3 Greg KH
@ 2007-12-13 6:51 ` Greg KH
2007-12-13 6:51 ` [patch 20/60] KVM: SVM: Intercept the invd and wbinvd instructions Greg KH
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:51 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-DgEjT+Ai2ygdnm+yROfE0A
Cc: Theodore Ts'o, Zwane Mwaikambo,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Justin Forbes,
Domenico Andreoli, Chris Wedgwood, Randy Dunlap, Michael Krufky,
Avi Kivity, Chuck Ebbert, Dave Jones, Chuck Wolber,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
alan-qBU/x9rampVanCEyBjwyrvXRex20P6io
[-- Attachment #1: kvm-x86-emulator-invd-instruction.patch --]
[-- Type: text/plain, Size: 1486 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
patch 651a3e29b3d19418d7a8a9787906061f9be7cc5f in mainline.
Emulate the 'invd' instruction (opcode 0f 08).
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
---
drivers/kvm/x86_emulate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -156,7 +156,7 @@ static u8 opcode_table[256] = {
static u16 twobyte_table[256] = {
/* 0x00 - 0x0F */
0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0,
- 0, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0,
+ ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0,
/* 0x10 - 0x1F */
0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0,
/* 0x20 - 0x2F */
@@ -1353,6 +1353,8 @@ twobyte_special_insn:
/* Disable writeback. */
no_wb = 1;
switch (b) {
+ case 0x08: /* invd */
+ break;
case 0x09: /* wbinvd */
break;
case 0x0d: /* GrpP (prefetch) */
--
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 20/60] KVM: SVM: Intercept the invd and wbinvd instructions
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2007-12-13 6:51 ` [patch 19/60] KVM: x86 emulator: invd instruction Greg KH
@ 2007-12-13 6:51 ` Greg KH
2007-12-13 6:52 ` [patch 24/60] KVM: Skip pio instruction when it is emulated, not executed Greg KH
2007-12-13 6:52 ` [patch 26/60] KVM: VMX: Reset mmu context when entering real mode Greg KH
5 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:51 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-DgEjT+Ai2ygdnm+yROfE0A
Cc: Theodore Ts'o, Zwane Mwaikambo,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Justin Forbes,
Domenico Andreoli, Chris Wedgwood, Randy Dunlap, Michael Krufky,
Avi Kivity, Chuck Ebbert, Dave Jones, Chuck Wolber,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
alan-qBU/x9rampVanCEyBjwyrvXRex20P6io
[-- Attachment #1: kvm-svm-intercept-the-invd-and-wbinvd-instructions.patch --]
[-- Type: text/plain, Size: 2292 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
patch cf5a94d1331b411b84414c13e43f578260942d6b in mainline.
'invd' can destroy host data, and 'wbinvd' allows the guest to induce
long (milliseconds) latencies.
Noted by Ben Serebrin.
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
---
drivers/kvm/svm.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -506,6 +506,7 @@ static void init_vmcb(struct vmcb *vmcb)
*/
/* (1ULL << INTERCEPT_SELECTIVE_CR0) | */
(1ULL << INTERCEPT_CPUID) |
+ (1ULL << INTERCEPT_INVD) |
(1ULL << INTERCEPT_HLT) |
(1ULL << INTERCEPT_INVLPGA) |
(1ULL << INTERCEPT_IOIO_PROT) |
@@ -519,6 +520,7 @@ static void init_vmcb(struct vmcb *vmcb)
(1ULL << INTERCEPT_STGI) |
(1ULL << INTERCEPT_CLGI) |
(1ULL << INTERCEPT_SKINIT) |
+ (1ULL << INTERCEPT_WBINVD) |
(1ULL << INTERCEPT_MONITOR) |
(1ULL << INTERCEPT_MWAIT);
@@ -1319,6 +1321,7 @@ static int (*svm_exit_handlers[])(struct
[SVM_EXIT_VINTR] = interrupt_window_interception,
/* [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, */
[SVM_EXIT_CPUID] = cpuid_interception,
+ [SVM_EXIT_INVD] = emulate_on_interception,
[SVM_EXIT_HLT] = halt_interception,
[SVM_EXIT_INVLPG] = emulate_on_interception,
[SVM_EXIT_INVLPGA] = invalid_op_interception,
@@ -1333,6 +1336,7 @@ static int (*svm_exit_handlers[])(struct
[SVM_EXIT_STGI] = invalid_op_interception,
[SVM_EXIT_CLGI] = invalid_op_interception,
[SVM_EXIT_SKINIT] = invalid_op_interception,
+ [SVM_EXIT_WBINVD] = emulate_on_interception,
[SVM_EXIT_MONITOR] = invalid_op_interception,
[SVM_EXIT_MWAIT] = invalid_op_interception,
};
--
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 21/60] KVM: x86 emulator: Use emulator_write_emulated and not emulator_write_std
[not found] ` <20071213065039.GA6867@kroah.com>
@ 2007-12-13 6:52 ` Greg KH
2007-12-13 6:52 ` [patch 22/60] KVM: Fix hang on uniprocessor Greg KH
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:52 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
Dave Jones, Chuck Wolber, Chris Wedgwood, Michael Krufky,
Chuck Ebbert, Domenico Andreoli, torvalds, akpm, alan, kvm-devel,
Amit Shah, Avi Kivity
[-- Attachment #1: kvm-x86-emulator-use-emulator_write_emulated-and-not-emulator_write_std.patch --]
[-- Type: text/plain, Size: 987 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Amit Shah <amit.shah@qumranet.com>
patch 00b2ef475d4728ca53a2bc788c7978042907e354 in mainline.
emulator_write_std() is not implemented, and calling write_emulated should
work just as well in place of write_std.
Fixes emulator failures with the push r/m instruction.
Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/kvm/x86_emulate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1066,7 +1066,7 @@ done_prefixes:
}
register_address_increment(_regs[VCPU_REGS_RSP],
-dst.bytes);
- if ((rc = ops->write_std(
+ if ((rc = ops->write_emulated(
register_address(ctxt->ss_base,
_regs[VCPU_REGS_RSP]),
&dst.val, dst.bytes, ctxt)) != 0)
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 22/60] KVM: Fix hang on uniprocessor
[not found] ` <20071213065039.GA6867@kroah.com>
2007-12-13 6:52 ` [patch 21/60] KVM: x86 emulator: Use emulator_write_emulated and not emulator_write_std Greg KH
@ 2007-12-13 6:52 ` Greg KH
2007-12-13 6:52 ` [patch 23/60] KVM: SVM: Fix FPU leak while emulating clts Greg KH
2007-12-13 6:52 ` [patch 25/60] KVM: VMX: Force vm86 mode if setting flags during real mode Greg KH
3 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:52 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
Dave Jones, Chuck Wolber, Chris Wedgwood, Michael Krufky,
Chuck Ebbert, Domenico Andreoli, torvalds, akpm, alan, kvm-devel,
Marko Kohtala, Avi Kivity
[-- Attachment #1: kvm-fix-hang-on-uniprocessor.patch --]
[-- Type: text/plain, Size: 1062 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Marko Kohtala <marko.kohtala@gmail.com>
This is not in mainline, as it was fixed differently in that tree.
first_cpu(cpus) returns the only CPU when NR_CPUS is 1 regardless of
the cpus mask. Therefore we avoid a kernel hang in
KVM_SET_MEMORY_REGION ioctl on uniprocessor by not entering the loop at
all.
Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/kvm/kvm_main.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -273,6 +273,11 @@ void kvm_flush_remote_tlbs(struct kvm *k
}
}
+ /* Uniprocessor kernel does not respect cpus in first_cpu. So
+ * do not go there if we have nothing to do. */
+ if (cpus_empty(cpus))
+ return;
+
/*
* We really want smp_call_function_mask() here. But that's not
* available, so ipi all cpus in parallel and wait for them
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 23/60] KVM: SVM: Fix FPU leak while emulating clts
[not found] ` <20071213065039.GA6867@kroah.com>
2007-12-13 6:52 ` [patch 21/60] KVM: x86 emulator: Use emulator_write_emulated and not emulator_write_std Greg KH
2007-12-13 6:52 ` [patch 22/60] KVM: Fix hang on uniprocessor Greg KH
@ 2007-12-13 6:52 ` Greg KH
2007-12-13 6:52 ` [patch 25/60] KVM: VMX: Force vm86 mode if setting flags during real mode Greg KH
3 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:52 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
Dave Jones, Chuck Wolber, Chris Wedgwood, Michael Krufky,
Chuck Ebbert, Domenico Andreoli, torvalds, akpm, alan, kvm-devel,
Amit Shah, Avi Kivity
[-- Attachment #1: kvm-svm-fix-fpu-leak-while-emulating-clts.patch --]
[-- Type: text/plain, Size: 818 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Amit Shah <amit.shah@qumranet.com>
patch 404fb881b82cf0cf6981832f8d31a7484e4dee81 in mainline.
The clts code didn't use set_cr0 properly, so our lazy FPU
processing wasn't being done by the clts instruction at all.
(this isn't called on Intel as the hardware does the decode for us)
Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/kvm/kvm_main.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1163,10 +1163,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu
int emulate_clts(struct kvm_vcpu *vcpu)
{
- unsigned long cr0;
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 24/60] KVM: Skip pio instruction when it is emulated, not executed
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2007-12-13 6:51 ` [patch 20/60] KVM: SVM: Intercept the invd and wbinvd instructions Greg KH
@ 2007-12-13 6:52 ` Greg KH
2007-12-13 6:52 ` [patch 26/60] KVM: VMX: Reset mmu context when entering real mode Greg KH
5 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:52 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-DgEjT+Ai2ygdnm+yROfE0A
Cc: Theodore Ts'o, Zwane Mwaikambo,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Justin Forbes,
Domenico Andreoli, Chris Wedgwood, Randy Dunlap, Michael Krufky,
Avi Kivity, Chuck Ebbert, Dave Jones, Chuck Wolber,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
alan-qBU/x9rampVanCEyBjwyrvXRex20P6io
[-- Attachment #1: kvm-skip-pio-instruction-when-it-is-emulated-not-executed.patch --]
[-- Type: text/plain, Size: 1967 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
patch 0967b7bf1c22b55777aba46ff616547feed0b141 in mainline.
If we defer updating rip until pio instructions are executed, we have a
problem with reset: a pio reset updates rip, and when the instruction
completes we skip the emulated instruction, pointing rip somewhere completely
unrelated.
Fix by updating rip when we see decode the instruction, not after emulation.
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
---
drivers/kvm/kvm_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1757,8 +1757,6 @@ static int complete_pio(struct kvm_vcpu
io->count -= io->cur_count;
io->cur_count = 0;
- if (!io->count)
- kvm_arch_ops->skip_emulated_instruction(vcpu);
return 0;
}
@@ -1804,6 +1802,7 @@ int kvm_setup_pio(struct kvm_vcpu *vcpu,
pio_dev = vcpu_find_pio_dev(vcpu, port);
if (!string) {
+ kvm_arch_ops->skip_emulated_instruction(vcpu);
kvm_arch_ops->cache_regs(vcpu);
memcpy(vcpu->pio_data, &vcpu->regs[VCPU_REGS_RAX], 4);
kvm_arch_ops->decache_regs(vcpu);
@@ -1850,6 +1849,9 @@ int kvm_setup_pio(struct kvm_vcpu *vcpu,
vcpu->run->io.count = now;
vcpu->pio.cur_count = now;
+ if (now == count)
+ kvm_arch_ops->skip_emulated_instruction(vcpu);
+
for (i = 0; i < nr_pages; ++i) {
spin_lock(&vcpu->kvm->lock);
page = gva_to_page(vcpu, address + i * PAGE_SIZE);
--
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 25/60] KVM: VMX: Force vm86 mode if setting flags during real mode
[not found] ` <20071213065039.GA6867@kroah.com>
` (2 preceding siblings ...)
2007-12-13 6:52 ` [patch 23/60] KVM: SVM: Fix FPU leak while emulating clts Greg KH
@ 2007-12-13 6:52 ` Greg KH
3 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:52 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
Dave Jones, Chuck Wolber, Chris Wedgwood, Michael Krufky,
Chuck Ebbert, Domenico Andreoli, torvalds, akpm, alan, kvm-devel,
Avi Kivity
[-- Attachment #1: kvm-vmx-force-vm86-mode-if-setting-flags-during-real-mode.patch --]
[-- Type: text/plain, Size: 767 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Avi Kivity <avi@qumranet.com>
patch 78f7826868da8e27d097802139a3fec39f47f3b8 in mainline.
When resetting from userspace, we need to handle the flags being cleared
even after we are in real mode.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/kvm/vmx.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -463,6 +463,8 @@ static unsigned long vmx_get_rflags(stru
static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
{
+ if (vcpu->rmode.active)
+ rflags |= IOPL_MASK | X86_EFLAGS_VM;
vmcs_writel(GUEST_RFLAGS, rflags);
}
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 26/60] KVM: VMX: Reset mmu context when entering real mode
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
` (4 preceding siblings ...)
2007-12-13 6:52 ` [patch 24/60] KVM: Skip pio instruction when it is emulated, not executed Greg KH
@ 2007-12-13 6:52 ` Greg KH
5 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2007-12-13 6:52 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-DgEjT+Ai2ygdnm+yROfE0A
Cc: Theodore Ts'o, Zwane Mwaikambo, Qing He,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Justin Forbes,
Domenico Andreoli, Chris Wedgwood, Randy Dunlap, Michael Krufky,
Avi Kivity, Chuck Ebbert, Dave Jones, Chuck Wolber,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
alan-qBU/x9rampVanCEyBjwyrvXRex20P6io
[-- Attachment #1: kvm-vmx-reset-mmu-context-when-entering-real-mode.patch --]
[-- Type: text/plain, Size: 1758 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Eddie Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
patch 8668a3c468ed55d19514117a5a959d91d3d03823 in mainline.
Resetting an SMP guest will force AP enter real mode (RESET) with
paging enabled in protected mode. While current enter_rmode() can
only handle mode switch from nonpaging mode to real mode which leads
to SMP reboot failure.
Fix by reloading the mmu context on entering real mode.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Qing He <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
---
drivers/kvm/mmu.c | 1 +
drivers/kvm/vmx.c | 1 +
2 files changed, 2 insertions(+)
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -1066,6 +1066,7 @@ int kvm_mmu_reset_context(struct kvm_vcp
destroy_kvm_mmu(vcpu);
return init_kvm_mmu(vcpu);
}
+EXPORT_SYMBOL_GPL(kvm_mmu_reset_context);
int kvm_mmu_load(struct kvm_vcpu *vcpu)
{
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -957,6 +957,7 @@ static void enter_rmode(struct kvm_vcpu
fix_rmode_seg(VCPU_SREG_GS, &vcpu->rmode.gs);
fix_rmode_seg(VCPU_SREG_FS, &vcpu->rmode.fs);
+ kvm_mmu_reset_context(vcpu);
init_rmode_tss(vcpu->kvm);
}
--
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-12-13 6:52 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20071213064518.328162328@mini.kroah.org>
[not found] ` <20071213065039.GA6867@kroah.com>
2007-12-13 6:52 ` [patch 21/60] KVM: x86 emulator: Use emulator_write_emulated and not emulator_write_std Greg KH
2007-12-13 6:52 ` [patch 22/60] KVM: Fix hang on uniprocessor Greg KH
2007-12-13 6:52 ` [patch 23/60] KVM: SVM: Fix FPU leak while emulating clts Greg KH
2007-12-13 6:52 ` [patch 25/60] KVM: VMX: Force vm86 mode if setting flags during real mode Greg KH
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-12-13 6:51 ` [patch 17/60] KVM: x86 emulator: implement movnti mem, reg Greg KH
2007-12-13 6:51 ` [patch 18/60] KVM: x86 emulator: fix access registers for instructions with ModR/M byte and Mod = 3 Greg KH
2007-12-13 6:51 ` [patch 19/60] KVM: x86 emulator: invd instruction Greg KH
2007-12-13 6:51 ` [patch 20/60] KVM: SVM: Intercept the invd and wbinvd instructions Greg KH
2007-12-13 6:52 ` [patch 24/60] KVM: Skip pio instruction when it is emulated, not executed Greg KH
2007-12-13 6:52 ` [patch 26/60] KVM: VMX: Reset mmu context when entering real mode Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox