sdk/emulator/qemu.git
10 years agotcg: Require TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Mon, 28 Apr 2014 19:01:23 +0000 (12:01 -0700)]
tcg: Require TCG_TARGET_INSN_UNIT_SIZE

Now that all backends do define TCG_TARGET_INSN_UNIT_SIZE,
remove the fallback definition.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotci: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Mon, 28 Apr 2014 18:58:30 +0000 (11:58 -0700)]
tci: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-mips: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Fri, 25 Apr 2014 19:22:44 +0000 (19:22 +0000)]
tcg-mips: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ia64: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Fri, 25 Apr 2014 17:24:23 +0000 (13:24 -0400)]
tcg-ia64: Define TCG_TARGET_INSN_UNIT_SIZE

Using a 16-byte aligned structure achieves best results, both for code
cleanliness and compiled code size.  However, this means that we can't
use the trick of encoding the slot number into the low 2 bits.

Thankfully, we only ever use slot2, so make that explicit in the names
of the relocation functions, and drop the code for other slots.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-s390: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Fri, 25 Apr 2014 14:18:59 +0000 (10:18 -0400)]
tcg-s390: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-aarch64: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Mon, 28 Apr 2014 19:02:31 +0000 (12:02 -0700)]
tcg-aarch64: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Acked-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-arm: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Thu, 24 Apr 2014 21:23:40 +0000 (14:23 -0700)]
tcg-arm: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-sparc: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Sat, 29 Mar 2014 00:13:25 +0000 (17:13 -0700)]
tcg-sparc: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Fri, 28 Mar 2014 22:34:04 +0000 (15:34 -0700)]
tcg-ppc: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Fri, 28 Mar 2014 21:58:38 +0000 (14:58 -0700)]
tcg-ppc64: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-i386: Define TCG_TARGET_INSN_UNIT_SIZE
Richard Henderson [Tue, 1 Apr 2014 15:34:03 +0000 (08:34 -0700)]
tcg-i386: Define TCG_TARGET_INSN_UNIT_SIZE

And use tcg pointer differencing functions as appropriate.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Define tcg_insn_unit for code pointers
Richard Henderson [Fri, 28 Mar 2014 19:56:22 +0000 (12:56 -0700)]
tcg: Define tcg_insn_unit for code pointers

To be defined by the tcg backend based on the elemental unit of the ISA.
During the transition, allow TCG_TARGET_INSN_UNIT_SIZE to be undefined,
which allows us to default tcg_insn_unit to the current uint8_t.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Introduce byte pointer arithmetic helpers
Richard Henderson [Mon, 31 Mar 2014 21:27:27 +0000 (14:27 -0700)]
tcg: Introduce byte pointer arithmetic helpers

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Avoid undefined behaviour patching code at unaligned addresses
Peter Maydell [Fri, 28 Mar 2014 15:29:48 +0000 (15:29 +0000)]
tcg: Avoid undefined behaviour patching code at unaligned addresses

To avoid C undefined behaviour when patching generated code,
provide wrappers tcg_patch8/16/32/64 which use the usual memcpy
trick, and use them in the i386 backend.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg: Avoid stores to unaligned addresses
Peter Maydell [Fri, 28 Mar 2014 15:29:47 +0000 (15:29 +0000)]
tcg: Avoid stores to unaligned addresses

