Commit Graph

33128 Commits

Author SHA1 Message Date
Paolo Bonzini f08b617018 softmmu: introduce cpu_ldst.h
This will collect all load and store helpers soon.  For now
it is just a replacement for softmmu_exec.h, which this patch
stops including directly, but we also include it where this will
be necessary in order to simplify the next patch.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:10:33 +02:00
Paolo Bonzini 1d854765df target-arm: move arm_*_code to a separate file
These will soon require cpu_ldst.h, so move them out of cpu.h.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:10:33 +02:00
Paolo Bonzini 58ed270df9 softmmu: move softmmu_template.h out of include/
It is only included in cputlb.c now.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:10:33 +02:00
Paolo Bonzini 0f590e749f softmmu: commonize helper definitions
They do not need to be in op_helper.c.  Because cputlb.c now includes
softmmu_template.h twice for each size, io_readX must be elided the
second time through.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:10:33 +02:00
Paolo Bonzini d94f0a8ecb softmmu: move ALIGNED_ONLY to cpu.h
Prepare for moving softmmu_header.h inclusion out of .c files

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:10:33 +02:00
Paolo Bonzini 93e22326d6 softmmu: make do_unaligned_access a method of CPU
We will reference it from more files in the next patch.  To avoid
ruining the small steps we're making towards multi-target, make
it a method of CPU rather than just a global.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:10:31 +02:00
Paolo Bonzini ca0aa40816 softmmu: move definition of CPU_MMU_INDEX to inclusion site, drop ACCESS_TYPE
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:05:52 +02:00
Paolo Bonzini a6c9eac0d5 softmmu: move MMUSUFFIX under SOFTMMU_CODE_ACCESS
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:05:47 +02:00
Paolo Bonzini 859d76120b softmmu: start introducing SOFTMMU_CODE_ACCESS in softmmu_header.h
This preprocessor symbol is already used in softmmu_template.h.  We
will use it to distinguish the two "fake" ACCESS_TYPEs
NB_MMU_MODES and NB_MMU_MODES + 1.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:05:27 +02:00
Paolo Bonzini 0983979b3a hw: use ld_p/st_p instead of ld_raw/st_raw
The ld_raw and st_raw definitions are only needed in code that
must compile for both user-mode and softmmu emulation.  Device
models can use the equivalent ld_p/st_p which are simple
pointer accessors.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:04:17 +02:00
Paolo Bonzini fddbd80cc9 nseries: clean up coding style
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:03:53 +02:00
Stefan Weil 7e4e88656c cputlb: Fix regression with TCG interpreter (bug 1310324)
Commit 0f842f8a24 replaced GETPC_EXT() which
was derived from GETPC() by GETRA_EXT() without fixing cputlb.c. A later
patch replaced GETRA_EXT() by GETRA() in exec/softmmu_template.h which
is included in cputlb.c.

The TCG interpreter failed because the values returned by GETRA() were no
longer explicitly set to 0. The redefinition of GETRA() introduced here
fixes this.

In addition, GETPC_ADJ which is also used in exec/softmmu_template.h is
set to 0. Both changes reduce the compiled code size for cputlb.c by more
than 100 bytes, so the normal TCG without interpreter also profits from
the reduced code size and slightly faster code.

