Commit Graph

39030 Commits

Author SHA1 Message Date
Peter Maydell a849047372 A set of patches add support for vector registers on s390x.
Notable: Floating point registers and vector registers overlap,
 so extra care is needed so that we end up with a consistent state
 in all cases.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJVZtPHAAoJEN7Pa5PG8C+vsTwP/RMv8R5l//hREjmTPXqMcnrE
 8Z2GQgkTJWxBSyqzCjGOpzS3F4mX3gI10bArTVVaGIOJKGbtuiiqWeF1Fkc193Pm
 RqlyWYjWHTY4fJvl+xYP5dIGTH2C8WeLkfhGc4QvFnnCBPHMGzVs3sw9LFq8xJ/p
 kC64/VQDZraSSsNx9uQ0IeYy5qI4ZzUnSWMerr27AAXpBOdp3FD8jpRyVzN1VPWD
 dlyUugYq1E7y3AR/hnANYr3uCTXNlQ4f1aa8y6GYHzED5UnMnFEVE0InCYWGYyql
 xb2cusdA8ZyMNtvs3r0FyjVlAvHGLNNeJncspJCvmUImcZHwXcFttpQCnK4OJD6t
 CTDmd3b4Wz9ljzYWPz/KgxygkqZyLZ7Fmn3DfTY+Zrq+18dasqSnsj/SMtywlGpB
 pKchNlD0oGLS3xKtDaHQhhpJD4tIw0CxT9MsYcLp0uwCB8zkUnuSXtIPhpVubg9F
 4DYnQG538LtJM4g4qUQYmMxE6IQSAxvKE+2GjyZa4JVL/Nv1oYkWwDY/6cWYekIQ
 u1aRZ1b1px9MrpaO/NfU2+7Ict0uKQrrzf64amqnBy1JmV5uie/JIrIcn26dpFeL
 KN4blfG5oZXRAkoY3PxeLYGCAPle4Lp0BHI6WXh2STCyYsYBsq/IAs66qt1Q/VQZ
 S+mJISMu6bqSuI1EQb99
 =y7nj
 -----END PGP SIGNATURE-----

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

A set of patches add support for vector registers on s390x.
Notable: Floating point registers and vector registers overlap,
so extra care is needed so that we end up with a consistent state
in all cases.

# gpg: Signature made Thu May 28 09:37:27 2015 BST using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20150528:
  s390x: Enable vector processing capability
  s390x: Migrate vector registers
  s390x: Add vector registers to ELF dump
  linux/elf.h update
  s390x: Add vector registers to HMP output
  s390x: gdb updates for vector registers
  gdb-xml: Include XML for s390 vector registers
  s390x: Store Additional Status SIGP order
  s390x: Vector Register IOCTLs
  s390x: Common access to floating point registers

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-05-28 14:57:34 +01:00
Peter Maydell bc3004f0bb -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQEcBAABAgAGBQJVZZZPAAoJEJykq7OBq3PIlY8H/jssSf1iBbV6B8oySzcPpNyC
 asTxOxwhkcydgVFzF3xy2H+YUJEfCyRLU4rGTvhIAdawjnCYQBWSyKDz4omWlJ4w
 4gc3Cyw7ZOK1V0wTs21h071roC+vMJIODXfcO8JuYGtJzKrOLVrPILdLEkhl/uLN
 YPLj89gvMcatF6hC3BUYkltBlp42fJIP+9Jhc9OBdxmAyGJFcUZPkyoKaF3FnhTT
 cdE3n75uf3jAIuG14NT6WK8wbKjUX4OQ/alo/gg87fUHaVZduZnAAb1XozyJ/e5o
 nuS9uKmuM/2QN/kb7As4cY3haRtAERO/bAiGhI5i2tahwn+o4uQ7ohfu7fC+RX0=
 =bVyU
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

