From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBozU-0006lC-Co for qemu-devel@nongnu.org; Tue, 20 Aug 2013 12:41:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBozN-00064r-Si for qemu-devel@nongnu.org; Tue, 20 Aug 2013 12:41:08 -0400 Received: from mail-we0-x22a.google.com ([2a00:1450:400c:c03::22a]:59049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBozN-00064Y-M4 for qemu-devel@nongnu.org; Tue, 20 Aug 2013 12:41:01 -0400 Received: by mail-we0-f170.google.com with SMTP id w62so646198wes.1 for ; Tue, 20 Aug 2013 09:41:00 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <52139BF3.7000609@redhat.com> Date: Tue, 20 Aug 2013 18:40:19 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <520A2A0D.4010600@siemens.com> In-Reply-To: <520A2A0D.4010600@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH uq/master] kvm: Simplify kvm_handle_io List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: qemu-devel , Gleb Natapov , kvm 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 > --- > 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