Cc: qemu-stable@nongnu.org
Reported-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:03:37 +02:00
Peter Maydell e00fcfeab3 VFIO patches: realtek NIC quirk + SPAPR IOMMU AddressSpace support
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTjPBKAAoJECObm247sIsi0fkP/1q5o3ZwwgO8y1lO43P39rRL
 BzCoa3EHGt0kGn7dImxFhjHClqhyqJL1SpaVOVTdTOmlOL1VVGJ/+2UJ0W7gB/jU
 zSYdmnX2UD5KNUrECqcWr+twNn1LGNcs3SCeFoe2WMmoPwqGHYs9FJmn5eqD7c6k
 iF3HD9H9sm1TauQ9iaFlg695Ap9y+MXOECaocYyx10j5wVyo4yByugtfrGjs3pOA
 BzzbRb89NAY+tneRnMoiWD3TS5CPYpvhWmAIW988u+mJLXLaO7CS1E7qacxuFUdu
 y2Z+pPjp6qpr1ZNYgOXqlrcW6/2PocP2qvwXN/P/waxN5OjDmkrOnT7hU0FWtTwz
 qnhrsPzaqthat28mLA+Fd0VXKkoMnGVilZixj59sXMnTjA1lL0sM8HMuGu/JRDCl
 Nqz9Mc2xhxegUZ6gyuIVBqY7qTO3x8DiVPGCAe3m6qiyWnNOBu5oBjnoz1ns5M5H
 aeysil1tp5PUGM3KomLXL8slkoo6Tiu0rKRI8tzwSWJ6VS0vtv5JrKKGF5oaTSL7
 YslkbQExoHa03aquUbc6DpN1LG35oOPhIg+HbErfp/Mb9j042s28rgeQ+55RNEev
 uJW0G0F8PYWr8DtIlk7bmVX0bFU8bV3O/gxNeb3jmTNXhcObNvr2GviZQr6UezLW
 ax1Nt+EhOfquV2j8uuLR
 =rimn
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140602.0' into staging

VFIO patches: realtek NIC quirk + SPAPR IOMMU AddressSpace support

# gpg: Signature made Mon 02 Jun 2014 22:44:42 BST using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

* remotes/awilliam/tags/vfio-pci-for-qemu-20140602.0:
  vfio: Add guest side IOMMU support
  vfio: Create VFIOAddressSpace objects as needed
  vfio: Introduce VFIO address spaces
  vfio: Rework to have error paths
  vfio: Fix 128 bit handling
  int128: Add int128_exts64()
  memory: Sanity check that no listeners remain on a destroyed AddressSpace
  vfio-pci: Quirk RTL8168 NIC

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-03 14:37:43 +01:00
Peter Maydell 278073ba29 seabios: update to 1.7.5 final
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTjI8XAAoJEEy22O7T6HE4iokQANmTbdW4InzVD/pBpizi0agp
 nbGyGpuiYCHkDORH0F0dmWsc8z2HMOZV+hNPyzal3tfD7E0shN7CuMOLcAVc6DDt
 qiYffdACgy84dRhDRfdl9pEnZ66nmlDAjka7p91oIZ6s3wwJzWWrfckdrey5MuaI
 cpDnbDy0MEfMnRt8Z8Y84WrDwKyFPsFhhx6nO/VKQtu0RXc66X9DTFDx+hy2dXCT
 5mFdKPBriHpOQMLa938dtVmbQjstU5C5CINHDlNOTqOs6hVxf/2X3+nZ/f4yxQSJ
 24kGLRUhvGvXwFxVmmwq6GUXiqIK2b3Lk5Hhyq35Vc5nM2/q1kFWr0/N4uk3yGGV
 bquRc9qTUe4B0ru3cGghH1uRnW9Uhg6NJZq5ss04IFgYuVcUZi+4sTA0A5gYK62Z
 iMOFGi5yMarxHGfFq0a0PMTRTQ2YyrP98S2hs54PNpicvTh7gLh/hUemj4guTarW
 +gIR4sgN4JayX8+lKPDjUPe4CgcoXdFdWCSIX6L7YId5S8RMEffWVS3NAYbI1qhC
 2PVUMsvITDibyKvtS9k10rF4NgvISEjBdk5dD9yvoHbO76b0eFHh1x9iTuBigERS
 yTKIa45i6FpXtgKpOPErdkvAckl9HUbTOh75MoIS4wLbVjQIvTqJMmXmVNVyOcfy
 Jsa3tb4PPehaSDDLat5L
 =AZIF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-roms-3' into staging

seabios: update to 1.7.5 final