# gpg: Signature made Wed May 27 11:02:55 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  net/net: Record usage status of mac address
  tap: Improve -netdev/netdev_add/-net/... tap error reporting
  tap: Finish conversion of tap_open() to Error
  tap-solaris: Convert tap_open() to Error
  tap-bsd: Convert tap_open() to Error
  tap-linux: Convert tap_open() to Error
  tap: Permit incremental conversion of tap_open() to Error
  tap: Convert launch_script() to Error
  tap: Convert net_init_tap_one() to Error
  tap: Convert tap_set_sndbuf() to Error
  tap: Improve -netdev/netdev_add/-net/... bridge error reporting
  tap: net_tap_fd_init() can't fail, drop dead error handling
  net/dump: Improve -net/host_net_add dump error reporting
  net: Improve -net nic error reporting
  net: Permit incremental conversion of init functions to Error
  net: Improve error message for -net hubport a bit
  net: Change help text to list -netdev instead of -net by default

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-05-28 11:03:02 +01:00
Eric Farman 46ca6b3bc9 s390x: Enable vector processing capability
Everything is finally in place, inform the kernel that user space
supports vector registers.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:04 +02:00
Eric Farman b2ac0ff5d9 s390x: Migrate vector registers
When migrating a guest, be sure to include the vector registers.
The vector registers are defined in a subsection, similar to the
existing subsection for floating point registers.  Since the
floating point registers are always present (and thus migrated),
we can skip them when performing the migration of the vector
registers which may or may not be present.

Suggested-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman 3ceeb2930f s390x: Add vector registers to ELF dump
Create ELF notes for the vector registers where applicable, so that
their contents can be examined by utilities such as crash or readelf.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman eeef559ab4 linux/elf.h update
Sync with kernel elf.h updates to get s390x vector register definitions.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman 56c4227149 s390x: Add vector registers to HMP output
There are mechanisms to dump registers via the qemu HMP interface,
such as the "info registers" command.  Expand this output to dump
the new vector registers.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman ca343c7a84 s390x: gdb updates for vector registers
gdb allows registers to be displayed/modified, and is being updated
to account for the new vector registers.  Mirror these changes in
the gdb stub in qemu so that this can be performed when gdb is
attached to the qemu gdbserver.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman 773d4ebc9a gdb-xml: Include XML for s390 vector registers
Include the vector registers XML file that is provided by gdb,
and can be used by the qemu gdbserver interface.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman abec53565d s390x: Store Additional Status SIGP order
Add handling for the Store Additional Status at Address order
that exists for the Signal Processor (SIGP) instruction.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman fcb79802e0 s390x: Vector Register IOCTLs
Handle the actual syncing of the vector registers with kernel space,
via the get/put register IOCTLs.

The vector registers that were introduced with the z13 overlay
the existing floating point registers.  FP registers 0-15 are
the high-halves of vector registers 0-15.  Thus, remove the
freg fields and replace them with the equivalent vector field
to avoid errors in duplication.  Moreover, synchronize either the
vector registers via kvm_sync_regs, or floating point registers
via the GET/SET FPU IOCTLs.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman c498d8e36e s390x: Common access to floating point registers
Provide a routine to access the correct floating point register,
to simplify future expansion.

Suggested-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Shannon Zhao 2bc22a58e1 net/net: Record usage status of mac address
Currently QEMU dynamically generates mac address for the NIC which
doesn't specify the mac address. But when we hotplug a NIC without
specifying mac address, the mac address will increase for the same NIC
along with hotplug and hot-unplug, and at last it will overflow. And if
we codeplug one NIC with mac address e.g. "52:54:00:12:34:56", then
hotplug one NIC without specifying mac address and the mac address of
the hotplugged NIC is duplicate of "52:54:00:12:34:56".

This patch add a mac_table to record the usage status and free the mac
address when the NIC is unrealized.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:34:07 +01:00
Markus Armbruster a308817743 tap: Improve -netdev/netdev_add/-net/... tap error reporting
When -netdev tap fails, it first reports a specific error, then a
generic one, like this:

    $ qemu-system-x86_64 -netdev tap,id=foo
    qemu-system-x86_64: -netdev tap,id=foo: could not configure /dev/net/tun: Operation not permitted
    qemu-system-x86_64: -netdev tap,id=foo: Device 'tap' could not be initialized

