qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Gleb Natapov <gleb@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCH uq/master] kvm: Simplify kvm_handle_io
Date: Tue, 20 Aug 2013 18:40:19 +0200	[thread overview]
Message-ID: <52139BF3.7000609@redhat.com> (raw)
In-Reply-To: <520A2A0D.4010600@siemens.com>

Il 13/08/2013 14:43, Jan Kiszka ha scritto:
> Now that cpu_in/out is just a wrapper around address_space_rw, we can
> also call the latter directly. As host endianness == guest endianness,
> there is no need for the memory access helpers st*_p/ld*_p as well.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  kvm-all.c |   28 ++--------------------------
>  1 files changed, 2 insertions(+), 26 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index 716860f..c861354 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1499,32 +1499,8 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size,
>      uint8_t *ptr = data;
>  
>      for (i = 0; i < count; i++) {
> -        if (direction == KVM_EXIT_IO_IN) {
> -            switch (size) {
> -            case 1:
> -                stb_p(ptr, cpu_inb(port));
> -                break;
> -            case 2:
> -                stw_p(ptr, cpu_inw(port));
> -                break;
> -            case 4:
> -                stl_p(ptr, cpu_inl(port));
> -                break;
> -            }
> -        } else {
> -            switch (size) {
> -            case 1:
> -                cpu_outb(port, ldub_p(ptr));
> -                break;
> -            case 2:
> -                cpu_outw(port, lduw_p(ptr));
> -                break;
> -            case 4:
> -                cpu_outl(port, ldl_p(ptr));
> -                break;
> -            }
> -        }
> -
> +        address_space_rw(&address_space_io, port, ptr, size,
> +                         direction == KVM_EXIT_IO_OUT);
>          ptr += size;
>      }
>  }
> 

Applied, thanks.

Paolo

      parent reply	other threads:[~2013-08-20 16:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13 12:43 [Qemu-devel] [PATCH uq/master] kvm: Simplify kvm_handle_io Jan Kiszka
2013-08-13 12:52 ` Andreas Färber
2013-08-20 16:40 ` Paolo Bonzini [this message]

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=52139BF3.7000609@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /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).