* [PATCH uq/master] kvm: Simplify kvm_handle_io
@ 2013-08-13 12:43 ` Jan Kiszka
0 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2013-08-13 12:43 UTC (permalink / raw)
To: Paolo Bonzini, Gleb Natapov; +Cc: qemu-devel, kvm
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;
}
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH uq/master] kvm: Simplify kvm_handle_io
@ 2013-08-13 12:43 ` Jan Kiszka
0 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2013-08-13 12:43 UTC (permalink / raw)
To: Paolo Bonzini, Gleb Natapov; +Cc: qemu-devel, kvm
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;
}
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH uq/master] kvm: Simplify kvm_handle_io
2013-08-13 12:43 ` [Qemu-devel] " Jan Kiszka
@ 2013-08-13 12:52 ` Andreas Färber
-1 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2013-08-13 12:52 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Paolo Bonzini, Gleb Natapov, qemu-devel, kvm
Am 13.08.2013 14:43, schrieb Jan Kiszka:
> 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(-)
Looks sensible,
Reviewed-by: Andreas Färber <afaerber@suse.de>
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH uq/master] kvm: Simplify kvm_handle_io
@ 2013-08-13 12:52 ` Andreas Färber
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2013-08-13 12:52 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Paolo Bonzini, qemu-devel, Gleb Natapov, kvm
Am 13.08.2013 14:43, schrieb Jan Kiszka:
> 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(-)
Looks sensible,
Reviewed-by: Andreas Färber <afaerber@suse.de>
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH uq/master] kvm: Simplify kvm_handle_io
2013-08-13 12:43 ` [Qemu-devel] " Jan Kiszka
@ 2013-08-20 16:40 ` Paolo Bonzini
-1 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2013-08-20 16:40 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Gleb Natapov, qemu-devel, 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 <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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH uq/master] kvm: Simplify kvm_handle_io
@ 2013-08-20 16:40 ` Paolo Bonzini
0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2013-08-20 16:40 UTC (permalink / raw)
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 <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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-20 16:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-13 12:43 [PATCH uq/master] kvm: Simplify kvm_handle_io Jan Kiszka
2013-08-13 12:43 ` [Qemu-devel] " Jan Kiszka
2013-08-13 12:52 ` Andreas Färber
2013-08-13 12:52 ` Andreas Färber
2013-08-20 16:40 ` Paolo Bonzini
2013-08-20 16:40 ` [Qemu-devel] " Paolo Bonzini
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.