Commit graph

49794 commits

Author SHA1 Message Date
John Snow ebde93bf9a ahci-test: test atapi read_cd with bcl, nb_sectors = 0
Commit 9ef2e93f introduced the concept of tagging ATAPI commands as
NONDATA, but this introduced a regression for certain commands better
described as CONDDATA. read_cd is such a command that both requires
a non-zero BCL if a transfer size is set, but is perfectly content to
accept a zero BCL if the transfer size is 0.

This test adds a regression test for the case where BCL and nb_sectors
are both 0.

Flesh out the CDROM tests by:

(1) Allowing the test to specify a BCL
(2) Allowing the buffer comparison test to compare a 0-size buffer
(3) Fix the BCL specification in libqos (It is LE, not BE)
(4) Add a nice human-readable message for future SCSI command additions

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1477970211-25754-4-git-send-email-jsnow@redhat.com
[Line length edit --js]
Signed-off-by: John Snow <jsnow@redhat.com>
2016-11-14 11:15:54 -05:00
John Snow 53c05e6c20 ahci-test: Create smaller test ISO images
These can simply be the size of the number of sectors we're reading,
plus one for a buffer. We don't need them to be any larger.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1477970211-25754-3-git-send-email-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2016-11-14 11:15:54 -05:00
John Snow e7bd708ec8 atapi: classify read_cd as conditionally returning data
For the purposes of byte_count_limit verification, add a new flag that
identifies read_cd as sometimes returning data, then check the BCL in
its command handler after we know that it will indeed return data.

Reported-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1477970211-25754-2-git-send-email-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2016-11-14 11:15:54 -05:00
Stefan Hajnoczi a77beb0fcb Block layer patches for 2.8.0-rc0
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJYJefEAAoJEH8JsnLIjy/WiqIP/icOckkeGIOhc59YMcZcqLVL
 wby2KbnBPMZx+ElgRDAn0GEQW83lEeMjGgHfgrOXjI1F1zmSYg6ieT4oWKXCNF5C
 Na/5lR+qYmSWGYZW02LGeM6R055IRO4BP/J0M6Uh8+4xgRPR30vkCiKMzLih7Vfi
 +JED8mdHdaIlqdmxB1gJV60kf7M2g9e6tPgvCPxjOtjBVoblry2yet7NhfikhBoH
 fTpaEv7BC+8nnm/DuFEwfmwT6wMIqyOnpjKHPd6p1qq4MngY5tNuq5SOlWn3l7wV
 Z83RJmI08Jn/p+ZNwb45Z+6Iimgqn3msvMN25nzmHO6d1ck+4Onp16JfyVEHzYnR
 HKlGcSpW+HX0zkkERRXTeFDScDiO19QvIigV8vfM3eeOkn2YzoxbQjgrSI/eEsm6
 p+EkBTErWIcZZm1R7Y4Z9/MnpN+35Vz6hQ6Ak0IPLwSCvrEO3aGRH1VCGEBRIFo6
 T9mJI0nYk5eBDEUU9Pxp54T2WNw95eMI7L51ZhvOsXhSsYFWDo/UaM0KyyWkJQw7
 N3D8g/FXUmvml+q2OokVecV5yDIrhrW2+VuS0M/e/fZpCfbcXFrAjUPqIYwEsZ5u
 jGchqNCfwbQ1dqI4kffJOudDq7PpUIgTNDD+H87prC6nRCcsNqeF39wQ0hdQZnyQ
 +wBEOye0V4kabQ9HxQk2
 =lpt5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'kwolf/tags/for-upstream' into staging

Block layer patches for 2.8.0-rc0

# gpg: Signature made Fri 11 Nov 2016 03:46:12 PM GMT
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* kwolf/tags/for-upstream:
  raw-posix: Rename 'raw_s' to 'rs'
  iotests: Always use -machine accel=qtest
  iotests: Skip test 162 if there is no SSH support
  block: Emit modules in bdrv_iterate_format()
  block: Fix bdrv_iterate_format() sorting
  nfs: Fix memory leak in nfs_file_create()
  qcow2: Remove stale FIXME comment
  raw_bsd: don't check size alignment when only offset is set
  raw_bsd: move check to prevent overflow
  hmp: Make block_stream set an explicit job ID
  block/ssh: Code cleanup for unused parameter
  block/nbd: Fix the leaked visitor

