Commit Graph

55156 Commits

Author SHA1 Message Date
Philippe Mathieu-Daudé
158b9aa568 nbd: fix memory leak in nbd_opt_go()
nbd/client.c:385:12: warning: Potential leak of memory pointed to by 'buf'

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170727024224.22900-5-f4bug@amsat.org>
[introduced in commit 8ecaeae8]
Signed-off-by: Eric Blake <eblake@redhat.com>
2017-07-28 11:58:20 -05:00
Peter Maydell
3aabfec2c8 MIPS patches 2017-07-28
Changes:
 * Improve ths MIPS board kernel load error reporting
 * Revert unnecessary warning messages
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.5 (GNU/Linux)
 
 iQIVAwUAWXsyeCI464bV95fCAQJwLA//S/4pz25g3tGtrjZR+7GQnMUyY4jl7a70
 +ut7uGCU9/6KgbAL3XgCLVaxAAth5Swh7rrOb2Yp1TxyL4PC/M4o/dYaKY8+okWu
 /s4v2UFSwtZPkVCkzeZRMx/suM9jAdFuEkB9CzwPKVyqnC5ghZs68xWZMuSi8cyL
 VPj8ovPEo7G5Sw1icSRHq9jdmi5lOMI72U+AFC8hz6r6IWVI584vR7D7ozqharhV
 7JK5oY5gFFeq39Ip8sRiP+VXaclroOg5nC+NTVcArtRGgvTSxWz7SQhTusbSALX3
 Q/iCyecpEkK88AOesGVcRZPA3no5zkCBbnSbxU0E/Eq1wYQmOg1D25WFsirUNhS+
 JhspYVmAIWZ9S8mdaLtEJEkJW+3srMauB7HGLCSravgWH1ZKVEqI10Ewsew2mErb
 ncPvO3flH9y1QFqwMZy8879WMVBF5Z4dGDwnF+fShj9TDgFPwrtDK6aaIV9kC+iQ
 dh8rOSw7RQYigqj1VWIF356n1R2c1V0fvI0d8jJqau+SbNRQYFMJ4UaCFQtzD748
 FUPuP5rCOs+BxyYBYQnW5nSn7Jno19imQEwxDAfSATDDTTKM8moK97ZrisMzXT0S
 3UcgfBapcyL9RCXi4/Ums2Q5GIVXtxi2xsZ0HW1ZIezIs0UpmMqOfsMXiDfD+fFC
 hcpKCFsGCTo=
 =ci7G
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170728' into staging

MIPS patches 2017-07-28

Changes:
* Improve ths MIPS board kernel load error reporting
* Revert unnecessary warning messages

# gpg: Signature made Fri 28 Jul 2017 13:47:52 BST
# gpg:                using RSA key 0x2238EB86D5F797C2
# gpg: Good signature from "Yongbok Kim <yongbok.kim@imgtec.com>"
# 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: 8600 4CF5 3415 A5D9 4CFA  2B5C 2238 EB86 D5F7 97C2

* remotes/yongbok/tags/mips-20170728:
  Revert "elf-loader: warn about invalid endianness"
  hw/mips: load_elf_strerror to report kernel loading failure

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-28 15:32:44 +01:00
Peter Maydell
762971738c ui: more keymap fixes for 2.10
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJZezUVAAoJEEy22O7T6HE4ZPsP/1IG6CLs6x49ckjfKDIZnjIv
 NVjrI0kvj4okZApDT7ro/4B4NqTTP87pPCF7fEW5P3Qh+BbVkiyKRdDJHR0dk5kG
 EMQQOvZAvyq9xWoq0r+Mhh7fQmqLDXDUse88eFXk24fc73JQWsrIDRltpCJYMTLX
 F6mKCylgM86n3UBTxhDDylMX5Zui+qiToT88LJ+Eorj6HosD36Fu1cH4v3lB0YSb
 DbipMx1dbGydJNTjSaKl42etLAbHpqtlfNlAXkprksM3wnxhAQedgddQ2M2JNgUZ
 ep3LisR4iIA6mUBt/MnO7SWCPypOpiXAyR0MbEy4bk7SpaQ/sidE5ti+ckA0plBJ
 HgbvsWBLAfoQ1R4bUQm2He8z7GyKpJOowZm10y+feKvaF4GjIszlQF5r+Zihy8iF
 HjqlEIeLaqz34lHOMPfpa6MzCHpFXwY8yaHpTh2nUKyI4lgnuhO32uupiaVBnWQq
 JrGIr3wDOTJ0CTnOqu1WLRKnE6n+xI2skQ4dcJ0tOPVx7rPhtm8K5JBYRyb77ELQ
 HA3bV5kTJZLCGPjikl7At3Ekyx28sseGEBaGd4GeYBMCGKoeThAxNi0JDh/zRby8
 WxRKrxdiRj88qBuNSpneWHQ4EjyTG5hzbfNFC0yG7mq5hvG0tYxthe6msF0omwbz
 dMp3f5pwWpmQ0kiny3Pf
 =jdk3
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20170728-pull-request' into staging

ui: more keymap fixes for 2.10

# gpg: Signature made Fri 28 Jul 2017 13:59:01 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20170728-pull-request:
  ui: add pause key to linux_to_qcode
  ui: drop ac_search and ac_stop
  ui: correctly detect spice PAUSE scancode sequence

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-28 14:20:17 +01:00
Alexey Kardashevskiy
665df9010a Revert "elf-loader: warn about invalid endianness"
This reverts c8e1158cf6 "elf-loader: warn about invalid endianness"
as it produces a useless message every time an LE kernel image is
passed via -kernel on a ppc64-pseries machine. The pseries machine
already checks for ELF_LOAD_WRONG_ENDIAN and tries with big_endian=0.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
2017-07-28 13:32:32 +01:00
Aurelien Jarno
3ee3122c0d hw/mips: load_elf_strerror to report kernel loading failure
Emulated MIPS boards bail out with a simple "could not load kernel" when
a kernel could not be load, without specifying the underlying reason.
Fix that by calling load_elf_strerror.

At the same time use error_report to report the error instead of
fprintf.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
2017-07-28 13:32:32 +01:00
Gerd Hoffmann
ef58430d5d ui: add pause key to linux_to_qcode
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170728063432.27578-1-kraxel@redhat.com
2017-07-28 12:35:40 +02:00
Gerd Hoffmann
103dce8f75 ui: drop ac_search and ac_stop
Both keys exist already: "ac_search" is "find" and "ac_stop" is "stop".

Fixes: 37810e8055
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170728063415.27480-1-kraxel@redhat.com
2017-07-28 12:35:40 +02:00
Daniel P. Berrange
e92316ad30 ui: correctly detect spice PAUSE scancode sequence
The SPICE input code is currently detcting 0xe1 0x1d 0x45 as
the PAUSE key make sequence and 0xe1 0x9d 0xc5 as the break
sequence. This is incorrect, because all 6 scancodes together
are the make sequence, and there is no break sequence.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170727174640.30359-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-07-28 12:35:40 +02:00
Peter Maydell
871a0f7ad2 More s390x fixes: Correct ilen, and ccw checking.
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZewBGAAoJEN7Pa5PG8C+v6EUP/1A5Gz/A06jfEqupyTrbWxRO
 CkOLIKQhcKaBHtfF+RpwOvSzcEoNN8Z5l6t6ymVo7/o493avZkhxtSwiWLm9ziAf
 XghEumAggVdjyaJVyvr1kZouJMtN8J8MZc4loBvY99l2DWRs5Rl8P4l9XISWyWmB
 1XgAodOB+DF7Syy2/PgAfxNoVaCSHh1UPNnqwMxj8X+kzJUCbWC4CjeVR1yeLz7j
 ULiiqmVwYSPW6MTf46BrlP+4zKwIIw/Euj0+KCqxfmRg6RPQ/l14whrwkxvF73dI
 tEOqWqc8t0oq1G0ak3c8VvM2w4j9fascvN+piz5/i+65+MoyuVMKJBzryLLEM69s
 ozYIMQ0hfG/KH7uMpccGV0RDzr750wZyU/cZKTgDYjfGOV/CfEQEhjyWISkAZCB7
 sV3daivO+DzMcsdWDwU/XG3cnG6/5Pc2p61wYTKw3KnXV3cLv1bwe2b9aFUpymwA
 VIHHSBW2qX0PK7CzeKGMyOckxYS6swTuUVQBGRPH4VUNR0HmjI59yJrv0iULCxQy
 4hDgkHgJcbOPm8d9gwQLJXmcu0Ub8PPI21jxqodhWVhRB9LLOuNLqJCq3Fh+QdZi
 L94++GMgqve5AIb+h3yAMCxiT+4RRUdlBiUEaPKZJj7dEsBIteIXaHLvxY6s+zPl
 0K1Jwdvtgmp25Qn8NAtP
 =CWHT
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170728' into staging

More s390x fixes: Correct ilen, and ccw checking.

# gpg: Signature made Fri 28 Jul 2017 10:13:42 BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20170728:
  s390x/css: fix bits must be zero check for TIC
  s390x/css: check ccw address validity
  target/s390x: fix pgm irq ilen in translate_pages()
  target/s390x: fix pgm irq ilen for stsi

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-28 10:35:02 +01:00
Halil Pasic
4add0da649 s390x/css: fix bits must be zero check for TIC
According to the PoP bit positions 0-3 and 8-32 of the format-1 CCW must
contain zeros.  Bits 0-3 are already covered by cmd_code validity
checking, and bit 32 is covered by the CCW address checking.

Bits 8-31 correspond to CCW1.flags and CCW1.count.  Currently we only
check for the absence of certain flags.  Let's fix this.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20170725224442.13383-3-pasic@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
[CH: tweaked comment]
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-28 10:06:25 +02:00
Halil Pasic
198c0d1f9d s390x/css: check ccw address validity
According to the PoP channel command words (CCW) must be doubleword
aligned and 31 bit addressable for format 1 and 24 bit addressable for
format 0 CCWs.

If the channel subsystem encounters a ccw address which does not satisfy
this alignment requirement a program-check condition is recognised.

The situation with 31 bit addressable is a bit more complicated: both the
ORB and a format 1 CCW TIC hold the address of (the rest of) the channel
program, that is the address of the next CCW in a word, and the PoP
mandates that bit 0 of that word shall be zero -- or a program-check
condition is to be recognized -- and does not belong to the field holding
the ccw address.

Since in code the corresponding fields span across the whole word (unlike
in PoP where these are defined as 31 bit wide) we can check this by
applying a mask. The 24 addressable case isn't affecting TIC because the
address is composed of a halfword and a byte portion (no additional zero
bit requirements) and just slightly complicates the ORB case where also
bits 1-7 need to be zero.

The same requirements (especially n-bit addressability) apply to the
ccw addresses generated while chaining.

Let's make our CSS implementation follow the AR more closely.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20170727154842.23427-1-pasic@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-28 10:06:25 +02:00
David Hildenbrand
98987d30b6 target/s390x: fix pgm irq ilen in translate_pages()
0 is certainly wrong. Let's use ILEN_AUTO.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170721125609.11117-3-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-28 10:06:25 +02:00
David Hildenbrand
031631c3cf target/s390x: fix pgm irq ilen for stsi
The instruction is 4 bytes long.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170721125609.11117-2-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-28 10:06:25 +02:00
Peter Maydell
e01151de16 ui: keymap fixes for 2.10
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJZefHmAAoJEEy22O7T6HE4PR8P/ig/NaLdR0LeDKPPlwgJcYTi
 EOw7MXlO7gMKJfU7POJ87qE09vIfdRJN8wsnCZdxQ4q3YfWwFrWCHNzsVdvh5reO
 HiQ/QCjNJlI756UslPvbnD+agt2oTchlvDeT9WPlqqb2ByXZLTMNEUoxPR9Dm5SO
 Jal26X5Qy9452c2u0Ivqv8JSFB0jb11SSL7FemiG0yaPn+xbaLh25UhE9VXcd1Yx
 FsHlFJDaXZan7wl0WuY4gDIbp3/Z5a1SdBsJ4eb34Awke4zS7uRO05mBRU+uOjWG
 5OtSFQEpGxVQbZhPV0mqMC4LsWZZVqRFhBVqum2SFU/EB35Vinpn7a5kZAPqqlW2
 u60bPr7GBX7izlISaD0ZFbldsaGTmAnoNxVFZ1UuHNQdEnzB/WR2m+tnTYhzOLBu
 PQpmY/Bk+WQdwJdWWHKYsEc99lZN+7qzazafRauvXoZKbO33WeIV4e7WyokMkqbv
 nUXLi9r0cwNmUTRz8mD2hai74HUpHreJqf8hQOiD5BaDbmOf2e9+ru04kxU+r35a
 jZ1jvLKdO6iLIMfzuSAz+uRZDzVXhJw1Gv/P4ZhJx8SHlu0ker4VBUUUCYfCkZvN
 ySWQYQ5LY3iDe/ro9TpSXyVeIX1z3itGmQMJCHsAfK2SyVcoV+Zr8+joqwQCyCRE
 TiNEzQSq0DeDeDI2x7Rf
 =ek0x
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20170727-pull-request' into staging

ui: keymap fixes for 2.10

# gpg: Signature made Thu 27 Jul 2017 15:00:06 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20170727-pull-request:
  ps2: fix sending of PAUSE/BREAK scancodes
  ui: drop altgr and altgr_r QKeyCodes
  ps2: enable multimedia keys
  ui: add multimedia keys
  ui: update keymaps
  ui: move qemu_input_linux_to_qcode()
  ui: add next and prior keysyms

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-27 15:27:06 +01:00
Daniel P. Berrange
7c388dbd0b ps2: fix sending of PAUSE/BREAK scancodes
The processing of the scancodes for PAUSE/BREAK  has been broken since
the conversion to qcodes in:

  commit 8c10e0baf0
  Author: Hervé Poussineau <hpoussin@reactos.org>
  Date:   Thu Sep 15 22:06:26 2016 +0200

    ps2: use QEMU qcodes instead of scancodes

When using a VNC client, with the raw scancode extension, the client
will send a scancode of 0xc6 for both PAUSE and BREAK. There is mistakenly
no entry in the qcode_to_number table for this scancode, so
ps2_keyboard_event() just generates a log message and discards the
scancode

