public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: fix repeated io emulation
@ 2011-08-18  3:06 Xiao Guangrong
  2011-08-18  3:07 ` [PATCH 2/2] kvm tools: remove count in io emulation callbacks Xiao Guangrong
  2011-08-18  6:13 ` [PATCH 1/2] kvm tools: fix repeated io emulation Pekka Enberg
  0 siblings, 2 replies; 7+ messages in thread
From: Xiao Guangrong @ 2011-08-18  3:06 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, Ingo Molnar, LKML, KVM

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@cn.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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-09-09 13:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-18  3:06 [PATCH 1/2] kvm tools: fix repeated io emulation Xiao Guangrong
2011-08-18  3:07 ` [PATCH 2/2] kvm tools: remove count in io emulation callbacks Xiao Guangrong
2011-08-18  6:13 ` [PATCH 1/2] kvm tools: fix repeated io emulation Pekka Enberg
2011-08-18  7:35   ` Sasha Levin
2011-08-18 15:08     ` Avi Kivity
2011-09-09  2:26       ` Xiao Guangrong
2011-09-09 13:45         ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox