OSDN Git Service

qmiga/qemu.git
6 years agouse g_path_get_basename instead of basename
Julia Suvorova [Thu, 1 Mar 2018 07:08:06 +0000 (10:08 +0300)]
use g_path_get_basename instead of basename

basename(3) and dirname(3) modify their argument and may return
pointers to statically allocated memory which may be overwritten by
subsequent calls.
g_path_get_basename and g_path_get_dirname have no such issues, and
therefore more preferable.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Message-Id: <1519888086-4207-1-git-send-email-jusual@mail.ru>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoballoon: Fix documentation of the --balloon parameter and deprecate it
Thomas Huth [Wed, 28 Feb 2018 05:38:23 +0000 (06:38 +0100)]
balloon: Fix documentation of the --balloon parameter and deprecate it

There are two issues with the documentation of the --balloon parameter:
First, "--balloon none" is simply doing nothing. Even if a machine had a
balloon device by default, this option is not disabling anything, it is
simply ignored. Thus let's simply drop this option from the documentation
to avoid to confuse the users (but keep the code in vl.c for backward
compatibility).
Second, the documentation claims that "--balloon virtio" is the default
mode, but this is not true anymore since commit 382f074371f7dc32a34.
Since that commit, the option also has no real use case anymore, since
you can simply use "--device virtio-balloon" nowadays instead. Thus to
simplify our complex parameter zoo a little bit, let's deprecate the
the parameter now and tell the user to use "--device virtio-balloon"
instead.

Fixes: 382f074371f7dc32a34c944c845b1698e83d8c36
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1519796303-13257-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoWHPX improve interrupt notification registration
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:36 +0000 (09:13 -0800)]
WHPX improve interrupt notification registration

Improves the usage of the InterruptNotification registration by skipping the
additional call to WHvSetVirtualProcessorRegisters if we have already
registered for the window exit.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-9-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoWHXP Removes the use of WHvGetExitContextSize
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:35 +0000 (09:13 -0800)]
WHXP Removes the use of WHvGetExitContextSize

The use of WHvGetExitContextSize will break ABI compatibility if the platform
changes the context size while a qemu compiled executable does not recompile.
To avoid this we now use sizeof and let the platform determine which version
of the struction was passed for ABI compatibility.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-8-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoFix WHPX issue leaking tpr values
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:34 +0000 (09:13 -0800)]
Fix WHPX issue leaking tpr values

Fixes an issue where if the tpr is assigned to the array but not a different
value from what is already expected on the vp the code will skip incrementing
the reg_count. In this case its possible that we set an invalid memory section
of the next call for DeliverabilityNotifications that was not expected.

The fix is to use a local variable to store the temporary tpr and only update
the array if the local tpr value is different than the vp context.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-7-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoFix WHPX typo in 'mmio'
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:33 +0000 (09:13 -0800)]
Fix WHPX typo in 'mmio'

Renames the usage of 'memio' to 'mmio' in the emulator callbacks.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-6-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoFix WHPX additional lock acquisition
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:32 +0000 (09:13 -0800)]
Fix WHPX additional lock acquisition

The code already is holding the qemu_mutex for the IO thread. We do not need
to additionally take the lock again in this case.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-5-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoRemove unnecessary WHPX __debugbreak();
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:31 +0000 (09:13 -0800)]
Remove unnecessary WHPX __debugbreak();

Minor code cleanup. The calls to __debugbreak() are not required and should
no longer be used to prevent unnecessary breaks.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-4-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoResolves WHPX breaking changes in SDK 17095
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:30 +0000 (09:13 -0800)]
Resolves WHPX breaking changes in SDK 17095

1. Fixes the changes required to the WHvTryMmioEmulation, WHvTryIoEmulation, and
WHvEmulatorCreateEmulator based on the new VpContext forwarding.
2. Removes the WHvRunVpExitReasonAlerted case.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-3-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoFixing WHPX casing to match SDK
Justin Terry (VM) via Qemu-devel [Mon, 26 Feb 2018 17:13:29 +0000 (09:13 -0800)]
Fixing WHPX casing to match SDK

Fixes an issue where the SDK that was releases had a different casing for the
*.h and *.lib files causing a build break if linked directly from Windows Kits.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
Message-Id: <1519665216-1078-2-git-send-email-juterry@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Justin Terry (VM) via Qemu-devel <qemu-devel@nongnu.org>
6 years agoRevert "build-sys: compile with -Og or -O1 when --enable-debug"
Paolo Bonzini [Tue, 6 Mar 2018 10:32:44 +0000 (11:32 +0100)]
Revert "build-sys: compile with -Og or -O1 when --enable-debug"

This reverts commit 906548689e37ab6cca1e93b3f8d9327a4e17e8af.
Even with -Og, the debug experience is noticeably worse
because gdb shows a lot more "<optimised out>" variables and
function arguments.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocheckpatch: add check for `while` and `for`
Su Hang [Tue, 6 Mar 2018 07:04:50 +0000 (15:04 +0800)]
checkpatch: add check for `while` and `for`

Adding check for `while` and `for` statements, which condition has more than
one line.

The former checkpatch.pl can check `if` statement, which condition has more
than one line, whether block misses brace round, like this:
'''
if (cond1 ||
    cond2)
    statement;
'''
But it doesn't do the same check for `for` and `while` statements.

Using `(?:...)` instead of `(...)` in regex pattern catch.
Because `(?:...)` is faster and avoids unwanted side-effect.

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Suggested-by: Eric Blake <eblake@redhat.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Su Hang <suhang16@mails.ucas.ac.cn>
Message-Id: <1520319890-19761-1-git-send-email-suhang16@mails.ucas.ac.cn>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocheckpatch: add a warning for basename/dirname
Julia Suvorova [Fri, 2 Mar 2018 10:43:19 +0000 (13:43 +0300)]
checkpatch: add a warning for basename/dirname

g_path_get_* do the same as g_strdup(basename/dirname(...)) but
without modifying the argument.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Message-Id: <1519987399-19160-1-git-send-email-jusual@mail.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoaddress_space_rw: address_space_to_flatview needs RCU lock
Paolo Bonzini [Mon, 5 Mar 2018 08:29:04 +0000 (09:29 +0100)]
address_space_rw: address_space_to_flatview needs RCU lock