# gpg: Signature made Mon 02 Jun 2014 15:49:59 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/kraxel/tags/pull-roms-3:
  seabios: update to 1.7.5 final

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-03 11:59:48 +01:00
Peter Maydell 82ea61c6da qtest: improve ehci/uhci test
usb: misc fixes, mostly for usb3/xhci
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTjIziAAoJEEy22O7T6HE4HNMP/A9kbK49yK4o+/9tdemCsNnD
 KfDlt8K+NPnI1VzhOTOpbFN1ci5Oq1VQ0syw6uIwU5v8E0ZXKoS7uqIYKTx2rjfX
 w5tGSlK/gjYGLeN/VhbIOcELuBo2hdUDzYEpjdcUZ0L4xkKRVwoN30P292/KlRTu
 ZBOdaz4JlrGJRTUgb35GaVNhtSFAdIPNUHlzdyq+lJJuJq4quQh4mO3J/eQqRveJ
 EiLRKvc1FV4Z0tLZ3tzKemDYGJoA6conRCe+Xt+fmdlROm/037HjQ+/KqUyXKdFs
 hpYAj58bKrtIE9Dyo3MwD7/4R2XgkDYNGXeGlrGTgmkhwujme8vB/K57sqYlLnE1
 1iCf03gXd+Ap1zU7BTv+abFfuA/7SFnkIgs3+zU68UFfmiBKGDQgxLCnqGMWlari
 DpIf94T7ZLdNz6sc4FG4gQCP+aVJYTUjkjtunfJMfE/qz6Xb5BJQIPc3aHnAsqrb
 LG75rjJfS1rh1+SvNm7f46fC+7A9eKYOlbkbH8c3BQDCJkZyeWovnml4xIlLkvkg
 8xJB5UJVb4B4MKQW7Zi0hrDaN8/GVVyWymtt3Dl/I2iHBdV2Z/U+2/rFtLtZQ1zi
 oLl+ZteHaU3hnr5DNns3DuMSG33UT+o9gzaHsUldetwLiyGOiUC2i4P3xPD7fPID
 mJKO98266m9KMshEdw7k
 =4LqT
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-8' into staging

qtest: improve ehci/uhci test
usb: misc fixes, mostly for usb3/xhci

# gpg: Signature made Mon 02 Jun 2014 15:40:34 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/kraxel/tags/pull-usb-8:
  xhci: order superspeed ports first
  xhci: make port reset trace point more verbose
  usb: add usb_pick_speed
  usb-host: add HAVE_STREAMS define
  usb-host: allow attaching usb3 devices to ehci
  usb: improve ehci/uhci test
  usb: move ehci register defines to header file
  usb: add uhci port status reserved bit
  usb: move uhci register defines to header file
  qtest: fix qpci_config_writel

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-02 17:07:21 +01:00
Peter Maydell 1673e89e93 sdl2: add support for text consoles
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTjIuoAAoJEEy22O7T6HE4qYQQALToHNyddpNlMHRUIbmCqKsY
 vDPxUJIy/DGcW8wzH6dvrPFa28QVYGBnrhfpj9ck4Kc1YpN8NrQE+0I8wS3snpuw
 LRwUkmzc+we07iPK0pFn1vpgXek0BYAZVtXUayDQnf79j83rVkHoOB8cFu/2IwA3
 FJR9pvBrQuqdblrEEFMmAvw6cBtSoqWXae+fjxzRdopC9Oz0pJUfr1FT+MXvhOPY
 FjC6G00JmAN3cGStanbs4HL4RFWEf7PSmETJXHOIPe6OA6ky1peINw37Z4AXGJNZ
 Gv9A59spjC3vhqO1DzhuA1eDZjLrQf+YfPsvAXvEq7GkLJ9j8TJu+uoaZuMhQ+6n
 RqoUG9TgDX9Hhfr07tYD2IOZdQiZ6Epb43OjZaJqp1NcS0LGdvt4/ewu6UxrzRw4
 gU0x1p47BsQc1RJJ4668rswjqmwaOhkDhwaWgCCQ0PdSGxN2SC/4sGqO9WCLkL3L
 MjgnNL3ZqxEN6UDW8o80JzZ0VEFLq8jlKOT8wBMquM4zgV3+ICi+StaLuOMnetmM
 LVKqpm3DcxvKWoDx7GZHQkk2ExXND4O41yLV1Q1mYXJSM7YZtDBz5VwZqFKVRqJl
 aE/xP0IIZIPXjO14uz7aH+kQoc43WSIZEeKv3KvJNqpdP9H6a9o//0PzKfdDsUB/
 nw93tGaQVlwGzaD5wEmf
 =Ma/a
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-3' into staging