With the command line, the messages go to stderr.  In HMP, they go to
the monitor.  In QMP, the second one becomes the error reply, and the
first one goes to stderr.

Convert net_init_tap() to Error.  This suppresses the unwanted second
message, and makes the specific error the QMP error reply.

[Dropped duplicate "and" from error message as suggested by Eric Blake:
"ifname=, script=, downscript=, and vnet_hdr=, "
"queues=, and vhostfds= are invalid with helper="
--Stefan]

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-16-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:34:07 +01:00
Markus Armbruster 95c35a74fe tap: Finish conversion of tap_open() to Error
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-15-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:34:07 +01:00
Markus Armbruster 576c6eb670 tap-solaris: Convert tap_open() to Error
Fixes inappropriate use of syslog().

Not fixed: leaks on error paths, suspicious non-fatal errors.  FIXMEs
added instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-14-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:34:07 +01:00
Markus Armbruster 4bce487e14 tap-bsd: Convert tap_open() to Error
Fixes inappropriate use of stderr in monitor command handler.

While there, improve some of the messages a bit.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-13-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:34:07 +01:00
Markus Armbruster 47896e2fd3 tap-linux: Convert tap_open() to Error
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-12-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:34:07 +01:00
Markus Armbruster 468dd82408 tap: Permit incremental conversion of tap_open() to Error
Convert the trivial ones immediately: tap-aix and tap-haiku.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-11-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:34:07 +01:00
Markus Armbruster ac4fcf5639 tap: Convert launch_script() to Error
Fixes inappropriate use of stderr in monitor command handler.

While there, improve the messages some.

[Fixed Error **err -> Error *err local variable that broke the build.
--Stefan]

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-10-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 10:33:35 +01:00
Markus Armbruster 445f116cab tap: Convert net_init_tap_one() to Error
[Dropped %s from "tap: open vhost char device failed: %s" since
error_setg_errno() already prints a human-readable error string and
there is no format string argument.
--Stefan]

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-9-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:05 +01:00
Markus Armbruster 80b832c300 tap: Convert tap_set_sndbuf() to Error
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-8-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:05 +01:00
Markus Armbruster a8a21be985 tap: Improve -netdev/netdev_add/-net/... bridge error reporting
When -netdev bridge fails, it first reports a specific error, then a
generic one, like this:

    $ qemu-system-x86_64 -netdev bridge,id=foo
    failed to launch bridge helper
    qemu-system-x86_64: -netdev bridge,id=foo: Device 'bridge' could not be initialized

The first message goes to stderr.  Wrong for HMP, because errors need
to go to the monitor there.

The second message goes to stderr for -netdev, to the monitor for HMP
netdev_add, and becomes the error reply for QMP netdev_add.

Convert net_bridge_run_helper() to Error, and propagate its errors
through net_init_bridge().  This ensures the error gets reported where
the user is, and suppresses the unwanted second message.

While there, improve the error messages a bit.

The above example becomes:

    $ qemu-system-x86_64 -netdev bridge,id=foo
    qemu-system-x86_64: -netdev bridge,id=foo: bridge helper failed

net_init_tap() also uses net_bridge_run_helper().  Propagate its
errors there as well.  Improves reporting these errors with -netdev
tap & friends.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-7-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:05 +01:00
Markus Armbruster da4a4eac26 tap: net_tap_fd_init() can't fail, drop dead error handling
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-6-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:05 +01:00
Markus Armbruster 3791f83ca9 net/dump: Improve -net/host_net_add dump error reporting
When -net dump fails, it first reports a specific error, then a
generic one, like this:

    $ qemu-system-x86_64 -net dump,id=foo,file=/eperm
    qemu-system-x86_64: -net dump,id=foo,file=/eperm: -net dump: can't open /eperm
    qemu-system-x86_64: -net dump,id=foo,file=/eperm: Device 'dump' could not be initialized