address_space_rw is calling address_space_to_flatview but it can
be called outside the RCU lock.  To fix it, transform flatview_rw
into address_space_rw, since flatview_rw is otherwise unused.

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoaddress_space_map: address_space_to_flatview needs RCU lock
Paolo Bonzini [Sun, 4 Mar 2018 23:23:26 +0000 (00:23 +0100)]
address_space_map: address_space_to_flatview needs RCU lock

address_space_map is calling address_space_to_flatview but it can
be called outside the RCU lock.  The function itself is calling
rcu_read_lock/rcu_read_unlock, just in the wrong place, so the
fix is easy.

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoaddress_space_access_valid: address_space_to_flatview needs RCU lock
Paolo Bonzini [Sun, 4 Mar 2018 23:23:26 +0000 (00:23 +0100)]
address_space_access_valid: address_space_to_flatview needs RCU lock

address_space_access_valid is calling address_space_to_flatview but it can
be called outside the RCU lock.  To fix it, push the rcu_read_lock/unlock
pair up from flatview_access_valid to address_space_access_valid.

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoaddress_space_read: address_space_to_flatview needs RCU lock
Paolo Bonzini [Sun, 4 Mar 2018 23:19:49 +0000 (00:19 +0100)]
address_space_read: address_space_to_flatview needs RCU lock

address_space_read is calling address_space_to_flatview but it can
be called outside the RCU lock.  To fix it, push the rcu_read_lock/unlock
pair up from flatview_read_full to address_space_read's constant size
fast path and address_space_read_full.

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoaddress_space_write: address_space_to_flatview needs RCU lock
Paolo Bonzini [Mon, 5 Mar 2018 08:23:56 +0000 (09:23 +0100)]
address_space_write: address_space_to_flatview needs RCU lock

address_space_write is calling address_space_to_flatview but it can
be called outside the RCU lock.  To fix it, push the rcu_read_lock/unlock
pair up from flatview_write to address_space_write.

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agomemory: inline some performance-sensitive accessors
Paolo Bonzini [Sun, 4 Mar 2018 23:31:20 +0000 (00:31 +0100)]
memory: inline some performance-sensitive accessors

These accessors are called from inlined functions, and the call sequence
is much more expensive than just inlining the access.  Move the
struct declaration to memory-internal.h so that exec.c and memory.c
can both use an inline function.

Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoopenpic_kvm: drop address_space_to_flatview call
Paolo Bonzini [Mon, 5 Mar 2018 08:18:26 +0000 (09:18 +0100)]
openpic_kvm: drop address_space_to_flatview call

The MemoryListener is registered on address_space_memory, there is
not much to assert.  This currently works because the callback
is invoked only once when the listener is registered, but section->fv
is the _new_ FlatView, not the old one on later calls and that
would break.

This confines address_space_to_flatview to exec.c and memory.c.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agochardev: fix leak in tcp_chr_telnet_init_io()
Peter Xu [Thu, 1 Mar 2018 08:44:24 +0000 (16:44 +0800)]
chardev: fix leak in tcp_chr_telnet_init_io()

Need to free TCPChardevTelnetInit when session established.

Since at it, switch to use G_SOURCE_* macros.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180301084438.13594-2-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agosdhci-test: fix leaks
Marc-André Lureau [Thu, 15 Feb 2018 21:25:52 +0000 (22:25 +0100)]
sdhci-test: fix leaks

Fix the following ASAN reports:

==20125==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f0faea03a38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
    #1 0x7f0fae450f75 in g_malloc0 ../glib/gmem.c:124
    #2 0x562fffd526fc in machine_start /home/elmarco/src/qemu/tests/sdhci-test.c:180

Indirect leak of 152 byte(s) in 1 object(s) allocated from:
    #0 0x7f0faea03850 in malloc (/lib64/libasan.so.4+0xde850)
    #1 0x7f0fae450f0c in g_malloc ../glib/gmem.c:94
    #2 0x562fffd5d21d in qpci_init_pc /home/elmarco/src/qemu/tests/libqos/pci-pc.c:122

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180215212552.26997-7-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoahci-test: fix opts leak of skip tests
Marc-André Lureau [Thu, 15 Feb 2018 21:25:51 +0000 (22:25 +0100)]
ahci-test: fix opts leak of skip tests

Fixes the following ASAN report:

Direct leak of 128 byte(s) in 8 object(s) allocated from:
    #0 0x7fefce311850 in malloc (/lib64/libasan.so.4+0xde850)
    #1 0x7fefcdd5ef0c in g_malloc ../glib/gmem.c:94
    #2 0x559b976faff0 in create_ahci_io_test /home/elmarco/src/qemu/tests/ahci-test.c:1810

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180215212552.26997-6-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agolockable: workaround GCC link issue with ASAN
Marc-André Lureau [Thu, 15 Feb 2018 21:25:48 +0000 (22:25 +0100)]
lockable: workaround GCC link issue with ASAN

Current GCC has an optimization bug when compiling with ASAN.

See also GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84307

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180215212552.26997-3-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agobuild-sys: fix -fsanitize=address check
Marc-André Lureau [Thu, 15 Feb 2018 21:25:47 +0000 (22:25 +0100)]
build-sys: fix -fsanitize=address check

Since 218bb57dd79d6843e0592c30a82ea8c1fddc74a5, the -fsanitize=address
check fails with:
config-temp/qemu-conf.c:3:20: error: integer overflow in expression [-Werror=overflow]
   return INT32_MIN / -1;

Interestingly, UBSAN check doesn't produce a compile time warning.
Use a test that doesn't have compile time warnings, and make it
specific to UBSAN check.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180215212552.26997-2-marcandre.lureau@redhat.com>
Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoqmp: Add qom-list-properties to list QOM object properties
Alexey Kardashevskiy [Thu, 1 Mar 2018 13:09:39 +0000 (00:09 +1100)]
qmp: Add qom-list-properties to list QOM object properties

There is already 'device-list-properties' which does most of the job,
however it does not handle everything returned by qom-list-types such
as machines as they inherit directly from TYPE_OBJECT and not TYPE_DEVICE.
It does not handle abstract classes either.

This adds a new qom-list-properties command which prints properties
of a specific class and its instance. It is pretty much a simplified copy
of the device-list-properties handler.

Since it creates an object instance, device properties should appear
in the output as they are copied to QOM properties at the instance_init
hook.

