Re: [Qemu-devel] [PATCH v2] Add infrastructure for QIDL-based device serialization

2012-09-24 Thread Paolo Bonzini
Il 24/09/2012 20:14, Michael Roth ha scritto: >>> > > I went with qUppercase because it avoids all the previous issues with >>> > > using leading underscores, and it's reserved in terms of QEMU coding >>> > > guidelines as far as I can tell (we generally require leading capital >>> > > for typedefs

Re: [Qemu-devel] [PATCH 38/41] block-migration: handle errors with the return codes correctly

2012-09-24 Thread Paolo Bonzini
Il 24/09/2012 20:24, Juan Quintela ha scritto: > Now, we give exactly the same error, just that we return the error > directly from blk_mig_save_dirty_block() instead of storing it on > QEMUFile and getting it through qemu_file_get_error(). Right you are. Apart from the do/while, Reviewed-by: Pa

Re: [Qemu-devel] [PATCH v3 0/3] qapi: convert add_client

2012-09-24 Thread Paolo Bonzini
Il 24/09/2012 23:55, Luiz Capitulino ha scritto: > v3 > > - qmp_add_client(): don't use errp to test for error > > Luiz Capitulino (1): > qapi: convert add_client > > Paolo Bonzini (2): > pci-assign: use monitor_handle_fd_param > monitor: add Error * argument to monitor_get_fd > > dump.

Re: [Qemu-devel] [PATCH 11/14] virtio-net: fix used len for tx

2012-09-24 Thread Jason Wang
On 09/25/2012 07:05 AM, Michael S. Tsirkin wrote: There is no out sg for TX, so used buf length for tx should always be 0. According to the spec, the len is "Total length of the descriptor chain which was used (written to)". So I wonder if we need to pass the len here, it looks useful for gue

Re: [Qemu-devel] [PATCH v5 0/4] non-blocking connect address handling cleanup

2012-09-24 Thread Amos Kong
On 24/09/12 19:11, Orit Wasserman wrote: Changes from v4: - Rename ConnectHandler to NonBlockingConnectHandler - move function comments to functions definitions - move connect_state allocation to outside of the loop - fix comments text Changes from v3: - a

Re: [Qemu-devel] [Qemu-ppc] [PATCH v10 1/1] Add USB option in machine options

2012-09-24 Thread Li Zhang
Hi Gerd, Any suggestion? Many thanks. -:) On Wed, Sep 19, 2012 at 1:59 AM, Alexander Graf wrote: > On 09/18/2012 07:36 PM, Alexander Graf wrote: >> >> On 09/03/2012 07:25 AM, Li Zhang wrote: >>> >>> When -usb option is used, global varible usb_enabled is set. >>> And all the plaform will create

Re: [Qemu-devel] [PATCH 03/14] iov: add iov_cpy

2012-09-24 Thread Michael S. Tsirkin
On Mon, Sep 24, 2012 at 07:34:00PM -0500, Anthony Liguori wrote: > "Michael S. Tsirkin" writes: > > > Add API to copy part of iovec safely. > > > > Signed-off-by: Michael S. Tsirkin > > --- > > iov.c | 23 +++ > > iov.h | 9 + > > 2 files changed, 32 insertions(+) >

Re: [Qemu-devel] [PATCH 04/14] virtio-net: avoid sg copy

2012-09-24 Thread Michael S. Tsirkin
On Mon, Sep 24, 2012 at 07:37:40PM -0500, Anthony Liguori wrote: > "Michael S. Tsirkin" writes: > > > Avoid tweaking iovec during receive. This removes > > the need to copy the vector. > > Note: we already have an evil cast in work_around_broken_dhclient > > and unfortunately this adds another on

Re: [Qemu-devel] [PATCH 07/14] virtio-net: first s/g is always at start of buf

2012-09-24 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > We know offset is 0, assert that. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Anthony Liguori Regards, Anthony Liguori > --- > hw/virtio-net.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/hw/virtio-net.c b/hw/virtio-net

Re: [Qemu-devel] [PATCH 06/14] virtio-net: refactor receive_hdr

2012-09-24 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > Now that we know host hdr length, we don't need to > duplicate the logic in receive_hdr: caller can > figure out the offset itself. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Anthony Liguori Regards, Anthony Liguori > --- > hw/virtio-net.c | 18 ++

Re: [Qemu-devel] [PATCH 05/14] virtio-net: use safe iov operations for rx

2012-09-24 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > Avoid magling iov manually: use safe iov operations > for processing packets incoming to guest. > This also removes the requirement for virtio header to > fit the first s/g entry exactly. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Anthony Liguori Regards

Re: [Qemu-devel] [PATCH 04/14] virtio-net: avoid sg copy

2012-09-24 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > Avoid tweaking iovec during receive. This removes > the need to copy the vector. > Note: we already have an evil cast in work_around_broken_dhclient > and unfortunately this adds another one. > const on buf is ignored by this function anyway so arguably > this is no

Re: [Qemu-devel] [PATCH 03/14] iov: add iov_cpy