Avoid stores to unaligned addresses in TCG code generation, by using the
usual memcpy() approach. (Using bswap.h would drag a lot of QEMU baggage
into TCG, so it's simpler just to do direct memcpy() here.)

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoexec-all.h: Use stl_p to avoid undefined behaviour patching x86 jumps
Peter Maydell [Fri, 28 Mar 2014 15:29:46 +0000 (15:29 +0000)]
exec-all.h: Use stl_p to avoid undefined behaviour patching x86 jumps

The code which patches x86 jump instructions assumes it can do an
unaligned write of a uint32_t. This is actually safe on x86, but it's
still undefined behaviour. We have infrastructure for doing efficient
unaligned accesses which doesn't engage in undefined behaviour, so
use it.

This is technically fractionally less efficient, at least with gcc 4.6;
instead of one instruction:
 7b2:   89 3e                   mov    %edi,(%rsi)
we get an extra spurious store to the stack slot:
 7b2:   89 7c 24 64             mov    %edi,0x64(%rsp)
 7b6:   89 3e                   mov    %edi,(%rsi)

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Fri, 9 May 2014 14:46:34 +0000 (15:46 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp: (38 commits)
  Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"
  qapi: Document optional arguments' backwards compatibility
  qmp: use valid JSON in transaction example
  qmp: Don't use error_is_set() to suppress additional errors
  dump: Drop pointless error_is_set(), DumpState member errp
  qemu-option: Clean up fragile use of error_is_set()
  qga: Drop superfluous error_is_set()
  qga: Clean up fragile use of error_is_set()
  qapi: Clean up fragile use of error_is_set()
  tests/qapi-schema: Drop superfluous error_is_set()
  qapi: Drop redundant, unclean error_is_set()
  hmp: Guard against misuse of hmp_handle_error()
  qga: Use return values instead of error_is_set(errp)
  error: Consistently name Error ** objects errp, and not err
  qmp: Consistently name Error ** objects errp, and not err
  qga: Consistently name Error ** objects errp, and not err
  qmp hmp: Consistently name Error * objects err, and not errp
  pci-assign: assigned_initfn(): set monitor error in common error handler
  pci-assign: propagate errors from assign_intx()
  pci-assign: propagate errors from assign_device()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoRevert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"
Peter Lieven [Thu, 8 May 2014 16:03:15 +0000 (18:03 +0200)]
Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"

This reverts commit 25a7017555f1b4aeb543b5d323ff4afb8f9c5437.

Turns out the argument *can* be null: QEMU now segfaults if it
receives an invalid parameter via a qmp command instead of throwing an
error.

For example:
{ "execute": "blockdev-add",
     "arguments": { "options" : { "driver": "invalid-driver" } } }

CC: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Document optional arguments' backwards compatibility
Eric Blake [Wed, 7 May 2014 01:57:41 +0000 (09:57 +0800)]
qapi: Document optional arguments' backwards compatibility

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: use valid JSON in transaction example
Eric Blake [Tue, 6 May 2014 15:39:03 +0000 (09:39 -0600)]
qmp: use valid JSON in transaction example

Our example should use the correct quotes to match what someone
could actually pass over the wire.

* qmp-commands.hx: Use correct JSON quotes.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: Don't use error_is_set() to suppress additional errors
Markus Armbruster [Fri, 2 May 2014 11:26:42 +0000 (13:26 +0200)]
qmp: Don't use error_is_set() to suppress additional errors

Using error_is_set(errp) that way can sweep programming errors under
the carpet when we get called incorrectly with an error set.

encrypted_bdrv_it() does it, because there's no way to make
bdrv_iterate() break its loop.  Actually safe, because qmp_cont()
clears the error before the loop.  Clean it up anyway: replace
bdrv_iterate() by bdrv_next(), break the loop on error.

Replace both occurrences, for consistency.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agodump: Drop pointless error_is_set(), DumpState member errp
Markus Armbruster [Fri, 2 May 2014 11:26:41 +0000 (13:26 +0200)]
dump: Drop pointless error_is_set(), DumpState member errp

In qmp_dump_guest_memory(), the error must be clear on entry, and we
always bail out after setting it, directly or via dump_init().
Therefore, both error_is_set() are always false.  Drop them.

DumpState member errp is now write-only.  Drop it, too.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-option: Clean up fragile use of error_is_set()
Markus Armbruster [Fri, 2 May 2014 11:26:40 +0000 (13:26 +0200)]
qemu-option: Clean up fragile use of error_is_set()

Using error_is_set(ERRP) to find out whether to bail out due to
previous error is either wrong, fragile, or unnecessarily opaque.
It's wrong when ERRP may be null, because errors go undetected when it
is.  It's fragile when proving ERRP non-null involves a non-local
argument.  Else, it's unnecessarily opaque (see commit 84d18f0).

The error_is_set(state->errp) in qemu_opts_from_qdict_1() is merely
fragile, because the callers never pass state argument with null
state->errp.

Make the code more robust and more obviously correct: test
*state->errp directly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqga: Drop superfluous error_is_set()
Markus Armbruster [Fri, 2 May 2014 11:26:39 +0000 (13:26 +0200)]
qga: Drop superfluous error_is_set()

acquire_privilege(), execute_async() and check_suspend_mode() do
nothing when called with an error set.  Callers shouldn't do that, and
no caller does.  Drop the superfluous tests.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqga: Clean up fragile use of error_is_set()
Markus Armbruster [Fri, 2 May 2014 11:26:38 +0000 (13:26 +0200)]
qga: Clean up fragile use of error_is_set()

Using error_is_set(ERRP) to find out whether a function failed is
either wrong, fragile, or unnecessarily opaque.  It's wrong when ERRP
may be null, because errors go undetected when it is.  It's fragile
when proving ERRP non-null involves a non-local argument.  Else, it's
unnecessarily opaque (see commit 84d18f0).

The error_is_set(errp) in the guest agent command handler functions
are merely fragile, because all chall chains (do_qmp_dispatch() via
the generated marshalling functions) pass a non-null errp argument.

Make the code more robust and more obviously correct: receive the
error in a local variable, then propagate it through the parameter.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Clean up fragile use of error_is_set()
Markus Armbruster [Fri, 2 May 2014 11:26:37 +0000 (13:26 +0200)]
qapi: Clean up fragile use of error_is_set()

Using error_is_set(ERRP) to find out whether a function failed is
either wrong, fragile, or unnecessarily opaque.  It's wrong when ERRP
may be null, because errors go undetected when it is.  It's fragile
when proving ERRP non-null involves a non-local argument.  Else, it's
unnecessarily opaque (see commit 84d18f0).

The error_is_set(errp) in do_qmp_dispatch() is merely fragile, because
the caller never passes a null errp argument.

Make the code more robust and more obviously correct: receive the
error in a local variable, then propagate it through the parameter.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotests/qapi-schema: Drop superfluous error_is_set()
Markus Armbruster [Fri, 2 May 2014 11:26:36 +0000 (13:26 +0200)]
tests/qapi-schema: Drop superfluous error_is_set()

visit_type_TestStruct() does nothing when called with an error set.
Callers shouldn't do that, and no caller does.  Drop the superfluous
test.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Drop redundant, unclean error_is_set()
Markus Armbruster [Fri, 2 May 2014 11:26:35 +0000 (13:26 +0200)]
qapi: Drop redundant, unclean error_is_set()

do_qmp_dispatch()'s test for qmp_dispatch_check_obj() failure examines
both the return value and the error object.  The latter part is
unclean; it works only when do_qmp_dispatch()'s caller passes a
non-null errp argument.  That's the case, but it's not locally
obvious.  Unclean.

Cleanup would be easy enough, but since the unclean code is also
redundant, let's just drop it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agohmp: Guard against misuse of hmp_handle_error()
Markus Armbruster [Fri, 2 May 2014 11:26:34 +0000 (13:26 +0200)]
hmp: Guard against misuse of hmp_handle_error()

Null errp argument makes no sense.  Assert it's not null, to make this
explicit, and guard against misuse.  All current callers pass non-null
errp.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqga: Use return values instead of error_is_set(errp)
Markus Armbruster [Fri, 2 May 2014 11:26:33 +0000 (13:26 +0200)]
qga: Use return values instead of error_is_set(errp)

Using error_is_set(errp) to check whether a function call failed is
fragile: it breaks when errp is null.  ga_get_fd_handle() and
guest_file_handle_add() don't return a useful value when they fail,
but that's just stupid.  Fix that, and check them instead.  As far
as I can tell, errp can't be null there, but this is more robust and
more obviously correct.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoerror: Consistently name Error ** objects errp, and not err
Markus Armbruster [Fri, 2 May 2014 11:26:32 +0000 (13:26 +0200)]
error: Consistently name Error ** objects errp, and not err

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: Consistently name Error ** objects errp, and not err
Markus Armbruster [Fri, 2 May 2014 11:26:31 +0000 (13:26 +0200)]
qmp: Consistently name Error ** objects errp, and not err

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqga: Consistently name Error ** objects errp, and not err
Markus Armbruster [Fri, 2 May 2014 11:26:30 +0000 (13:26 +0200)]
qga: Consistently name Error ** objects errp, and not err

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp hmp: Consistently name Error * objects err, and not errp
Markus Armbruster [Fri, 2 May 2014 11:26:29 +0000 (13:26 +0200)]
qmp hmp: Consistently name Error * objects err, and not errp

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: assigned_initfn(): set monitor error in common error handler
Laszlo Ersek [Thu, 10 Apr 2014 08:24:45 +0000 (10:24 +0200)]
pci-assign: assigned_initfn(): set monitor error in common error handler

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate errors from assign_intx()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:44 +0000 (10:24 +0200)]
pci-assign: propagate errors from assign_intx()

Among the callers, only assigned_initfn() should set the  monitor's stored
error. Other callers may run in contexts where the monitor's stored error
makes no sense. For example:

assigned_dev_pci_write_config()
  assigned_dev_update_msix()
    assign_intx()

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate errors from assign_device()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:43 +0000 (10:24 +0200)]
pci-assign: propagate errors from assign_device()