This adds a object_class_property_iter_init() helper to allow class
properties enumeration uses it in the new QMP command to allow properties
listing for abstract classes.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <20180301130939.15875-3-aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoqmp: Merge ObjectPropertyInfo and DevicePropertyInfo
Alexey Kardashevskiy [Thu, 1 Mar 2018 13:09:38 +0000 (00:09 +1100)]
qmp: Merge ObjectPropertyInfo and DevicePropertyInfo

ObjectPropertyInfo is more generic and only missing @description.
This adds a description to ObjectPropertyInfo and removes
DevicePropertyInfo so the resulting ObjectPropertyInfo can be used
elsewhere.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <20180301130939.15875-2-aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoDocument --rtc-td-hack, --localtime and --startdate as deprecated
Thomas Huth [Tue, 20 Feb 2018 15:01:32 +0000 (16:01 +0100)]
Document --rtc-td-hack, --localtime and --startdate as deprecated

These options have been marked in a comment in qemu-options.hx as
deprecated in 2009 already (see commit 1ed2fc1fa35fadc0d6), but we
never informed the users about these deprecations. Let's catch up
on that omission now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1519138892-12836-1-git-send-email-thuth@redhat.com>
[Fix messages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocpus: CPU threads are always created initially for one CPU only
David Hildenbrand [Fri, 9 Feb 2018 19:52:39 +0000 (20:52 +0100)]
cpus: CPU threads are always created initially for one CPU only

It can never happen for single-threaded TCG that we have more than one
CPU in the list, while the first one has not been marked as "created".

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180209195239.16048-4-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocpus: wait for CPU creation at central place
David Hildenbrand [Fri, 9 Feb 2018 19:52:38 +0000 (20:52 +0100)]
cpus: wait for CPU creation at central place

We can now also wait for the CPU creation for single-threaded TCG, so we
can move the waiting bits further out.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180209195239.16048-3-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocpus: properly inititalize CPU > 1 under single-threaded TCG
David Hildenbrand [Fri, 9 Feb 2018 19:52:37 +0000 (20:52 +0100)]
cpus: properly inititalize CPU > 1 under single-threaded TCG

All but the first CPU are currently not fully inititalized (e.g.
cpu->created is never set).

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180209195239.16048-2-david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoscsi: Remove automatic creation of SCSI controllers with -drive if=scsi
Thomas Huth [Tue, 20 Feb 2018 10:42:37 +0000 (11:42 +0100)]
scsi: Remove automatic creation of SCSI controllers with -drive if=scsi

Automatic creation of SCSI controllers for "-drive if=scsi" for x86
machines was quite a bad idea (see description of commit f778a82f0c179
for details). This is marked as deprecated since QEMU v2.9.0, and as
far as I know, nobody complained that this is still urgently required
anymore. Time to remove this now.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1519123357-13225-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoRemove the deprecated -tdf option
Thomas Huth [Mon, 19 Feb 2018 20:23:40 +0000 (21:23 +0100)]
Remove the deprecated -tdf option

It's been marked as deprecated since a very long time already, and
the parameter is not doing anything useful anymore except for printing
a warning, so it's now time to finally get rid of this option.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1519071820-4062-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agog364fb: fix DirtyBitmapSnapshot leak
Paolo Bonzini [Wed, 14 Feb 2018 16:36:33 +0000 (17:36 +0100)]
g364fb: fix DirtyBitmapSnapshot leak

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Tue, 6 Mar 2018 11:20:44 +0000 (11:20 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Mon 05 Mar 2018 17:45:51 GMT
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (38 commits)
  block: Fix NULL dereference on empty drive error
  qcow2: Replace align_offset() with ROUND_UP()
  block/ssh: Add basic .bdrv_truncate()
  block/ssh: Make ssh_grow_file() blocking
  block/ssh: Pull ssh_grow_file() from ssh_create()
  qemu-img: Make resize error message more general
  qcow2: make qcow2_co_create2() a coroutine_fn
  block: rename .bdrv_create() to .bdrv_co_create_opts()
  Revert "IDE: Do not flush empty CDROM drives"
  block: test blk_aio_flush() with blk->root == NULL
  block: add BlockBackend->in_flight counter
  block: extract AIO_WAIT_WHILE() from BlockDriverState
  aio: rename aio_context_in_iothread() to in_aio_context_home_thread()
  docs: document how to use the l2-cache-entry-size parameter
  specs/qcow2: Fix documentation of the compressed cluster descriptor
  iotest 033: add misaligned write-zeroes test via truncate
  block: fix write with zero flag set and iovector provided
  block: Drop unused .bdrv_co_get_block_status()
  vvfat: Switch to .bdrv_co_block_status()
  vpc: Switch to .bdrv_co_block_status()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
# Conflicts:
# include/block/block.h

6 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.12-20180306' into staging
Peter Maydell [Tue, 6 Mar 2018 10:21:35 +0000 (10:21 +0000)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.12-20180306' into staging

ppc patch queue 2018-03-06

This pull request supersedes ppc-for-2.12-20180302 which had compile
problems with some gcc versions.  It also contains a few additional
patches.

Highlights are:
    * New Sam460ex machine type
    * Yet more fixes related to vcpu id allocation for spapr
    * Numerous macio cleanupsr
    * Some enhancements to the Spectre/Meltdown fixes for pseries,
      allowing use of a better mitigation for indirect branch based
      exploits
    * New pseries machine types with Spectre/Meltdown mitigations
      enabled (stop gap until libvirt and management understands the
      machine options)
    * A handful of other fixes

# gpg: Signature made Tue 06 Mar 2018 04:01:00 GMT
# gpg:                using RSA key 6C38CACA20D9B392
# 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.12-20180306: (30 commits)
  PowerPC: Add TS bits into msr_mask
  adb: add trace-events for monitoring keyboard/mouse during bus enumeration
  PPC: e500: Fix duplicate kernel load and device tree overlap
  hw/ppc/spapr,e500: Use new property "stdout-path" for boot console
  ppc/spapr-caps: Define the pseries-2.12-sxxm machine type
  ppc/spapr-caps: Convert cap-ibs to custom spapr-cap
  ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap
  ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap
  ppc/spapr-caps: Add support for custom spapr_capabilities
  target/ppc: Check mask when setting cap_ppc_safe_indirect_branch
  macio: remove macio_init() function
  macio: move setting of CUDA timebase frequency to macio_common_realize()
  mac_newworld: use object link to pass OpenPIC object to macio
  openpic: move OpenPIC state and related definitions to openpic.h
  openpic: move KVM-specific declarations into separate openpic_kvm.h file
  mac_oldworld: use object link to pass heathrow PIC object to macio
  macio: move macio related structures and defines into separate macio.h file
  heathrow: change heathrow_pic_init() to return the heathrow device
  heathrow: convert to trace-events
  heathrow: QOMify heathrow PIC
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoPowerPC: Add TS bits into msr_mask
Simon Guo [Mon, 5 Mar 2018 10:53:48 +0000 (18:53 +0800)]
PowerPC: Add TS bits into msr_mask

During migration, after MSR bits is synced, cpu_post_load() will use
msr_mask to determine which PPC MSR bits will be applied into the target
side. Hardware Transaction Memory(HTM) has been supported since Power8,
but TS0/TS1 bit was not in msr_mask yet. That will prevent target KVM
from loading TM checkpointed values.

This patch adds TS bits into msr_mask for Power8, so that transactional
application can be migrated across qemu.

Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoadb: add trace-events for monitoring keyboard/mouse during bus enumeration
Mark Cave-Ayland [Mon, 5 Mar 2018 21:51:13 +0000 (21:51 +0000)]
adb: add trace-events for monitoring keyboard/mouse during bus enumeration

This is useful to help diagnose problems related to address clashes during
MacOS 9 boot.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoPPC: e500: Fix duplicate kernel load and device tree overlap
David Engraf [Fri, 2 Mar 2018 11:20:13 +0000 (12:20 +0100)]
PPC: e500: Fix duplicate kernel load and device tree overlap

This patch fixes an incorrect behavior when the -kernel argument has been
specified without -bios. In this case the kernel was loaded twice. At address
32M as a raw image and afterwards by load_elf/load_uimage at the
corresponding load address. In this case the region for the device tree and
the raw kernel image may overlap.

The patch fixes the behavior by loading the kernel image once with
load_elf/load_uimage and skips loading the raw image.

When here do not use bios_name/size for the kernel and use a more generic
name called payload_name/size.

New in v3: dtb must be stored between kernel and initrd because Linux can
           handle the dtb only within the first 64MB. Add a comment to
           clarify the behavior.

Signed-off-by: David Engraf <david.engraf@sysgo.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agohw/ppc/spapr,e500: Use new property "stdout-path" for boot console
Nikunj A Dadhania [Thu, 1 Mar 2018 06:05:50 +0000 (11:35 +0530)]
hw/ppc/spapr,e500: Use new property "stdout-path" for boot console

Linux kernel commit 2a9d832cc9aae21ea827520fef635b6c49a06c6d
(of: Add bindings for chosen node, stdout-path) deprecated chosen property
"linux,stdout-path" and "stdout".

Introduce the new property "stdout-path" and continue supporting the older
property to remain compatible with existing/older firmware. This older property
can be deprecated after 5 years.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc/spapr-caps: Define the pseries-2.12-sxxm machine type
Suraj Jitindar Singh [Thu, 1 Mar 2018 06:38:04 +0000 (17:38 +1100)]
ppc/spapr-caps: Define the pseries-2.12-sxxm machine type

The sxxm (speculative execution exploit mitigation) machine type is a
variant of the 2.12 machine type with workarounds for speculative
execution vulnerabilities enabled by default.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc/spapr-caps: Convert cap-ibs to custom spapr-cap
Suraj Jitindar Singh [Thu, 1 Mar 2018 06:38:02 +0000 (17:38 +1100)]
ppc/spapr-caps: Convert cap-ibs to custom spapr-cap

Convert cap-ibs (indirect branch speculation) to a custom spapr-cap
type.

All tristate caps have now been converted to custom spapr-caps, so
remove the remaining support for them.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
[dwg: Don't explicitly list "?"/help option, trust convention]
[dwg: Fold tristate removal into here, to not break bisect]
[dwg: Fix minor style problems]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc/spapr-caps: Convert cap-sbbc to custom spapr-cap
Suraj Jitindar Singh [Thu, 1 Mar 2018 06:38:01 +0000 (17:38 +1100)]
ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap

Convert cap-sbbc (speculation barrier bounds checking) to a custom
spapr-cap type.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
[dwg: Removed trailing whitespace]
[dwg: Don't explicitly list "?"/help option, trust convention]
[dwg: Fix some minor style problems]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc/spapr-caps: Convert cap-cfpc to custom spapr-cap
Suraj Jitindar Singh [Thu, 1 Mar 2018 06:38:00 +0000 (17:38 +1100)]
ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap

Convert cap-cfpc (cache flush on privilege change) to a custom spapr-cap
type.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
[dwg: Don't explicitly list "?"/help option, trusting convention]
[dwg: Strip no-longer-necessary ATTRIBUTE_UNUSED back off]
[dwg: Fix some minor style problems]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc/spapr-caps: Add support for custom spapr_capabilities
Suraj Jitindar Singh [Thu, 1 Mar 2018 06:37:59 +0000 (17:37 +1100)]
ppc/spapr-caps: Add support for custom spapr_capabilities

There are currently 2 implemented types of spapr-caps, boolean and
tristate. However there may be a need for caps which don't fit either of
these options. Add a custom capability type for which a list of custom
valid strings can be specified and implement the get/set functions for
these. Also add a field for help text to describe the available options.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
[dwg: Change "help" option to "?" matching qemu conventions]
[dwg: Add ATTRIBUTE_UNUSED to avoid breaking bisect]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agotarget/ppc: Check mask when setting cap_ppc_safe_indirect_branch
Suraj Jitindar Singh [Thu, 1 Mar 2018 06:37:58 +0000 (17:37 +1100)]
target/ppc: Check mask when setting cap_ppc_safe_indirect_branch

Check the character and character_mask field when setting
cap_ppc_safe_indirect_branch based on the hypervisor response
to KVM_PPC_GET_CPU_CHAR. Previously the mask field wasn't checked
which was incorrect.

Fixes: 8acc2ae5 (target/ppc/kvm: Add cap_ppc_safe_[cache/bounds_check/indirect_branch])

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agomacio: remove macio_init() function
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:43 +0000 (20:32 +0000)]
macio: remove macio_init() function

Move the remaining comment into macio.c for reference, then remove the
macio_init() function and instantiate the macio devices for both Old World
and New World machines via qdev_init_nofail() directly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agomacio: move setting of CUDA timebase frequency to macio_common_realize()
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:42 +0000 (20:32 +0000)]
macio: move setting of CUDA timebase frequency to macio_common_realize()

This removes the last of the functionality from macio_init() in preparation
for its subsequent removal.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agomac_newworld: use object link to pass OpenPIC object to macio
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:41 +0000 (20:32 +0000)]
mac_newworld: use object link to pass OpenPIC object to macio

Also switch macio_newworld_realize() over to use it rather than using the pic_mem
memory region directly.

Now that both Old World and New World macio devices no longer make use of the
pic_mem memory region directly, we can remove it.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoopenpic: move OpenPIC state and related definitions to openpic.h
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:40 +0000 (20:32 +0000)]
openpic: move OpenPIC state and related definitions to openpic.h

This is to faciliate access to OpenPICState when wiring up the PIC to the macio
controller.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoopenpic: move KVM-specific declarations into separate openpic_kvm.h file
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:39 +0000 (20:32 +0000)]
openpic: move KVM-specific declarations into separate openpic_kvm.h file

This is needed before the next patch because the target-dependent kvm stub
uses the existing kvm_openpic_connect_vcpu() declaration, making it impossible
to move the device-specific declarations into the same file without breaking
ppc-linux-user compilation.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agomac_oldworld: use object link to pass heathrow PIC object to macio
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:38 +0000 (20:32 +0000)]
mac_oldworld: use object link to pass heathrow PIC object to macio