sdl2: add support for text consoles

# gpg: Signature made Mon 02 Jun 2014 15:35:20 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/kraxel/tags/pull-sdl-3:
  sdl2: textinput + terminal
  sdl2: make Ctrl-Alt-<nr> hotkeys show and hide windows
  console: add kbd_put_string_console
  console: add kbd_put_qcode_console

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-02 16:10:12 +01:00
Gerd Hoffmann 3257fc8383 seabios: update to 1.7.5 final
git shortlog since -rc1:

Gerd Hoffmann (2):
      acpi: remove PORT_ACPI_PM_BASE constant
      Allow using full io region on q35.

Kevin O'Connor (2):
      vgabios: Add debug message if x86emu leal check triggers.
      python3 fixes for vgabios and csm builds.

Paolo Bonzini (1):
      smm: remove code to handle ACPI disable/enable

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:49:00 +02:00
Peter Maydell 36f5db59cf misc minor vnc patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTjIrZAAoJEEy22O7T6HE4ZyYQAN0C+pnrzqMP+BSJ3vgnC7cR
 cFkg/03jHM/IBpbqmTyqnkJ/15KNLouuP6kCXYSJi/bYZJ3VLJcw0kaJGuHSx+cN
 trJMsQUMr8bMjR15A18gerisnrkKfmcuQ1gz/dzNj7KWaQ4kO8IsRxrX4SD5qxSF
 1qmGQwu2hJWQ1eY7UzM+IZgKst6eiXh4nkCtz+gCOGsmGMHML/D6LWVKGuL83EWh
 pu7ToByzcPdzw80uRDRcwGO1Xjs+quMsIA+Z5N19cbACps6pnMgySj3qNBLF3BY8
 dKRpLANX6QpI58DqQiX1DEfmBO0ObRYeo0Fy38bPGlKdlnhFzibrtZ8gITyWUR/l
 WZSancv8ExdXh+DKepFbRwxSQ9VMdKp9ICl25WYFEyChza1lF3Tax12QBxOy0v4U
 nDfZaCVQQFQxEZKLKPCguExdTashPZ3FbNVZDgWkZ99V9eBFIiNLAWxjOw8cQdOw
 pvP55vH73xwuG4ZdwnXGrkXMwBIONYyv1AbUWgkmNxMrDyKqOLf1UnZB950iCxUw
 P7f5d5N1nI+Vm/M13pxTY/yBU2ryNNwZ1YN1P5+laMgwPoPj+93b21nhoWTDB56q
 9GOpWyF3yWKzt5DNIkXO4H+BhMHvb/LGUBTWIidShyLSyEXHslWPbYxpjsuQmeEn
 U6xmn6eD2FySOrDuEEgR
 =ZPEW
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-3' into staging

misc minor vnc patches

# gpg: Signature made Mon 02 Jun 2014 15:31:53 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/kraxel/tags/pull-vnc-3:
  vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16,24,32}
  vnc: add trace events for key events
  vnc: refuse to set a password with VNC_AUTH_NONE

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-02 15:47:40 +01:00
Gerd Hoffmann 7bafd8889e xhci: order superspeed ports first
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:38:09 +02:00
Gonglei b52991537c vnc-enc-tight: Fix divide-by-zero in tight_detect_smooth_image{16,24,32}
Spotted by Coverity:

