[PATCH] uio/uio_pci_generic: fix error return code in probe()

2013-05-23 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- drivers/uio/uio_pci_generic.c | 3 ++- 1 file changed, 2 insertions

[PATCH] KVM: add missing misc_deregister() on error in kvm_init()

2013-05-05 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn Add the missing misc_deregister() before return from kvm_init() in the debugfs init error handling case. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- virt/kvm/kvm_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/virt/kvm

[PATCH -next] kvm/ppc/mpic: fix missing unlock in set_base_addr()

2013-05-01 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn Add the missing unlock before return from function set_base_addr() when disables the mapping. Introduced by commit 5df554ad5b7522ea62b0ff9d5be35183494efc21 (kvm/ppc/mpic: in-kernel MPIC emulation) Signed-off-by: Wei Yongjun yongjun_

[PATCH -next] kvm/ppc/mpic: fix missing unlock in set_base_addr()

2013-05-01 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn Add the missing unlock before return from function set_base_addr() when disables the mapping. Introduced by commit 5df554ad5b7522ea62b0ff9d5be35183494efc21 (kvm/ppc/mpic: in-kernel MPIC emulation) Signed-off-by: Wei Yongjun yongjun_

[PATCH] KVM: x86: fix error return code in kvm_arch_vcpu_init()

2013-04-17 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- arch/x86/kvm/x86.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH] vfio: make local function vfio_pci_intx_unmask_handler() static

2013-03-21 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn vfio_pci_intx_unmask_handler() was not declared. It should be static. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- drivers/vfio/pci/vfio_pci_intrs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vfio

[PATCH -next] vhost-blk: remove unused variable

2013-03-11 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn The variable vq is initialized but never used otherwise, so remove the unused variable. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- drivers/vhost/blk.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/vhost/blk.c b

[PATCH -next] tcm_vhost: remove unused variable in vhost_scsi_allocate_cmd()

2012-11-07 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn The variable se_sess is initialized but never used otherwise, so remove the unused variable. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- drivers

[PATCH -next] kvm tools: remove duplicated include from builtin-setup.c

2012-10-26 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn Remove duplicated include. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- tools/kvm/builtin-setup.c | 4 1 file changed, 4 deletions(-) diff

[PATCH] vhost: remove duplicated include from tcm_vhost.c

2012-08-25 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn From: Wei Yongjun yongjun_...@trendmicro.com.cn Remove duplicated include. Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn --- drivers/vhost/tcm_vhost.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/vhost/tcm_vhost.c b

Re: [PATCH] kvm: remove useless function define kvm_inject_pit_timer_irqs()

2011-03-02 Thread Wei Yongjun
格式好像有问题,你用的什么邮件客户端?你设置了80个字符自动换行? 把邮件保存了,在用git am能够打上去么? 改好了先重新发送一个给我。 发出来应该是这样的: -- diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h index 46d08ca..9f3cea3 100644 --- a/arch/x86/kvm/i8254.h +++ b/arch/x86/kvm/i8254.h @@

Re: [PATCH] kvm: remove useless function define kvm_inject_pit_timer_irqs()

2011-03-02 Thread Wei Yongjun
I am sorry for mail to wrong address, please ignore this mail, thanks. --snip-- ... From 19d8130e2fabd8a36fc8183749efaf1c0fdcd225 Mon Sep 17 00:00:00 2001 From: Duan Jiong djduanji...@gmail.com Date: Wed, 2 Mar 2011 17:18:57 +0800 Just remove useless function define

[PATCH] [qemu-kvm-next-tree] fix compile error of hw/device-assignment.c

2010-12-08 Thread Wei Yongjun
: (Each undeclared identifier is reported only once hw/device-assignment.c:1463: error: for each function it appears in.) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- hw/device-assignment.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/device-assignment.c b/hw

Re: [PATCH v2 6/8] KVM: x86 emulator: simplify instruction decode flags for opcodes C0-DF

2010-08-26 Thread Wei Yongjun
Use the new byte/word dual opcode decode. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/emulate.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 935f98e..2610fc5 100644 ---

Re: [PATCH v2 6/8] KVM: x86 emulator: simplify instruction decode flags for opcodes C0-DF

2010-08-26 Thread Wei Yongjun
Use the new byte/word dual opcode decode. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/emulate.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 935f98e..2610fc5 100644 ---

