From patchwork Tue Jul 21 22:13:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 36642 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 n6LMDToD002829 for ; Tue, 21 Jul 2009 22:13:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756388AbZGUWNU (ORCPT ); Tue, 21 Jul 2009 18:13:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756136AbZGUWNT (ORCPT ); Tue, 21 Jul 2009 18:13:19 -0400 Received: from mx2.redhat.com ([66.187.237.31]:54770 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754389AbZGUWNQ (ORCPT ); Tue, 21 Jul 2009 18:13:16 -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 n6LMDGAf023937 for ; Tue, 21 Jul 2009 18:13:16 -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 n6LMDENx008895; Tue, 21 Jul 2009 18:13:15 -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 n6LMDC9A012787; Tue, 21 Jul 2009 18:13:14 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: avi@redhat.com Subject: [PATCH v2 5/6] remove kvm_specific kvm_out* functions Date: Tue, 21 Jul 2009 18:13:11 -0400 Message-Id: <1248214392-12533-6-git-send-email-glommer@redhat.com> In-Reply-To: <1248214392-12533-5-git-send-email-glommer@redhat.com> References: <1248214392-12533-1-git-send-email-glommer@redhat.com> <1248214392-12533-2-git-send-email-glommer@redhat.com> <1248214392-12533-3-git-send-email-glommer@redhat.com> <1248214392-12533-4-git-send-email-glommer@redhat.com> <1248214392-12533-5-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 As example of what was already done with inb. This is a little bit more tricky, because of SMM, but those bits are handled directly in apic anyway. Signed-off-by: Glauber Costa --- qemu-kvm.c | 60 +++--------------------------------------------------------- 1 files changed, 3 insertions(+), 57 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index cef522d..0724c28 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -95,55 +95,6 @@ static int kvm_debug(void *opaque, void *data, } #endif -#define PM_IO_BASE 0xb000 - -static int kvm_outb(void *opaque, uint16_t addr, uint8_t data) -{ - if (addr == 0xb2) { - switch (data) { - case 0: { - cpu_outb(0, 0xb3, 0); - break; - } - case 0xf0: { - unsigned x; - - /* enable acpi */ - x = cpu_inw(0, PM_IO_BASE + 4); - x &= ~1; - cpu_outw(0, PM_IO_BASE + 4, x); - break; - } - case 0xf1: { - unsigned x; - - /* enable acpi */ - x = cpu_inw(0, PM_IO_BASE + 4); - x |= 1; - cpu_outw(0, PM_IO_BASE + 4, x); - break; - } - default: - break; - } - return 0; - } - cpu_outb(0, addr, data); - return 0; -} - -static int kvm_outw(void *opaque, uint16_t addr, uint16_t data) -{ - cpu_outw(0, addr, data); - return 0; -} - -static int kvm_outl(void *opaque, uint16_t addr, uint32_t data) -{ - cpu_outl(0, addr, data); - return 0; -} - int kvm_mmio_read(void *opaque, uint64_t addr, uint8_t *data, int len) { cpu_physical_memory_rw(addr, data, len, 0); @@ -825,14 +776,12 @@ static int handle_io(kvm_vcpu_context_t vcpu) struct kvm_run *run = vcpu->run; kvm_context_t kvm = vcpu->kvm; uint16_t addr = run->io.port; - int r; 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: - r = 0; switch (run->io.size) { case 1: *(uint8_t *)p = cpu_inb(kvm->opaque, addr); @@ -851,16 +800,13 @@ static int handle_io(kvm_vcpu_context_t vcpu) case KVM_EXIT_IO_OUT: switch (run->io.size) { case 1: - r = kvm_outb(kvm->opaque, addr, - *(uint8_t *)p); + cpu_outb(kvm->opaque, addr, *(uint8_t *)p); break; case 2: - r = kvm_outw(kvm->opaque, addr, - *(uint16_t *)p); + cpu_outw(kvm->opaque, addr, *(uint16_t *)p); break; case 4: - r = kvm_outl(kvm->opaque, addr, - *(uint32_t *)p); + cpu_outl(kvm->opaque, addr, *(uint32_t *)p); break; default: fprintf(stderr, "bad I/O size %d\n", run->io.size);