Convert net_init_tap() to Error.  This suppresses the unwanted second
message.

Improve the error messages to include strerror(errno) where
appropriate.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-5-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:05 +01:00
Markus Armbruster 6630886863 net: Improve -net nic error reporting
When -net nic fails, it first reports a specific error, then a generic
one, like this:

    $ qemu-system-x86_64 -net nic,netdev=nonexistent
    qemu-system-x86_64: -net nic,netdev=nonexistent: netdev 'nonexistent' not found
    qemu-system-x86_64: -net nic,netdev=nonexistent: Device 'nic' could not be initialized

Convert net_init_nic() to Error to get rid of the unwanted second
error message.

While there, tidy up an Overcapitalized Error Message.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-4-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:05 +01:00
Markus Armbruster a30ecde6e7 net: Permit incremental conversion of init functions to Error
Error reporting for netdev_add is broken: the net_client_init_fun[]
report the actual errors with (at best) error_report(), and their
caller net_client_init1() makes up a generic error on top.

For command line and HMP, this produces an mildly ugly error cascade.

In QMP, the actual errors go to stderr, and the generic error becomes
the command's error reply.

To fix this, we need to convert the net_client_init_fun[] to Error.

To permit fixing them one by one, add an Error ** parameter to the
net_client_init_fun[].  If the call fails without returning an Error,
make up the same generic Error as before.  But if it returns one, use
that instead.  Since none of them does so far, no functional change.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-3-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:04 +01:00
Markus Armbruster ca7eb1848b net: Improve error message for -net hubport a bit
Type "hubport" is valid only with -netdev.  Unfortunately, that's
detected late and the error message doesn't explain why:

    $ qemu-system-i386 -net hubport,id=foo,hubid=0
    qemu-system-i386: -net hubport,id=foo,hubid=0: Device 'hubport' could not be initialized

Improve the error message to "Parameter 'type' expects a net type".

Not fixed: -net hubport without the parameters required by -netdev
hubport still asks for those parameters:

    $ qemu-system-i386 -net hubport
    qemu-system-i386: -net hubport: Parameter 'hubid' is missing

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1431691143-1015-2-git-send-email-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:04 +01:00
Thomas Huth 6a8b4a5be2 net: Change help text to list -netdev instead of -net by default
Looking at the output of "qemu-system-xxx -help", you easily get
the impression that "-net" is the preferred way instead of "-netdev"
to specify host network interface, since the "-net" option is
omnipresent but the "-netdev" option is only listed as a one-liner
at the end. This is ugly since "-net" is considered as legacy and
even might be removed one day. Thus, this patch switches the output
to explain the host network interfaces with the "-netdev" option
instead, moving the old "-net" option into some few lines at
the end.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1431701904-12230-1-git-send-email-thuth@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-05-27 09:51:04 +01:00
Peter Maydell 0915aed584 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQIcBAABAgAGBQJVX4p0AAoJEH3vgQaq/DkOuLAQAIWV1mHP5ZjzN81eeFxxe4VI
 gD2CgJ1MddFQcVplHjhj7ppwYKqusldvRhvxb5LO2hhtYDNDisFRotFF1zsnWNfo
 /CjSG9U/GUCKs1VDJ0XRIpCRohQHIZnhRb/GmVSuPx4tT2aDu4J1YEYpCYG78ajD
 YpHPmnE3LuJnzMwXHTB3WaF6AWyYNbA4mX7cH8kfHVZS8zPBMZi9v80QJSg1Tb9u
 XysiFsdQt8LHP3n/EShdv7cFt131nZxZeWozHQwzk2RKniI8iuJsZw/uf+GIPNDp
 52klQXIdTLw4xJAfNt1zntbLNXrcbP2VTwgKRYQEOeyL1BzCym03W/LwJwMFhAPC
 mnB8QU/HFkpQj7cqALB4drc5BNGeSfwkcDODK+yhe1vjKV78LE/zOmrVxUA/rEKa
 IBJYv0k44JijAJxyZIijSVBH69OZPBtczEmHkcI6k8THonQlpNB0oLOj97oDGqM+
 bFYrPRK0WKfG7enC2cPLAdXC3xSwWXumReA4xeIw/FMpQJHAmkt2xEE6VI+zKZUD
 h4bL4l6nKFX1bQ+0A08Z6UQIAhC1p1F/ZQmjoTSQezRAR2Nd9NfEOl8iUnJMIUTr
 3NPmtZLTqv/rBZdCpgBZ/8a+sBja9met91DGCd5fJ6rmHpTc9qiRQkemhyho8UDv
 vfeWvrQz4WHLEhCIbFEI
 =JDLF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging

# gpg: Signature made Fri May 22 20:58:44 2015 BST using RSA key ID AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/ide-pull-request:
  ahci: do not remap clb/fis unconditionally
  macio: move unaligned DMA write code into separate pmac_dma_write() function
  macio: move unaligned DMA read code into separate pmac_dma_read() function
  qtest: pre-buffer hex nibs
  libqos/ahci: Swap memread/write with bufread/write
  qtest: add memset to qtest protocol
  qtest: Add base64 encoded read/write
  qtest: allow arbitrarily long sends
  qtest/ahci: add migrate halted dma test
  qtest/ahci: add halted dma test
  qtest/ahci: add flush migrate test
  qtest/ahci: add migrate dma test
  qtest/ahci: Add migration test
  ich9/ahci: Enable Migration
  libqos: Add migration helpers
  libqos/ahci: Fix sector set method
  libqos/ahci: Add halted command helpers
  glib: remove stale compat functions
  configure: require glib 2.22

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-05-26 11:31:03 +01:00
John Snow cd6cb73beb ahci: do not remap clb/fis unconditionally
This continues the IOMMU fix from 2.3, where we should not attempt
to remap the CLB or FIS RX buffers if the AHCI device is currently
running.

The same applies to migration: keep our mitts off these registers
unless the device is supposed to be on.

Does not impact backwards compatibility for the AHCI device.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1431470173-30847-2-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
Mark Cave-Ayland bd4214fc92 macio: move unaligned DMA write code into separate pmac_dma_write() function
Similarly switch the macio IDE routines over to use the new function and
tidy-up the remaining code as required.

[Maintainer edit: printf format codes adjusted for 32/64bit. --js]

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: John Snow <jsnow@redhat.com>
Message-id: 1425939893-14404-3-git-send-email-mark.cave-ayland@ilande.co.uk
Signed-off-by: John Snow <jsnow@redhat.com>
2015-05-22 15:58:22 -04:00
Mark Cave-Ayland 4827ac1e8f macio: move unaligned DMA read code into separate pmac_dma_read() function
This considerably helps simplify the complexity of the macio read routines and
by switching macio CDROM accesses to use the new code, fixes the issue with
the CDROM device being detected intermittently by Darwin/OS X.

[Maintainer edit: printf format codes adjusted for 32/64bit. --js]

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ailande.co.uk>
Acked-by: John Snow <jsnow@redhat.com>
Message-id: 1425939893-14404-2-git-send-email-mark.cave-ayland@ilande.co.uk
Signed-off-by: John Snow <jsnow@redhat.com>
2015-05-22 15:58:22 -04:00
John Snow 5560b85a31 qtest: pre-buffer hex nibs
Instead of converting each byte one-at-a-time and then sending each byte
over the wire, use sprintf() to pre-compute all of the hex nibs into a
single buffer, then send the entire buffer all at once.

This gives a moderate speed boost to memread() and memwrite() functions.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1431021095-7558-2-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 91d0374a7f libqos/ahci: Swap memread/write with bufread/write
Where it makes sense, use the new faster primitives.
For generally small reads/writes such as for the PRDT
and FIS packets, stick with the more wasteful but
easier to debug memread/memwrite.

