summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlauber Costa <glommer@redhat.com>2009-10-19 11:20:42 -0200
committerMarcelo Tosatti <mtosatti@redhat.com>2009-10-20 12:52:09 -0200
commit0e26711a6692b118b3148a45f9576e9b3c8b8e3a (patch)
treeb333d74ac52148e2de5359004fd2b57dd4017e46
parentRemove kvmctl from kvm/user/config-x86-common.mak (diff)
downloadqemu-kvm-0e26711a6692b118b3148a45f9576e9b3c8b8e3a.tar.gz
qemu-kvm-0e26711a6692b118b3148a45f9576e9b3c8b8e3a.tar.bz2
qemu-kvm-0e26711a6692b118b3148a45f9576e9b3c8b8e3a.zip
use handle_io upstream version.
We can use upstream version of handle_io, there called kvm_handle_io() Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--kvm-all.c2
-rw-r--r--qemu-kvm.c58
2 files changed, 7 insertions, 53 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 0a8aa4c27..5e03cd944 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -520,6 +520,7 @@ err:
return ret;
}
+#endif
static int kvm_handle_io(uint16_t port, void *data, int direction, int size,
uint32_t count)
@@ -560,6 +561,7 @@ static int kvm_handle_io(uint16_t port, void *data, int direction, int size,
return 1;
}
+#ifdef KVM_UPSTREAM
static void kvm_run_coalesced_mmio(CPUState *env, struct kvm_run *run)
{
#ifdef KVM_CAP_COALESCED_MMIO
diff --git a/qemu-kvm.c b/qemu-kvm.c
index b58a45729..9f2a153ab 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -751,58 +751,6 @@ int kvm_set_irqchip(kvm_context_t kvm, struct kvm_irqchip *chip)
#endif
-static int handle_io(CPUState *env)
-{
- struct kvm_run *run = env->kvm_run;
- uint16_t addr = run->io.port;
- int i;
- void *p = (void *) run + run->io.data_offset;
-
- for (i = 0; i < run->io.count; ++i) {
- switch (run->io.direction) {
- case KVM_EXIT_IO_IN:
- switch (run->io.size) {
- case 1:
- *(uint8_t *) p = cpu_inb(addr);
- break;
- case 2:
- *(uint16_t *) p = cpu_inw(addr);
- break;
- case 4:
- *(uint32_t *) p = cpu_inl(addr);
- break;
- default:
- fprintf(stderr, "bad I/O size %d\n", run->io.size);
- return -EMSGSIZE;
- }
- break;
- case KVM_EXIT_IO_OUT:
- switch (run->io.size) {
- case 1:
- cpu_outb(addr, *(uint8_t *) p);
- break;
- case 2:
- cpu_outw(addr, *(uint16_t *) p);
- break;
- case 4:
- cpu_outl(addr, *(uint32_t *) p);
- break;
- default:
- fprintf(stderr, "bad I/O size %d\n", run->io.size);
- return -EMSGSIZE;
- }
- break;
- default:
- fprintf(stderr, "bad I/O direction %d\n", run->io.direction);
- return -EPROTO;
- }
-
- p += run->io.size;
- }
-
- return 0;
-}
-
static int handle_debug(CPUState *env)
{
#ifdef KVM_CAP_SET_GUEST_DEBUG
@@ -994,7 +942,11 @@ int kvm_run(CPUState *env)
abort();
break;
case KVM_EXIT_IO:
- r = handle_io(env);
+ r = kvm_handle_io(run->io.port,
+ (uint8_t *)run + run->io.data_offset,
+ run->io.direction,
+ run->io.size,
+ run->io.count);
break;
case KVM_EXIT_DEBUG:
r = handle_debug(env);