2012-09-24 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > Add API to copy part of iovec safely. > > Signed-off-by: Michael S. Tsirkin > --- > iov.c | 23 +++ > iov.h | 9 + > 2 files changed, 32 insertions(+) > > diff --git a/iov.c b/iov.c > index c6a66f0..0dfcb28 100644 > --- a/iov.c > +++ b

[Qemu-devel] [PATCH 13/14] virtio-net: test peer header support at init time

2012-09-24 Thread Michael S. Tsirkin
There's no reason to query header support at random times: at load or feature query. Driver also might not query functions. Cleaner to do it at device init. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff

[Qemu-devel] [PATCH 08/14] virtio-net: switch tx to safe iov functions

2012-09-24 Thread Michael S. Tsirkin
Avoid mangling iovec manually: use safe iov_* functions. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 6e6f5f3..23feb21 100644 --- a/hw/virtio-net

[Qemu-devel] [PATCH 14/14] virtio-net: enable mrg buf header in tap on linux

2012-09-24 Thread Michael S. Tsirkin
Modern linux supports arbitrary header size, which makes it possible to pass mrg buf header to tap directly without iovec mangling. Use this capability when it is there. This removes the need to deal with it in vhost-net as we do now. Signed-off-by: Michael S. Tsirkin --- hw/vhost_net.c | 13 -

[Qemu-devel] [PATCH 12/14] virtio-net: minor code simplification

2012-09-24 Thread Michael S. Tsirkin
During packet filtering, we can now use host hdr len to offset incoming buffer unconditionally. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index d9a9f8f..c65dead 100644 --- a/hw/vi

[Qemu-devel] [PATCH 04/14] virtio-net: avoid sg copy

2012-09-24 Thread Michael S. Tsirkin
Avoid tweaking iovec during receive. This removes the need to copy the vector. Note: we already have an evil cast in work_around_broken_dhclient and unfortunately this adds another one. const on buf is ignored by this function anyway so arguably this is not making things much worse. Signed-off-by:

[Qemu-devel] [PATCH 07/14] virtio-net: first s/g is always at start of buf

2012-09-24 Thread Michael S. Tsirkin
We know offset is 0, assert that. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 3a0d1a7..6e6f5f3 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -630,6 +630,7 @@ static

[Qemu-devel] [PATCH 00/14] virtio-net: iovec handling cleanup

2012-09-24 Thread Michael S. Tsirkin
virtio net is using lots of manual mangling of iovecs; I don't see any obvious crashes but it does look scary since guest can manipulate iovecs. This patchset changes it to use iov_* functions which are safer. On a recent linux kernel, new code will actually do less iovec processing because it is

[Qemu-devel] [PATCH 02/14] iov: add const annotation

2012-09-24 Thread Michael S. Tsirkin
iov_from_buf does not change iov, make it const. Signed-off-by: Michael S. Tsirkin --- iov.c | 2 +- iov.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iov.c b/iov.c index 60705c7..c6a66f0 100644 --- a/iov.c +++ b/iov.c @@ -26,7 +26,7 @@ # include #endif -size_t io

[Qemu-devel] [PATCH 09/14] virtio-net: simplify rx code

2012-09-24 Thread Michael S. Tsirkin
Remove code duplication using guest header length that we track. Drop specific layout requirement for rx buffers: things work using generic iovec functions in any case. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --gi

[Qemu-devel] [PATCH 05/14] virtio-net: use safe iov operations for rx

2012-09-24 Thread Michael S. Tsirkin
Avoid magling iov manually: use safe iov operations for processing packets incoming to guest. This also removes the requirement for virtio header to fit the first s/g entry exactly. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 25 ++--- 1 file changed, 14 insertion

[Qemu-devel] [PATCH 11/14] virtio-net: fix used len for tx

2012-09-24 Thread Michael S. Tsirkin
There is no out sg for TX, so used buf length for tx should always be 0. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 2381ee5..d9a9f8f 100644 --- a/hw/virtio-net.c +++ b/hw/vi

[Qemu-devel] [PATCH 06/14] virtio-net: refactor receive_hdr

2012-09-24 Thread Michael S. Tsirkin
Now that we know host hdr length, we don't need to duplicate the logic in receive_hdr: caller can figure out the offset itself. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/hw/virtio-net.c b/hw/virti

[Qemu-devel] [PATCH 10/14] virtio: don't mark unaccessed memory as dirty

2012-09-24 Thread Michael S. Tsirkin
offset of accessed buffer is calculated using iov_length, so it can exceed accessed len. If that happens math in len - offset wraps around, and size becomes wrong. As real value is 0, so this is harmless but unnecessary. Signed-off-by: Michael S. Tsirkin --- hw/virtio.c | 2 +- 1 file changed, 1

[Qemu-devel] [PATCH 03/14] iov: add iov_cpy