Also, change the return type to "void"; the function is static (with a
sole caller) and the negative errno values are not distinguished from each
other.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate errors from assigned_dev_register_regions()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:42 +0000 (10:24 +0200)]
pci-assign: propagate errors from assigned_dev_register_regions()

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate errors from assigned_dev_register_msix_mmio()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:41 +0000 (10:24 +0200)]
pci-assign: propagate errors from assigned_dev_register_msix_mmio()

The return type is also changed from "int" to "void", because it was used
in a success vs. failure sense only (the caller didn't distinguish error
codes from each other, and even assigned_dev_register_msix_mmio() masked
mmap()'s errno values with a common -EFAULT).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate errors from assigned_device_pci_cap_init()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:40 +0000 (10:24 +0200)]
pci-assign: propagate errors from assigned_device_pci_cap_init()

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate errors from get_real_device()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:39 +0000 (10:24 +0200)]
pci-assign: propagate errors from get_real_device()

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: assignment should fail if we can't read config space
Laszlo Ersek [Thu, 10 Apr 2014 08:24:38 +0000 (10:24 +0200)]
pci-assign: assignment should fail if we can't read config space

assigned_initfn()
  get_real_device()
    read()

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: accept Error from pci_add_capability2()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:37 +0000 (10:24 +0200)]
pci-assign: accept Error from pci_add_capability2()