When using a SPICE client, it will also send 0xc6 for BREAK, but
will send 0xe1 0x1d 0x45 0xe1 0x9d 0xc5 for PAUSE. There is no
entry in the qcode_to_number table for the scancode 0xe1 because
it is a special XT keyboard prefix not mapping to any QKeyCode.
Again ps2_keyboard_event() just generates a log message and discards
the scancode. The following 0x1d, 0x45, 0x9d, 0xc5 scancodes get
handled correctly. Rather than trying to handle 3 byte sequences
of scancodes in the PS/2 driver, special case the SPICE input
code so that it captures the 3 byte pause sequence and turns it
into a Pause QKeyCode.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170727113243.23991-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-07-27 14:24:05 +02:00
Gerd Hoffmann
912092b8e4 ui: drop altgr and altgr_r QKeyCodes
The right alt key (alt_r aka KEY_RIGHTALT) is used for AltGr.
The altgr and altgr_r keys simply don't exist.  Drop them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170727104720.30061-1-kraxel@redhat.com
2017-07-27 14:23:33 +02:00
Gerd Hoffmann
0500cb1d25 ps2: enable multimedia keys
Fixes: 8c10e0baf0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-6-kraxel@redhat.com
2017-07-27 14:23:10 +02:00
Gerd Hoffmann
37810e8055 ui: add multimedia keys
Add multimedia keys to QKeyCodes and to the keymaps.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-5-kraxel@redhat.com
2017-07-27 14:23:10 +02:00
Gerd Hoffmann
9ade7759ed ui: update keymaps
Add recently added QKeyCodes to the keymaps.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-4-kraxel@redhat.com
2017-07-27 14:23:09 +02:00
Gerd Hoffmann
606eb0c649 ui: move qemu_input_linux_to_qcode()
Move from input-linux.c to input-keymap.c and export it,
so the function is available elsewhere too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-3-kraxel@redhat.com
2017-07-27 14:23:09 +02:00
Gerd Hoffmann
d52a1a9102 ui: add next and prior keysyms
Page-up and Page-down were renamed.  Add the names to the keysym list
so we can parse both old and new names.  The keypad versions are already
present in the vnc map.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170726152918.11995-2-kraxel@redhat.com
2017-07-27 14:23:09 +02:00
Peter Maydell
6be37cc583 VFIO fixes 2017-07-26
- Error path use after free bug fixes (Philippe Mathieu-Daudé)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJZeNYMAAoJECObm247sIsi33UQAJyGyE/szH8Z2wJAuY1poK+6
 OLw65KtGpCNLKt9+DEt1y0aA5arK/rjrLmdn/7D+A1IHLHbQcb/C+PvMhv5Mo2s0
 SckwUmgL9hohgvpcJuybNpLs1IFbEUt2IekEkczwYoVrGZXh3DlNaxPh+PVz80kt
 P0Lp/EQ9lvKNxbvZq+D6jHDkt0ICheqI43nA641qxpDlZq7DfnQdkuNFJq0ZPe+k
 QKW0FkwfEG5mmofVhq6+xu0IyuVDJJmyqcrYB+rUCk2amKOMkzSpzxjOPPiEP4u2
 XBIvmNWjhZwptIBV6o42ASi2zwv7k7l+yCw94EY89nlCqDHGXH6OyXxF99Sua94D
 h5oV5mq0Bx/xK6wt22RCOgwt1xaHakjuoV2vFheyNA5K2C+s1sWv03TrarxHC8PI
 vuZFlRwBhiiFcAVc0/RMUvP6kqSpr0taEetnCEc7WS6zlXls98BtoH/Cc/YeZah9
 ybL1VZ75Hz5DpdsXyFQoeC2Hiap+AVEXpAqrPVwdVe2LkRpP5015u5qMATSfo3kV
 SmF1hCN7300omp24LReEqFvhlaRW7whkFlDF0UzF6cg2vXQXtxB0MauwcmXuZ+cZ
 laUcqyXkwZsy83fZwiQKXsHIzy8WiR8XP4yyihMYPSIP7WL41Al1gRROX5aSr5R+
 fGRdLrZ3AooByfFF7l8T
 =zmWF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20170726.0' into staging

VFIO fixes 2017-07-26

 - Error path use after free bug fixes (Philippe Mathieu-Daudé)