Also switch macio_oldworld_realize() over to use it rather than using the pic_mem
memory region directly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agomacio: move macio related structures and defines into separate macio.h file
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:37 +0000 (20:32 +0000)]
macio: move macio related structures and defines into separate macio.h file

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoheathrow: change heathrow_pic_init() to return the heathrow device
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:36 +0000 (20:32 +0000)]
heathrow: change heathrow_pic_init() to return the heathrow device

This enables the device to be made available during the setup of the Old World
machine. In order to pass back the previous set of IRQs we temporarily introduce
a new pic_irqs parameter until it can be removed.

An additional benefit of this change is that it is also possible to remove the
pic_mem pointer used for macio by accessing the memory region via sysbus.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoheathrow: convert to trace-events
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:35 +0000 (20:32 +0000)]
heathrow: convert to trace-events

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoheathrow: QOMify heathrow PIC
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:34 +0000 (20:32 +0000)]
heathrow: QOMify heathrow PIC

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agomacio: move ESCC device within the macio device
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:33 +0000 (20:32 +0000)]
macio: move ESCC device within the macio device

Now that the ESCC device is instantiated directly via qdev, move it to within
the macio device and wire up the IRQs and memory regions using the sysbus API.

This enables to remove the now-obsolete escc_mem parameter to the macio_init()
function.