(1) Event assignment:  Assigning: "pixels" = "0".
(2) Event cond_true:  Condition "y < h", taking true branch
(3) Event cond_false:  Condition "x < w", taking false branch
(4) Event loop_end:  Reached end of loop
(5) Event divide_by_zero:  In expression "(stats[0] + stats[1]) * 100U / pixels",
division by expression "pixels" which may be zero has undefined behavior.

290     DEFINE_DETECT_FUNCTION(16)
291     DEFINE_DETECT_FUNCTION(32)

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:30:52 +02:00
Gerd Hoffmann 4006617552 vnc: add trace events for key events
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:29:01 +02:00
Gerd Hoffmann cf864569cd vnc: refuse to set a password with VNC_AUTH_NONE
Current code silently changes the authentication settings
in case you try to set a password without password authentication
turned on.  This is bad.  Return an error instead.

If we want allow changing auth settings at runtime this should
be done explicitly using a separate monitor command, not as
side effect of set_passwd.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:29:01 +02:00
Gerd Hoffmann 7bd3055ffd xhci: make port reset trace point more verbose
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:29:00 +02:00
Gerd Hoffmann b791c3b38c usb: add usb_pick_speed
We can pick the usb port speed in generic code, by looking at the port
and device speed masks and looking for the fastest match.  So add a
function to do exactly that, and drop the speed setting code from
usb_desc_attach as it isn't needed any more.

This way we can set the device speed before calling port->ops->attach,
which fixes some xhci hotplug issues.

https://bugzilla.redhat.com/show_bug.cgi?id=1046873

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:29:00 +02:00
Gerd Hoffmann 322fd1f4f7 usb-host: add HAVE_STREAMS define 2014-06-02 16:29:00 +02:00
Gerd Hoffmann b88a3e01f5 usb-host: allow attaching usb3 devices to ehci
Extend compatibility test function to also figure whenever usb3
devices can be supported on ehci.  Tweak ep0 maxpacketsize field
due to usb2 <-> usb3 difference.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:59 +02:00
Gerd Hoffmann d81d410635 usb: improve ehci/uhci test
* Attach usb devices to the bus.
 * Check initial port status register state.
 * Flip ehci initialization bit.
 * Check port status register state again to
   see whenever device handover to ehci worked.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:59 +02:00
Gerd Hoffmann 381626a969 usb: move ehci register defines to header file
So we can easily use them in tests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:59 +02:00
Gerd Hoffmann 95dd1c4d7a usb: add uhci port status reserved bit
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:59 +02:00
Gerd Hoffmann 9a1d111e70 usb: move uhci register defines to header file
So we can easily use them in tests.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:59 +02:00
Gerd Hoffmann ad489e9346 qtest: fix qpci_config_writel
Found by Paolo.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:59 +02:00
Gerd Hoffmann f2335791fd sdl2: textinput + terminal
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:58 +02:00
Gerd Hoffmann 363f59d9e4 sdl2: make Ctrl-Alt-<nr> hotkeys show and hide windows
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:58 +02:00
Gerd Hoffmann bdef972474 console: add kbd_put_string_console
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:58 +02:00
Gerd Hoffmann 50ef467923 console: add kbd_put_qcode_console
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-06-02 16:28:58 +02:00
Peter Maydell f72b49398f Block patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTjIJwAAoJEH8JsnLIjy/WVGsQALIytTnSQcYtB2R0Npw0R9pO
 Zhp1hcAN8sQKEbfA7t4lp9rmc2+JhgwQO7KI/3Dhk43/LQFLOEPtDsEINZT830QZ
 gvaHQVNLGhxhuIZG2njeJB2CEfBRjJjZ5DtA5sHAsKLcQKbA0xBCqhlCAL5gZ7/O
 Up/TOXOP396n4oIjBzUGY0WRxVYTaixpEQuk7oCh2/s3hihj3GU6PKjB8bqHd9PE
 bwaXv2gIkaHnsTyHn9QvRTci9EqNcpV1uSPGvjU7C7hDhIx30EXBC0ptY619PtYc
 nTqRkc0jU+jq2CMUbOwkKFDMN4rivYwxpWs8iOZZViFUuSWfmsMWXXTNRNybWGwa
 o6FCBwXqTYVa+a7048oDZAEGZkbiM4upzWtlztjSGEoRGgra81WQUiltUsJi+U3s
 kySVCCNdMWY5jwN3ceEuhZpQ8Uv8qpMS857TFax1tQb0RjLu2vKHf1rUuNmtAyJ1
 fPYvsXAgEozavhl63vOCo1mgZknvId9keO8p9h23HObZJhcMORNZ/eMKzK2OjMQe
 T1QmWBTBXs0ULkuv4E7CwSQ9Dr09VJnTHM5EjekhxXfu1Dq4N/6gZmcoWu49VIvg
 Ho6Xg72z+sFdJ7Y/l8oCqUKCJdmQT2GeqKEkS3QiH0nY+J26ZtGNnylm1cUQzY7Z
 3tbAuQi/mIDVF++M08CA
 =WVw4
 -----END PGP SIGNATURE-----

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