[PATCH] KVM: x86 emulator: add CALL FAR instruction emulation (opcode 9a)

2010-08-25 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 26f69c2..e5f7f5c 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2487,7

[PATCH] Add realmode test for CALL FAR IMM instruction

2010-08-25 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/realmode.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index a833829..2e12680 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -437,6 +437,9 @@ void test_call(void

Re: [PATCH] Add realmode test for CALL FAR IMM instruction

2010-08-25 Thread Wei Yongjun
On 08/25/2010 09:16 AM, Wei Yongjun wrote: Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/realmode.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index a833829..2e12680 100644 --- a/x86/realmode.c +++ b/x86

[PATCHv2] Add realmode test for CALL FAR IMM instruction

2010-08-25 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/realmode.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index a833829..d171a56 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -437,6 +437,7 @@ void test_call(void

[PATCH] Add realmode test for LDS/LES/LFS/LGS/LSS instruction

2010-08-23 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/realmode.c | 59 1 files changed, 59 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index b69e474..8c771fc 100644 --- a/x86/realmode.c +++ b/x86

[PATCH v3] KVM: x86 emulator: add LDS/LES/LFS/LGS/LSS instruction emulation

2010-08-23 Thread Wei Yongjun
Add LDS/LES/LFS/LGS/LSS instruction emulation. (opcode 0xc4, 0xc5, 0x0f 0xb2, 0x0f 0xb4~0xb5) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v2 - v3: no changes, just porting to today's git tree --- arch/x86/kvm/emulate.c | 50 --- 1 files

[PATCH] KVM: x86 emulator: simplify BSF/BSR instruction emulation

2010-08-23 Thread Wei Yongjun
Since emulate_2op() changed to use register for destination, we can now simplify BSF/BSR instruction to use it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 30 -- 1 files changed, 8 insertions(+), 22 deletions(-) diff --git

[PATCH] KVM: MMU: fix missing percpu counter destroy

2010-08-23 Thread Wei Yongjun
commit ad05c88266b4cce1c820928ce8a0fb7690912ba1 (KVM: create aggregate kvm_total_used_mmu_pages value) introduce percpu counter kvm_total_used_mmu_pages but never destroy it, this may cause oops when rmmod modprobe. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |5

Re: [BUG?] can not writeback more then 8 bytes memory

2010-08-23 Thread Wei Yongjun
On 08/20/2010 12:12 PM, Wei Yongjun wrote: Hi all: I have the following patch to SIDT emulation instruction, but it does not work because we can not writeback more then 8 bytes memory, the SIDT under PROTO64 is 10 bytes. I change the code to write twice, first time write limit

[PATCH v3] Add realmode test for jcxz instruction

2010-08-23 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v2 - v3: rebased --- x86/realmode.c | 42 ++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index 8c771fc..a833829 100644 --- a/x86/realmode.c +++ b/x86

[BUG?] can not writeback more then 8 bytes memory

2010-08-20 Thread Wei Yongjun
Hi all: I have the following patch to SIDT emulation instruction, but it does not work because we can not writeback more then 8 bytes memory, the SIDT under PROTO64 is 10 bytes. I change the code to write twice, first time write limit, then write address, and it does not work too. If I change

[PATCH] KVM: x86 emulator: add JrCXZ instruction emulation

2010-08-19 Thread Wei Yongjun
Add JrCXZ instruction emulation (opcode 0xe3) Used by FreeBSD boot loader. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index cbf6209..6ccc584 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2331,7 +2331,7

[PATCH] Add realmode test for jcxz instruction

2010-08-19 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com diff --git a/x86/realmode.c b/x86/realmode.c index ce8fb18..0caf388 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1262,6 +1262,32 @@ void test_cbw(void) print_serial(cwde test 1: PASS\n); } +void test_jcxz(void

Re: [PATCH v2 3/3] KVM: x86 emulator: fix REPZ/REPNZ termination condition

2010-08-19 Thread Wei Yongjun
On 08/19/2010 07:55 AM, Wei Yongjun wrote: Hi Avi Kivity: EFLAGS.ZF needs to be checked after each iteration, not before. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/emulate.c | 38 ++ 1 files changed, 18 insertions(+), 20

Re: [PATCH v2 3/3] KVM: x86 emulator: fix REPZ/REPNZ termination condition

2010-08-19 Thread Wei Yongjun
On 08/19/2010 07:55 AM, Wei Yongjun wrote: Hi Avi Kivity: EFLAGS.ZF needs to be checked after each iteration, not before. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/emulate.c | 38 ++ 1 files changed, 18 insertions(+), 20

[PATCH v2] Add realmode test for jcxz instruction

2010-08-19 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/realmode.c | 62 1 files changed, 62 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index ce8fb18..75d77bd 100644 --- a/x86/realmode.c +++ b/x86

[PATCH v2] KVM: x86 emulator: add LDS/LES/LFS/LGS/LSS instruction emulation

2010-08-19 Thread Wei Yongjun
Add LDS/LES/LFS/LGS/LSS instruction emulation. (opcode 0xc4, 0xc5, 0x0f 0xb2, 0x0f 0xb4~0xb5) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v1 - v2: mask LES/LDS as No64. --- arch/x86/kvm/emulate.c | 51 --- 1 files changed, 47 insertions(+), 4

[PATCH] KVM: x86 emulator: add LOOP/LOOPcc instruction emulation

2010-08-18 Thread Wei Yongjun
Add LOOP/LOOPcc instruction emulation (opcode 0xe0~0xe2). Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index ac13831..46b7da8 100644

[PATCH] test: Add realmode test for loopcc instruction

2010-08-18 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/realmode.c | 43 +++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index 35f6a16..bedd175 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1194,6

[PATCH] KVM: x86 emulator: add CBW/CWDE/CDQE instruction emulation

2010-08-18 Thread Wei Yongjun
Add CBW/CWDE/CDQE instruction emulation.(opcode 0x98) Used by FreeBSD's boot loader. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index

[PATCH] test: Add real mode test for cbw/cwde instruction

2010-08-18 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/realmode.c | 27 +++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/x86/realmode.c b/x86/realmode.c index bedd175..ce8fb18 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1236,6 +1236,32

[PATCH] KVM: x86 emulator: add LDS/LES/LFS/LGS/LSS instruction emulation

2010-08-18 Thread Wei Yongjun
Add LDS/LES/LFS/LGS/LSS instruction emulation. (opcode 0xc4, 0xc5, 0x0f 0xb2, 0x0f 0xb4~0xb5) Used by FreeDOS livecd. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 51 --- 1 files changed, 47 insertions(+), 4 deletions

Re: [PATCH v2 3/3] KVM: x86 emulator: fix REPZ/REPNZ termination condition

2010-08-18 Thread Wei Yongjun
Hi Avi Kivity: EFLAGS.ZF needs to be checked after each iteration, not before. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/emulate.c | 38 ++ 1 files changed, 18 insertions(+), 20 deletions(-) diff --git a/arch/x86/kvm/emulate.c

[PATCH 1/2 v4] KVM: x86 emulator: put register operand write back to a function

2010-08-16 Thread Wei Yongjun
Introduce function write_register_operand() to write back the register operand. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 55 --- 1 files changed, 23 insertions(+), 32 deletions(-) diff --git a/arch/x86/kvm

[PATCH 2/2 v4] KVM: x86 emulator: add XADD instruction emulation

2010-08-16 Thread Wei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d690daf..41ca98b 100644

[PATCH RESEND] KVM: PPC: fix leakage of error page in kvmppc_patch_dcbz()

2010-08-16 Thread Wei Yongjun
Add kvm_release_page_clean() after is_error_page() to avoid leakage of error page. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/powerpc/kvm/book3s.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index

Re: [PATCH 1/2] KVM: x86 emulator: put register operand write back to a function

2010-08-15 Thread Wei Yongjun
On 08/12/2010 04:38 PM, Wei Yongjun wrote: Introduce function write_register_operand() to write back the register operand. +static void write_register_operand(struct operand *op, unsigned long val, + unsigned int bytes) +{ +/* The 4-byte case

[PATCH 1/2] KVM: x86 emulator: put register operand write back to a function

2010-08-12 Thread Wei Yongjun
Introduce function write_register_operand() to write back the register operand. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 53 +++ 1 files changed, 22 insertions(+), 31 deletions(-) diff --git a/arch/x86/kvm

[PATCH 2/2] KVM: x86 emulator: add XADD instruction emulation

2010-08-12 Thread Wei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 8bf80a9..7c47e37 100644

[PATCH] test: Add test for xadd instruction

2010-08-12 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- x86/emulator.c | 51 +++ 1 files changed, 51 insertions(+), 0 deletions(-) diff --git a/x86/emulator.c b/x86/emulator.c index 348d548..c4579ab 100644 --- a/x86/emulator.c +++ b/x86/emulator.c

[PATCH 2/2 v2] KVM: x86 emulator: add XADD instruction emulation

2010-08-12 Thread Wei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v1 - v2: remove implicit LOCK prefix --- arch/x86/kvm/emulate.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm

[PATCH 2/2 v3] KVM: x86 emulator: add XADD instruction emulation

2010-08-12 Thread Wei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v2 - v3: add Lock prefix to decode --- arch/x86/kvm/emulate.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c

[PATCH] KVM: x86 emulator: add bsf/bsr instruction emulation

2010-08-09 Thread Wei Yongjun
Add bsf/bsr instruction emulation (opcode 0x0f 0xbc~0xbd) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 28 ++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index fb4ac8c

[PATCH] test: add test for bsf/bsr instruction

2010-08-09 Thread Wei Yongjun
This patch add test for bsf/bsr instruction. Signed-off-by: Wei Yongjunyj...@cn.fujitsu.com --- x86/emulator.c | 64 1 files changed, 64 insertions(+), 0 deletions(-) diff --git a/x86/emulator.c b/x86/emulator.c index aef5d90..348d548

[PATCH v2] KVM: x86 emulator: add bsf/bsr instruction emulation

2010-08-09 Thread Wei Yongjun
Add bsf/bsr instruction emulation (opcode 0x0f 0xbc~0xbd) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v1 - v2: use 'u8 zf' instead of int. --- arch/x86/kvm/emulate.c | 28 ++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm

[PATCH 1/3 v2] KVM: x86 emulator: fix negative bit offset BitOp instruction emulation

2010-08-08 Thread Wei Yongjun
If bit offset operands is a negative number, BitOp instruction will return wrong value. This patch fix it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 24 ++-- 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm

[PATCH 2/3 v2] KVM: x86 emulator: do not adjust the address for immediate source

2010-08-08 Thread Wei Yongjun
adjust the dst address for a register source but not adjust the address for an immediate source. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c

[PATCH 3/3 v2] KVM: x86 emulator: mask group 8 instruction as BitOp

2010-08-08 Thread Wei Yongjun
Mask group 8 instruction as BitOp, so we can share the code for adjust the source operand. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 11 --- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c

[PATCH 1/3] KVM: x86 emulator: fix negative bit offset BitOp instruction emulation

2010-08-06 Thread Wei Yongjun
If bit offset operands is a negative number, BitOp instruction will return wrong value. This patch fix it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 32 ++-- 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/arch/x86

PATCH 2/3] KVM: x86 emulator: do not adjust the address for immediate source

2010-08-06 Thread Wei Yongjun
adjust the dst address for a register source but not adjust the address for an immediate source. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c

[PATCH 3/3] KVM: x86 emulator: mask group 8 instruction as BitOp

2010-08-06 Thread Wei Yongjun
Mask group 8 instruction as BitOp, so we can share the code for adjust the source operand. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 11 --- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c

[PATCH 2/3 v2] KVM: x86 emulator: do not adjust the address for immediate source

2010-08-06 Thread Wei Yongjun
adjust the dst address for a register source but not adjust the address for an immediate source. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v1 - v2 just fix the missing left bracket of mail title --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions

[PATCH] KVM: x86 emulator: remove useless label from x86_emulate_insn()

2010-08-06 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index dc6a74e..a755b85 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c

[PATCH] KVM: x86 emulator: add setcc instruction emulation

2010-08-06 Thread Wei Yongjun
Add setcc instruction emulation (opcode 0x0f 0x90~0x9f) Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index a755b85..e057e57 100644 --- a/arch

[PATCH] test: Add test for setcc instruction

2010-08-06 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com diff --git a/x86/emulator.c b/x86/emulator.c index e278812..5c8093e 100644 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -375,6 +375,44 @@ void test_btc(void *mem) report(btcl reg, r/m, a[0] == 1 a[1] == 2 a[2] == 0x8004); } +void

[PATCHv3] KVM: x86 emulator: fix BitOp instruction emulation

2010-08-05 Thread Wei Yongjun
If bit offset operands is a negative number, BitOp instruction will return wrong value. This patch fix it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 45 ++--- 1 files changed, 30 insertions(+), 15 deletions(-) diff

[PATCH] test: add test for btc instruction

2010-08-05 Thread Wei Yongjun
This patch add test for btc instruction. Signed-off-by: Wei Yongjunyj...@cn.fujitsu.com --- x86/emulator.c | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/x86/emulator.c b/x86/emulator.c index eefb764..e278812 100644 --- a/x86/emulator.c +++

[PATCH] KVM: x86 emulator: simplify two-byte opcode check

2010-08-05 Thread Wei Yongjun
Two-byte opcode always start with 0x0F and the decode flags of opcode 0xF0 is always 0, so remove dup check. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 12 +--- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b

[PATCH 2/3] KVM: x86 emulator: change OUT instruction to use dst instead of src

2010-08-05 Thread Wei Yongjun
Change OUT instruction to use dst instead of src, so we can reuse those code for all out instructions. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch

[PATCH 3/3] KVM: x86 emulator: remove dup code of in/out instruction

2010-08-05 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 24 1 files changed, 4 insertions(+), 20 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 95815b9..0e360c6 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm

[PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode

2010-08-05 Thread Wei Yongjun
Introduce DstImmUByte for dst operand decode, which will be used for out instruction. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index

[PATCH 1/4] KVM: x86 emulator: use SrcAcc to simplify stos decoding

2010-08-04 Thread Wei Yongjun
Use SrcAcc to simplify stos decoding. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index f03ff26..4624b11 100644 --- a/arch/x86/kvm/emulate.c

[PATCH 2/4] KVM: x86 emulator: disable writeback when decode dest operand

2010-08-04 Thread Wei Yongjun
This patch change to disable writeback when decode dest operand if the dest type is ImplicitOps or not specified. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 23 ++- 1 files changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/x86

[PATCH 3/4] KVM: x86 emulator: using SrcOne for instruction d0/d1 decoding

2010-08-04 Thread Wei Yongjun
Using SrcOne for instruction d0/d1 decoding. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 31c33f4..1ce3c4f 100644 --- a/arch/x86/kvm

[PATCH 4/4] KVM: x86 emulator: remove dup code of in/out instruction

2010-08-04 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 50 --- 1 files changed, 21 insertions(+), 29 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 1ce3c4f..d197b46 100644 --- a/arch/x86/kvm

[PATCH] KVM: x86 emulator: fix group 8 instruction decoding

2010-08-04 Thread Wei Yongjun
Group 8 instruction, BT[S|R|C] should be mask as BitOp. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d197b46..eba5a67 100644 --- a/arch

[PATCH] KVM: x86 emulator: cleanup for BitOp instruction emulation

2010-08-04 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index eba5a67..c05a5d7 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c

Re: [PATCH] KVM: x86 emulator: cleanup for BitOp instruction emulation

2010-08-04 Thread Wei Yongjun
On 08/04/2010 11:01 AM, Wei Yongjun wrote: Signed-off-by: Wei Yongjunyj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index eba5a67..c05a5d7 100644

[PATCHv2] KVM: x86 emulator: cleanup for BitOp instruction emulation

2010-08-04 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index eba5a67..74008ed 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c

Re: [PATCH] x86 emulator: Add IRET instruction

2010-07-25 Thread Wei Yongjun
On Mon, Jul 26, 2010 at 2:59 AM, Paolo Bonzini pbonz...@redhat.com wrote: On 07/25/2010 09:20 PM, Mohammed Gamal wrote: + if (c-op_bytes == 4) + temp_eflags = ((temp_eflags 0x257fd5) | (ctxt-eflags 0x1a)); Should this do also if (c-op_bytes ==

[PATCHv2] KVM: x86 emulator: fix xchg instruction emulation

2010-07-14 Thread Wei Yongjun
If the destination is a memory operand and the memory cannot map to a valid page, the xchg instruction emulation and locked instruction will not work on io regions and stuck in endless loop. We should emulate exchange as write to fix it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com Acked

[PATCH] test: add test for xchg instruction

2010-07-14 Thread Wei Yongjun
This patch add test for xchg instruction. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- kvm/test/x86/emulator.c | 52 +++ 1 files changed, 52 insertions(+), 0 deletions(-) diff --git a/kvm/test/x86/emulator.c b/kvm/test/x86/emulator.c index

Re: qemu-kvm: compile error in xen_backend.c

2010-07-14 Thread Wei Yongjun
today's qemu-kvm tree + latest xen source Sorry, after I redo configure, the error is gone. Thanks. CC xen_backend.o /pub/scm/weiyj/source/kvm/qemu-kvm/hw/xen_backend.c: In function 'xen_be_get_xendev': /pub/scm/weiyj/source/kvm/qemu-kvm/hw/xen_backend.c:219: error: too few arguments

[PATCH] KVM: PPC: fix leakage of page release in kvmppc_patch_dcbz()

2010-07-14 Thread Wei Yongjun
Add kvm_release_page_clean() after is_error_page() to avoid leakage of error page. No test. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/powerpc/kvm/book3s.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm

[PATCH] KVM: x86 emulator: fix xchg instruction emulation

2010-07-13 Thread Wei Yongjun
If the destination is a memory operand and the memory cannot map to a valid page, the xchg instruction emulation will fail. If so, we should emulate exchange as write to fix it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/x86.c |2 ++ 1 files changed, 2 insertions(+), 0

Re: [PATCH 5/6] KVM: x86 emulator: fix 'mov AL,moffs' instruction decoding

2010-07-07 Thread Wei Yongjun
On 07/06/2010 11:53 AM, Wei Yongjun wrote: 'mov AL,moffs' do not need decode dest operand and 'mov moffs,AL' do not need decode source operand. @@ -177,8 +177,8 @@ static u32 opcode_table[256] = { 0, 0, SrcImmFAddr | No64, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0

[PATCHv2] KVM: x86 emulator: re-implementing 'mov AL,moffs' instruction decoding

2010-07-07 Thread Wei Yongjun
This patch change to use DstAcc for decoding 'mov AL, moffs' and introduced SrcAcc for decoding 'mov moffs, AL'. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c | 32 +++- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git

[PATCH 1/6] KVM: x86 emulator: fix 'mov sreg,rm16' instruction decoding

2010-07-06 Thread Wei Yongjun
Memory reads for 'mov sreg,rm16' should be 16 bits only. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index e8bdddc..d842a7d 100644 --- a/arch

[PATCH 2/6] KVM: x86 emulator: fix the comment of out instruction

2010-07-06 Thread Wei Yongjun
Fix the comment of out instruction, using the same style as the other instructions. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d842a7d

[PATCH 3/6] KVM: x86 emulator: fix 'and AL,imm8' instruction decoding

2010-07-06 Thread Wei Yongjun
'and AL,imm8' should be mask as ByteOp, otherwise the dest operand length will no correct and we may fill the full EAX when writeback. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm

[PATCH 4/6] KVM: x86 emulator: fix 'mov rm,sreg' instruction decoding

2010-07-06 Thread Wei Yongjun
The source operand of 'mov rm,sreg' is segment register, not general-purpose register, so remove SrcReg from decoding. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b

[PATCH 5/6] KVM: x86 emulator: fix 'mov AL,moffs' instruction decoding

2010-07-06 Thread Wei Yongjun
'mov AL,moffs' do not need decode dest operand and 'mov moffs,AL' do not need decode source operand. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm

Re: [PATCH] test: add test for pusha and popa instructions

2010-06-20 Thread Wei Yongjun
On 06/15/2010 05:10 AM, Wei Yongjun wrote: This patch add test for pusha and popa instructions. Did you test the test? These tests require 'emulate_invalid_guest_state=1' and to run on Intel to actually test anything. You can check with ftrace whether kvm actually emulated

[PATCH] KVM: x86 emulator: fix group3 instruction decoding

2010-06-17 Thread Wei Yongjun
*/ emulate_2op_SrcV(test, c-src, c-dst, ctxt-eflags); ... } Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/emulate.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index c990db0..abb8cec 100644

Re: [PATCH] KVM: x86 emulator: fix group3 instruction decoding

2010-06-17 Thread Wei Yongjun
On 06/17/2010 12:33 PM, Wei Yongjun wrote: Group 3 instruction with ModRM reg field as 001 is defined as test instruction under AMD arch, and emulate_grp3() is ready for emulate it, so fix the decoding. Strange but true. Did you encounter any situation which actually needed

[PATCH] KVM: x86 emulator: fix pusha instruction emulation

2010-06-14 Thread Wei Yongjun
emulate pusha instruction only writeback the last EDI register, but the other registers which need to be writeback is ignored. This patch fixed it. --- arch/x86/kvm/emulate.c | 133 ++-- 1 files changed, 73 insertions(+), 60 deletions(-) diff --git

[PATCHv2] KVM: x86 emulator: fix pusha instruction emulation

2010-06-14 Thread Wei Yongjun
emulate pusha instruction only writeback the last EDI register, but the other registers which need to be writeback is ignored. This patch fixed it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- v1 - v2 add missing signed off by --- arch/x86/kvm/emulate.c | 133

[PATCH] test: add test for pusha and popa instructions

2010-06-14 Thread Wei Yongjun
This patch add test for pusha and popa instructions. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- kvm/test/x86/realmode.c | 46 ++ 1 files changed, 46 insertions(+), 0 deletions(-) diff --git a/kvm/test/x86/realmode.c b/kvm/test/x86

[PATCH] KVM: MMU: cleanup for function unaccount_shadowed()

2010-04-16 Thread Wei Yongjun
Since gfn is not changed in the for loop, we do not need to call gfn_to_memslot_unaliased() under the loop, and it is safe to move it out. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm

[PATCH] KVM: ia64: fix the error code of ioctl KVM_IA64_VCPU_GET_STACK failure

2010-03-11 Thread Wei Yongjun
The ioctl KVM_IA64_VCPU_GET_STACK does not set the error code if copy_to_user() fail, and 0 will be return, we should use -EFAULT instead of 0 in this case, so this patch fixed it. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/ia64/kvm/kvm-ia64.c |4 +++- 1 files changed, 3

[PATCH] KVM: x86: fix the error of ioctl KVM_IRQ_LINE if no irq chip

2010-03-11 Thread Wei Yongjun
If no irq chip in kernel, ioctl KVM_IRQ_LINE will return -EFAULT. But I see in other place such as KVM_[GET|SET]IRQCHIP, -ENXIO is return. So this patch used -ENXIO instead of -EFAULT. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/kvm/x86.c |2 ++ 1 files changed, 2 insertions

[PATCH] KVM: ia64: fix the error of ioctl KVM_IRQ_LINE if no irq chip

2010-03-11 Thread Wei Yongjun
If no irq chip in kernel, ioctl KVM_IRQ_LINE will return -EFAULT. But I see in other place such as KVM_[GET|SET]IRQCHIP, -ENXIO is return. So this patch used -ENXIO instead of -EFAULT. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/ia64/kvm/kvm-ia64.c |2 ++ 1 files changed, 2

Re: [PATCH] KVM: coalesced_mmio: NULLify the pointers before freeing ring page and dev

2010-03-11 Thread Wei Yongjun
Takuya Yoshikawa wrote: kvm_coalesced_mmio_init() keeps to hold the addresses of a coalesced mmio ring page and dev even after it has freed them. This may trigger problems, e.g., if we call kvm_coalesced_mmio_free() in kvm_destroy_vm() or kvm_vm_ioctl_register_coalesced_mmio() afterward.

[PATCH] KVM: fix to not use NULL kvm-coalesced_mmio_ring in kvm_vcpu_fault()

2010-03-11 Thread Wei Yongjun
If coalesced_mmio init fail, the kvm-coalesced_mmio_ring will be set to NULL. If so, we should return VM_FAULT_SIGBUS in kvm_vcpu_fault() even if vmf-pgoff == KVM_COALESCED_MMIO_PAGE_OFFSET. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- virt/kvm/kvm_main.c |3 ++- 1 files changed, 2

[PATCH] KVM: fix the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO failure

2010-03-11 Thread Wei Yongjun
This patch change the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO from -EINVAL to -ENXIO if no coalesced mmio dev exists. Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- virt/kvm/coalesced_mmio.c |4 ++-- virt/kvm/kvm_main.c |2 -- 2 files changed, 2 insertions(+), 4

  1   2   >