# gpg: Signature made Wed 26 Jul 2017 18:49:00 BST
# gpg:                using RSA key 0x239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>"
# gpg:                 aka "Alex Williamson <alex@shazbot.org>"
# gpg:                 aka "Alex Williamson <alwillia@redhat.com>"
# gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>"
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-fixes-20170726.0:
  vfio/pci: fix use of freed memory
  vfio/platform: fix use of freed memory

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-27 10:49:05 +01:00
Peter Maydell
2dca6d9e7e x86 bug fix for -rc1
Fix for a bug in "-cpu max" that breaks libvirt usage of
 query-cpu-model-expansion.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJZeODwAAoJECgHk2+YTcWmSPsQALAiv1pAUfXmKbhionOX3NTA
 mrGzKItg1eyRQw2n83z/S9AzSWTgPEKban5e+7JvJvJMzHMgs6ug3xS/F3U02Z8b
 TvBX0qN/cZCuSrxcDs7H1dujfuYJKoBekUVeiiCifJRINuWR1Y2rgPLFnEkCTh+w
 dRqhm2x3PpdmSgdKeQQM3mCC3pFwYmzkPtC08bbnJ2kAzw8B8Pgu2gA4ttFqHaVK
 JbUXxdYA6qZdVAUa9OHlP54NVh34jzK8piptpTOBgHXK7dKuEMLLE32j9St5oy3r
 SdPu81pJ66i45rkm3cQuatbjYCupA7cVgg/LMUWSTMPbmbAw2dcmvkzQAK178jD3
 sASvhJn36hd2GHiC2mLfeQ75IN7SA7Zk/R397cl72fubVi/pW21QHNy3DBsnMVI9
 iclwpZm7/k/goBegsqIA3Tr8LzN/YdOkhkpzyA1OpVtMsjcdlHNzokZmFT55wfTA
 cCZu+OwQdhyFyJJvc5ZOWVDLm2ezwQkJ1CldBlFOHD2CCTYunp/M0u6TdRyI3lN/
 gdAdy1Ws5og5hVw6d7npDLPgqdszPAaMrQTxKr4SqDi66qy/MvLY/zWDn0PgRxur
 EyyXjnPCuDlzoWneh6yhNRUifGQcQ6v3bSf6kYCZLJRwIM82iSnH0cHljgp6LTND
 YMjnawcJNUJk4euBnAoy
 =41wG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging

x86 bug fix for -rc1

Fix for a bug in "-cpu max" that breaks libvirt usage of
query-cpu-model-expansion.

# gpg: Signature made Wed 26 Jul 2017 19:35:28 BST
# gpg:                using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-pull-request:
  target/i386: Don't use x86_cpu_load_def() on "max" CPU model
  target/i386: Define CPUID_MODEL_ID_SZ macro
  target/i386: Use host_vendor_fms() in max_x86_cpu_initfn()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-27 10:15:11 +01:00