2012-09-24 Thread Michael S. Tsirkin
Add API to copy part of iovec safely. Signed-off-by: Michael S. Tsirkin --- iov.c | 23 +++ iov.h | 9 + 2 files changed, 32 insertions(+) diff --git a/iov.c b/iov.c index c6a66f0..0dfcb28 100644 --- a/iov.c +++ b/iov.c @@ -228,3 +228,26 @@ void iov_hexdump(const st

[Qemu-devel] [PATCH 01/14] virtio-net: track host/guest header length

2012-09-24 Thread Michael S. Tsirkin
Tracking these in device state instead of re-calculating on each packet. No functional changes. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 649074

Re: [Qemu-devel] linux aio and cache mode

2012-09-24 Thread ching
On 09/24/2012 08:30 PM, Kevin Wolf wrote: > Am 24.09.2012 13:32, schrieb ching: >> Hi all, >> >> My host is qemu-1.1.1 and x64 kernel 3.5.4. The guest is using aio="native" >> >> I am trying to use unsafe cache mode to boost i/o performance. > aio=native requires the image to be opened with O_DIREC

[Qemu-devel] [PATCH 5/7] target-s390x: Use CPU_LOG_INT

2012-09-24 Thread Richard Henderson
Three places in the interrupt code did we not honor the mask. Cc: Alexander Graf Signed-off-by: Richard Henderson --- target-s390x/helper.c | 7 --- target-s390x/misc_helper.c | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target-s390x/helper.c b/target-s390x/h

[Qemu-devel] [PATCH 6/7] target-s390x: Avoid double CPU_LOG_TB_CPU

2012-09-24 Thread Richard Henderson
This is already handled generically in cpu_exec. Cc: Alexander Graf Signed-off-by: Richard Henderson --- target-s390x/translate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 6fa76a0..4cc9225 100644 --- a/target-s390x/translate.c +

[Qemu-devel] [PATCH 3/7] target-s390x: Call tcg_gen_debug_insn_start

2012-09-24 Thread Richard Henderson
Cc: Alexander Graf Signed-off-by: Richard Henderson --- target-s390x/translate.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 3214783..6fa76a0 100644 --- a/target-s390x/translate.c +++ b/target-s390x/transl

[Qemu-devel] [PATCH 0/7] Tidy -d op_opt,int,cpu

2012-09-24 Thread Richard Henderson
The first patch applies to most targets, in wanting to produce good dumps for -d op_opt without -d op. The next three add dump_insn support to the targets lacking it. The final three fix irritations that apply to s390x. I didn't survey the other targets for similar mistakes. r~ Richard Hende

[Qemu-devel] [PATCH 4/7] target-unicore32: Call tcg_gen_debug_insn_start

2012-09-24 Thread Richard Henderson
Cc: Guan Xuetao Signed-off-by: Richard Henderson --- target-unicore32/translate.c | 4 1 file changed, 4 insertions(+) diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c index b786a6b..36f4f2f 100644 --- a/target-unicore32/translate.c +++ b/target-unicore32/translate.

[Qemu-devel] [PATCH 1/7] Emit debug_insn for CPU_LOG_TB_OP_OPT as well.

2012-09-24 Thread Richard Henderson
For all targets that currently call tcg_gen_debug_insn_start, add CPU_LOG_TB_OP_OPT to the condition that gates it. This is useful for comparing optimization dumps, when the pre-optimization dump is merely noise. Signed-off-by: Richard Henderson --- target-alpha/translate.c | 2 +- target-

[Qemu-devel] [PATCH 7/7] target-s390x: Tidy cpu_dump_state

2012-09-24 Thread Richard Henderson
The blank lines inside the single dump make it difficult for the eye to pick out the block. Worse, with interior newlines, but no blank line following, the PSW line appears to belong to the next dump block. Cc: Alexander Graf Signed-off-by: Richard Henderson --- target-s390x/translate.c | 22 +

[Qemu-devel] [PATCH 2/7] target-m68k: Call tcg_gen_debug_insn_start

2012-09-24 Thread Richard Henderson
Cc: Paul Brook Signed-off-by: Richard Henderson --- target-m68k/translate.c | 4 1 file changed, 4 insertions(+) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index fb707f2..451ef74 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -2953,6 +2953,10 @@ s

[Qemu-devel] [PATCH 3/3] qapi: convert add_client

2012-09-24 Thread Luiz Capitulino
Also fixes a few issues while there: 1. The fd returned by monitor_get_fd() leaks in most error conditions 2. monitor_get_fd() return value is not checked. Best case we get an error that is not correctly reported, worse case one of the functions using the fd (with value of -1) will explo

[Qemu-devel] [PATCH 1/3] pci-assign: use monitor_handle_fd_param

2012-09-24 Thread Luiz Capitulino
From: Paolo Bonzini There is no need to open-code the choice between a file descriptor number or a named one. Just use monitor_handle_fd_param, which also takes care of printing the error message. Signed-off-by: Paolo Bonzini Signed-off-by: Luiz Capitulino --- hw/kvm/pci-assign.c | 12 +++---

[Qemu-devel] [PATCH 2/3] monitor: add Error * argument to monitor_get_fd

2012-09-24 Thread Luiz Capitulino
From: Paolo Bonzini Signed-off-by: Paolo Bonzini Signed-off-by: Luiz Capitulino --- dump.c | 3 +-- migration-fd.c | 2 +- monitor.c | 15 +-- monitor.h | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dump.c b/dump.c index 2bf8d8d..1a3c

[Qemu-devel] [PATCH v3 0/3] qapi: convert add_client

2012-09-24 Thread Luiz Capitulino
v3 - qmp_add_client(): don't use errp to test for error Luiz Capitulino (1): qapi: convert add_client Paolo Bonzini (2): pci-assign: use monitor_handle_fd_param monitor: add Error * argument to monitor_get_fd dump.c | 3 +-- hw/kvm/pci-assign.c | 12 +++- migration

Re: [Qemu-devel] [PATCH 3/7] tcg-i386: Implement movcond

2012-09-24 Thread Richard Henderson
On 09/24/2012 02:37 PM, Alex Barcelo wrote: > just finished a git-bisect and I found this... and now I do not fully > understand why I have the problem. > > To replicate the error (in a i386 machine, at least): > $ make clean && ./configure --enable-debug && make -j && make install > [Note: I trie

[Qemu-devel] [PATCH 3/3] tcg: Add tcg_high_cond

2012-09-24 Thread Richard Henderson
The table that was recently added for hppa is generally usable. And with the renumbering of the TCG_COND constants it's not too difficult to compute rather than have a table. Signed-off-by: Richard Henderson --- tcg/hppa/tcg-target.c | 17 ++--- tcg/tcg.h | 17 +++

Re: [Qemu-devel] [PATCH 3/7] tcg-i386: Implement movcond

2012-09-24 Thread Alex Barcelo
just finished a git-bisect and I found this... and now I do not fully understand why I have the problem. To replicate the error (in a i386 machine, at least): $ make clean && ./configure --enable-debug && make -j && make install [Note: I tried both ppc and i386 targets, so doesn't seem machine-dep

Re: [Qemu-devel] [PATCH 8/9] mm: compaction: Cache if a pageblock was scanned and no pages were isolated

2012-09-24 Thread Andrew Morton
On Mon, 24 Sep 2012 10:39:38 +0100 Mel Gorman wrote: > On Fri, Sep 21, 2012 at 02:36:56PM -0700, Andrew Morton wrote: > > > Also, what has to be done to avoid the polling altogether? eg/ie, zap > > a pageblock's PB_migrate_skip synchronously, when something was done to > > that pageblock which

[Qemu-devel] [PATCH 2/3] tcg: Add TCG_COND_NEVER, TCG_COND_ALWAYS

2012-09-24 Thread Richard Henderson
There are several cases that can be handled easier inside both translators and code generators if we have out-of-band values for conditions. It's easy enough to handle ALWAYS and NEVER in the natural way inside the tcg middle-end. Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c | 2

[Qemu-devel] [PATCH 1/3] tcg: Add is_unsigned_cond

2012-09-24 Thread Richard Henderson
Before we rearrange the TCG_COND enumeration, add a predicate for the (single) use of comparisons vs TCGCond. Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.c | 2 +- tcg/tcg.h | 5 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tcg/s390/tcg-target.c b/

[Qemu-devel] [PATCH 0/3] TCGCond improvements

2012-09-24 Thread Richard Henderson
The second patch comes from the target-s390 patch set I've been working on. The first patch has been split out from that. The third patch provides tcg_high_cond globally, as the 32-bit sparc port suffers from the same bug that afflicted hppa. Richard Henderson (3): tcg: Add is_unsigned_cond

[Qemu-devel] [PATCH 2/2] tcg: Streamline movcond_i64 using movcond_i32

2012-09-24 Thread Richard Henderson
When movcond_i32 is available we can further reduce the generated op count from 12 to 6, and the generated code size on i686 from 88 to 74 bytes. Signed-off-by: Richard Henderson --- tcg/tcg-op.h | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tcg/tcg-

[Qemu-devel] [PATCH 1/2] tcg: Streamline movcond_i64 using 32-bit arithmetic

2012-09-24 Thread Richard Henderson
Avoiding 64-bit arithmetic (outside of the compare) reduces the generated op count from 15 to 12, and the generated code size on i686 from 105 to 88 bytes. Signed-off-by: Richard Henderson --- tcg/tcg-op.h | 20 1 file changed, 20 insertions(+) diff --git a/tcg/tcg-op.h b/t

[Qemu-devel] [PATCH v3 0/2] Optimize movcond

2012-09-24 Thread Richard Henderson
Changes v2->v3: Rebase with the first 5 patches committed. Fix 32/64-bit compile problems. Oops. r~ Richard Henderson (2): tcg: Streamline movcond_i64 using 32-bit arithmetic tcg: Streamline movcond_i64 using movcond_i32 tcg/tcg-op.h | 28 1 file changed,

Re: [Qemu-devel] [PATCH] CODING_STYLE: Define how to handle acronyms in CamelCase

2012-09-24 Thread Alex Williamson
On Mon, 2012-09-24 at 22:01 +0200, Michael S. Tsirkin wrote: > On Mon, Sep 24, 2012 at 12:08:16PM -0600, Alex Williamson wrote: > > When creating structure names in CamelCase, it's easy to have > > back-to-back capitals when using acronyms (ex. PCIINTxRoutingNotifier, > > QEMUSGList, VFIOINTx). In

Re: [Qemu-devel] [PATCH] CODING_STYLE: Define how to handle acronyms in CamelCase

2012-09-24 Thread Michael S. Tsirkin
On Mon, Sep 24, 2012 at 12:08:16PM -0600, Alex Williamson wrote: > When creating structure names in CamelCase, it's easy to have > back-to-back capitals when using acronyms (ex. PCIINTxRoutingNotifier, > QEMUSGList, VFIOINTx). In the worst case these can look like macros, > but even adjoining a si

Re: [Qemu-devel] [PATCH] w32: Always use standard instead of native format strings

2012-09-24 Thread Stefan Weil
Am 24.09.2012 21:28, schrieb Eric Blake: On 08/22/2012 01:42 PM, Stefan Weil wrote: GLib 2.0 include files use __printf__ for the format attribute which resolves to native format strings on w32 hosts. QEMU wants standard format strings instead of native format strings, so we simply change any d

Re: [Qemu-devel] [PATCH] w32: Always use standard instead of native format strings

2012-09-24 Thread Eric Blake
On 08/22/2012 01:42 PM, Stefan Weil wrote: > GLib 2.0 include files use __printf__ for the format attribute > which resolves to native format strings on w32 hosts. > > QEMU wants standard format strings instead of native format > strings, so we simply change any declaration with __printf__ > to us

Re: [Qemu-devel] [PATCH 1/3] irq: Add new function qemu_init_irqs

2012-09-24 Thread Peter Maydell
On 24 September 2012 20:08, Stefan Weil wrote: > It is used to avoid dynamic memory allocation for qemu_irq arrays > with known size or single qemu_irq variables. This patch is going to collide with Peter Crosthwaite's patch that allows an irq array to be extended. Also, the memory allocated wit

[Qemu-devel] [PATCH 2/3] hw/arm_timer: Fix memory leak (detected by Valgrind)

2012-09-24 Thread Stefan Weil
qi was allocated using g_malloc and never released. It is not necessary to use dynamic memory allocation for qi because it is copied to entries in s->timer and not used otherwise. Signed-off-by: Stefan Weil --- hw/arm_timer.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff -

[Qemu-devel] [PATCH 3/3] hw/spitz: Fix memory leaks (detected by Valgrind)

2012-09-24 Thread Stefan Weil
outsignals was allocated using g_malloc and never released. It is not necessary to use dynamic memory allocation for that array because its entries are copied and not used otherwise. Only 7 entries are used. lcd_hsync can be initialized directly instead of copying the first entry of a dynamically

[Qemu-devel] [PATCH 1/3] irq: Add new function qemu_init_irqs

2012-09-24 Thread Stefan Weil
It is used to avoid dynamic memory allocation for qemu_irq arrays with known size or single qemu_irq variables. Signed-off-by: Stefan Weil --- hw/irq.c | 15 +-- hw/irq.h |4 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/irq.c b/hw/irq.c index d413a0b.

[Qemu-devel] [PATCH 0/3] Fix some memory leaks caused by qemu_allocate_irqs

2012-09-24 Thread Stefan Weil
There are several memory leaks in QEMU which are caused by calling qemu_allocate_irqs. Some of these leaks are fixed here in the 2nd and 3rd patch. More can be fixed using the same pattern. The first patch adds a new function which avoids unnecessary memory allocation. [PATCH 1/3] irq: Add new f

[Qemu-devel] [PATCH 4/4] hw/ds1338: Implement state save/restore

2012-09-24 Thread Peter Maydell
Implement state save/restore for the DS1338. This requires the usual minor adjustment of types in the state struct to get fixed-width ones with vmstate macros. Signed-off-by: Peter Maydell --- hw/ds1338.c | 27 ++- 1 file changed, 22 insertions(+), 5 deletions(-) diff

[Qemu-devel] [PATCH 0/4] ds1338 I2C RTC+NVRAM: various fixes

2012-09-24 Thread Peter Maydell
Clang's static analyzer drew my attention to the mishandling of the register pointer in ds1338_send(); one thing led to another and I fixed a few other things while I was there. There seems a reasonable chance that the overrun of nvram[] is guest-exploitable, but I assume nobody treats realview or

[Qemu-devel] [PATCH 1/4] hw/ds1338: Fix mishandling of register pointer

2012-09-24 Thread Peter Maydell
Correct several deficiencies in the handling of the register pointer: * it should wrap around after 0x3f, not 0xff * guard against the caller handing us an out of range pointer (on h/w this can never happen, because only a 7 bit value is transferred over the I2C bus) * there was confusion

[Qemu-devel] [PATCH 2/4] hw/ds1338: Recapture current time when register pointer wraps around

2012-09-24 Thread Peter Maydell
The DS1338 datasheet documents that the current time is captured into the secondary registers when the register pointer wraps round to zero as well as at a START condition. Implement this. Signed-off-by: Peter Maydell --- hw/ds1338.c | 59 ++-

[Qemu-devel] [PATCH RESEND 3/3] virtio-serial-bus: let chardev know the exact number of bytes requested

2012-09-24 Thread Amit Shah
Using the virtqueue_avail_bytes() function had an unnecessarily crippling effect on the number of bytes needed by the guest as reported to the chardev layer in the can_read() callback. Using the new virtqueue_get_avail_bytes() function will let us advertise the exact number of bytes we can send to

[Qemu-devel] [PATCH RESEND 1/3] virtio: use unsigned int for counting bytes in vq

2012-09-24 Thread Amit Shah
The virtqueue_avail_bytes() function counts bytes in an int. Use an unsigned int instead. Signed-off-by: Amit Shah --- hw/virtio.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 209c763..4c9e20a3 100644 --- a/hw/virtio.c +++ b/hw/virtio

[Qemu-devel] [PATCH RESEND 2/3] virtio: Introduce virtqueue_get_avail_bytes()

2012-09-24 Thread Amit Shah
The current virtqueue_avail_bytes() is oddly named, and checks if a particular number of bytes are available in a vq. A better API is to fetch the number of bytes available in the vq, and let the caller do what's interesting with the numbers. Introduce virtqueue_get_avail_bytes(), which returns t

[Qemu-devel] [PATCH RESEND 0/3] Introduce virtqueue_get_avail_bytes()

2012-09-24 Thread Amit Shah
This is a rebased version of the patchset sent earlier. The current virtqueue_avail_bytes() is a weird API: it's oddly-named: doesn't tell us what the API is going to do, and also suits just one use-case (that in virtio-net.c). Introduce virtqueue_get_avail_bytes(), which returns the number of by

[Qemu-devel] [PATCH 3/4] hw/ds1338: Remove 'now' field from state struct

2012-09-24 Thread Peter Maydell
The 'struct tm now' field in the state structure is in fact only ever used as a temporary (the actual RTC state is held in 'offset'). Remove it from the state structure in favour of using local variables to avoid confusion about whether it needs to be saved on migration. Signed-off-by: Peter Mayde

Re: [Qemu-devel] [PATCH 38/41] block-migration: handle errors with the return codes correctly

2012-09-24 Thread Juan Quintela
Paolo Bonzini wrote: > Il 21/09/2012 10:47, Juan Quintela ha scritto: >> Signed-off-by: Juan Quintela >> --- >> @@ -635,18 +639,15 @@ static int block_save_complete(QEMUFile *f, void >> *opaque) >> all async read completed */ >> assert(block_mig_state.submitted == 0); >> > > Not cl

Re: [Qemu-devel] [PATCH v2] Add infrastructure for QIDL-based device serialization

2012-09-24 Thread Michael Roth
On Sat, Sep 22, 2012 at 02:33:52PM +, Blue Swirl wrote: > On Fri, Sep 21, 2012 at 4:24 PM, Michael Roth > wrote: > > On Fri, Sep 21, 2012 at 05:57:42PM +0200, Paolo Bonzini wrote: > >> Il 21/09/2012 16:07, Michael Roth ha scritto: > >> > > >> > QIDL_DECLARE(SerialDevice) { > >> >

Re: [Qemu-devel] [PATCH 41/41] cpus: create qemu_cpu_is_vcpu()

2012-09-24 Thread Juan Quintela
Paolo Bonzini wrote: > Il 21/09/2012 10:47, Juan Quintela ha scritto: >> Old code used !io_thread to know if a thread was an vcpu or not. That >> fails when we introduce the iothread. >> >> Signed-off-by: Juan Quintela >> --- >> cpus.c | 9 +++-- >> 1 file changed, 7 insertions(+), 2 delet

[Qemu-devel] [PATCH] CODING_STYLE: Define how to handle acronyms in CamelCase

2012-09-24 Thread Alex Williamson
When creating structure names in CamelCase, it's easy to have back-to-back capitals when using acronyms (ex. PCIINTxRoutingNotifier, QEMUSGList, VFIOINTx). In the worst case these can look like macros, but even adjoining a single, all-caps acronym makes it more difficult to interpret. For example

Re: [Qemu-devel] [PATCH 1/2] fdt: move dumpdtb interpretation code to device_tree.c

2012-09-24 Thread Peter Maydell
On 23 September 2012 07:41, Alexander Graf wrote: > +void qemu_devtree_dumpdtb(void *fdt, int size) > +{ > +QemuOpts *machine_opts; > + > +machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > +if (machine_opts) { > +const char *dumpdtb = qemu_opt_get(machine_opts, "du

Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value

2012-09-24 Thread Aurelien Jarno
On Mon, Sep 24, 2012 at 05:28:35PM +0100, Peter Maydell wrote: > In float16_to_float32, when returning an infinity, just pass zero > as the mantissa argument to packFloat32(), rather than shifting > a value which we know must be zero. > > Signed-off-by: Peter Maydell > --- > Spotted by the clang

Re: [Qemu-devel] [PATCH 04/25] ahci: add ide device initialization helper

2012-09-24 Thread Jason Baron
On Mon, Sep 24, 2012 at 06:52:29PM +0200, Markus Armbruster wrote: > Jason Baron writes: > > > On Fri, Sep 21, 2012 at 04:05:14PM +0200, Markus Armbruster wrote: > >> Jason Baron writes: > >> > >> > From: Isaku Yamahata > >> > > >> > Introduce a helper function which initializes the ahci port

Re: [Qemu-devel] [PATCH 04/25] ahci: add ide device initialization helper

2012-09-24 Thread Markus Armbruster
Jason Baron writes: > On Fri, Sep 21, 2012 at 04:05:14PM +0200, Markus Armbruster wrote: >> Jason Baron writes: >> >> > From: Isaku Yamahata >> > >> > Introduce a helper function which initializes the ahci port with >> > ide devices. >> > It will be used by q35 support. >> > >> > Cc: Alexander

[Qemu-devel] [PATCH v6 12/16] target-i386: Add optional Hypervisor leaf extra.

2012-09-24 Thread Don Slutz
Signed-off-by: Don Slutz --- target-i386/cpu.h |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index ebb3498..254ddef 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -812,6 +812,10 @@ typedef struct CPUX86State { uin

[Qemu-devel] [PATCH 1/2] fdt: move dumpdtb interpretation code to device_tree.c

2012-09-24 Thread Alexander Graf
The dumpdtb code can be useful in more places than just for e500. Move it to a generic place. Signed-off-by: Alexander Graf --- device_tree.c | 22 ++ device_tree.h |2 ++ hw/ppc/e500.c | 15 +-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --g

[Qemu-devel] [PATCH 2/2] ARM: Add dumpdtb support

2012-09-24 Thread Alexander Graf
This patch adds support for the dumpdtb machine option to all ARM boards that have device tree support. Signed-off-by: Alexander Graf --- hw/arm_boot.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/arm_boot.c b/hw/arm_boot.c index a6e9143..0830a62 100644 --- a/hw/ar

[Qemu-devel] [PATCH v6 10/16] target-i386: Use Hypervisor vendor in -machine pc, accel=tcg.

2012-09-24 Thread Don Slutz
Also known as Paravirtualization vendor. This change is based on: Microsoft Hypervisor CPUID Leaves: http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx Linux kernel change starts with: http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html Al

Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value

2012-09-24 Thread Richard Henderson
On 2012-09-24 09:28, Peter Maydell wrote: > In float16_to_float32, when returning an infinity, just pass zero > as the mantissa argument to packFloat32(), rather than shifting > a value which we know must be zero. > > Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson r~

[Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value

2012-09-24 Thread Peter Maydell
In float16_to_float32, when returning an infinity, just pass zero as the mantissa argument to packFloat32(), rather than shifting a value which we know must be zero. Signed-off-by: Peter Maydell --- Spotted by the clang static analyzer. This brings this code into line with the other float-to-floa

[Qemu-devel] [PATCH v6 14/16] target-i386: Add setting of Hypervisor leaf extra for known vmare4.

2012-09-24 Thread Don Slutz
This was taken from: http://article.gmane.org/gmane.comp.emulators.kvm.devel/22643 Signed-off-by: Don Slutz --- target-i386/cpu.c | 32 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 8bb20c7..b77dbf

[Qemu-devel] [PATCH 04/19] block: Framework for reopening files safely

2012-09-24 Thread Kevin Wolf
From: Jeff Cody This is based on Supriya Kannery's bdrv_reopen() patch series. This provides a transactional method to reopen multiple images files safely. Image files are queue for reopen via bdrv_reopen_queue(), and the reopen occurs when bdrv_reopen_multiple() is called. Changes are staged

[Qemu-devel] [PATCH 01/19] blockdev: preserve readonly and snapshot states across media changes

2012-09-24 Thread Kevin Wolf
From: Kevin Shanahan If readonly=on is given at device creation time, the ->readonly flag needs to be set in the block driver state for this device so that readonly-ness is preserved across media changes (qmp change command). Similarly, to preserve the snapshot property requires ->open_flags to b

[Qemu-devel] [PATCH 17/19] block: vpc image file reopen

2012-09-24 Thread Kevin Wolf
From: Jeff Cody There is currently nothing that needs to be done for VPC image file reopen. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- block/vpc.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index c0b82c4..b6bf52f 100644

[Qemu-devel] [PATCH v6 09/16] target-i386: Use Hypervisor vendor in -machine pc, accel=kvm.

2012-09-24 Thread Don Slutz
Also known as Paravirtualization vendor. This change is based on: Microsoft Hypervisor CPUID Leaves: http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx Linux kernel change starts with: http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html Al

[Qemu-devel] [PATCH 19/19] block: remove keep_read_only flag from BlockDriverState struct

2012-09-24 Thread Kevin Wolf
From: Jeff Cody The keep_read_only flag is no longer used, in favor of the bdrv flag BDRV_O_ALLOW_RDWR. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- block.c |2 -- block_int.h |1 - 2 files changed, 0 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 84

[Qemu-devel] [PATCH 09/19] block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c

2012-09-24 Thread Kevin Wolf
From: Jeff Cody The aligned_buf pointer and aligned_buf size are no longer used in raw_posix.c, so remove all references to them. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- block/raw-posix.c | 21 + 1 files changed, 1 insertions(+), 20 deletions(-) diff --gi

[Qemu-devel] [PATCH 18/19] block: convert bdrv_commit() to use bdrv_reopen()

2012-09-24 Thread Kevin Wolf
From: Jeff Cody Currently, bdrv_commit() reopens images r/w itself, via risky _delete() and _open() calls. Use the new safe method for drive reopen. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- block.c | 48 +--- 1 files changed, 5 inser

[Qemu-devel] [PATCH 08/19] block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c

2012-09-24 Thread Kevin Wolf
From: Jeff Cody Rather than check for a non-NULL aligned_buf to determine if raw_aio_submit needs to check for alignment, check for the presence of BDRV_O_NOCACHE in the bs->open_flags. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- block/raw-posix.c |2 +- 1 files changed, 1 inse

[Qemu-devel] [PATCH 02/19] block: correctly set the keep_read_only flag

2012-09-24 Thread Kevin Wolf
From: Jeff Cody I believe the bs->keep_read_only flag is supposed to reflect the initial open state of the device. If the device is initially opened R/O, then commit operations, or reopen operations changing to R/W, are prohibited. Currently, the keep_read_only flag is only accurate for the acti

Re: [Qemu-devel] [PATCH v5 0/4] VFIO-based PCI device assignment

2012-09-24 Thread Michael S. Tsirkin
On Fri, Sep 14, 2012 at 05:01:35PM -0600, Alex Williamson wrote: > Same goodness as v4, plus: > > - Addressed comments by Blue Swirl (thanks for the review) >(hopefully w/o breaking anything wrt slow bar endianness) > - Fixed a couple checkpatch warnings that snuck in > > BTW, this works fi

[Qemu-devel] [PATCH 10/19] block: raw-posix image file reopen

2012-09-24 Thread Kevin Wolf
From: Jeff Cody This is derived from the Supriya Kannery's reopen patches. This contains the raw-posix driver changes for the bdrv_reopen_* functions. All changes are staged into a temporary scratch buffer during the prepare() stage, and copied over to the live structure during commit(). Upon

[Qemu-devel] [PATCH 11/19] block: raw image file reopen

2012-09-24 Thread Kevin Wolf
From: Jeff Cody These are the stubs for the file reopen drivers for the raw format. There is currently nothing that needs to be done by the raw driver in reopen. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- block/raw.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletio

Re: [Qemu-devel] [PATCH] aio: another fix to the walking_handlers logic

2012-09-24 Thread Bharata B Rao
On Mon, Sep 24, 2012 at 05:06:11PM +0200, Paolo Bonzini wrote: > The AIO dispatch loop will call QLIST_REMOVE and g_free even if there > are other pending calls to qemu_aio_wait outside the current one. > > Signed-off-by: Paolo Bonzini > --- > This is on top of the existing fix that is po

[Qemu-devel] [PATCH v6 05/16] target-i386: Use Hypervisor level in -machine pc, accel=kvm.

2012-09-24 Thread Don Slutz
Also known as Paravirtualization level. This change is based on: Microsoft Hypervisor CPUID Leaves: http://msdn.microsoft.com/en-us/library/windows/hardware/ff542428%28v=vs.85%29.aspx Linux kernel change starts with: http://fixunix.com/kernel/538707-use-cpuid-communicate-hypervisor.html Als

[Qemu-devel] [PATCH 15/19] block: vmdk image file reopen

2012-09-24 Thread Kevin Wolf
From: Jeff Cody This patch supports reopen for VMDK image files. VMDK extents are added to the existing reopen queue, so that the transactional model of reopen is maintained with multiple image files. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- block/vmdk.c | 35

Re: [Qemu-devel] [PATCH 5/8] tcg: Implement concat*_i64 with deposit_i64

2012-09-24 Thread Richard Henderson
On 2012-09-22 12:52, Aurelien Jarno wrote: > On Fri, Sep 21, 2012 at 05:18:13PM -0700, Richard Henderson wrote: >> For tcg_gen_concat_i32_i64 we only use deposit if the host supports it. >> For tcg_gen_concat32_i64 even if the host does not, as we get identical >> code before and after. >> >> Note

  1   2   3   >