From patchwork Mon Jul 20 23:10:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 36426 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6KNAXth021907 for ; Mon, 20 Jul 2009 23:10:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754347AbZGTXKc (ORCPT ); Mon, 20 Jul 2009 19:10:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754332AbZGTXKc (ORCPT ); Mon, 20 Jul 2009 19:10:32 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53382 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754197AbZGTXKT (ORCPT ); Mon, 20 Jul 2009 19:10:19 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6KNAJGp029407 for ; Mon, 20 Jul 2009 19:10:19 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6KNAJkQ002977; Mon, 20 Jul 2009 19:10:19 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6KNAGkj028980; Mon, 20 Jul 2009 19:10:18 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: avi@redhat.com Subject: [PATCH 6/9] remove kvm_in* functions Date: Mon, 20 Jul 2009 19:10:13 -0400 Message-Id: <1248131416-11272-7-git-send-email-glommer@redhat.com> In-Reply-To: <1248131416-11272-6-git-send-email-glommer@redhat.com> References: <1248131416-11272-1-git-send-email-glommer@redhat.com> <1248131416-11272-2-git-send-email-glommer@redhat.com> <1248131416-11272-3-git-send-email-glommer@redhat.com> <1248131416-11272-4-git-send-email-glommer@redhat.com> <1248131416-11272-5-git-send-email-glommer@redhat.com> <1248131416-11272-6-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We can use plain qemu's here, and save a couple of lines/complexity. I'm leaving outb for later, because the SMM thing makes it a little bit less trivial. Signed-off-by: Glauber Costa --- qemu-kvm.c | 25 ++++--------------------- 1 files changed, 4 insertions(+), 21 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 26cac25..58d5de2 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -97,24 +97,6 @@ static int kvm_debug(void *opaque, void *data, } #endif -static int kvm_inb(void *opaque, uint16_t addr, uint8_t *data) -{ - *data = cpu_inb(0, addr); - return 0; -} - -static int kvm_inw(void *opaque, uint16_t addr, uint16_t *data) -{ - *data = cpu_inw(0, addr); - return 0; -} - -static int kvm_inl(void *opaque, uint16_t addr, uint32_t *data) -{ - *data = cpu_inl(0, addr); - return 0; -} - #define PM_IO_BASE 0xb000 static int kvm_outb(void *opaque, uint16_t addr, uint8_t data) @@ -855,15 +837,16 @@ static int handle_io(kvm_vcpu_context_t vcpu) for (i = 0; i < run->io.count; ++i) { switch (run->io.direction) { case KVM_EXIT_IO_IN: + r = 0; switch (run->io.size) { case 1: - r = kvm_inb(kvm->opaque, addr, p); + *(uint8_t *)p = cpu_inb(kvm->opaque, addr); break; case 2: - r = kvm_inw(kvm->opaque, addr, p); + *(uint16_t *)p = cpu_inw(kvm->opaque, addr); break; case 4: - r = kvm_inl(kvm->opaque, addr, p); + *(uint32_t *)p = cpu_inl(kvm->opaque, addr); break; default: fprintf(stderr, "bad I/O size %d\n", run->io.size);