For ahci-test (before migration tests):
With this patch:
real    0m3.675s
user    0m2.582s
sys     0m1.718s

Without any qtest protocol improvements:
real    0m14.171s
user    0m12.072s
sys     0m12.527s

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1430864578-22072-6-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 4d00796364 qtest: add memset to qtest protocol
Previously, memset was just a frontend to write() and only
stupidly sent the pattern many times across the wire.

Let's not discuss who stupidly wrote it like that in the first place.
(Hint: It was me.)

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1430864578-22072-4-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 7a6a740d8d qtest: Add base64 encoded read/write
For larger pieces of data that won't need to be debugged and
viewing the hex nibbles is unlikely to be useful, we can encode
data using base64 instead of encoding each byte as %02x, which
leads to some space savings and faster reads/writes.

For now, the default is left as hex nibbles in memwrite() and memread().
For the purposes of making qtest io easier to read and debug, some
callers may want to specify using the old encoding format for small
patches of data where the savings from base64 wouldn't be that profound.

memwrite/memread use a data encoding that takes 2x the size of the original
buffer, but base64 uses "only" (4/3)x, so for larger buffers we can save a
decent amount of time and space.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1430864578-22072-3-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 332cc7e9b3 qtest: allow arbitrarily long sends
qtest currently has a static buffer of size 1024 that if we
overflow, ignores the additional data silently which leads
to hangs or stream failures.

Use glib's string facilities to allow arbitrarily long data,
but split this off into a new function, qtest_sendf.

Static data can still be sent using qtest_send, which avoids
the malloc/copy overhead.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1430864578-22072-2-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 5d1cf0917b qtest/ahci: add migrate halted dma test
Test migrating a halted DMA transaction.
Resume, then test data integrity.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-10-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 189d1b6126 qtest/ahci: add halted dma test
If we're going to test the migration of halted DMA jobs,
we should probably check to make sure we can resume them
locally as a first step.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-9-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow a606ce50c2 qtest/ahci: add flush migrate test
Use blkdebug to inject an error on first flush, then attempt to flush
on the first guest. When the error halts the VM, migrate to the
second VM, and attempt to resume the command.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-8-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 88e21f9485 qtest/ahci: add migrate dma test
Write to one guest, migrate, and then read from the other.
adjust ahci_io to clear any buffers it creates, so that we
can use ahci_io safely on both guests knowing we are using
empty buffers and not accidentally re-using data.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-7-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 278128ab06 qtest/ahci: Add migration test
Notes:

 * The migration is performed on QOSState objects.

 * The migration is performed in such a way that it does not assume
   consistency between the allocators attached to each. That is to say,
   you can use each QOSState object completely independently and then at
   an arbitrary point decide to migrate, and the destination object will
   now be consistent with the memory within the source guest. The source
   object that was migrated from will have a completely blank allocator.

ahci-test.c:
 - verify_state is added
 - ahci_migrate is added as a frontend to migrate
 - test_migrate_sanity test case is added.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-6-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 04329029a8 ich9/ahci: Enable Migration
Lift the flag preventing the migration of the ICH9/AHCI devices.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-5-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 085248ae87 libqos: Add migration helpers
libqos.c:
    -set_context for addressing which commands go where
    -migrate performs the actual migration

malloc.c:
    - Structure of the allocator is adjusted slightly with
      a second-tier malloc to make swapping around the allocators
      easy when we "migrate" the lists from the source to the destination.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-4-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 455e861cc6 libqos/ahci: Fix sector set method
|| probably does not mean the same thing as |.