(Note this patch also contains small touch-ups to the formatting in
macio_escc_legacy_setup() and ppc_heathrow_init() in order to keep checkpatch
happy)

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agomacio: embed DBDMA device directly within macio
Mark Cave-Ayland [Wed, 28 Feb 2018 20:32:32 +0000 (20:32 +0000)]
macio: embed DBDMA device directly within macio

The current recommendation is to embed subdevices directly within their container
device, so do this for the DBDMA device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agospapr: harden code that depends on VSMT
Greg Kurz [Tue, 27 Feb 2018 15:23:07 +0000 (16:23 +0100)]
spapr: harden code that depends on VSMT

VSMT must be set in order to compute VCPU ids. This means that the
following functions must not be called before spapr_set_vsmt_mode()
was called:
- spapr_vcpu_id()
- spapr_is_thread0_in_vcore()
- xics_max_server_number()

We had a recent regression where the latter would be called before VSMT
was set, and broke migration of some old machine types. This patch
adds assert() in the above functions to avoid problems in the future.

Also, since VSMT is really a CPU related thing, spapr_set_vsmt_mode() is
now called from spapr_init_cpus(), just before the first VSMT user.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agospapr: register dummy ICPs later
Greg Kurz [Tue, 27 Feb 2018 15:22:58 +0000 (16:22 +0100)]
spapr: register dummy ICPs later

Some older machine types create more ICPs than needed. We hence
need to register up to xics_max_server_number() dummy ICPs to
accomodate the migration of these machine types.

Recent VSMT rework changed xics_max_server_number() to return

    DIV_ROUND_UP(max_cpus * spapr->vsmt, smp_threads)

instead of

    DIV_ROUND_UP(max_cpus * kvmppc_smt_threads(), smp_threads);

The change is okay but it requires spapr->vsmt to be set, which
isn't the case with the current code. This causes the formula to
return zero and we don't create dummy ICPs. This breaks migration
of older guests as reported here:

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

The dummy ICP workaround doesn't really have a dependency on XICS
itself. But it does depend on proper VCPU id numbering and it must
be applied before creating vCPUs (ie, creating real ICPs). So this
patch moves the workaround to spapr_init_cpus(), which already
assumes VSMT to be set.

Fixes: 72194664c8a1 ("spapr: use spapr->vsmt to compute VCPU ids")
Reported-by: Lukas Doktor <ldoktor@redhat.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc: Add aCube Sam460ex board
BALATON Zoltan [Mon, 19 Feb 2018 10:34:25 +0000 (11:34 +0100)]
ppc: Add aCube Sam460ex board

Add emulation of aCube Sam460ex board based on AMCC 460EX embedded SoC.
This is not a complete implementation yet with a lot of components
still missing but enough for the U-Boot firmware to start and to boot
a Linux kernel or AROS.

Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agopc-bios: Added u-boot-sam460 firmware binary
BALATON Zoltan [Fri, 2 Mar 2018 11:50:14 +0000 (12:50 +0100)]
pc-bios: Added u-boot-sam460 firmware binary

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoroms: Added git submodule for u-boot-sam460 (firmware for sam460ex)
BALATON Zoltan [Fri, 2 Mar 2018 11:50:14 +0000 (12:50 +0100)]
roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc440: Add emulation of plb-pcix controller found in some 440 SoCs
BALATON Zoltan [Mon, 19 Feb 2018 10:34:25 +0000 (11:34 +0100)]
ppc440: Add emulation of plb-pcix controller found in some 440 SoCs

