[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E4C81CE.8030508@cn.fujitsu.com>
Date: Thu, 18 Aug 2011 11:06:54 +0800
From: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
To: Avi Kivity <avi@...hat.com>
CC: Marcelo Tosatti <mtosatti@...hat.com>, Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: [PATCH 1/2] kvm tools: fix repeated io emulation
When kvm emulates repeation io read instruction, it can exit to user-space with
'count' > 1, we need to emulate io access for many times
Signed-off-by: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
---
tools/kvm/ioport.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/kvm/ioport.c b/tools/kvm/ioport.c
index 2d69ae4..6b0bd30 100644
--- a/tools/kvm/ioport.c
+++ b/tools/kvm/ioport.c
@@ -129,6 +129,7 @@ bool kvm__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int s
struct ioport_operations *ops;
bool ret = false;
struct ioport *entry;
+ void *ptr = data;
br_read_lock();
entry = ioport_search(&ioport_tree, port);
@@ -137,12 +138,16 @@ bool kvm__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int s
ops = entry->ops;
- if (direction == KVM_EXIT_IO_IN) {
- if (ops->io_in)
- ret = ops->io_in(entry, kvm, port, data, size, count);
- } else {
- if (ops->io_out)
- ret = ops->io_out(entry, kvm, port, data, size, count);
+ while (count--) {
+ if (direction == KVM_EXIT_IO_IN) {
+ if (ops->io_in)
+ ret = ops->io_in(entry, kvm, port, ptr, size, count);
+ } else {
+ if (ops->io_out)
+ ret = ops->io_out(entry, kvm, port, ptr, size, count);
+ }
+
+ ptr += size;
}
br_read_unlock();
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists