From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v2 6/6] remove kvm_mmio_read and kvm_mmio_write Date: Sat, 25 Jul 2009 12:24:41 -0300 Message-ID: <20090725152441.GA4429@amt.cnet> 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> <1248214392-12533-6-git-send-email-glommer@redhat.com> <1248214392-12533-7-git-send-email-glommer@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com To: Glauber Costa Return-path: Received: from mx2.redhat.com ([66.187.237.31]:44852 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751621AbZGYPb4 (ORCPT ); Sat, 25 Jul 2009 11:31:56 -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 n6PFVvH7022074 for ; Sat, 25 Jul 2009 11:31:57 -0400 Content-Disposition: inline In-Reply-To: <1248214392-12533-7-git-send-email-glommer@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jul 21, 2009 at 06:13:12PM -0400, Glauber Costa wrote: > all they did was to call a qemu function. Call this function instead. > > Signed-off-by: Glauber Costa > --- > qemu-kvm-x86.c | 7 +------ > qemu-kvm.c | 34 ++++++++-------------------------- > 2 files changed, 9 insertions(+), 32 deletions(-) > > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c > index 350f272..741ae0a 100644 > --- a/qemu-kvm-x86.c > +++ b/qemu-kvm-x86.c > @@ -344,7 +344,6 @@ void kvm_show_code(kvm_vcpu_context_t vcpu) > unsigned char code; > char code_str[SHOW_CODE_LEN * 3 + 1]; > unsigned long rip; > - kvm_context_t kvm = vcpu->kvm; > > r = ioctl(fd, KVM_GET_SREGS, &sregs); > if (r == -1) { > @@ -364,11 +363,7 @@ void kvm_show_code(kvm_vcpu_context_t vcpu) > for (n = -back_offset; n < SHOW_CODE_LEN-back_offset; ++n) { > if (n == 0) > strcat(code_str, " -->"); > - r = kvm_mmio_read(kvm->opaque, rip + n, &code, 1); > - if (r < 0) { > - strcat(code_str, " xx"); > - continue; > - } > + cpu_physical_memory_rw(rip + n, &code, 1, 0); > sprintf(code_str + strlen(code_str), " %02x", code); > } > fprintf(stderr, "code:%s\n", code_str); > diff --git a/qemu-kvm.c b/qemu-kvm.c > index 0724c28..9b1c506 100644 > --- a/qemu-kvm.c > +++ b/qemu-kvm.c > @@ -95,18 +95,6 @@ static int kvm_debug(void *opaque, void *data, > } > #endif > > -int kvm_mmio_read(void *opaque, uint64_t addr, uint8_t *data, int len) > -{ > - cpu_physical_memory_rw(addr, data, len, 0); > - return 0; > -} > - > -int kvm_mmio_write(void *opaque, uint64_t addr, uint8_t *data, int len) > -{ > - cpu_physical_memory_rw(addr, data, len, 1); > - return 0; > -} > - > static int handle_unhandled(kvm_context_t kvm, kvm_vcpu_context_t vcpu, > uint64_t reason) > { > @@ -888,23 +876,17 @@ int kvm_set_mpstate(kvm_vcpu_context_t vcpu, struct kvm_mp_state *mp_state) > } > #endif > > -static int handle_mmio(kvm_vcpu_context_t vcpu) > +static void handle_mmio(kvm_vcpu_context_t vcpu) > { > unsigned long addr = vcpu->run->mmio.phys_addr; > - kvm_context_t kvm = vcpu->kvm; > struct kvm_run *kvm_run = vcpu->run; > void *data = kvm_run->mmio.data; > > /* hack: Red Hat 7.1 generates these weird accesses. */ > if ((addr > 0xa0000-4 && addr <= 0xa0000) && kvm_run->mmio.len == 3) > - return 0; > + return; > > - if (kvm_run->mmio.is_write) > - return kvm_mmio_write(kvm->opaque, addr, data, > - kvm_run->mmio.len); > - else > - return kvm_mmio_read(kvm->opaque, addr, data, > - kvm_run->mmio.len); > + cpu_physical_memory_rw(addr, data, kvm_run->mmio.len, kvm_run->mmio.is_write); Glauber, The indentation now looks horrible. Applied the kvm_init order patches.