Block patches

# gpg: Signature made Mon 02 Jun 2014 14:56:00 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  qemu-img: Report error even with --oformat=json
  vmdk: Fix local_err in vmdk_create
  block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX
  qemu-img: Plug memory leak in convert command
  block/sheepdog: Plug memory leak in sd_snapshot_create()
  block/vvfat: Plug memory leak in read_directory()
  block/vvfat: Plug memory leak in check_directory_consistency()
  block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR
  blockdev: Plug memory leak in drive_init()
  blockdev: Plug memory leak in blockdev_init()
  qemu-io: Don't print NULL when open without non-option arg fails
  qemu-io: Plug memory leak in open command
  qemu-io: Support multiple -o in open command
  block: Plug memory leak on brv_open_image() error path
  qcow2: Plug memory leak on qcow2_invalidate_cache() error paths
  block/vvfat: Plug memory leak in enable_write_target()
  qemu-img: Plug memory leak on block option help error path

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-02 15:27:18 +01:00
Peter Maydell 9bb931802e Revert "bsd-user: replace fprintf(stderr, ...) with error_report()"
This reverts commit 1fba509527.

That commit converted various fprintf(stderr, ...) calls to
use error_report(); however none of these bsd-user files include
a header which gives a prototype for error_report, so this
causes compiler warnings. Since these are just straightforward
reporting of command line errors, we should handle these in the
obvious way by printing to stderr, as we do for linux-user.
There's no need to drag in the error-handling framework for this,
especially since user-mode doesn't have the "maybe we need to
send this to the monitor" issues system emulation does.

Acked-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-02 13:26:59 +01:00
Max Reitz 55d492d760 qemu-img: Report error even with --oformat=json
img_check() should report that the format of the given image does not
support checks even if JSON output is desired. JSON data is output to
stdout, as opposed to error messages, which are (in the case of
qemu-img) printed to stderr. Therefore, it is easy to distinguish
between the two.

Also, img_info() does already use error_report() for human-readable
messages even though JSON output is desired (through
collect_image_info_list()).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-02 13:58:40 +02:00
David Gibson 5e70018b00 vfio: Add guest side IOMMU support
This patch uses the new IOMMU notifiers to allow VFIO pass through devices
to work with guest side IOMMUs, as long as the host-side VFIO iommu has
sufficient capability and granularity to match the guest side. This works
by tracking all map and unmap operations on the guest IOMMU using the
notifiers, and mirroring them into VFIO.

There are a number of FIXMEs, and the scheme involves rather more notifier
structures than I'd like, but it should make for a reasonable proof of
concept.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 13:10:07 -06:00
David Gibson 0688448b71 vfio: Create VFIOAddressSpace objects as needed
So far, VFIO has a notion of different logical DMA address spaces, but
only ever uses one (system memory).  This patch extends this, creating
new VFIOAddressSpace objects as necessary, according to the AddressSpace
reported by the PCI subsystem for this device's DMAs.