Message-id: 1478883311-24052-1-git-send-email-kwolf@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-14 15:42:23 +00:00
Stefan Hajnoczi 736986fad3 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
 
 iQEcBAABCAAGBQJYJcCfAAoJEMo1YkxqkXHG55UH/01ihDPjm2eVf8srui646bn7
 aO5h7MDUp8E4iAS+RSjuv8xQXlmCSBNEVGuH5Snlk/7rFOW/wco4ZynB+efqt5V2
 HBpzQ8GXsfwq68oW8vZZozWH0EB6OwVV4r5bSzzAeQnJvL3x1paxOdqlA7xD1WG8
 2BPzDcV9iTNl62rjJcGE4kulrUA+WYY3BGaxlGZpvHqoQRfH16waAms+vZ4dZAdz
 igs0J9Zmwdt2PgdXFghKU/KwdkIgiPmwICarQV1fXnoMlmXH5lAVTTrBdkimAYRN
 m652dKR3aAPFlQVMrB7LjpN5ofKq4iSz0QcHqqm6mWIhSyTkBB2t8HCaqcfyu7c=
 =oAhr
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/fam/tags/for-upstream' into staging

* remotes/fam/tags/for-upstream:
  test-uuid: fix leak

Message-id: 20161111131818.GC12800@lemon
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-14 15:35:57 +00:00
Halil Pasic 8cc49f0302 tests/test-vmstate.c: add array of pointer to struct
Increase test coverage by adding tests for the macro
VMSTATE_ARRAY_OF_POINTER_TO_STRUCT.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Guenther Hutzl <hutzl@linux.vnet.ibm.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2016-11-14 14:50:56 +01:00
Halil Pasic 6d57b4c000 tests/test-vmstate.c: add save_buffer util func
Let us de-duplicate some code by introducing an utility function for
saving a chunk of bytes (used when testing load based on wire).

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Guenther Hutzl <hutzl@linux.vnet.ibm.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2016-11-14 14:50:56 +01:00
zhanghailiang fe39a4d440 migration: fix missing assignment for has_x_checkpoint_delay
We forgot to assign true to params->has_x_checkpoint_delay parameter
in qmp_query_migrate_parameters.

Without this, qmp command 'query-migrate-parameters' doesn't show the
default value for x-checkpoint-delay option.

This also fixes the fact that HMP was relying on unspecified behavior by
reading x_checkpoint_delay without checking has_x_checkpoint_delay.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
2016-11-14 14:50:56 +01:00
Kevin Wolf ff569b9424 Block patches for qemu 2.8
-----BEGIN PGP SIGNATURE-----
 
 iQEvBAABCAAZBQJYJdw7EhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQDaQ
 B/4xLnht9qMPknYsUXZAlCr0hw7zJCla63t4FG8xIK6oMUNteWWPabPhRunR0rLS
 7LPceqeyK1M7klDY+M+stW6ofpcPAEFIdyT1O/t2MId6yFXxskWCZxeQMWxK3Uz5
 36m4ys6AnMx+cs0eUMrQxH3oLGNeE2l+ahZwFY0GXqXO7qIdNpOccNAm79tKxF1i
 eVHirr/BqqP2l2U5lVHFrYkbJQ+Ff4IUJO5hkj7FUk25937SnUg3qMGI/diRh2K0
 sVh6PYt8R6i6Zw3NxkzF2VDGUQpxVQfWkVAMhxKn1AKftkd7Vn+UAApdbChXANBJ
 LOrrwKFNzTBBtwqhGUGQ/Pzp
 =Kqth
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'mreitz/tags/pull-block-2016-11-11' into queue-block

Block patches for qemu 2.8

