kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org, avi@redhat.com
Subject: Re: [PATCH v2 6/6] remove kvm_mmio_read and kvm_mmio_write
Date: Mon, 27 Jul 2009 14:47:52 -0300	[thread overview]
Message-ID: <20090727174752.GD4776@poweredge.glommer> (raw)
In-Reply-To: <20090725152441.GA4429@amt.cnet>

On Sat, Jul 25, 2009 at 12:24:41PM -0300, Marcelo Tosatti wrote:
> 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 <glommer@redhat.com>
> > ---
> >  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.
Gosh... I propose we fix the identation of that file once and for all.

It should be pretty easy and automatic if we convert all tabs to 4-spaces, which
can be done with a straightforward sed script. Do I have your okay to proceed with this,
Master Kivity?


  reply	other threads:[~2009-07-27 17:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21 22:13 [PATCH v2 0/6] Glauber Costa
2009-07-21 22:13 ` [PATCH v2 1/6] remove kvm_in* functions Glauber Costa
2009-07-21 22:13   ` [PATCH v2 2/6] reuse env stop and stopped states Glauber Costa
2009-07-21 22:13     ` [PATCH v2 3/6] remove kvm_abi variable Glauber Costa
2009-07-21 22:13       ` [PATCH v2 4/6] remove created from kvm_state Glauber Costa
2009-07-21 22:13         ` [PATCH v2 5/6] remove kvm_specific kvm_out* functions Glauber Costa
2009-07-21 22:13           ` [PATCH v2 6/6] remove kvm_mmio_read and kvm_mmio_write Glauber Costa
2009-07-25 15:24             ` Marcelo Tosatti
2009-07-27 17:47               ` Glauber Costa [this message]
2009-07-22 19:50           ` [PATCH v2 5/6] remove kvm_specific kvm_out* functions Marcelo Tosatti
2009-07-23  5:47             ` Gleb Natapov
2009-07-22 19:51       ` [PATCH v2 3/6] remove kvm_abi variable Marcelo Tosatti
2009-07-27 15:43     ` [PATCH v2 2/6] reuse env stop and stopped states Avi Kivity
2009-07-28  0:48       ` Glauber Costa
2009-07-28  6:17         ` Avi Kivity
2009-07-28  6:24           ` Gleb Natapov
2009-07-28  6:28             ` Avi Kivity
2009-07-28  6:29               ` Gleb Natapov
2009-07-28  6:31                 ` Avi Kivity
2009-07-28 13:45           ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090727174752.GD4776@poweredge.glommer \
    --to=glommer@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).