This is the PCIX controller found in newer 440 core SoCs e.g. the
AMMC 460EX. The device tree refers to this as plb-pcix compared to
the plb-pci controller in older 440 SoCs.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
[dwg: Remove hwaddr from trace-events, that doesn't work with some
 trace backends]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc440_uc: Fix unintialized variable warning with older gcc
BALATON Zoltan [Fri, 2 Mar 2018 21:43:23 +0000 (22:43 +0100)]
ppc440_uc: Fix unintialized variable warning with older gcc

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agospapr: fix missing CPU core nodes in DT when running with TCG
Greg Kurz [Fri, 16 Feb 2018 18:58:06 +0000 (19:58 +0100)]
spapr: fix missing CPU core nodes in DT when running with TCG

Commit 5d0fb1508e2d "spapr: consolidate the VCPU id numbering logic
in a single place" introduced a helper to detect thread0 of a virtual
core based on its VCPU id. This is used to create CPU core nodes in
the DT, but it is broken in TCG.

$ qemu-system-ppc64 -nographic -accel tcg -machine dumpdtb=dtb.bin \
                    -smp cores=16,maxcpus=16,threads=1
$ dtc -f -O dts dtb.bin | grep POWER8
                PowerPC,POWER8@0 {
                PowerPC,POWER8@8 {

instead of the expected 16 cores that we get with KVM:

$ dtc -f -O dts dtb.bin | grep POWER8
                PowerPC,POWER8@0 {
                PowerPC,POWER8@8 {
                PowerPC,POWER8@10 {
                PowerPC,POWER8@18 {
                PowerPC,POWER8@20 {
                PowerPC,POWER8@28 {
                PowerPC,POWER8@30 {
                PowerPC,POWER8@38 {
                PowerPC,POWER8@40 {
                PowerPC,POWER8@48 {
                PowerPC,POWER8@50 {
                PowerPC,POWER8@58 {
                PowerPC,POWER8@60 {
                PowerPC,POWER8@68 {
                PowerPC,POWER8@70 {
                PowerPC,POWER8@78 {

This happens because spapr_get_vcpu_id() maps VCPU ids to
cs->cpu_index in TCG mode. This confuses the code in
spapr_is_thread0_in_vcore(), since it assumes thread0 VCPU
ids to have a spapr->vsmt spacing.

    spapr_get_vcpu_id(cpu) % spapr->vsmt == 0

Actually, there's no real reason to expose cs->cpu_index instead
of the VCPU id, since we also generate it with TCG. Also we already
set it explicitly in spapr_set_vcpu_id(), so there's no real reason
either to call kvm_arch_vcpu_id() with KVM.

This patch unifies spapr_get_vcpu_id() to always return the computed
VCPU id both in TCG and KVM. This is one step forward towards KVM<->TCG
migration.

Fixes: 5d0fb1508e2d
Reported-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoblock: Fix NULL dereference on empty drive error
Kevin Wolf [Mon, 5 Mar 2018 14:59:35 +0000 (15:59 +0100)]
block: Fix NULL dereference on empty drive error

blk_error_action() sends a BLOCK_IO_ERROR QMP event which includes the
node name of its root node. If the BlockBackend represents an empty
drive, there is no root node, so we should not try to access its node
name. Make the field optional in the event and include it only when
the BlockBackend isn't empty.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Mon, 5 Mar 2018 16:41:20 +0000 (16:41 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

Mostly patches that are only indirectly related to the block layer, but I've
reviewed them and there is no maintainer.

# gpg: Signature made Mon 05 Mar 2018 09:39:50 GMT
# gpg:                using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  README: Document 'git-publish' workflow
  Add a git-publish configuration file
  tests/libqos: Check for valid dev pointer when looking for PCI devices
  util/uri.c: wrap single statement blocks with braces {}
  util/uri.c: remove brackets that wrap `return` statement's content.
  util/uri.c: Coding style check, Only whitespace involved

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20180305-pull-request' into...
Peter Maydell [Mon, 5 Mar 2018 15:16:30 +0000 (15:16 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180305-pull-request' into staging

ui: build curses, gtk and sdl as modules.

# gpg: Signature made Mon 05 Mar 2018 08:48:24 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# 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-20180305-pull-request:
  ui/sdl: build as module
  audio: rename CONFIG_* to CONFIG_AUDIO_*
  ui/curses: build as module
  ui/gtk: build as module
  configure: opengl doesn't depend on x11
  configure: add X11 vars to config-host.mak
  console: add ui module loading support
  console: add and use qemu_display_find_default
  egl-headless: switch over to new display registry
  curses: switch over to new display registry
  cocoa: switch over to new display registry
  sdl: switch over to new display registry
  console: add qemu display registry, add gtk

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
Peter Maydell [Mon, 5 Mar 2018 14:27:24 +0000 (14:27 +0000)]
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Mon 05 Mar 2018 03:06:59 GMT
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@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: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request:
  tap: setting error appropriately when calling net_init_tap_one()
  hw/net: Remove unnecessary header includes
  net: Add a new convenience option "--nic" to configure default/on-board NICs
  net: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP commands
  net: Remove the deprecated way of dumping network packets
  net: Make net_client_init() static
  net: Only show vhost-user in the help text if CONFIG_POSIX is defined
  net: List available netdevs with "-netdev help"
  net: Move error reporting from net_init_client/netdev to the calling site

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.12-pull-request' into...
Peter Maydell [Mon, 5 Mar 2018 13:29:31 +0000 (13:29 +0000)]
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.12-pull-request' into staging

# gpg: Signature made Sun 04 Mar 2018 17:32:25 GMT
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/m68k-for-2.12-pull-request:
  target/m68k: add fscale, fgetman and fgetexp
  softfloat: use floatx80_infinity in softfloat
  target/m68k: add fmod/frem
  softfloat: export some functions
  target/m68k: TCGv returned by gen_load() must be freed

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-qapi-2018-03-01-v4' into staging
Peter Maydell [Mon, 5 Mar 2018 09:47:37 +0000 (09:47 +0000)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-qapi-2018-03-01-v4' into staging

qapi patches for 2018-03-01

- Markus Armbruster: Modularize generated QAPI code

# gpg: Signature made Fri 02 Mar 2018 19:50:16 GMT
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-qapi-2018-03-01-v4: (30 commits)
  qapi: Don't create useless directory qapi-generated
  Fix up dangling references to qmp-commands.* in comment and doc
  qapi: Move qapi-schema.json to qapi/, rename generated files
  docs: Correct outdated information on QAPI
  docs/devel/writing-qmp-commands: Update for modular QAPI
  qapi: Empty out qapi-schema.json
  Include less of the generated modular QAPI headers
  qapi: Generate separate .h, .c for each module
  watchdog: Consolidate QAPI into single file
  qapi/common: Fix guardname() for funny filenames
  qapi/types qapi/visit: Generate built-in stuff into separate files
  qapi: Make code-generating visitors use QAPIGen more
  qapi: Rename generated qmp-marshal.c to qmp-commands.c
  qapi: Record 'include' directives in intermediate representation
  qapi: Generate in source order
  qapi: Record 'include' directives in parse tree
  qapi: Concentrate QAPISchemaParser.exprs updates in .__init__()
  qapi: Lift error reporting from QAPISchema.__init__() to callers
  qapi/common: Eliminate QAPISchema.exprs
  qapi: Improve include file name reporting in error messages
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoREADME: Document 'git-publish' workflow
Fam Zheng [Mon, 26 Feb 2018 03:03:26 +0000 (11:03 +0800)]
README: Document 'git-publish' workflow

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 20180226030326.20219-3-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agoAdd a git-publish configuration file
Fam Zheng [Mon, 26 Feb 2018 03:03:25 +0000 (11:03 +0800)]
Add a git-publish configuration file

git-publish [1] is a convenient tool to send patches and has been
popular among QEMU developers.  Recently it has been made available in
Fedora/Debian official repo.

One nice feature of the tool is a per-project configuration with
profiles, especially in which the cccmd option is a handy method to
create the Cc list.

[1]: https://github.com/stefanha/git-publish

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 20180226030326.20219-2-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agotests/libqos: Check for valid dev pointer when looking for PCI devices
Thomas Huth [Tue, 27 Feb 2018 06:44:44 +0000 (07:44 +0100)]
tests/libqos: Check for valid dev pointer when looking for PCI devices

dev could be NULL if the PCI device can not be found due to some
reasons, so we must not dereference the pointer in this case.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1519713884-2346-1-git-send-email-thuth@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agoutil/uri.c: wrap single statement blocks with braces {}
Su Hang [Sun, 25 Feb 2018 04:35:58 +0000 (12:35 +0800)]
util/uri.c: wrap single statement blocks with braces {}

For this patch, using curly braces to wrap `if` `while` `else` statements,
which only hold single statement. For example:
'''
if (cond)
    statement;
'''
to
'''
if (cond) {
    statement;
}
'''

And using tricks that compare the disassemblies before and after
code changes, to make sure code logic isn't changed:
'''
git checkout master
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-master.txt
git checkout cleanupbranch
make util/uri.o
strip util/uri.o
objdump -Drx util/uri.o > /tmp/uri-cleanup.txt

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agoutil/uri.c: remove brackets that wrap `return` statement's content.
Su Hang [Sun, 25 Feb 2018 04:35:57 +0000 (12:35 +0800)]
util/uri.c: remove brackets that wrap `return` statement's content.

only remove brackets that wrap `return` statements' content.

use `perl -pi -e "s/return \((.*?)\);/return \1;/g" util/uri.c`
to remove pattern like this: "return (1);"

Signed-off-by: Su Hang <suhang16@mails.ucas.ac.cn>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 1519533358-13759-3-git-send-email-suhang16@mails.ucas.ac.cn
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agoutil/uri.c: Coding style check, Only whitespace involved
Su Hang [Sun, 25 Feb 2018 04:35:56 +0000 (12:35 +0800)]
util/uri.c: Coding style check, Only whitespace involved

Using `clang-format -i util/uri.c` first, then change back few code
manually, to make sure only whitespace involved.

Signed-off-by: Su Hang <suhang16@mails.ucas.ac.cn>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 1519533358-13759-2-git-send-email-suhang16@mails.ucas.ac.cn
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agoui/sdl: build as module
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:47 +0000 (11:05 +0100)]
ui/sdl: build as module

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-14-kraxel@redhat.com

6 years agoaudio: rename CONFIG_* to CONFIG_AUDIO_*
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:46 +0000 (11:05 +0100)]
audio: rename CONFIG_* to CONFIG_AUDIO_*

This avoids a name clash for CONFIG_SDL, which is used by both sdl video
support and sdl audio support.  It also more clear that this is a audio
driver configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-13-kraxel@redhat.com

6 years agoui/curses: build as module
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:45 +0000 (11:05 +0100)]
ui/curses: build as module

Also drop curses libs from libs_softmmu.  Add CURSES_{CFLAGS,LIBS}
variables so we can use them for linking the curses module.

Also make target/unicore32/helper.o depend on curses which uses curses
directly for some reason ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-12-kraxel@redhat.com

6 years agoui/gtk: build as module
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:44 +0000 (11:05 +0100)]
ui/gtk: build as module

Also drop gtk and vte libs from libs_softmmu, so the libs are not
pulled in unless the gtk module actually gets loaded.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-11-kraxel@redhat.com

6 years agoconfigure: opengl doesn't depend on x11
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:43 +0000 (11:05 +0100)]
configure: opengl doesn't depend on x11

So remove x11 from pkg-config check and don't
add x11 cflags/libs to opengl cflags/libs.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-10-kraxel@redhat.com

6 years agoconfigure: add X11 vars to config-host.mak
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:42 +0000 (11:05 +0100)]
configure: add X11 vars to config-host.mak

Simplifies handling the X11 dependency,
also makes ui/Makefile.objs more readable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-9-kraxel@redhat.com

6 years agoconsole: add ui module loading support
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:41 +0000 (11:05 +0100)]
console: add ui module loading support

If a requested user interface is not available, try loading it as
module, simliar to block layer modules.  Needed to keep things working
when followup patches start to build user interfaces as modules.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-8-kraxel@redhat.com

6 years agoconsole: add and use qemu_display_find_default
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:40 +0000 (11:05 +0100)]
console: add and use qemu_display_find_default

Using the new display registry instead of #ifdefs in vl.c.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-7-kraxel@redhat.com

6 years agoegl-headless: switch over to new display registry
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:39 +0000 (11:05 +0100)]
egl-headless: switch over to new display registry

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-6-kraxel@redhat.com

6 years agocurses: switch over to new display registry
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:38 +0000 (11:05 +0100)]
curses: switch over to new display registry

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-5-kraxel@redhat.com

6 years agococoa: switch over to new display registry
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:37 +0000 (11:05 +0100)]
cocoa: switch over to new display registry

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-4-kraxel@redhat.com

6 years agosdl: switch over to new display registry
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:36 +0000 (11:05 +0100)]
sdl: switch over to new display registry

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-3-kraxel@redhat.com

6 years agoconsole: add qemu display registry, add gtk
Gerd Hoffmann [Thu, 1 Mar 2018 10:05:35 +0000 (11:05 +0100)]
console: add qemu display registry, add gtk

Add a registry for user interfaces.  Add qemu_display_init and
qemu_display_early_init helper functions for display initialization.

Hook up gtk ui as first user.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180301100547.18962-2-kraxel@redhat.com

6 years agotap: setting error appropriately when calling net_init_tap_one()
Jay Zhou [Fri, 2 Mar 2018 09:04:44 +0000 (17:04 +0800)]
tap: setting error appropriately when calling net_init_tap_one()

If netdev_add tap,id=net0,...,vhost=on failed in net_init_tap_one(),
the followed up device_add virtio-net-pci,netdev=net0 will fail
too, prints:

   TUNSETOFFLOAD ioctl() failed: Bad file descriptor TUNSETOFFLOAD
   ioctl() failed: Bad file descriptor

The reason is that the fd of tap is closed when error occured after
calling net_init_tap_one().

The fd should be closed when calling net_init_tap_one failed:
   - if tap_set_sndbuf() failed
   - if tap_set_sndbuf() succeeded but vhost failed to open or
     initialize with vhostforce flag on
   - with wrong vhost command line parameter
The fd should not be closed just because vhost failed to open or
initialize but without vhostforce flag. So the followed up
device_add can fall back to userspace virtio successfully.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Suggested-by: Igor Mammedov <imammedo@redhat.com>
Suggested-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agohw/net: Remove unnecessary header includes
Thomas Huth [Thu, 22 Feb 2018 09:58:37 +0000 (10:58 +0100)]
hw/net: Remove unnecessary header includes

Headers like "hw/loader.h" and "qemu/sockets.h" are not needed in
the hw/net/*.c files. And Some other headers are included via other
headers already, so we can drop them, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agonet: Add a new convenience option "--nic" to configure default/on-board NICs
Thomas Huth [Wed, 21 Feb 2018 10:18:36 +0000 (11:18 +0100)]
net: Add a new convenience option "--nic" to configure default/on-board NICs

The legacy "-net" option can be quite confusing for the users since most
people do not expect to get a "vlan" hub between their emulated guest
hardware and the host backend. But so far, we are also not able to get
rid of "-net" completely, since it is the only way to configure on-board
NICs that can not be instantiated via "-device" yet. It's also a little
bit shorter to type "-net nic -net tap" instead of "-device xyz,netdev=n1
-netdev tap,id=n1".

So what we need is a new convenience option that is shorter to type than
the full -device + -netdev stuff, and which can be used to configure the
on-board NICs that can not be handled via -device yet. Thus this patch now
provides such a new option "--nic": It adds an entry in the nd_table to
configure a on-board / default NIC, creates a host backend and connects
the two directly, without a confusing "vlan" hub inbetween.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agonet: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP commands
Thomas Huth [Wed, 21 Feb 2018 10:18:35 +0000 (11:18 +0100)]
net: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP commands

They are deprecated since QEMU v2.10, and so far nobody complained that
these commands are still necessary for any reason - and since you can use
'netdev_add' and 'netdev_remove' instead, there also should not be any
real reason. Since they are also standing in the way for the upcoming
'vlan' clean-up, it's now time to remove them.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agonet: Remove the deprecated way of dumping network packets
Thomas Huth [Wed, 21 Feb 2018 10:18:34 +0000 (11:18 +0100)]
net: Remove the deprecated way of dumping network packets

"-net dump" has been marked as deprecated since QEMU v2.10, since it
only works with the deprecated 'vlan' parameter (or hubs). Network
dumping should be done with "-object filter-dump" nowadays instead.
Since nobody complained so far about the deprecation message, let's
finally get rid of "-net dump" now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agonet: Make net_client_init() static
Thomas Huth [Wed, 21 Feb 2018 10:18:33 +0000 (11:18 +0100)]
net: Make net_client_init() static

The function is only used within net.c, so there's no need that
this is a global function.

While we're at it, also remove the unused prototype compute_mcast_idx()
(the function has been removed in commit d9caeb09b107e91122d10ba4a08a).

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agonet: Only show vhost-user in the help text if CONFIG_POSIX is defined
Thomas Huth [Wed, 21 Feb 2018 10:18:32 +0000 (11:18 +0100)]
net: Only show vhost-user in the help text if CONFIG_POSIX is defined

According to net/Makefile.objs we only link in the vhost-user code
if CONFIG_POSIX has been set. So the help screen should also only
show this information if CONFIG_POSIX has been defined.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agonet: List available netdevs with "-netdev help"
Thomas Huth [Wed, 21 Feb 2018 10:18:31 +0000 (11:18 +0100)]
net: List available netdevs with "-netdev help"

Other options like "-chardev" or "-device" feature a nice help text
with the available devices when being called with "help" or "?".
Since it is quite useful, especially if you want to see which network
backends have been compiled into the QEMU binary, let's provide such
a help text for "-netdev", too.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
6 years agonet: Move error reporting from net_init_client/netdev to the calling site
Thomas Huth [Wed, 21 Feb 2018 10:18:30 +0000 (11:18 +0100)]
net: Move error reporting from net_init_client/netdev to the calling site

It looks strange that net_init_client() and net_init_netdev() both
take an "Error **errp" parameter, but then do the error reporting
with "error_report_err(local_err)" on their own. Let's move the
error reporting to the calling site instead to simplify this code
a little bit.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>