All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	anthony@codemonkey.ws, gleb@redhat.com
Subject: [Qemu-devel] [PULL 6/9] kvm: Simplify kvm_handle_io
Date: Sat, 24 Aug 2013 05:49:59 +0200	[thread overview]
Message-ID: <1377316202-2849-7-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1377316202-2849-1-git-send-email-pbonzini@redhat.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

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>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 kvm-all.c | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index bfa4aac..ef52a0f 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1508,32 +1508,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;
     }
 }
-- 
1.8.3.1

  parent reply	other threads:[~2013-08-24  3:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-24  3:49 [Qemu-devel] [PULL 0/9] KVM changes for 2013-08-23 Paolo Bonzini
2013-08-24  3:49 ` [Qemu-devel] [PULL 1/9] Initialize IA32_FEATURE_CONTROL MSR in reset and migration Paolo Bonzini
2013-08-24  3:49 ` [Qemu-devel] [PULL 2/9] target-i386: remove tabs from target-i386/cpu.h Paolo Bonzini
2013-08-24  3:49 ` [Qemu-devel] [PULL 3/9] kvm: migrate vPMU state Paolo Bonzini
2013-08-24  3:49 ` [Qemu-devel] [PULL 4/9] kvm: add KVM_IRQFD_FLAG_RESAMPLE support Paolo Bonzini
2013-08-24  3:49 ` [Qemu-devel] [PULL 5/9] kvm: x86: fix setting IA32_FEATURE_CONTROL with nested VMX disabled Paolo Bonzini
2013-08-24  3:49 ` Paolo Bonzini [this message]
2013-08-24  3:50 ` [Qemu-devel] [PULL 7/9] kvm-all.c: max_cpus should not exceed KVM vcpu limit Paolo Bonzini
2013-08-24  3:50 ` [Qemu-devel] [PULL 8/9] kvm: i386: fix LAPIC TSC deadline timer save/restore Paolo Bonzini
2013-08-24  3:50 ` [Qemu-devel] [PULL 9/9] kvm: shorten the parameter list for get_real_device() Paolo Bonzini
2013-08-24  3:55 ` [Qemu-devel] [PULL 0/9] KVM changes for 2013-08-23 Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2013-08-24  3:55 [Qemu-devel] [PULL v2 " Paolo Bonzini
2013-08-24  3:55 ` [Qemu-devel] [PULL 6/9] kvm: Simplify kvm_handle_io Paolo Bonzini
2013-08-23  9:39 [Qemu-devel] [PULL 0/9] KVM changes for 2013-08-23 Paolo Bonzini
2013-08-23  9:39 ` [Qemu-devel] [PULL 6/9] kvm: Simplify kvm_handle_io Paolo Bonzini
2013-08-23  9:03 [Qemu-devel] [PULL 0/9] KVM changes for 2013-08-23 Paolo Bonzini
2013-08-23  9:03 ` [Qemu-devel] [PULL 6/9] kvm: Simplify kvm_handle_io Paolo Bonzini

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=1377316202-2849-7-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.