qmp: fix handling of cmd with Equals in qmp-shell

	qmp: fix handling of cmd with equal mark in qmp-shell

    qmp-shell splits the argument and value of input command
	by equal mark("="). But there are commands whose values
	include equal mark themselves, and the json built by
	qmp-shell will not correct. For example, when using NBD as
	the target of block-backup command, the input
	"block-backup target=nbd+unix:///drive0?socket=/tmp/nbd.sock"
	will fail, because the json built will be as follows:

    {
		"execute":"block-backup",
		"arguments":{"target":"nbd+unix:///drive0?socket"}
	}

    Fix it by joining the sections split by equal mark excluding the
	first section in __build_cmd function when the length of sections
	is larger than two.

Signed-off-by: zhangleiqiang <zhangleiqiang@huawei.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qapi: fix leak in unit tests

qmp_output_get_qobject() increments the qobject's reference count. Since
we currently pass this straight into qobject_to_json() so we can feed
the data into a QMP input visitor, we never actually free the underlying
qobject when qmp_output_visitor_cleanup() is called. This causes leaks
on all of the QMP serialization tests.

Fix this by holding a pointer to the qobject and decref'ing it before
returning from qmp_deserialize().

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
virtio-net: add virtio_net_set_netclient_name.

This adds virtio_net_set_netclient_name, which is used to set the
name and type shown in "info network" command.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1368619970-23892-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-net-x: forward the netclient name and type.

This forwards the name and the type of virtio-net-x to fix the bad
behaviour of "info network" command.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Message-id: 1368619970-23892-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vnc: Make ledstate comparison before modifiers updated

The ledstate should be compared before modifiers updated,
otherwise the ledstate would be the same as current_led_state.

Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1368606040-11950-1-git-send-email-lilei@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
configure: Detect uuid on MacOSX (fixes compile failure)

Commit 7791dba3ec broke compilation on MacOSX, because it introduced
a new include of util.h. On MacOSX this includes pwd.h which in turn
includes the system uuid/uuid.h, which causes a compile failure if
QEMU was configured without CONFIG_UUID due to a conflict between
the system header and our fallback versions:
  block/vdi.c:124:20: error: static declaration of 'uuid_generate'
  follows non-static declaration
  static inline void uuid_generate(uuid_t out)
                     ^
  /usr/include/uuid/uuid.h:63:6: note: previous declaration is here
  void uuid_generate(uuid_t out);
       ^

Fix this breakage by improving configure's check for uuid to work on
MacOSX (where there is no need to link in a separate libuuid).

Note that if the user explicitly runs configure with '--disable-uuid'
on MacOSX then QEMU will fail to compile.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1368563799-22755-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
w32: Fix configure test for -march=i486

The latest version of MinGW needs a test for __sync_val_compare_and_swap
to fix a missing symbol linker error.

Reported-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1368301619-32097-2-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Revert "versatile_pci: Put the host bridge PCI device at slot 29"

This reverts commit 5f37ef92b7690423ac6311d3c597e182fc5f8fe6.
It turns out that some kernels incorrectly depend on the
old QEMU behaviour of not putting the host PCI bridge device
where the hardware puts it, because they use a swizzling IRQ
mapping which is incorrect but happens to match up with old
broken QEMU when the slot number mod 4 is zero. Since we
start PCI devices at 11, if we put the host bridge at 29
then the first real PCI device goes at 11 and doesn't work.
Not putting the host bridge at 29 means it defaults to 11,
so the first real PCI device is at 12 and works.

Since continuing with the old behaviour doesn't cause problems
for kernels which do work with hardware, the simplest fix for
this is to revert the change.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1368545616-22344-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/pci-host/versatile.c: Update autodetect to detect newer kernels

Newer versatilepb kernels still don't get the IRQ mapping right
for the PCI controller, but they get it differently wrong (they add
a fixed +64 offset to everything they write to PCI_INTERRUPT_LINE).
Update the autodetection to handle these too, and include a more
detailed comment on the various different behaviours that might
be present.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1368545616-22344-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/pci-host/versatile.c: Provide property for forcing broken IRQ mapping

Although we try our best to automatically detect broken versions
of Linux which assume the old broken IRQ mapping we used to implement
for our model of the Versatile PCI controller, it turns out that
some particularly new kernels manage to outwit the autodetection.

We therefore provide a property for enabling the old broken IRQ
mapping, so that if users happen to have such a kernel they can
work around its deficiencies with the command line option:
  -global versatile_pci.broken-irq-mapping=1

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1368545616-22344-4-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ide-test: Fix endianness problems

The test case passes on big endian hosts now (tested on ppc64)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1368622839-7084-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-common: Resolve vector build breakes for AltiVec

On Mac OS X ppc, altivec.h defines "vector", leading to build breakage
when used as variable name, e.g. in tracing code.
Fix this by undefining identifiers after altivec.h inclusion.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Message-id: 1368632771-4328-1-git-send-email-andreas.faerber@web.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Michael Roth (1) and Zhangleiqiang (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  qapi: fix leak in unit tests
  qmp: fix handling of cmd with Equals in qmp-shell

Message-id: 1368625179-27962-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Update version for 1.5.0-rc2 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>