Eduardo Habkost
bd1820227e target/i386: Don't use x86_cpu_load_def() on "max" CPU model
When commit 0bacd8b304 ('i386: Don't set CPUClass::cpu_def on
"max" model') removed the CPUClass::cpu_def field, we kept using
the x86_cpu_load_def() helper directly in max_x86_cpu_initfn(),
emulating the previous behavior when CPUClass::cpu_def was set.

However, x86_cpu_load_def() is intended to help initialization of
CPU models from the builtin_x86_defs table, and does lots of
other steps that are not necessary for "max".

One of the things x86_cpu_load_def() do is to set the properties
listed at tcg_default_props/kvm_default_props.  We must not do
that on the "max" CPU model, otherwise under KVM we will
incorrectly report all KVM features as always available, and the
"svm" feature as always unavailable.  The latter caused the bug
reported at:

  https://bugzilla.redhat.com/show_bug.cgi?id=1467599
  ("Unable to start domain: the CPU is incompatible with host CPU:
  Host CPU does not provide required features: svm")

Replace x86_cpu_load_def() with simple object_property_set*()
calls.  In addition to fixing the above bug, this makes the KVM
branch in max_x86_cpu_initfn() very similar to the existing TCG
branch.

For reference, the full list of steps performed by
x86_cpu_load_def() is:

* Setting min-level and min-xlevel.  Already done by
  max_x86_cpu_initfn().
* Setting family/model/stepping/model-id.  Done by the code added
  to max_x86_cpu_initfn() in this patch.
* Copying def->features.  Wrong because "-cpu max" features need to
  be calculated at realize time.  This was not a problem in the
  current code because host_cpudef.features was all zeroes.
* x86_cpu_apply_props() calls.  This causes the bug above, and
  shouldn't be done.
* Setting CPUID_EXT_HYPERVISOR.  Not needed because it is already
  reported by x86_cpu_get_supported_feature_word(), and because
  "-cpu max" features need to be calculated at realize time.
* Setting CPU vendor to host CPU vendor if on KVM mode.
  Redundant, because max_x86_cpu_initfn() already sets it to the
  host CPU vendor.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170712162058.10538-5-ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-07-26 14:55:12 -03:00
Eduardo Habkost
7d8050b514 target/i386: Define CPUID_MODEL_ID_SZ macro
Document cpu_x86_fill_model_id() and define CPUID_MODEL_ID_SZ to
help callers use the right buffer size.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170712162058.10538-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-07-26 14:55:12 -03:00
Eduardo Habkost
bfef624895 target/i386: Use host_vendor_fms() in max_x86_cpu_initfn()
The existing code duplicated the logic in host_vendor_fms(), so
reuse the helper function instead.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170712162058.10538-3-ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-07-26 14:55:12 -03:00
Philippe Mathieu-Daudé
96d2c2c574 vfio/pci: fix use of freed memory
hw/vfio/pci.c:308:29: warning: Use of memory after it is freed
        qemu_set_fd_handler(*pfd, NULL, NULL, vdev);
                            ^~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2017-07-26 11:38:18 -06:00
Philippe Mathieu-Daudé
418c69813f vfio/platform: fix use of freed memory
free the data _after_ using it.

hw/vfio/platform.c:126:29: warning: Use of memory after it is freed
        qemu_set_fd_handler(*pfd, NULL, NULL, NULL);
                            ^~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2017-07-26 11:38:17 -06:00
Peter Maydell
522fd24ca0 Update version for v2.10.0-rc0 release
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-25 17:13:09 +01:00
Peter Maydell
0f1e9c8094 Block patches for 2.10-rc0
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJZd1cgAAoJEPQH2wBh1c9AyN4H/3JqDemoPMEk45nyML4oLoJe
 I3gwbdDfa20nux8wOETbmwx2RFBjvDi88QO6iEXRg8hZPufy74L7xRV0OzmonHVa
 ODl3oKyGragKxoZSGsrkx71jh4vuk8IaLgy1TUrITVQXfu4WR6lrguimd1T8Q0Y2
 UEJLgb/aWbZY9JMwioB7xQ+ANGNwPlMBP5bQYjTn8K9mXZNpbiBce9tSKBZyPr66
 1UwvxPAuMmJyEIOlRDMiwWNLojlqGJCv3RosSDYR7xDaDaPBwrXNrWZaQsUxIB3F
 aOxO2Ob+7MKw9wjt4v6MUZoXCMdC34Heb6vb4/OEmRK/8KuRssfqr2mma8OzFMM=
 =jeeO
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2017-07-25' into staging

Block patches for 2.10-rc0

# gpg: Signature made Tue 25 Jul 2017 15:35:12 BST
# 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

* remotes/maxreitz/tags/pull-block-2017-07-25:
  qemu-iotests: Fix reference output for 186
  qcow2-bitmap: fix bitmap_free
  qcow: fix memory leaks related to encryption

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-25 16:27:54 +01:00
Kevin Wolf
bd998d7cc8 qemu-iotests: Fix reference output for 186
Commits 70f17a1 ('error: Revert unwanted change of warning messages')
and e1824e5 ('qemu-iotests: Test 'info block'') had a semantic merge
conflict, which results in failure for qemu-iotests case 186. Fix the
reference output to consider the changes of 70f17a1.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1500973176-29235-1-git-send-email-kwolf@redhat.com
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-07-25 16:33:58 +02:00
Vladimir Sementsov-Ogievskiy
b6b75a99da qcow2-bitmap: fix bitmap_free
Fix possible crash on error path in
qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in
88ddffae8f the bug was introduced later in commit 469c71edc7 (when
qcow2_remove_persistent_dirty_bitmap was added).

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170714123341.373857-1-vsementsov@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-07-25 16:33:31 +02:00
Daniel P. Berrange
0696ae2c92 qcow: fix memory leaks related to encryption
Fix leak of the 'encryptopts' string, which was mistakenly
declared const.

Fix leak of QemuOpts entry which should not have been deleted
from the opts array.

Reported by: coverity
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20170714103105.5781-1-berrange@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2017-07-25 16:33:31 +02:00
Peter Maydell
4c4414a438 hw/display/sm501: Don't use vmstate_register_ram_global()
The sm501 device uses vmstate_register_ram_global() to register its
memory region for migration.  This means it gets a name that is
assumed to be global to the whole system, which in turn means that if
you create two of the device we assert because of the duplication:

qemu-system-ppc -device sm501 -device sm501
RAMBlock "sm501.local" already registered, abort!
Aborted (core dumped)

Changing this to just use memory_region_init_ram()'s automatic
registration of the memory region with a device-local name fixes
this.  The downside is that it breaks migration compatibility, but
luckily we only added migration support to this device in the 2.10
release cycle so we haven't released a QEMU version with the broken
implementation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: 1500309462-12792-1-git-send-email-peter.maydell@linaro.org
2017-07-25 13:04:28 +01:00
Peter Maydell
5fb203a199 Various changes for the s390x code:
- updates for cpu model handling
 - fix compilation with --disable-tcg
 - fixes in vfio-ccw and I/O instruction handling
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZdww5AAoJEN7Pa5PG8C+vzlwP/iQBy81J4aS8HvsOqRrPO8SZ
 ympZW9hxux52Igr1yXbCJn2jYGmF2Yl4mS+Q/4JvZ6cs38bSMLOE/FWEIvrjgpKG
 +IAnbv7icn8/tJFgZSdQpmvb5meeX6T3HNsyerjnGtz3c84DDBycJp4jRWTkDWB+
 zE0CyAPfqborCK7kMR788lXIZVo5DnwMGq+rOriIPPKrPxeuhCO11xNTSBnPS5Ae
 2P/eKfgqd99hjBK4vqR+zo0ldo3uL7xDZnVK54ucp+xLmtQnKMeqrT73+LE/OHXR
 kL9mrWLVYawJUuMFPR6J20E5IMFjLKHkVg177a78Zukf2lwCkn/xegzDZnhCPX4e
 bTFlJBSB4C/7KMFi1QFtyqUbw5VQ7CeAaCJskwLE6aJ89hmKkuGdOcgGOanJtv4f
 IniOBANWie/IfJVGnHQ0amupMK9UKCGjJ3+k6SLQQl3UV8q4EE/0QvcKvMwJa8gE
 2wnmPue5gFUhFKZBR6ugbVC+C5aMBF/LvY8sPRLgioN3rKi0gzXO5ChCwqLV0J7J
 3q3VN1yltAcgmkvUkkNkNg9XI/9sft9ycCZhQdPQvHhAa8dSQj503m1TknhTjVnl
 os7RXnMMhJfKayJEXbmAFQU9TldCtZKNGAnWPwXbEednHZHOBGPz9msYOZgFMwXk
 ttg9AHhAzY/ynnOIisO2
 =8RaH
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170725' into staging

Various changes for the s390x code:
- updates for cpu model handling
- fix compilation with --disable-tcg
- fixes in vfio-ccw and I/O instruction handling

# gpg: Signature made Tue 25 Jul 2017 10:15:37 BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20170725:
  s390x/css: fix ilen in IO instruction handlers
  target/s390x: Add remaining switches to compile with --disable-tcg
  target/s390x: Move exception-related functions to a new excp_helper.c file
  target/s390x: Rework program_interrupt() and related functions
  target/s390x: Move diag helpers to a separate file
  target/s390x: Move s390_cpu_dump_state() to helper.c
  target/s390x: improve baselining if certain base features are missing
  s390x/kvm: better comment regarding zPCI feature availability
  target/s390x: introduce (test|set)_be_bit
  target/s390x: indicate query subfunction in s390_fill_feat_block
  target/s390x: drop BE_BIT()
  s390/cpumodel: remove KSS from the default model of z14
  vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device
  vfio/ccw: allocate irq info with the right size

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-25 11:28:58 +01:00
Peter Maydell
08cf4b5ed2 ppc patch queue 2017-07-25
Last pull request for the 2.10 hard freeze, and correspondingly small.
 There are a handful of bugfixes here plus an update for the "pseries"
 guest firmware (SLOF).
 
 This is later than ideal for a guest firmware update.  However, this
 does include a number of fixes in that guest firmware, so I think it's
 worth the risk of squeezing this in just before the hard freeze.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAll22nIACgkQbDjKyiDZ
 s5K5zg//S8KovwKO7CunPQn/uUjqqx8zqGOogIcYIH8st2g2GzKPBF4yMtWH30Ik
 ZterHQe5sePOLZQ0YPqd4gRyC+YYtG5S98mOEIKi/29UFjmMMAGpzDPy7X2miBN+
 Z6u93aZloNwAQ3YN9chK63N3y0fQbs6K7kUNVnK4pVq3koM2B4N1QzrECFef0u6y
 AAdLgLZcp3n6li29cRDBRccWbRmAfMDg3HzjGDUg6X/Y41v472T9MMn+rXwJ7Vg7
 a9rfZjIBrCE2Xbww2SustlmgMG7PjYC2LafUqkzpmOT2z4XibV5xLl5gdHByaqX7
 XAVyqs1PbUD3p1okIOX0VV7xxWIO8NJI+c63oXEqHFJEWCt4TYRSH9oZSFxT1nOd
 Ioj19zjP6V51Jb3bLm7E88/hQdLPHLhp7hD2NVonfuhKZ4bOZTdNVf8TZYMDH9s3
 MAEZSKXoDmHWX8JalI5JrYtbz4hlijCQGyk/9Albvuqa94zJsexfEVA+DQ5B65E9
 F8ylI769AQ2OS5d0Nh8jP4+xqfYDCZEUtUhUsFK+/VL1eg4Bz9zqmOowx3iHgNud
 BOYsc551z310JTHblqDAjMZpe9plwd443JLaLm4RyrVFoxlt25QXOxa+xrXqRr8R
 Sj+McOlFH4ZfM+zRAAGebcnj0AbR6GPSByczKY8wWivbtDZ0DWs=
 =nXHc
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.10-20170725' into staging

ppc patch queue 2017-07-25

Last pull request for the 2.10 hard freeze, and correspondingly small.
There are a handful of bugfixes here plus an update for the "pseries"
guest firmware (SLOF).

This is later than ideal for a guest firmware update.  However, this
does include a number of fixes in that guest firmware, so I think it's
worth the risk of squeezing this in just before the hard freeze.

# gpg: Signature made Tue 25 Jul 2017 06:43:14 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.10-20170725:
  pseries: Update SLOF firmware image
  spapr: Fix QEMU abort during memory unplug
  spapr/htab: fix savevm
  spapr_pci: Fix obsolete comment about MSIX encoding in addr/data

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-25 10:04:39 +01:00
Halil Pasic
7e01376dae s390x/css: fix ilen in IO instruction handlers
When initiating a program check interruption by calling program_interrupt
the instruction length (ilen) of the current instruction is supplied as
the third parameter.

On s390x all the IO instructions are of instruction format S and their
ilen is 4.  The calls to program_interrupt (introduced by commits
7b18aad543 ("s390: Add channel I/O instructions.", 2013-01-24) and
61bf0dcb2e ("s390x/ioinst: Add missing alignment checks for IO
instructions", 2013-06-21)) however use ilen == 2.

This is probably due to a confusion between ilen which specifies the
instruction length in bytes and ILC which does the same but in halfwords.
If kvm_enabled() this does not actually matter, because the ilen
parameter of program_interrupt is effectively unused.

Let's provide the correct ilen to program_interrupt.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Fixes:  7b18aad543 ("s390: Add channel I/O instructions.")
Fixes: 61bf0dcb2e ("s390x/ioinst: Add missing alignment checks for IO instructions")
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170724143452.55534-1-pasic@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Thomas Huth
b114588c06 target/s390x: Add remaining switches to compile with --disable-tcg
Adding some CONFIG_TCG tests to be finally able to compile QEMU
on s390x also without TCG.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1500886370-14572-6-git-send-email-thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Thomas Huth
cded4014ae target/s390x: Move exception-related functions to a new excp_helper.c file
These functions can not be compiled with --disable-tcg. But since we
need the other functions from helper.c in the non-tcg build, we can also
not simply remove helper.c from the non-tcg builds. Thus the problematic
functions have to be moved into a separate new file instead that we
can later omit in the non-tcg builds.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1500886370-14572-5-git-send-email-thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Thomas Huth
e3cfd926f7 target/s390x: Rework program_interrupt() and related functions
misc_helper.c won't be compiled with --disable-tcg anymore, but we
still need the program_interrupt() function in that case. Move it
to interrupt.c instead, and refactor it to re-use the code from
trigger_pgm_exception() (for TCG) and enter_pgmcheck() (for KVM,
which now got renamed to kvm_s390_program_interrupt() for
clarity).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1500886370-14572-4-git-send-email-thuth@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Thomas Huth
3d6722051b target/s390x: Move diag helpers to a separate file
misc_helper.c won't be compiled with --disable-tcg anymore, but we
still need the diag helpers in KVM builds, too, so move the helper
functions to a separate file.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1500886370-14572-3-git-send-email-thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Thomas Huth
b5bd2e91a6 target/s390x: Move s390_cpu_dump_state() to helper.c
translate.c can not be compiled with --disable-tcg, but we need
the s390_cpu_dump_state() in KVM-only builds, too. So let's move
that function to helper.c instead, which will also be compiled
when --disable-tcg has been specified.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1500886370-14572-2-git-send-email-thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
David Hildenbrand
30e82de704 target/s390x: improve baselining if certain base features are missing
There are certain features that we put into base models, but that are
not relevant for the actual search. The most famous example are
MSA subfunctions that might be disabled on certain real hardware out
there.

While the kvm host model detection will usually detect the correct model
on such machines (as it will in the common case not pass features to check
for into s390_find_cpu_def()), baselining will fall back to a quite old
model just because some MSA subfunctions are missing.

Let's improve that by ignoring lack of these features while performing
the search for a base model.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170720123721.12366-6-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
David Hildenbrand
e23bc1b202 s390x/kvm: better comment regarding zPCI feature availability
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170720123721.12366-5-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
David Hildenbrand
3d1cfc3c68 target/s390x: introduce (test|set)_be_bit
Using ordinary bitmap operations to set/test bits does not work properly
on architectures !s390x. Let's drop (test|set)_bit_inv and introduce
(test|set)_be_bit instead. These functions work on uint8_t array, not on
unsigned longs arrays and are for now only used in the context of
CPU features.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170720123721.12366-4-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
David Hildenbrand
cc18f90762 target/s390x: indicate query subfunction in s390_fill_feat_block
We'll have to do the same for TCG, so let's just move it in there.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170720123721.12366-3-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
David Hildenbrand
f026fcd192 target/s390x: drop BE_BIT()
Unused and broken, let's just get rid of it.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170720123721.12366-2-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Christian Borntraeger
c1b364ffd7 s390/cpumodel: remove KSS from the default model of z14
The SIE_KSS feature will allow a guest to use KSS for a nested guest.
To create a nested guest the SIE_F2 facility is still necessary.
Since SIE_F2 is not part of the default model it does not make
a lot of sense to provide the SIE_KSS feature in the default model.
Let's also create a dependency check.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <1500550051-7821-2-git-send-email-borntraeger@de.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Dong Jia Shi
6a79dd4631 vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device
Commit 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
iterator") introduced a pointer to the Object DeviceState in the VFIO
common base-device and skipped non-realized devices as we iterate
VFIOGroup.device_list. While it missed to initialize the pointer for
the vfio-ccw case. Let's fix it.

Fixes: 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
                  iterator")

Cc: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <20170718014926.44781-3-bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00
Jing Zhang
28e22d4bae vfio/ccw: allocate irq info with the right size
When allocating memory for the vfio_irq_info parameter of the
VFIO_DEVICE_GET_IRQ_INFO ioctl, we used the wrong size. Let's
fix it by using the right size.

Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Jing Zhang <bjzhjing@linux.vnet.ibm.com>
Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Message-Id: <20170718014926.44781-2-bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-07-25 09:17:42 +02:00