Additionally, allow users to submit a prd_size of 0
to indicate that they'd like to continue using the default.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-3-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 008b6e123f libqos/ahci: Add halted command helpers
Sometimes we want a command to halt the VM instead
of complete successfully, so it'd be nice to let the
libqos/ahci functions cope with such scenarios.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1430417242-11859-2-git-send-email-jsnow@redhat.com
2015-05-22 15:58:22 -04:00
John Snow 62754b1571 glib: remove stale compat functions
Since we're bumping the version to 2.22+,
remove the now-stale compat functions.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1431469140-22208-2-git-send-email-jsnow@redhat.com
2015-05-22 15:58:06 -04:00
John Snow f40685c62b configure: require glib 2.22
This provides g_ptr_array_new_with_free_func, as well as a few
other functions that we've been hacking around in glib-compat.h.
Cleaning up the compatibility headers will come later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1431469140-22208-2-git-send-email-jsnow@redhat.com
2015-05-22 14:13:58 -04:00
Peter Maydell 0d2ed6039c Block layer core and image format patches
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVX0lfAAoJEH8JsnLIjy/WFloQAMFIiYVZU7HqXFJn0SpJTFuT
 XeMLj1rNCWQMNnD3lrwGqRL81rZG8mH+d15gzPfL6gzxZgSIr2VfQrFjMCJHuiBG
 F8CkaYnKNOqyiAHNkcVsP0Brsn7ZVKTWZzWzAdbP8eVWgjnstmwFURz56bhVyIpY
 5b4atvH6GAeKrraZVTMhz1ltT6051EsH7OOYDyIFgMC6RL8X/N+34QIOY65whfqj
 9vpCiajGX8deGXpGPPNTMf8Nf2J/06X2xzcIqmq/YaD5fCi7XQJAm755eHcGfKdA
 HACuKNsFk6VHYeKLsB383FFGuIvYgDT3Vqh1TGCN/jYlVm0kdIKKajW2KCX90l+9
 Ep8saQvWYNA6tbIW631qRM3VHWuUI80U8nlVHlNdeBeTglf3Q7QUuur8FsL7S/aR
 2ij2JymPaORQ5GZAWfVWpiJd15BOW5uOeP2FpoF5kHAgt2E4KRIEmmSsWNF6L3+E
 7cMrl7EknlRQNlz9//SqaSUzFhFSO0w267tpDRQmHKWLVzijo9a1AGgSR9EpqYtj
 dBjvYgQQQf3aioOhzBd916qO0vMrOsD9XbmIFQAZCW9bIZ/ly9BrZGu419p2DCUs
 WP45PGwG0WlEKpVAhg7jJz8df2fGh1BxXcKyWHe0BpHLnI9rAUg3YbauO3miY8vc
 3xoJZqL+pYrswOdDG3HA
 =x52M
 -----END PGP SIGNATURE-----

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

Block layer core and image format patches

# gpg: Signature made Fri May 22 16:21:03 2015 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (22 commits)
  MAINTAINERS: Split "Block QAPI, monitor, command line" off core
  MAINTAINERS: Add header files to Block Layer Core section
  tests: add test case for encrypted qcow2 read/write
  qemu-io: prompt for encryption keys when required
  util: allow \n to terminate password input
  util: move read_password method out of qemu-img into osdep/oslib
  qcow2/qcow: protect against uninitialized encryption key
  qemu-iotests: Make debugging python tests easier
  qemu-iotests: qemu-img info on afl VMDK image with a huge capacity
  block: Detect multiplication overflow in bdrv_getlength
  qemu-io: Use getopt() correctly
  qcow2: style fixes in qcow2-cache.c
  qcow2: make qcow2_cache_put() a void function
  qcow2: use a hash to look for entries in the L2 cache
  qcow2: remove qcow2_cache_find_entry_to_replace()
  qcow2: use an LRU algorithm to replace entries from the L2 cache
  qcow2: simplify qcow2_cache_put() and qcow2_cache_entry_mark_dirty()
  qcow2: use one single memory block for the L2/refcount cache tables
  vmdk: Fix overflow if l1_size is 0x20000000
  vmdk: Fix next_cluster_sector for compressed write
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-05-22 17:20:09 +01:00