Propagate any errors while adding PCI capabilities to
assigned_device_pci_cap_init(). We'll continue the propagation upwards
when assigned_device_pci_cap_init() becomes a leaf itself (when none of
its callees will report errors internally any longer when detecting and
returning them).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci: add Error-propagating pci_add_capability2()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:36 +0000 (10:24 +0200)]
pci: add Error-propagating pci_add_capability2()

... and rebase pci_add_capability() to it.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate Error from check_irqchip_in_kernel()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:35 +0000 (10:24 +0200)]
pci-assign: propagate Error from check_irqchip_in_kernel()

Rename check_irqchip_in_kernel() to verify_irqchip_in_kernel(), so that
the name reflects our expectation better. Rather than returning a bool,
make it do nothing or set an Error.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: propagate errors from get_real_id()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:34 +0000 (10:24 +0200)]
pci-assign: propagate errors from get_real_id()

get_real_id() has two thin wrappers (and no other callers),
get_real_vendor_id() and get_real_device_id(); it's easiest to convert
them in one fell swoop.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: make assign_failed_examine() just format the cause
Laszlo Ersek [Thu, 10 Apr 2014 08:24:33 +0000 (10:24 +0200)]
pci-assign: make assign_failed_examine() just format the cause

This allows us to report the entire error with one error_report() call,
easing future error propagation.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agopci-assign: accept Error from monitor_handle_fd_param2()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:32 +0000 (10:24 +0200)]
pci-assign: accept Error from monitor_handle_fd_param2()

Propagate any errors in monitor fd handling up to get_real_device(), and
report them there. We'll continue the propagation upwards when
get_real_device() becomes a leaf itself (when none of its callees will
report errors internally any longer when detecting and returning an
error).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
eviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: add Error-propagating monitor_handle_fd_param2()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:31 +0000 (10:24 +0200)]
monitor: add Error-propagating monitor_handle_fd_param2()

and rebase monitor_handle_fd_param() to it. (Note that this will slightly
change the behavior when the qemu_parse_fd() branch is selected and it
fails: we now report (and in case of QMP, set) the error immediately,
rather than allowing the caller to set its own error message (if any)).

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agocutils: tighten qemu_parse_fd()
Laszlo Ersek [Thu, 10 Apr 2014 08:24:30 +0000 (10:24 +0200)]
cutils: tighten qemu_parse_fd()

qemu_parse_fd() used to handle at least the following strings incorrectly:
o "-2":         simply let through
o "2147483648": returned as LONG_MAX==INT_MAX on ILP32 (with ERANGE
                ignored); implementation-defined behavior on LP64

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: treat all negative return of strtosz_suffix() as error
Amos Kong [Mon, 28 Apr 2014 05:53:49 +0000 (13:53 +0800)]
qapi: treat all negative return of strtosz_suffix() as error

strtosz_suffix() might return negative error, this patch fixes
the error handling.

This patch also changes to handle error in the if statement
rather than handle success specially, this will make this use
of strtosz_suffix consistent with all other uses.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Add a primitive to include other files from a QAPI schema file
Lluís Vilanova [Wed, 7 May 2014 18:46:15 +0000 (20:46 +0200)]
qapi: Add a primitive to include other files from a QAPI schema file

The primitive uses JSON syntax, and include paths are relative to the file using the directive:

  { 'include': 'path/to/file.json' }

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Use an explicit input file
Lluís Vilanova [Fri, 2 May 2014 13:52:35 +0000 (15:52 +0200)]
qapi: Use an explicit input file