# gpg: Signature made Fri Nov 11 15:56:59 2016 CET
# gpg:                using RSA key 0xF407DB0061D5CF40
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2016-11-11:
  raw-posix: Rename 'raw_s' to 'rs'
  iotests: Always use -machine accel=qtest
  iotests: Skip test 162 if there is no SSH support
  block: Emit modules in bdrv_iterate_format()
  block: Fix bdrv_iterate_format() sorting

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-11 15:58:12 +01:00
Fam Zheng 4e6d13c983 raw-posix: Rename 'raw_s' to 'rs'
It is too confusing because it sounds like a BDRVRawState variable.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 1477565117-17230-1-git-send-email-famz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-11-11 15:56:22 +01:00
Max Reitz 3bb8ef4b7a iotests: Always use -machine accel=qtest
Currently, we only use -machine accel=qtest when qemu is invoked through
the common.qemu functions. However, we always want to use it, so move it
from common.qemu directly into QEMU_OPTIONS.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20161017183917.8837-1-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-11-11 15:56:22 +01:00
Max Reitz eaed090735 iotests: Skip test 162 if there is no SSH support
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20161012204907.25941-4-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-11-11 15:56:22 +01:00
Max Reitz eb0df69f50 block: Emit modules in bdrv_iterate_format()
Some block drivers may not be loaded yet, but qemu supports them
nonetheless. bdrv_iterate_format() should report them, too.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20161012204907.25941-3-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-11-11 15:56:22 +01:00
Max Reitz ceff5bd79c block: Fix bdrv_iterate_format() sorting
bdrv_iterate_format() did not actually sort the formats by name but by
"pointer interpreted as string". That is probably not what we intended
to do, so fix it (by changing qsort_strcmp() so it matches the example
from qsort()'s manual page).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20161012204907.25941-2-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-11-11 15:56:22 +01:00
Kevin Wolf 07555ba6f3 nfs: Fix memory leak in nfs_file_create()
The leak was introduced in commit 94d6a7a7.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-11 15:54:55 +01:00
Alberto Garcia 9dd76f82d9 qcow2: Remove stale FIXME comment
It was from the time when none of the global functions had a qcow2_
prefix.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-11 15:54:55 +01:00
Tomáš Golembiovský 80a15e3e2e raw_bsd: don't check size alignment when only offset is set
We make sure that the size is aligned to sector length to prevent any
round ups. Otherwise we could end up reading/writing data outside the
area specified by user. This is only needed when user supplies the size
option to avoid any surprises. It is not necessary when only offset is
set.

More over, the check made it difficult to use the offset option without
size option. The check puts unneeded restriction on the offset which had
to be aligned too. Because bdrv_getlength() returns aligned value having
unaligned offset would make the check fail.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-11 15:54:55 +01:00
Tomáš Golembiovský 40332872fe raw_bsd: move check to prevent overflow
When only offset is specified but no size and the offset is greater than
the real size of the containing device an overflow occurs when parsing
the options. This overflow is harmless because we do check for this
exact situation little bit later, but it leads to an error message with
weird values. It is better to do the check is sooner and prevent the
overflow.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-11 15:54:55 +01:00
Alberto Garcia 11d6fbe05f hmp: Make block_stream set an explicit job ID
A job ID is always required in order to create a block job on a
non-root node. The default ID (obtained with bdrv_get_device_name())
is otherwise empty in this scenario and the job cannot be created.

The HMP block_stream command doesn't set a job ID and therefore it
doesn't allow streaming to intermediate nodes. One solution is to add
an extra parameter to set a job ID. The other solution is to simply
use the node name passed to block_stream as job ID. This won't work
if it's automatically generated (because it contains a '#') but is
otherwise simple enough for all other cases.

This way 'block_stream node3' will create a job with the ID 'node3'
and the good old 'block_stream virtio0' will keep the previous
behaviour and use 'virtio0' for the job ID.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-11 15:54:55 +01:00
Ashijeet Acharya 9a80832abf block/ssh: Code cleanup for unused parameter
This patch drops the unused parameter "BDRVSSHState" being passed into
the ssh_config() function and does code cleanup. The unused parameter
was introduced by the commit c322712.

Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-11 15:54:55 +01:00
Ashijeet Acharya a1d4e38a8b block/nbd: Fix the leaked visitor
This patch frees the leaked visitor in nbd_refresh_filename() and uses
visit_free() to fix it. The leak was introduced by the commit 491d6c7.

Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-11-11 15:54:55 +01:00
Marc-André Lureau d9c05e507f test-uuid: fix leak
ASAN spotted:
SUMMARY: AddressSanitizer: 74 byte(s) leaked in 2 allocation(s).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161109110210.25925-1-marcandre.lureau@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
2016-11-11 20:53:23 +08:00
Stefan Hajnoczi 83c83f9a52 Small fixes for hard freeze.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQExBAABCAAbBQJYJJOAFBxwYm9uemluaUByZWRoYXQuY29tAAoJEL/70l94x66D
 lDkH/iLwh7X1m3cKAW1NPrfgIc8nJ9w9wNjzvw+e/DbkE1SoNFL8qEm9XBFjuqTu
 DWGnnLOyLQ5MPTcow+hgbAshUqbkbhGTTSSU1oDSGAoap9MDeT93UJYpvd/zwwxZ
 03G0A5Ot/KdaJscvfiu+ILmnLtCLOzsx2Z13c7fuHAErekM0OaG/sFR3GtCYL91r
 HA3PVIDBpvk14KIQQiImtSK+SJv73xPfGyGxSutK8T5wYYSBeXXL06+ITGtaX5ik
 Da4J0SS2w4H6lQCy7YqkhJ7l3eHjYqglRZ7EzgIaqkyIYWoGkjDr/1wmsozYAy/G
 R5VxNjiScgZ8DdHJ9XdJ2s5gwoA=
 =Tq9k
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'bonzini/tags/for-upstream' into staging

Small fixes for hard freeze.

# gpg: Signature made Thu 10 Nov 2016 03:34:24 PM GMT
# gpg:                using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* bonzini/tags/for-upstream:
  nbd: Don't inf-loop on early EOF
  target-i386: document how x86 gdb_num_core_regs is computed.
  qdev: fix use-after-free regression from becdfa00cf
  target-i386/machine: fix migrate faile because of Hyper-V HV_X64_MSR_VP_RUNTIME
  vl.c: move pidfile creation up the line
  target-i386: fix typo

Message-id: 1478800362-18138-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-11 12:51:50 +00:00
Thomas Huth 6bbcb76301 MAINTAINERS: Remove obsolete stable branches
There are only very old and orphaned stable branches listed
in the MAINTAINERS file - so this section is pretty useless
nowadays. Let's remove it.

Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-11-10 15:29:59 +00:00
John Snow 538193bc9e MAINTAINERS: Add Fam and Jsnow for Bitmap support
These files are currently unmaintained.

I'm proposing that Fam and I co-maintain them; under the model that
whomever between us isn't authoring a given series will be responsible
for reviewing it.

Signed-off-by: John Snow <jsnow@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
Acked-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-11-10 15:29:59 +00:00
Thomas Huth 87a9023a93 MAINTAINERS: Add an entry for the CHRP NVRAM files
I recently added new files to the source tree that are not
covered by any maintainer yet -- and since every new source
file should have a maintainer nowadays, I volunteer to look
after these files now, too.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-11-10 15:29:59 +00:00
Thomas Huth e9a5611405 m68k: Update the 68k sections in the MAINTAINERS file
disas/m68k.c obviously belong to the m68k CPU section in
the MAINTAINERS file, but remove the hw/m68k/ directory
here since it only contains machine (not CPU) related
files, as requested by Laurent. Add the machine related
files to the right machine sections instead.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-11-10 15:29:59 +00:00
Thomas Huth 7098b79e6f sparc: Add slavio_misc.c and eccmemctl.c to the MAINTAINERS file
Both files seem to belong to the Sun4m machine.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-11-10 15:29:59 +00:00
Thomas Huth f7e242d6a3 MAINTAINERS: Add some ARM related files to the corresponding sections
The files w/cpu/a*mpcore.c are already assigned to the ARM CPU
section, but the corresponding headers include/hw/cpu/a*mpcore.h
are still missing.

The file hw/*/imx* are already assigned to the i.MX31 machine, but
the corresponding header files include/hw/*/imx* are still missing.

The file hw/misc/arm_integrator_debug.c seems to belong to Integrator
CP, hw/cpu/realview_mpcore.c seems to belong to Real View, and
hw/misc/mst_fpga.c seems to belong to PXA2XX.

And the files hw/misc/zynq* and include/hw/misc/zynq* seem to belong
to the Xilinx Zynq machine.

Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2016-11-10 15:29:59 +00:00
Samuel Thibault 7c70300296 Fix cursesw detection
On systems which do not provide ncursesw.pc and whose /usr/include/curses.h
does not include wide support, we should not only try with no -I, i.e.
/usr/include, but also with -I/usr/include/ncursesw.

To properly detect for wide support with and without -Werror, we need to
check for the presence of e.g. the WACS_DEGREE macro.

We also want to stop at the first curses_inc_list configuration which works,
and make sure to set IFS to : at each new loop.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 20161109102752.13255-1-samuel.thibault@ens-lyon.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-10 15:29:58 +00:00
Peter Korsgaard 86f3bf0ebe hw/input/hid: support alternative sysrq/break scancodes for gtk-vnc
The printscreen/sysrq and pause/break keys currently don't work for guests
using -usbdevice keyboard when accessed through vnc with a gtk-vnc based
client.

The reason for this is a mismatch between gtk-vnc and qemu in how these keys
should be mapped to XT keycodes.

On the original IBM XT these keys behaved differently than other keys.

Quoting from https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html:

The keys PrtSc/SysRq and Pause/Break are special. The former produces
scancode e0 2a e0 37 when no modifier key is pressed simultaneously, e0 37
together with Shift or Ctrl, but 54 together with (left or right) Alt.  (And
one gets the expected sequences upon release.  But see below.) The latter
produces scancode sequence e1 1d 45 e1 9d c5 when pressed (without modifier)
and nothing at all upon release.  However, together with (left or right)
Ctrl, one gets e0 46 e0 c6, and again nothing at release.  It does not
repeat.

Gtk-vnc supports the 'QEMU Extended Key Event Message' RFB extension to send
raw XT keycodes directly to qemu, but the specification doesn't explicitly
specify how to map such long/complicated keycode sequences.  From the spec
(https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#qemu-extended-key-event-message)

The keycode is the XT keycode that produced the keysym. An XT keycode is an
XT make scancode sequence encoded to fit in a single U32 quantity.  Single
byte XT scancodes with a byte value less than 0x7f are encoded as is.
2-byte XT scancodes whose first byte is 0xe0 and second byte is less than
0x7f are encoded with the high bit of the first byte set

hid.c currently expects the keycode sequence with shift/ctl for sysrq (e0 37
-> 0xb7 in RFB), whereas gtk-vnc uses the sequence with alt (0x54).
Likewise, hid.c expects the code without modifiers (e1 1d 45 -> 0xc5 in
RFB), whereas gtk-vnc sends the keycode sequence with ctrl for pause (e0 46
-> 0xc6 in RFB).

See keymaps.cvs in gtk-vnc for the mapping used:
https://git.gnome.org/browse/gtk-vnc/tree/src/keymaps.csv#n150

Now, it isn't obvious to me which sequence is really "right", but as the
0x54/0xc6 keycodes are currently unused in hid.c, supporting both seems like
the pragmatic solution to me.  The USB HID keyboard boot protocol used by
hid.c doesn't have any other mapping applicable to these keys.

The other guest keyboard interfaces (ps/2, virtio, ..) are not affected,
because they handle these keys differently.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Message-id: 20161028145132.1702-1-peter@korsgaard.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-10 15:29:58 +00:00
Thomas Huth 204af15b04 ui/gtk: Fix build with older versions of gtk
GDK_KEY_Delete is only defined with gtk version 2.22 and newer,
on older versions this key was called GDK_Delete instead.
Since this is the case for all GDK_KEY_* defines, change the
already existing preprocessor check there to test for version 2.22,
so we know that we can remove this code block in case we require
that version as a minimum one day.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 1478081328-25515-1-git-send-email-thuth@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-10 15:29:58 +00:00
Li Qiang 07b026fd82 usbredir: free vm_change_state_handler in usbredir destroy dispatch
In usbredir destroy dispatch function, it doesn't free the vm change
state handler once registered in usbredir_realize function. This will
lead a memory leak issue. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 58216976.d0236b0a.77b99.bcd6@mx.google.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-10 15:29:58 +00:00
Li Qiang 791f97758e usb: ehci: fix memory leak in ehci_init_transfer
In ehci_init_transfer function, if the 'cpage' is bigger than 4,
it doesn't free the 'p->sgl' once allocated previously thus leading
a memory leak issue. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Message-id: 5821c0f4.091c6b0a.e0c92.e811@mx.google.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-10 15:29:58 +00:00
Gerd Hoffmann 423f7cf233 ipxe: update to 20161108 snapshot
git shortlog 04186319..b991c67c
===============================

Laszlo Ersek (3):
      [efi] Install the HII config access protocol on a child of the SNP handle
      [librm] Conditionalize the workaround for the Tivoli VMM's SSE garbling
      [build] Disable TIVOLI_VMM_WORKAROUND in the qemu configuration

Lukas Grossar (1):
      [intel] Add PCI device ID for I219-V/LM

Michael Brown (57):
      [efi] Fix uninitialised data in HII IFR structures
      [bios] Do not enable interrupts when printing to the console
      [pxe] Disable interrupts on the PIC before starting NBP
      [dhcp] Allow for variable encapsulation of architecture-specific options
      [dhcpv6] Include RFC5970 client architecture options in DHCPv6 requests
      [dhcpv6] Include vendor class identifier option in DHCPv6 requests
      [dhcp] Automatically generate vendor class identifier string
      [xfer] Send intf_close() if redirection fails
      [downloader] Treat redirection failures as fatal
      [iscsi] Treat redirection failures as fatal
      [debug] Allow per-object runtime enabling/disabling of debug messages
      [debug] Allow debug messages to be initially disabled at runtime
      [libc] Allow assertions to be globally enabled or disabled
      [profile] Allow profiling to be globally enabled or disabled
      [rng] Check for functioning RTC interrupt
      [acpi] Add support for ACPI power off
      [acpi] Allow time for ACPI power off to take effect
      [ipv4] Send gratuitous ARPs whenever a new IPv4 address is applied
      [intel] Strip spurious VLAN tags received by virtual function NICs
      [intel] Remove duplicate intelvf_mbox_queues() function
      [ipv6] Perform SLAAC only during autoconfiguration
      [settings] Create space for IPv6 in settings display order
      [ipv6] Rename ipv6_scope to dhcpv6_scope
      [settings] Correctly mortalise autovivified child settings blocks
      [ipv6] Allow settings to comprise arbitrary subsets of NDP options
      [ipv6] Expose IPv6 settings acquired through NDP
      [dhcpv6] Expose IPv6 address setting acquired through DHCPv6
      [ipv6] Expose IPv6 link-local address settings
      [settings] Allow settings blocks to specify a sibling ordering
      [ipv6] Match user expectations for IPv6 settings priorities
      [ipv6] Create routing table based on IPv6 settings
      [ipv6] Rename ipv6_scope to ipv6_settings_scope
      [test] Update IPv6 tests to use okx()
      [ipv6] Allow for multiple routers
      [hyperv] Use instance UUID in device name
      [crypto] Remove obsolete extern declaration for asn1_invalidate_cursor()
      [crypto] Allow for parsing of partial ASN.1 cursors
      [image] Add image_asn1() to extract ASN.1 objects from image
      [crypto] Add DER image format
      [crypto] Add PEM image format
      [image] Use image_asn1() to extract data from CMS signature images
      [build] Remove obsolete explicit object requirements
      [crypto] Enable both DER and PEM formats by default
      [build] Remove more obsolete explicit object requirements
      [pixbuf] Enable PNG format by default
      [crypto] Add image_x509() to extract X.509 certificates from image
      [crypto] Generalise X.509 "valid" field to a "flags" field
      [list] Add list_next_entry() and list_prev_entry()
      [crypto] Expose certstore_del() to explicitly remove stored certificates
      [crypto] Allow certificates to be marked as having been added explicitly
      [crypto] Add certstat() to display basic certificate information
      [cmdline] Add certificate management commands
      [crypto] Mark permanent certificates as permanent
      [efi] Mark AppleNetBoot.h as a native iPXE header
      [efi] Update to current EDK2 headers
      [efi] Add EFI_BLOCK_IO2_PROTOCOL header and GUID definition
      [bzimage] Fix page alignment of initrd images

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-11-10 15:29:43 +00:00
Eric Blake a5068244b4 nbd: Don't inf-loop on early EOF
Commit 7d3123e converted a single read_sync() into a while loop
that assumed that read_sync() would either make progress or give
an error. But when the server hangs up early, the client sees
EOF (a read_sync() of 0) and never makes progress, which in turn
caused qemu-iotest './check -nbd 83' to go into an infinite loop.

Rework the loop to accomodate reads cut short by EOF.

Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1478551093-32757-1-git-send-email-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-10 16:01:30 +01:00
Doug Evans 175cad36a5 target-i386: document how x86 gdb_num_core_regs is computed.
It helps when reading the code to see how the number is arrived at.

Signed-off-by: Doug Evans <dje@google.com>
Message-Id: <94eb2c187eda43dba005406c86f7@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-10 16:01:09 +01:00
Marc-André Lureau 2209401fa7 qdev: fix use-after-free regression from becdfa00cf
Spotted by Coverity, CID 1365383.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161107095922.31676-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-10 16:01:09 +01:00
ZhuangYanying 5122787580 target-i386/machine: fix migrate faile because of Hyper-V HV_X64_MSR_VP_RUNTIME
Hyper-V HV_X64_MSR_VP_RUNTIME was introduced in linux-4.4 + qemu-2.5.

As long as the KVM module supports, qemu will save / load the
vmstate_msr_hyperv_runtime register during the migration.

Regardless of whether the hyperv_runtime configuration of x86_cpu_properties is
enabled.

The qemu-2.3 does not support this feature, of course, failed to migrate.

    linux-BGSfqC:/home/qemu # ./x86_64-softmmu/qemu-system-x86_64 --enable-kvm \
        -nodefaults -machine pc-i440fx-2.3,accel=kvm,usb=off -smp 4 -m 4096 -drive \
        file=/work/suse/sles11sp3.img.bak,format=raw,if=none,id=drive-virtio-disk0,cache=none \
        -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 \
        -vnc :99 -device cirrus-vga,id=video0,vgamem_mb=8,bus=pci.0,addr=0x2 -monitor vc

    save_section_header:se->section_id=3,se->idstr:ram,se->instance_id=0,se->version_id=4
    save_section_header:se->section_id=0,se->idstr:timer,se->instance_id=0,se->version_id=2
    save_section_header:se->section_id=4,se->idstr:cpu_common,se->instance_id=0,se->version_id=1
    save_section_header:se->section_id=5,se->idstr:cpu,se->instance_id=0,se->version_id=12
    vmstate_subsection_save:vmsd->name:cpu/async_pf_msr
    hyperv_runtime_enable_needed:env->msr_hv_runtime=128902811
    vmstate_subsection_save:vmsd->name:cpu/msr_hyperv_runtime

Since hyperv_runtime is false, vm will not use hv->runtime_offset, then
vmstate_msr_hyperv_runtime is no need to transfer while migrating.

Signed-off-by: ann.zhuangyanying@huawei.com
Message-Id: <1478247398-5016-1-git-send-email-ann.zhuangyanying@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-10 16:01:06 +01:00
Michael Tokarev 004c8e0090 vl.c: move pidfile creation up the line
With current code, pid file is open after various
sockets, chardevs, fsdevs and the like.  This causes
interesting effects, for example when monitor is a
unix-socket, and another qemu instance is already
running, new qemu first "damages" the socket and
next complain that it can't acquire the pid file and
exits, making running qemu unreachable.

Move pid file creation earlier, right after the call
to os_daemonize(), where we know our process id (pid).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Message-Id: <1478096330-18081-1-git-send-email-mjt@msgid.tls.msk.ru>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-09 14:08:17 +01:00
Paolo Bonzini f5c052b973 target-i386: fix typo
The impact is small because kvm_get_vcpu_events fixes env->hflags, but
it is wrong and could cause INITs to be delayed arbitrarily with
-machine kernel_irqchip=off.

Reported-by: Achille Fouilleul <achille.fouilleul@gadz.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-11-09 14:08:17 +01:00
Stefan Hajnoczi 9b4b035026 -----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJYIhapAAoJEJykq7OBq3PIkBoH/jWgy1B9/SblX8Ed1qeA+SCV
 pMUYOSv2ldNBd0GPVFlhlQXslBv/CJtXEvZyMY2uwgP/k2hYRQga2OsF7XPRYVLE
 2jzTRFB98zNBcIL1yCrJukNQtNCLZCTZTmDZ4L6FmkwcD4fVPqZPgSM4G50aHq8/
 EUrfidiyEa/wB6N5LcIWX4/v3CPDj9xF94qKtUFa4I+wSaR8n6qZNUTw1YdD/P2D
 TIMAlaB4YhpObSiqAE0VWXBEZ8MXjNF5MNRh1Oi8bWaCbkvCcI8iXUAO/ZGlKm2H
 4uZBfrqJpGfZPRy7S8Qges/2Xk2P6d7bUSfYdRmPnsUA2b5UtgxdRHIMUKtl9C8=
 =sxVN
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'public/tags/tracing-pull-request' into staging

# gpg: Signature made Tue 08 Nov 2016 06:17:13 PM GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* public/tags/tracing-pull-request:
  docs/tracing.txt: Update documentation of default backend

Message-id: 1478629053-31709-1-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-09 12:44:16 +00:00
Stefan Hajnoczi f70073df4a -----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJYIhWNAAoJEJykq7OBq3PIUA4H/0DNb10Qcx5BnN7aAYwRZ4Rz
 4Q/UHKuGljRmw5jLJkanaXylHDOX/ihiZjkPVGS3KyPI+dzKL9blkybh/sQGImQV
 8jRY/l/1msWDGfzmgIlGozwMvwyupG0voMd4Zt9aDkRaZbPEaWVmApQ9L8mndajS
 ruvA25egbuiZdG+dPioa7jYb8j/OYDhfSvYwGjxRVQTngiocabbWPb/DlKOfXrVT
 H+92672TOa+FjU2UomdjOBVZvEUP06sEbIOc4/ciZRVHHK4vhByyt4cRF8k8+qHD
 lAI5D1ai3VWA+H7ykjXO/OD+ygDsZhZBiR6HJXlmHj4wWMs9Y5OUtaProMJ0juY=
 =n9DS
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'public/tags/block-pull-request' into staging

# gpg: Signature made Tue 08 Nov 2016 06:12:29 PM GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* public/tags/block-pull-request:
  aio-posix: simplify aio_epoll_update
  aio-posix: avoid NULL pointer dereference in aio_epoll_update
  block: Don't mark node clean after failed flush

Message-id: 1478628762-31050-1-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-09 12:43:50 +00:00
Peter Maydell 3b0fc80dd8 docs/tracing.txt: Update documentation of default backend
In commit baf86d6b3c we switched the default trace backend from "nop"
to "log". Update the documentation to match.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1478276837-31780-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-08 18:16:48 +00:00
Paolo Bonzini 35dd66e23c aio-posix: simplify aio_epoll_update
Extract common code out of the "if".

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20161108135524.25927-3-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-08 17:09:14 +00:00
Paolo Bonzini 36173ec5f1 aio-posix: avoid NULL pointer dereference in aio_epoll_update
aio_epoll_update dereferences parameter "node", but it could have been NULL
if deleting an fd handler that was not registered in the first place.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 20161108135524.25927-2-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-08 17:09:14 +00:00
Kevin Wolf e6af1e0854 block: Don't mark node clean after failed flush
Commit 3ff2f67a changed bdrv_co_flush() so that no flush is issues if
the image hasn't been dirtied since the last flush. This is not quite
correct: The condition should be that the image hasn't been dirtied
since the last _successful_ flush. This patch changes the logic
accordingly.

Without this fix, subsequent bdrv_co_flush() calls would return success
without actually doing anything even though the image is still dirty.
The difference is visible in some blkdebug test cases where error
messages incorrectly disappeared after commit 3ff2f67a.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1478300595-10090-1-git-send-email-kwolf@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-08 16:06:35 +00:00
Stefan Hajnoczi 207faf24c5 target-arm queue:
* bitbang_i2c: Handle NACKs from devices
  * Fix corruption of CPSR when SCTLR.EE is set
  * nvic: set pending status for not active interrupts
  * char: cadence: check baud rate generator and divider values
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJYIFq7AAoJEDwlJe0UNgzeLEsP/3gNpyfVsy347Nwf40+Lx1/f
 003jbQwK3MLYy2jIEJFFWmDnxDXEHQe/gyAOyrC9fS3C0dKFzkmHd00k/UqKGGOq
 xNI/7UAUATeAUSvPaM91fUoRqqXIWjYNo+7rzaTOaoWep1/myvavy9R71nS31Wwy
 kBQxL4yUr+qX5ZZUARnPkMze/JPu+gbuWAjfXsvOPolynzyyBzcWIXgrCBH2cUx1
 QGyXGbEj1MAlWJF8AAhW08qSF5Bg5ehORDsUFlC0bcG9TMfESckI//ygwyjrGPDc
 FNVpClLmERxVU+xOfX24nQxZsDHC+F+EPZYZgPUh+7vjj8Bjdf6DtbuBzzmEHSP8
 ywt7kb6mo9VZXh2QfDndgRmscHZiGN/hrkZpIzZqzRo0yljBoxLQC7vThVFqyqrW
 ytbe3hfs60fV4tWGwFObPMHgANDNrxg2sSbDXwK4NlxpPyiKiJYb6d3D6U7GeCyi
 FH1hOVJkLanO/FfhMgKa8GqF51Xrne+8khHRfaKWhtj6VLsGHtc9KSr1VYJ04sXz
 gFougYPVzvCklhHs5mXaUmfT8VtA1BBvo0eIBA1o2NswJaERfK6SXv6jMRA8q//b
 WOXBcoKRFAAAWpfTV2W/NJMI1t7Z3V1o/sIxWc9Gu42Oiwj3PQ58Mnrsmm819BRz
 6G3H03pRtxo55noZ4enI
 =cXvL
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'pm215/tags/pull-target-arm-20161107' into staging

target-arm queue:
 * bitbang_i2c: Handle NACKs from devices
 * Fix corruption of CPSR when SCTLR.EE is set
 * nvic: set pending status for not active interrupts
 * char: cadence: check baud rate generator and divider values

# gpg: Signature made Mon 07 Nov 2016 10:43:07 AM GMT
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* pm215/tags/pull-target-arm-20161107:
  hw/i2c/bitbang_i2c: Handle NACKs from devices
  Fix corruption of CPSR when SCTLR.EE is set
  nvic: set pending status for not active interrupts
  char: cadence: check baud rate generator and divider values

Message-id: 1478515653-6361-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-07 14:02:15 +00:00
Cornelia Huck 0ea3eb65e8 s390x/kvm: fix run_on_cpu sigp conversions
Commit 14e6fe12a ("*_run_on_cpu: introduce run_on_cpu_data type")
attempted to convert all users of run_on_cpu to use the new
run_on_cpu_data type. It missed to change the called sigp_* routines,
however. Fix that.

Fixes: 14e6fe12a ("*_run_on_cpu: introduce run_on_cpu_data type")
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-id: 20161102162103.66480-1-cornelia.huck@de.ibm.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-11-07 11:25:02 +00:00
Peter Maydell 9706e0162d hw/i2c/bitbang_i2c: Handle NACKs from devices
If the guest attempts to talk to a nonexistent device over i2c,
the i2c_start_transfer() function will return non-zero, indicating
that the bus is signalling a NACK. Similarly, if the i2c_send()
function returns nonzero then the target device returned a NACK.
Handle this possibility in the bitbang_i2c code, by returning
the state machine to the STOPPED state and returning the NACK
bit to the guest.

This bit of missing functionality was spotted by Coverity
(it noticed that we weren't checking the return value from
i2c_start_transfer()).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1477332749-27098-1-git-send-email-peter.maydell@linaro.org
2016-11-07 10:01:15 +00:00