This isn't enough yet to support guest side IOMMUs with VFIO, but it does
mean we could now support VFIO devices on, for example, a guest side PCI
host bridge which maps system memory at somewhere other than 0 in PCI
space.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 13:09:14 -06:00
David Gibson 3df3e0a587 vfio: Introduce VFIO address spaces
The only model so far supported for VFIO passthrough devices is the model
usually used on x86, where all of the guest's RAM is mapped into the
(host) IOMMU and there is no IOMMU visible in the guest.

This patch begins to relax this model, introducing the notion of a
VFIOAddressSpace.  This represents a logical DMA address space which will
be visible to one or more VFIO devices by appropriate mapping in the (host)
IOMMU.  Thus the currently global list of containers becomes local to
a VFIOAddressSpace, and we verify that we don't attempt to add a VFIO
group to multiple address spaces.

For now, only one VFIOAddressSpace is created and used, corresponding to
main system memory, that will change in future patches.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 13:05:19 -06:00
Alexey Kardashevskiy 279a35ab4a vfio: Rework to have error paths
This reworks vfio_connect_container() and vfio_get_group() to have
common exit path at the end of the function bodies.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 13:03:21 -06:00
Alexey Kardashevskiy 7532d3cbf1 vfio: Fix 128 bit handling
Upcoming VFIO on SPAPR PPC64 support will initialize the IOMMU
memory region with UINT64_MAX (2^64 bytes) size so int128_get64()
will assert.

The patch takes care of this check. The existing type1 IOMMU code
is not expected to map all 64 bits of RAM so the patch does not
touch that part.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 13:02:02 -06:00
Alexey Kardashevskiy 12e1129b80 int128: Add int128_exts64()
This adds macro to extend signed 64bit value to signed 128bit value.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 13:00:28 -06:00
David Gibson 078c44f48e memory: Sanity check that no listeners remain on a destroyed AddressSpace
At the moment, most AddressSpace objects last as long as the guest system
in practice, but that could well change in future.  In addition, for VFIO
we will be introducing some private per-AdressSpace information, which must
be disposed of before the AddressSpace itself is destroyed.

To reduce the chances of subtle bugs in this area, this patch adds
asssertions to ensure that when an AddressSpace is destroyed, there are no
remaining MemoryListeners using that AS as a filter.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 12:59:00 -06:00
Alex Williamson 4cb47d281a vfio-pci: Quirk RTL8168 NIC
This device is ridiculous.  It has two MMIO BARs, BAR4 and BAR2.  BAR4
hosts the MSI-X table, so oviously it would be too easy to access it
directly, instead it creates a window register in BAR2 that, among
other things, provides access to the MSI-X table.  This means MSI-X
doesn't work in the guest because the driver actually manages to
program the physical table.  When interrupt remapping is present, the
device MSI will be blocked.  The Linux driver doesn't make use of this
window, so apparently it's not required to make use of MSI-X.  This
quirk makes the device work with the Windows driver that does use this
window for MSI-X, but I certainly cannot recommend this device for
assignment (the Windows 7 driver also constantly pokes PCI config
space).

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2014-05-30 12:43:50 -06:00
Fam Zheng c13959c745 vmdk: Fix local_err in vmdk_create
In vmdk_create and vmdk_create_extent, initialize local_err before using
it, and don't leak it on error.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30 14:26:54 +02:00
Peter Maydell 675036e4da block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX
In the MacOSX specific code in raw-posix.c we use the define
LONG_LONG_MAX. This is actually a non-standard pre-C99 define;
switch to using the standard LLONG_MAX instead.

This apparently fixes a compilation failure with certain
compiler/OS versions (though it is unclear which).

Reported-by: Peter Bartoli <peter@bartoli.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30 14:26:54 +02:00
Markus Armbruster bb9cd2ee99 qemu-img: Plug memory leak in convert command
Introduced in commit 661a0f7.  Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30 14:26:54 +02:00
Markus Armbruster 2df5fee2db block/sheepdog: Plug memory leak in sd_snapshot_create()
Has always been leaky.  Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30 14:26:54 +02:00