Use an explicit input file on the command-line instead of reading from standard
input.

It also outputs the proper file name when there's an error.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: [trivial] Do not catch unknown exceptions in "test-qapi.py"
Lluís Vilanova [Fri, 2 May 2014 13:52:30 +0000 (15:52 +0200)]
qapi: [trivial] Do not catch unknown exceptions in "test-qapi.py"

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: [trivial] Break long command lines
Lluís Vilanova [Fri, 2 May 2014 13:52:24 +0000 (15:52 +0200)]
qapi: [trivial] Break long command lines

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Peter Maydell [Thu, 8 May 2014 11:38:01 +0000 (12:38 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

Tracing pull request

# gpg: Signature made Wed 07 May 2014 18:14:02 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/tracing-pull-request:
  configure: Show trace output file conditionally
  trace: [tracetool] Minimize the amount of per-backend code
  trace: [simple] Bump up log version number
  trace: [tracetool] Change format docs to point to the generated file
  trace: [tracetool] Show list of frontends and backends sorted by name
  trace: [tracetool] Cosmetic changes
  trace: [tracetool] Spacing changes
  trace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy'
  trace: [tracetool] Add method 'Event.api' to build event names

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/spice/tags/pull-spice-7' into staging
Peter Maydell [Thu, 8 May 2014 09:57:25 +0000 (10:57 +0100)]
Merge remote-tracking branch 'remotes/spice/tags/pull-spice-7' into staging

spice: small fixes

# gpg: Signature made Thu 08 May 2014 09:50:21 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-7:
  spice: fix libvirt snapshots
  spice: fix "info spice"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agospice: fix libvirt snapshots
Gerd Hoffmann [Tue, 29 Apr 2014 07:27:31 +0000 (09:27 +0200)]
spice: fix libvirt snapshots

Only notify spice-server about migration events in case we got
target host information beforehand.  So we kick the seamless spice
client migration only in case a actual live migration happens, not
when libvirt uses live-migration-to-file for snapshotting.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agospice: fix "info spice"
Gerd Hoffmann [Tue, 15 Apr 2014 06:55:44 +0000 (08:55 +0200)]
spice: fix "info spice"

In case no listening address was specified, "info spice" reports
"0.0.0.0" as address.  Which is incorrect in case spice is listening
on ipv6.  Replace it by a wildcard "*" to indicate it is not limited
to a specific address.

Note:  Being more specific is not possible without extending the
spice-server api.  The socket is handled by spice-server not
qemu, so qemu can't easily figure the actual socket address.

Reported-by: David Jaša <djasa@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-05-07' into staging
Peter Maydell [Wed, 7 May 2014 17:38:39 +0000 (18:38 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-05-07' into staging

trivial patches for 2014-05-07

# gpg: Signature made Wed 07 May 2014 18:01:15 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514  66A7 BEE5 9D74 A4C3 D7DB

* remotes/mjt/tags/trivial-patches-2014-05-07: (21 commits)
  libcacard: remove unnecessary EOL from debug prints
  docs/memory.txt: Fix document on MMIO operations
  readline: Sort completions before printing them.
  readline: use g_strndup instead of open-coding it
  qmp: report path ambiguity error
  libcacard: replace pstrcpy() with memcpy()
  glib: move g_poll() replacement into glib-compat.h
  do not call g_thread_init() for glib >= 2.31
  hw/9pfs: Add include file for exported symbol
  xen: remove unused global, xen_xcg
  hw: Add missing 'static' attributes
  qemu-timer: Add missing 'static' attribute
  ui: Add missing 'static' attribute
  monitor: Add missing 'static' attribute
  hw/s390x: Add missing 'static' attribute
  hw/mips: Add missing 'static' and 'const' attributes
  hw/9pfs: Add missing 'static' attributes
  arch_init: Be sure of only one exit entry with DPRINTF() for ram_load()
  tests/tcg: Fix compilation of test_path
  qga: Fix typo (plural) in comment
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/sstabellini/xen-140507-2' into staging
Peter Maydell [Wed, 7 May 2014 17:12:14 +0000 (18:12 +0100)]
Merge remote-tracking branch 'remotes/sstabellini/xen-140507-2' into staging

* remotes/sstabellini/xen-140507-2:
  xen_disk: add discard support
  pass an inclusive address range to xc_domain_pin_memory_cacheattr
  xen: factor out common functions
  xen: move Xen HVM files under hw/i386/xen
  xen: move Xen PV machine files to hw/xenpv
  qemu-xen: free all the pirqs for msi/msix when driver unload
  exec: Limit translation limiting in address_space_translate to xen

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoconfigure: Show trace output file conditionally
Stefan Weil [Fri, 14 Mar 2014 20:09:10 +0000 (21:09 +0100)]
configure: Show trace output file conditionally

It is only used with the simple trace backend.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [tracetool] Minimize the amount of per-backend code
Lluís Vilanova [Sun, 23 Feb 2014 19:37:40 +0000 (20:37 +0100)]
trace: [tracetool] Minimize the amount of per-backend code

Backends now only contain the essential backend-specific code, and most of the work is moved to frontend code.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [simple] Bump up log version number
Lluís Vilanova [Sun, 23 Feb 2014 19:37:35 +0000 (20:37 +0100)]
trace: [simple] Bump up log version number

The following tracetool cleanup changes the event numbering policy.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [tracetool] Change format docs to point to the generated file
Lluís Vilanova [Sun, 23 Feb 2014 19:37:30 +0000 (20:37 +0100)]
trace: [tracetool] Change format docs to point to the generated file

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [tracetool] Show list of frontends and backends sorted by name
Lluís Vilanova [Sun, 23 Feb 2014 19:37:24 +0000 (20:37 +0100)]
trace: [tracetool] Show list of frontends and backends sorted by name

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [tracetool] Cosmetic changes
Lluís Vilanova [Sun, 23 Feb 2014 19:37:19 +0000 (20:37 +0100)]
trace: [tracetool] Cosmetic changes

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [tracetool] Spacing changes
Lluís Vilanova [Sun, 23 Feb 2014 19:37:13 +0000 (20:37 +0100)]
trace: [tracetool] Spacing changes

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy'
Lluís Vilanova [Sun, 23 Feb 2014 19:37:08 +0000 (20:37 +0100)]
trace: [tracetool] Add methods 'Event.copy' and 'Arguments.copy'

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agotrace: [tracetool] Add method 'Event.api' to build event names
Lluís Vilanova [Sun, 23 Feb 2014 19:37:02 +0000 (20:37 +0100)]
trace: [tracetool] Add method 'Event.api' to build event names

Makes it easier to ensure proper naming across the different frontends and backends.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agolibcacard: remove unnecessary EOL from debug prints
Alon Levy [Mon, 5 May 2014 14:41:32 +0000 (17:41 +0300)]
libcacard: remove unnecessary EOL from debug prints

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agodocs/memory.txt: Fix document on MMIO operations
Fam Zheng [Mon, 5 May 2014 07:53:41 +0000 (15:53 +0800)]
docs/memory.txt: Fix document on MMIO operations

.impl.valid should be .impl.unaligned and the description needs some
fixes.

.old_portio is removed since commit b40acf99b (ioport: Switch
dispatching to memory core layer).

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoreadline: Sort completions before printing them.
Hani Benhabiles [Thu, 1 May 2014 14:26:42 +0000 (15:26 +0100)]
readline: Sort completions before printing them.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoreadline: use g_strndup instead of open-coding it
Michael Tokarev [Mon, 5 May 2014 09:23:50 +0000 (13:23 +0400)]
readline: use g_strndup instead of open-coding it

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
10 years agoqmp: report path ambiguity error
Michael Tokarev [Sun, 4 May 2014 08:23:59 +0000 (12:23 +0400)]
qmp: report path ambiguity error

Without this, ambiguous path is reported to the user as
"not found", which is confusing at least.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard: replace pstrcpy() with memcpy()
Michael Tokarev [Fri, 2 May 2014 14:35:59 +0000 (18:35 +0400)]
libcacard: replace pstrcpy() with memcpy()

Commit 2e679780ae86c6ca8 replaced strncpy() with pstrcpy()
in one place in libcacard.  This is a qemu-specific function,
while libcacard is a stand-alone library (or tries to be).
But since we know the exact length of the string to copy,
and know that it definitely will fit in the destination
buffer, use memcpy() instead, and null-terminate the string
after that.

An alternative is to use g_strlcpy() or strncpy(), but memcpy()
is more than adequate in this place.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial@nongnu.org
Cc: Alon Levy <alevy@redhat.com>
10 years agoglib: move g_poll() replacement into glib-compat.h
Stefan Hajnoczi [Fri, 2 May 2014 14:35:56 +0000 (18:35 +0400)]
glib: move g_poll() replacement into glib-compat.h

We have a dedicated header file for wrappers to smooth over glib version
differences.  Move the g_poll() definition into glib-compat.h for
consistency.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial@nongnu.org
10 years agodo not call g_thread_init() for glib >= 2.31
Michael Tokarev [Fri, 2 May 2014 14:35:55 +0000 (18:35 +0400)]
do not call g_thread_init() for glib >= 2.31

glib >= 2.31 always enables thread support and g_thread_supported()
is #defined to 1, there's no need to call g_thread_init() anymore,
and it definitely does not need to report error which never happens.
Keep code for old < 2.31 glibc anyway for now, just #ifdef it
differently.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-trivial@nongnu.org
10 years agohw/9pfs: Add include file for exported symbol
Stefan Weil [Fri, 2 May 2014 20:22:32 +0000 (22:22 +0200)]
hw/9pfs: Add include file for exported symbol

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoxen: remove unused global, xen_xcg
Jim Meyering [Sat, 3 May 2014 06:04:40 +0000 (08:04 +0200)]
xen: remove unused global, xen_xcg

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jim Meyering <meyering@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw: Add missing 'static' attributes
Stefan Weil [Fri, 2 May 2014 20:34:40 +0000 (22:34 +0200)]
hw: Add missing 'static' attributes

This fixes warnings from the static code analysis (smatch).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqemu-timer: Add missing 'static' attribute
Stefan Weil [Sat, 3 May 2014 06:12:15 +0000 (08:12 +0200)]
qemu-timer: Add missing 'static' attribute

This fixes a warning from the static code analysis (smatch).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoui: Add missing 'static' attribute
Stefan Weil [Fri, 2 May 2014 20:48:30 +0000 (22:48 +0200)]
ui: Add missing 'static' attribute

There was already a forward declaration using 'static',
but the attribute was missing in the implementation.

This fixes a warning from the static code analysis (smatch).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agomonitor: Add missing 'static' attribute
Stefan Weil [Fri, 2 May 2014 20:43:57 +0000 (22:43 +0200)]
monitor: Add missing 'static' attribute

This fixes a warning from the static code analysis (smatch).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw/s390x: Add missing 'static' attribute
Stefan Weil [Fri, 2 May 2014 20:39:12 +0000 (22:39 +0200)]
hw/s390x: Add missing 'static' attribute

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agohw/mips: Add missing 'static' and 'const' attributes
Stefan Weil [Fri, 2 May 2014 20:29:33 +0000 (22:29 +0200)]
hw/mips: Add missing 'static' and 'const' attributes

This fixes a warning from the static code analysis (smatch).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
10 years agohw/9pfs: Add missing 'static' attributes
Stefan Weil [Fri, 2 May 2014 20:22:57 +0000 (22:22 +0200)]
hw/9pfs: Add missing 'static' attributes

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoarch_init: Be sure of only one exit entry with DPRINTF() for ram_load()
Chen Gang [Thu, 1 May 2014 13:28:11 +0000 (21:28 +0800)]
arch_init: Be sure of only one exit entry with DPRINTF() for ram_load()

When DPRINTF() has effect, the original author wants to print all
ram_load() calling results. So need use 'goto' instead of 'return'
within ram_load(), just like other areas have done.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agotests/tcg: Fix compilation of test_path
Peter Maydell [Tue, 29 Apr 2014 11:09:24 +0000 (12:09 +0100)]
tests/tcg: Fix compilation of test_path

The test_path binary is (unlike the other test binaries in tests/tcg)
actually intended to be compiled with the same compiler used to build
the main QEMU executables. It actually #includes a number of the
QEMU source files in an attempt to unit-test the util/path.c functions,
and so if it is not compiled with the same compiler used by configure
to set CONFIG_ settings then it is liable to fail to build.
Fix the makefile to build it with the default C compiler rules, not
CC_I386, and fix the test itself not to include a lot of unnecessary
trace related source files which cause the build to fail if the trace
backend is anything other than 'simple'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqga: Fix typo (plural) in comment
Stefan Weil [Tue, 29 Apr 2014 06:24:34 +0000 (08:24 +0200)]
qga: Fix typo (plural) in comment

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: remove bashism
Michael Tokarev [Fri, 2 May 2014 11:36:39 +0000 (15:36 +0400)]
configure: remove bashism

Commit e26110cfc67d48 added a check for shacmd to create a hash
for modules.  This check in configure is using bash construct &>
to redirect both stdout and stderr, which does fun things on some
shells.  Get rid of it, use standard redirection instead.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Fam Zheng <famz@redhat.com>
10 years agoxen_disk: add discard support
Olaf Hering [Wed, 7 May 2014 13:40:04 +0000 (13:40 +0000)]
xen_disk: add discard support

Implement discard support for xen_disk. It makes use of the existing
discard code in qemu.

The discard support is enabled unconditionally. The tool stack may
provide a property "discard-enable" in the backend node to optionally
disable discard support.  This is helpful in case the backing file was
intentionally created non-sparse to avoid fragmentation.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agopass an inclusive address range to xc_domain_pin_memory_cacheattr
Stefano Stabellini [Wed, 7 May 2014 13:48:37 +0000 (13:48 +0000)]
pass an inclusive address range to xc_domain_pin_memory_cacheattr

xc_domain_pin_memory_cacheattr expects an inclusive address range:
adjust the parameters.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoxen: factor out common functions
Wei Liu [Wed, 7 May 2014 16:16:43 +0000 (16:16 +0000)]
xen: factor out common functions

So common functions used by both HVM and PV are factored out from
xen-all.c to xen-common.c.

Finally rename xen-all.c to xen-hvm.c, as those functions are only
useful to HVM guest.

Create *-stub files and modify Makefile.target to reflect the changes.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Wed, 7 May 2014 16:16:03 +0000 (17:16 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc,net,MAINTAINERS,build updates

MAINTAINERS updated with link to the security process documentation
apic version modified to make more guests happy
On top of that, bugfixes all over the place

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Wed 07 May 2014 17:15:29 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream:
  configure: make source tree build more robust
  MAINTAINERS: addresses for responsible disclosure
  pm_smbus: correctly report unclaimed cycles
  smbus: return -1 if nothing found at the given address
  smbus: allow returning an error from reads
  apic: use emulated lapic version 0x14 on pc machines >= 2.1
  pc: add compat_props placeholder for 2.0 machine type
  i8259: don't abort when trying to use level sensitive irqs
  acpi: fix tables for no-hpet configuration
  acpi-build: properly decrement objects' reference counters
  acpi/pcihp.c: Rewrite acpi_pcihp_get_bsel using object_property_get_int

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoconfigure: make source tree build more robust
Michael S. Tsirkin [Mon, 28 Apr 2014 12:09:01 +0000 (15:09 +0300)]
configure: make source tree build more robust

When source directory can be arrived at by two paths,
configure might misdetect an out of tree build.
The simplest way to trigger the problem is running
configure using a full path. E.g. (<firstpath> refers to qemu source
tree):
    ln -s <firstpath> <secondpath>
    cd <firstpath>
    <secondpath>/configure

A more practical way is when make runs configure automatically:

1. cd <firstpath>/; ./configure
    SRC_PATH=<firstpath>/ is written into config_host.mak
2. cd <secondpath>/; touch configure; make
    make now runs <firstpath>/configure, so configure
    assumes it's an out of tree build

When this happens configure overwrites parts of
the current tree with symlinks.

Make the test more robust: look for configure
in the current directory.
If there - we know it's a source build!

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoMAINTAINERS: addresses for responsible disclosure
Michael S. Tsirkin [Thu, 17 Apr 2014 13:45:46 +0000 (16:45 +0300)]
MAINTAINERS: addresses for responsible disclosure

Adding addresses to MAINTAINERS, as agreed on the last conference call:

http://wiki.qemu.org/SecurityProcess

People sometimes detect security issues in upstream
QEMU and don't know where to report them in a non-public way.
Of course whoever just wants full disclosure can just go public,
but there's nothing specified for non-public - until recently Anthony
was doing this informally.

As I started doing this recently anyway, I can handle this on the QEMU side
in a more formal way.

Adding a secalert mailing list as well - they are the ones who is actually
opening CVEs, communicating issues to all downstreams etc,
and they are already handling this for upstream, not just Red Hat.

Keeping Anthony's address around in case he wants to be informed.

Peter Maydell said that he prefers not to be on this contact list at
this point.

A public mailing list has been created - not listing it here yet -
until we know how to set it up in a secure fashion and
until there are more people so manually copying everyone
becomes unwieldy for reporters.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoxen: move Xen HVM files under hw/i386/xen
Wei Liu [Wed, 7 May 2014 13:43:39 +0000 (13:43 +0000)]
xen: move Xen HVM files under hw/i386/xen

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agopm_smbus: correctly report unclaimed cycles
Paolo Bonzini [Mon, 31 Mar 2014 16:26:31 +0000 (18:26 +0200)]
pm_smbus: correctly report unclaimed cycles

Without this patch, i2cdetect will report all addresses as present.
With it, only 0x50..0x57 are present.

Before:

         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
    10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
    20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
    30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
    40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
    50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
    60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
    70: 70 71 72 73 74 75 76 77

After:

         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoxen: move Xen PV machine files to hw/xenpv
Wei Liu [Wed, 7 May 2014 13:43:37 +0000 (13:43 +0000)]
xen: move Xen PV machine files to hw/xenpv

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>