]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20181212' into staging
Peter Maydell [Thu, 13 Dec 2018 13:06:09 +0000 (13:06 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181212' into staging

s390x patches for 4.0:
- add 4.0 machine type
- various fixes and small changes

# gpg: Signature made Wed 12 Dec 2018 09:52:04 GMT
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20181212:
  hw/s390x/virtio-ccw.c: Don't take address of fields in packed structs
  vfio-ap: flag as compatible with balloon
  s390x/tod: Properly stop the KVM TOD while the guest is not running
  s390/MAINTAINERS: Add Halil as kvm and machine maintainer
  s390x: introduce 4.0 compat machine
  s390x/zpci: drop msix.available

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Thu, 13 Dec 2018 11:35:42 +0000 (11:35 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

Minor virtio-blk fixes.

# gpg: Signature made Wed 12 Dec 2018 09:50:17 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:
  virtio-blk: fix comment for virtio_blk_rw_complete as nalloc is initially -1
  virtio-blk: rename iov to out_iov in virtio_blk_handle_request()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-12-04-1' into...
Peter Maydell [Thu, 13 Dec 2018 09:27:30 +0000 (09:27 +0000)]
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-12-04-1' into staging

Merge tpm 2018/12/04 v1

# gpg: Signature made Tue 04 Dec 2018 15:25:52 GMT
# gpg:                using RSA key 75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-12-04-1:
  tpm: Make sure the locality received from backend is valid
  tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
  tpm: Remove unused locty parameter from tpm_tis_abort()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging
Peter Maydell [Wed, 12 Dec 2018 21:11:49 +0000 (21:11 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging

x86 queue, 2018-12-11

* New CPU features: MOVDIRI, MOVDIR64B (Liu Jingqi);
  STIBP (Eduardo Habkost)
* Fix clang build warning (Peter Maydell)

# gpg: Signature made Tue 11 Dec 2018 20:52:56 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-pull-request:
  i386: Add "stibp" flag name
  target/i386/kvm.c: Don't mark cpuid_data as QEMU_PACKED
  x86/cpu: Enable MOVDIR64B cpu feature
  x86/cpu: Enable MOVDIRI cpu feature

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/s390x/virtio-ccw.c: Don't take address of fields in packed structs
Peter Maydell [Mon, 10 Dec 2018 12:04:36 +0000 (12:04 +0000)]
hw/s390x/virtio-ccw.c: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

Patch produced with scripts/coccinelle/inplace-byteswaps.cocci
(with a couple of long lines manually wrapped).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181210120436.30522-1-peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agovfio-ap: flag as compatible with balloon
Cornelia Huck [Wed, 5 Dec 2018 14:35:03 +0000 (15:35 +0100)]
vfio-ap: flag as compatible with balloon

vfio-ap devices do not pin any pages in the host. Therefore, they
are compatible with memory ballooning.

Flag them as compatible, so both vfio-ap and a balloon can be
used simultaneously.

Cc: qemu-stable@nongnu.org
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/tod: Properly stop the KVM TOD while the guest is not running
David Hildenbrand [Fri, 30 Nov 2018 09:49:57 +0000 (10:49 +0100)]
s390x/tod: Properly stop the KVM TOD while the guest is not running

Just like on other architectures, we should stop the clock while the guest
is not running. This is already properly done for TCG. Right now, doing an
offline migration (stop, migrate, cont) can easily trigger stalls in the
guest.

Even doing a
    (hmp) stop
    ... wait 2 minutes ...
    (hmp) cont
will already trigger stalls.

So whenever the guest stops, backup the KVM TOD. When continuing to run
the guest, restore the KVM TOD.

One special case is starting a simple VM: Reading the TOD from KVM to
stop it right away until the guest is actually started means that the
time of any simple VM will already differ to the host time. We can
simply leave the TOD running and the guest won't be able to recognize
it.

For migration, we actually want to keep the TOD stopped until really
starting the guest. To be able to catch most errors, we should however
try to set the TOD in addition to simply storing it. So we can still
catch basic migration problems.

If anything goes wrong while backing up/restoring the TOD, we have to
ignore it (but print a warning). This is then basically a fallback to
old behavior (TOD remains running).

I tested this very basically with an initrd:
    1. Start a simple VM. Observed that the TOD is kept running. Old
       behavior.
    2. Ordinary live migration. Observed that the TOD is temporarily
       stopped on the destination when setting the new value and
       correctly started when finally starting the guest.
    3. Offline live migration. (stop, migrate, cont). Observed that the
       TOD will be stopped on the source with the "stop" command. On the
       destination, the TOD is temporarily stopped when setting the new
       value and correctly started when finally starting the guest via
       "cont".
    4. Simple stop/cont correctly stops/starts the TOD. (multiple stops
       or conts in a row have no effect, so works as expected)

In the future, we might want to send the guest a special kind of time sync
interrupt under some conditions, so it can synchronize its tod to the
host tod. This is interesting for migration scenarios but also when we
get time sync interrupts ourselves. This however will most probably have
to be handled in KVM (e.g. when the tods differ too much) and is not
desired e.g. when debugging the guest (single stepping should not
result in permanent time syncs). I consider something like that an add-on
on top of this basic "don't break the guest" handling.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181130094957.4121-1-david@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390/MAINTAINERS: Add Halil as kvm and machine maintainer
Christian Borntraeger [Tue, 4 Dec 2018 13:38:02 +0000 (14:38 +0100)]
s390/MAINTAINERS: Add Halil as kvm and machine maintainer

Halil does more work in this area than I do right now. Lets add Halil.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20181204133802.100998-1-borntraeger@de.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x: introduce 4.0 compat machine
Cornelia Huck [Mon, 19 Nov 2018 10:58:53 +0000 (11:58 +0100)]
s390x: introduce 4.0 compat machine

Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/zpci: drop msix.available
David Hildenbrand [Mon, 5 Nov 2018 11:03:10 +0000 (12:03 +0100)]
s390x/zpci: drop msix.available

I fail to see why this is useful as we require MSIX always and
completely fail adding a device.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181105110313.29312-2-david@redhat.com>
Fixes: 4f6482bfe3da1e6b51ad4722a0c22f22f0d54a3b
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agovirtio-blk: fix comment for virtio_blk_rw_complete as nalloc is initially -1
Dongli Zhang [Tue, 6 Nov 2018 04:52:32 +0000 (12:52 +0800)]
virtio-blk: fix comment for virtio_blk_rw_complete as nalloc is initially -1

The initial value of nalloc is -1, but not 1.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-id: 1541479952-32355-1-git-send-email-dongli.zhang@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agovirtio-blk: rename iov to out_iov in virtio_blk_handle_request()
Dongli Zhang [Tue, 6 Nov 2018 16:09:16 +0000 (00:09 +0800)]
virtio-blk: rename iov to out_iov in virtio_blk_handle_request()

In virtio_blk_handle_request(), in_iov is used for input header while iov
is used for output header. Rename iov to out_iov to pair output header's
name with in_iov to avoid confusing people when reading source code.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Message-id: 1541520556-8334-1-git-send-email-dongli.zhang@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/vivier2/tags/trivial-patches-pull-request'...
Peter Maydell [Tue, 11 Dec 2018 22:26:44 +0000 (22:26 +0000)]
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-patches-pull-request' into staging

Trivial patches (2018-12-11)

# gpg: Signature made Tue 11 Dec 2018 18:02:20 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/vivier2/tags/trivial-patches-pull-request: (30 commits)
  Fixes i386 xchgq test
  maint: Grammar fix to mailmap
  MAINTAINERS: Update email address for Fam Zheng
  cutils: Assert in-range base for string-to-integer conversions
  util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
  target: hax: fix errors in comment
  MAINTAINERS: Use my work email to review Build and test automation patches
  MAINTAINERS: Add a missing entry for the NVDIMM device
  MAINTAINERS: Add a missing entry to the QMP section
  MAINTAINERS: Add a missing entry to SPICE
  MAINTAINERS: Add missing entries for the MPS2 machine
  MAINTAINERS: Add missing entries for the Canon DIGIC machine
  MAINTAINERS: Add missing entries to the vhost section
  MAINTAINERS: Add missing entries to the PC Chipset section
  MAINTAINERS: Add a missing entry for the sun4m machines
  MAINTAINERS: Add a missing entry for the Old World machines
  MAINTAINERS: Add a missing entry for the Xilinx S3A-DSP 1800 machine
  MAINTAINERS: Add missing entries for the Jazz machine
  MAINTAINERS: Add missing entries for the Xilinx ZynqMP machine
  MAINTAINERS: Add a missing entry to the SPARC CPU
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoi386: Add "stibp" flag name
Eduardo Habkost [Mon, 10 Dec 2018 18:02:50 +0000 (16:02 -0200)]
i386: Add "stibp" flag name

The STIBP flag may be supported by the host KVM module, so QEMU
can allow it to be configured manually, and it can be exposed to
guests when using "-cpu host".

No additional migration code is required because the whole
contents of spec_ctrl is already migrated in the "cpu/spec_ctrl"
section.

Corresponding KVM patch was submitted at:
https://lore.kernel.org/lkml/20181205191956.31480-1-ehabkost@redhat.com/

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181210180250.31299-1-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agotarget/i386/kvm.c: Don't mark cpuid_data as QEMU_PACKED
Peter Maydell [Mon, 10 Dec 2018 11:46:54 +0000 (11:46 +0000)]
target/i386/kvm.c: Don't mark cpuid_data as QEMU_PACKED

clang complains about taking the address of a packed
member of a struct:

target/i386/kvm.c:1245:27: warning: taking address of packed member 'cpuid' of class or structure '' may result in an unaligned pointer value [-Waddress-of-packed-member]
    c = cpuid_find_entry(&cpuid_data.cpuid, 1, 0);
                          ^~~~~~~~~~~~~~~~
target/i386/kvm.c:1297:31: warning: taking address of packed member 'cpuid' of class or structure '' may result in an unaligned pointer value [-Waddress-of-packed-member]
        c = cpuid_find_entry(&cpuid_data.cpuid, kvm_base, 0);
                              ^~~~~~~~~~~~~~~~

The kernel's definitions of struct kvm_cpuid2 and struct
kvm_cpuid_entry2 are carefully set up with padding fields
so that there is no between-struct padding anyway, so
the QEMU_PACKED annotation is unnecessary and might result
in the compiler generating worse code. Drop it, and instead
assert at build time that there is no stray padding.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181210114654.31433-1-peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agox86/cpu: Enable MOVDIR64B cpu feature
Liu Jingqi [Tue, 6 Nov 2018 07:13:27 +0000 (15:13 +0800)]
x86/cpu: Enable MOVDIR64B cpu feature

MOVDIR64B moves 64-bytes as direct-store with 64-bytes write atomicity.
Direct store is implemented by using write combining (WC) for writing
data directly into memory without caching the data.

The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 28] MOVDIR64B

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

Cc: Xu Tao <tao3.xu@intel.com>
Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
Message-Id: <1541488407-17045-3-git-send-email-jingqi.liu@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agox86/cpu: Enable MOVDIRI cpu feature
Liu Jingqi [Tue, 6 Nov 2018 07:13:26 +0000 (15:13 +0800)]
x86/cpu: Enable MOVDIRI cpu feature

MOVDIRI moves doubleword or quadword from register to memory through
direct store which is implemented by using write combining (WC) for
writing data directly into memory without caching the data.

The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 27] MOVDIRI

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

Cc: Xu Tao <tao3.xu@intel.com>
Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
Message-Id: <1541488407-17045-2-git-send-email-jingqi.liu@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into...
Peter Maydell [Tue, 11 Dec 2018 19:18:58 +0000 (19:18 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging

Machine queue post-3.1.0 (including 4.0 machine-types)

Features:
* Add 4.0 machine-types to q35/440fx/arm/spapr (Alex Williamson)

Documentation:
* Document vCPU hotplug procedure (Kashyap Chamarthy)
* Deprecate `cpu-add` monitor commands (Kashyap Chamarthy)

Bug fixes:
* A small sun4v_rtc_write() tracing fix that fell through the cracks
  (Eduardo Habkost)
* Validation of "host-nodes" option on memory backends (Eduardo Habkost)
* memory-device fixes and cleanups (David Hildenbrand)

Cleanups:
* Machine-type code cleanup (remove unnecessary instance_init functions)
  (Eduardo Habkost)
* qdev, qom, and global property code cleanups (Marc-André Lureau)
* PCMachineState field renames (Corey Minyard)
* numa: Match struct to typedef name (Eric Blake)
* hostmem-file: remove object id from pmem error message (Zhang Yi)

# gpg: Signature made Tue 11 Dec 2018 17:58:03 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/machine-next-pull-request: (24 commits)
  qom: remove unimplemented class_finalize
  qdev: move qdev_prop_register_global_list() to tests
  accel: register global_props like machine globals
  qom: make user_creatable_complete() specific to UserCreatable
  qom: make interface types abstract
  tests: qdev_prop_check_globals() doesn't return "all_used"
  pc: Use default_machine_opts to set suppress_vmdesc
  spapr: Delete instance_options functions
  spapr: Use default_machine_opts to set suppress_vmdesc
  spapr: Use default_machine_opts to set use_hotplug_event_source
  virt: Eliminate separate instance_init functions
  q35/440fx/arm/spapr: Add QEMU 4.0 machine type
  hostmem: Validate host-nodes before setting bitmap
  numa: Match struct to typedef name
  i386: Rename bools in PCMachineState to end in _enabled
  move ObjectClass to typedefs.h
  memory-device: avoid overflows on very huge devices
  memory-device: use QEMU_IS_ALIGNED
  range: pass const pointer where possible
  Deprecate HMP `cpu-add`
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoqom: remove unimplemented class_finalize
Marc-André Lureau [Tue, 4 Dec 2018 14:20:10 +0000 (18:20 +0400)]
qom: remove unimplemented class_finalize

Instead of trying to implement something that isn't well specified,
remove it. (it would be tricky to implement, since a class struct is
memcpy on children types...)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-7-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqdev: move qdev_prop_register_global_list() to tests
Marc-André Lureau [Tue, 4 Dec 2018 14:20:09 +0000 (18:20 +0400)]
qdev: move qdev_prop_register_global_list() to tests

The function is only used by a test, move it there.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20181204142023.15982-6-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoaccel: register global_props like machine globals
Marc-André Lureau [Tue, 4 Dec 2018 14:20:08 +0000 (18:20 +0400)]
accel: register global_props like machine globals

global_props is only used for Xen xen_compat_props. It's a static
array of GlobalProperty, like machine globals in SET_MACHINE_COMPAT().
Let's register the globals the same way, without extra copy allocation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20181204142023.15982-5-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqom: make user_creatable_complete() specific to UserCreatable
Marc-André Lureau [Tue, 4 Dec 2018 14:20:07 +0000 (18:20 +0400)]
qom: make user_creatable_complete() specific to UserCreatable

Instead of accepting any Object*, change user_creatable_complete() to
require a UserCreatable*. Modify the callers to pass the appropriate
argument, removing redundant dynamic cast checks in object creation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-4-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqom: make interface types abstract
Marc-André Lureau [Tue, 4 Dec 2018 14:20:06 +0000 (18:20 +0400)]
qom: make interface types abstract

Interfaces don't have instance, let's make the interface type really
abstract to avoid confusion.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-3-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agotests: qdev_prop_check_globals() doesn't return "all_used"
Marc-André Lureau [Tue, 4 Dec 2018 14:20:05 +0000 (18:20 +0400)]
tests: qdev_prop_check_globals() doesn't return "all_used"

Instead, it returns 1 if an error was detected, which is the case for:

/qdev/properties/dynamic/global/subprocess:
warning: global dynamic-prop-type-bad.prop3 has invalid class name
warning: global nohotplug-type.prop5=105 not used
warning: global nondevice-type.prop6 has invalid class name

Clarify the function return value.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-2-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agopc: Use default_machine_opts to set suppress_vmdesc
Eduardo Habkost [Wed, 5 Dec 2018 20:58:27 +0000 (18:58 -0200)]
pc: Use default_machine_opts to set suppress_vmdesc

Instead of setting suppress_vmdesc at instance_init time, set
default_machine_opts on pc_i440fx_2_2_machine_options() to
implement equivalent behavior.

This will let us eliminate the need for pc_compat_*() functions
for PC machine-types.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-6-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agospapr: Delete instance_options functions
Eduardo Habkost [Wed, 5 Dec 2018 20:58:26 +0000 (18:58 -0200)]
spapr: Delete instance_options functions

Now that all instance_options functions for spapr are empty,
delete them.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-5-ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agospapr: Use default_machine_opts to set suppress_vmdesc
Eduardo Habkost [Wed, 5 Dec 2018 20:58:25 +0000 (18:58 -0200)]
spapr: Use default_machine_opts to set suppress_vmdesc

Instead of setting suppress_vmdesc at instance_init time, set
default_machine_opts on spapr_machine_2_2_class_options() to
implement equivalent behavior.

This will let us eliminate the need for separate instance_init
functions for each spapr machine-type.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-4-ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agospapr: Use default_machine_opts to set use_hotplug_event_source
Eduardo Habkost [Wed, 5 Dec 2018 20:58:24 +0000 (18:58 -0200)]
spapr: Use default_machine_opts to set use_hotplug_event_source

Instead of setting use_hotplug_event_source at instance_init
time, set default_machine_opts on spapr_machine_2_7_class_options()
to implement equivalent behavior.

This will let us eliminate the need for separate instance_init
functions for each spapr machine-type.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-3-ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agovirt: Eliminate separate instance_init functions
Eduardo Habkost [Wed, 5 Dec 2018 20:58:23 +0000 (18:58 -0200)]
virt: Eliminate separate instance_init functions

All instance_init functions for all virt machine-types run
exactly the same code, so we don't need separate functions.  We
only need to set instance_init for TYPE_VIRT_MACHINE.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181205205827.19387-2-ehabkost@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoq35/440fx/arm/spapr: Add QEMU 4.0 machine type
Alex Williamson [Tue, 4 Dec 2018 16:27:16 +0000 (09:27 -0700)]
q35/440fx/arm/spapr: Add QEMU 4.0 machine type

Including all machine types that might have a pcie-root-port.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <154394083644.28192.8501647946108201466.stgit@gimli.home>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
[ehabkost: fixed accidental recursion at spapr_machine_3_1_class_options()]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohostmem: Validate host-nodes before setting bitmap
Eduardo Habkost [Fri, 30 Nov 2018 12:28:44 +0000 (10:28 -0200)]
hostmem: Validate host-nodes before setting bitmap

host_memory_backend_set_host_nodes() was not validating
host-nodes before writing to backend->host_nodes, making QEMU
write beyond the end of the bitmap.

Fix the crash and add a simple regression test for the fix.

While at it, fix memory leak of the list returned by
visit_type_uint16List().

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181130122844.29103-1-ehabkost@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
[ehabkost: removed test case code]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agonuma: Match struct to typedef name
Eric Blake [Thu, 15 Nov 2018 21:17:52 +0000 (15:17 -0600)]
numa: Match struct to typedef name

There's no reason to violate our naming conventions by having a
struct with a different name than its typedef.  Messed up since
its introduction in commit 8c85901e, but made more obvious when
commit 3bfe5716 promoted it to typedefs.h.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181115211752.1295571-3-eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoi386: Rename bools in PCMachineState to end in _enabled
Corey Minyard [Wed, 7 Nov 2018 15:24:34 +0000 (09:24 -0600)]
i386: Rename bools in PCMachineState to end in _enabled

This makes their function more clear and prevents conflicts when adding
the actual devices to the machine state, if necessary.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181107152434.22219-1-minyard@acm.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomove ObjectClass to typedefs.h
Gerd Hoffmann [Tue, 6 Nov 2018 10:23:30 +0000 (11:23 +0100)]
move ObjectClass to typedefs.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20181106102335.20027-2-kraxel@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomemory-device: avoid overflows on very huge devices
David Hildenbrand [Tue, 23 Oct 2018 15:23:05 +0000 (17:23 +0200)]
memory-device: avoid overflows on very huge devices

Should not be a problem right now, but it could theoretically happen
in the future.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181023152306.3123-7-david@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomemory-device: use QEMU_IS_ALIGNED
David Hildenbrand [Tue, 23 Oct 2018 15:23:04 +0000 (17:23 +0200)]
memory-device: use QEMU_IS_ALIGNED

Shorter and easier to read.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181023152306.3123-6-david@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agorange: pass const pointer where possible
David Hildenbrand [Tue, 23 Oct 2018 15:23:02 +0000 (17:23 +0200)]
range: pass const pointer where possible

If there are no changes, let's use a const pointer.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181023152306.3123-4-david@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoDeprecate HMP `cpu-add`
Kashyap Chamarthy [Tue, 30 Oct 2018 12:35:25 +0000 (13:35 +0100)]
Deprecate HMP `cpu-add`

Since we're deprecating the QMP `cpu-add`, let's deprecate its HMP
equivalent, too.

Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20181030123526.26415-3-kchamart@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoDeprecate QMP `cpu-add`
Kashyap Chamarthy [Tue, 30 Oct 2018 12:35:24 +0000 (13:35 +0100)]
Deprecate QMP `cpu-add`

The intended functionality of QMP `cpu-add` is replaced with
`device_add` (and `query-hotpluggable-cpus`).  So let's deprecate
`cpu-add`.

A complete example of vCPU hotplug with the recommended way (using
`device_add`) is provided as part of a seperate docs patch.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20181030123526.26415-2-kchamart@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agodocs: Document vCPU hotplug procedure
Kashyap Chamarthy [Tue, 30 Oct 2018 12:35:26 +0000 (13:35 +0100)]
docs: Document vCPU hotplug procedure

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20181030123526.26415-4-kchamart@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohw/timer/sun4v-rtc: Fix tracing at sun4v_rtc_write()
Eduardo Habkost [Wed, 31 Oct 2018 00:18:43 +0000 (21:18 -0300)]
hw/timer/sun4v-rtc: Fix tracing at sun4v_rtc_write()

The code was converted to use sun4v_rtc_read() by mistake, fix
it.

Reported-by: David Gibson <david@gibson.dropbear.id.au>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181031001843.12892-1-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohostmem-file: remove object id from pmem error message
Zhang Yi [Wed, 24 Oct 2018 14:14:56 +0000 (22:14 +0800)]
hostmem-file: remove object id from pmem error message

We will never get the canonical path from the object
before object_property_add_child.

Signed-off-by: Zhang Yi <yi.z.zhang@linux.intel.com>
Message-Id: <a6491f996827f4039c1a52198ed5dcc7727cb0f9.1540389255.git.yi.z.zhang@linux.intel.com>
[ehabkost: reword commit message]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoFixes i386 xchgq test
fabrice.desclaux@cea.fr [Fri, 7 Dec 2018 14:44:40 +0000 (15:44 +0100)]
Fixes i386 xchgq test

As "xchg" reads and writes both operands, the "+m" is required to avoid
undefined behavior on -O2 compilation.

Signed-off-by: Fabrice Desclaux <fabrice.desclaux@cea.fr>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <03506cf0-a204-f619-8ee4-4990a5e69af5@cea.fr>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agomaint: Grammar fix to mailmap
Eric Blake [Fri, 7 Dec 2018 17:07:33 +0000 (11:07 -0600)]
maint: Grammar fix to mailmap

Make the sentence read better.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20181207170733.129532-1-eblake@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Update email address for Fam Zheng
Fam Zheng [Wed, 21 Nov 2018 15:30:36 +0000 (23:30 +0800)]
MAINTAINERS: Update email address for Fam Zheng

Since I am about to change company, update the email address in
MAINTAINERS to my personal one. Depending on responsibility changes I
may eventually fade out in some of the maintained areas, but that will
be figured out afterward, or maybe I'll use the work email later. For
now, just do a search and replace.

Signed-off-by: Fam Zheng <fam@euphon.net>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181121153036.2941-1-famz@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agocutils: Assert in-range base for string-to-integer conversions
Eric Blake [Thu, 6 Dec 2018 15:18:56 +0000 (09:18 -0600)]
cutils: Assert in-range base for string-to-integer conversions

POSIX states that the value of endptr is unspecified if strtol()
fails with EINVAL due to an invalid base argument.  Since none of
the callers to check_strtox_error() initialized endptr, we could
end up propagating uninitialized data back to a caller on error.
However, passing an out-of-range base is already a sign of poor
programming, so let's just assert that base is in range, at which
point check_strtox_error() can be tightened to assert that it is
receiving an initialized ep that points somewhere within the
caller's original string, regardless of whether strto*() succeeded
or failed with ERANGE.

Reported-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181206151856.77503-1-eblake@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoutil: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()
Li Qiang [Fri, 30 Nov 2018 09:53:58 +0000 (01:53 -0800)]
util: vfio-helpers: use ARRAY_SIZE in qemu_vfio_init_pci()

Cc: qemu-trivial@nongnu.org
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1543571638-2892-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agotarget: hax: fix errors in comment
Li Qiang [Tue, 27 Nov 2018 10:00:12 +0000 (02:00 -0800)]
target: hax: fix errors in comment

Cc: qemu-trivial@nongnu.org
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1543312812-2929-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Use my work email to review Build and test automation patches
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:59 +0000 (21:49 +0100)]
MAINTAINERS: Use my work email to review Build and test automation patches

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-25-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the NVDIMM device
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:56 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the NVDIMM device

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-22-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry to the QMP section
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:54 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry to the QMP section

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181125205000.10324-20-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry to SPICE
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:52 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry to SPICE

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20181125205000.10324-18-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the MPS2 machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:51 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the MPS2 machine

Missed in de343bb632a.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181125205000.10324-17-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the Canon DIGIC machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:50 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the Canon DIGIC machine

This pattern now also matches:
- include/hw/timer/digic-timer.h
- include/hw/char/digic-uart.h

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181125205000.10324-16-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries to the vhost section
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:49 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries to the vhost section

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-15-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries to the PC Chipset section
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:47 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries to the PC Chipset section

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-13-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the sun4m machines
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:44 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the sun4m machines

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20181125205000.10324-10-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the Old World machines
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:43 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the Old World machines

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20181125205000.10324-9-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry for the Xilinx S3A-DSP 1800 machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:41 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry for the Xilinx S3A-DSP 1800 machine

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20181125205000.10324-7-philmd@redhat.com>
[lv: added the missing 'F:' field]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the Jazz machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:40 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the Jazz machine

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Message-Id: <20181125205000.10324-6-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing entries for the Xilinx ZynqMP machine
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:39 +0000 (21:49 +0100)]
MAINTAINERS: Add missing entries for the Xilinx ZynqMP machine

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20181125205000.10324-5-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add a missing entry to the SPARC CPU
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:37 +0000 (21:49 +0100)]
MAINTAINERS: Add a missing entry to the SPARC CPU

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20181125205000.10324-3-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Fix ACPI tests data files path
Philippe Mathieu-Daudé [Sun, 25 Nov 2018 20:49:36 +0000 (21:49 +0100)]
MAINTAINERS: Fix ACPI tests data files path

Missed while moving those files in 438c78dab75.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20181125205000.10324-2-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agotarget: hax: replace g_malloc with g_new0
Li Qiang [Mon, 26 Nov 2018 09:56:19 +0000 (01:56 -0800)]
target: hax: replace g_malloc with g_new0

And also the g_malloc doesn't need check return value,
remove it.

Cc: qemu-trivial@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1543226179-5135-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add nios2-related files to the Nios2 section
Thomas Huth [Thu, 22 Nov 2018 15:11:40 +0000 (16:11 +0100)]
MAINTAINERS: Add nios2-related files to the Nios2 section

nios2_iic.c and the default-configs/nios2-softmmu.mak file are
currently "unmaintained" according to the get_maintainers.pl script.
Move them to the Nios2 section where they obviously belong to.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1542899500-23346-1-git-send-email-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoMAINTAINERS: Add missing hw/pci-host entries
Thomas Huth [Thu, 22 Nov 2018 13:02:40 +0000 (14:02 +0100)]
MAINTAINERS: Add missing hw/pci-host entries

Bonito belongs to Fulong-2E, Sabre belongs to Sun4u, and Mac-Newworld
and Mips-Boston were missing the header files.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Acked-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <1542891760-13937-1-git-send-email-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agomisc: Avoid UTF-8 in error messages
Eric Blake [Tue, 20 Nov 2018 20:36:28 +0000 (14:36 -0600)]
misc: Avoid UTF-8 in error messages

While most developers are now using UTF-8 environments, it's
harder to guarantee that error messages will be output to
a multibyte locale. Rather than risking error messages that
get corrupted into mojibake when the user runs qemu in a
non-multibyte locale, let's stick to straight ASCII error
messages, rather than assuming that our use of UTF-8 in source
code string constants will work unchanged in other locales.

Found with:
$ LC_ALL=C git grep -l $'".*[\x80-\xff].*"' origin -- '**/*.[ch]' | cat
origin:hw/misc/tmp105.c
origin:hw/misc/tmp421.c

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181120203628.2367003-1-eblake@redhat.com>
[lv: added command line to find non ASCII characters]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoqapi: Reduce Makefile boilerplate
Eric Blake [Fri, 16 Nov 2018 20:00:16 +0000 (14:00 -0600)]
qapi: Reduce Makefile boilerplate

Adding a new qapi module had some rather tedious repetition to
wire it into Makefile, Makefile.objs, and .gitignore (for example,
see commit bf42508f and its followup b61acdec). For make, add some
indirection by taking advantage of GNU Make string processing to
expand a list of module names into all the required artifacts, so
that future additions of a new module need only touch the list of
module names.  And for gitignore, use globs to cover all generated
file names.

The list has to live in Makefile.objs, due to the way that
our unnest-vars macro slirps in that file without remembering
any definition of $(QAPI_MODULES) from Makefile.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Yuval Shaia <yuval.shaia@oracle.com>
Message-Id: <20181116200016.2080785-1-eblake@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agohw: set_netdev: remove useless code
Li Qiang [Fri, 9 Nov 2018 08:13:34 +0000 (00:13 -0800)]
hw: set_netdev: remove useless code

In set_netdev(), the peers[i] is initialized
qemu_find_net_clients_except() when i is in
0 between 'queues' it can't be NULL.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1541751214-17515-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agomisc: fix spelling
Marc-André Lureau [Mon, 5 Nov 2018 13:54:00 +0000 (17:54 +0400)]
misc: fix spelling

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20181105135400.18366-1-marcandre.lureau@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agovirtio: pass argument by value for virtqueue_map_iovec()
Dongli Zhang [Fri, 2 Nov 2018 06:16:36 +0000 (14:16 +0800)]
virtio: pass argument by value for virtqueue_map_iovec()

Pass num_sg by value instead of by pointer, as num_sg is never modified in
virtqueue_map_iovec().

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1541139396-4727-1-git-send-email-dongli.zhang@oracle.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agohw: qdev: fix error in comment
Li Qiang [Tue, 30 Oct 2018 15:16:37 +0000 (08:16 -0700)]
hw: qdev: fix error in comment

Cc: qemu-trivial@nongnu.org
Signed-off-by: Li Qiang <liq3ea@163.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20181030151637.37207-1-liq3ea@163.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
5 years agoOpen 4.0 development tree
Peter Maydell [Tue, 11 Dec 2018 17:27:58 +0000 (17:27 +0000)]
Open 4.0 development tree

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoUpdate version for v3.1.0 release v3.1.0
Peter Maydell [Tue, 11 Dec 2018 17:18:37 +0000 (17:18 +0000)]
Update version for v3.1.0 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoUpdate version for v3.1.0-rc5 release
Peter Maydell [Thu, 6 Dec 2018 17:07:12 +0000 (17:07 +0000)]
Update version for v3.1.0-rc5 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoi2c: pm_smbus: check smb_index before block transfer write
Prasad J Pandit [Thu, 6 Dec 2018 12:18:30 +0000 (17:48 +0530)]
i2c: pm_smbus: check smb_index before block transfer write

While performing block transfer write in smb_ioport_writeb(),
'smb_index' is incremented and used to index smb_data[] array.
Check 'smb_index' value to avoid OOB access.

Note that this bug is exploitable by a guest to escape
from the virtual machine. However the commit which
introduced the bug was only made after the 3.0 release,
and so it is not present in any released QEMU versions.

Fixes: 38ad4fae43 i2c: pm_smbus: Add block transfer capability
Reported-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20181206121830.6177-1-ppandit@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoUpdate version for v3.1.0-rc4 release
Peter Maydell [Tue, 4 Dec 2018 18:31:50 +0000 (18:31 +0000)]
Update version for v3.1.0-rc4 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotpm: Make sure the locality received from backend is valid
Stefan Berger [Tue, 4 Dec 2018 14:54:39 +0000 (09:54 -0500)]
tpm: Make sure the locality received from backend is valid

Make sure that the locality passed from the backend to
tpm_tis_request_completed() is valid.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agotpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
Stefan Berger [Tue, 20 Nov 2018 18:14:51 +0000 (13:14 -0500)]
tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid

Make sure that the new locality passed to tpm_tis_prep_abort()
is valid.

Add a comment to aborting_locty that it may be any locality, including
TPM_TIS_NO_LOCALITY.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agovirtio-net-test: add large tx buffer test
Jason Wang [Tue, 4 Dec 2018 03:53:47 +0000 (11:53 +0800)]
virtio-net-test: add large tx buffer test

This test tries to build a packet whose size is greater than INT_MAX
which tries to trigger integer overflow in qemu_net_queue_append_iov()
which may result OOB.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20181204035347.6148-6-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agovirtio-net-test: remove unused macro
Jason Wang [Tue, 4 Dec 2018 03:53:46 +0000 (11:53 +0800)]
virtio-net-test: remove unused macro

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-id: 20181204035347.6148-5-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agovirtio-net-test: accept variable length argument in pci_test_start()
Jason Wang [Tue, 4 Dec 2018 03:53:45 +0000 (11:53 +0800)]
virtio-net-test: accept variable length argument in pci_test_start()

This allows flexibility to be reused for all kinds of command line
used by other tests.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-id: 20181204035347.6148-4-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonet: hub: suppress warnings of no host network for qtest
Jason Wang [Tue, 4 Dec 2018 03:53:44 +0000 (11:53 +0800)]
net: hub: suppress warnings of no host network for qtest

If we want to qtest through hub, it would be much more simpler and
safer to configure the hub without host network. So silent this
warnings for qtest.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20181204035347.6148-3-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonet: drop too large packet early
Jason Wang [Tue, 4 Dec 2018 03:53:43 +0000 (11:53 +0800)]
net: drop too large packet early

We try to detect and drop too large packet (>INT_MAX) in 1592a9947036
("net: ignore packet size greater than INT_MAX") during packet
delivering. Unfortunately, this is not sufficient as we may hit
another integer overflow when trying to queue such large packet in
qemu_net_queue_append_iov():

- size of the allocation may overflow on 32bit
- packet->size is integer which may overflow even on 64bit

Fixing this by moving the check to qemu_sendv_packet_async() which is
the entrance of all networking codes and reduce the limit to
NET_BUFSIZE to be more conservative. This works since:

- For the callers that call qemu_sendv_packet_async() directly, they
  only care about if zero is returned to determine whether to prevent
  the source from producing more packets. A callback will be triggered
  if peer can accept more then source could be enabled. This is
  usually used by high speed networking implementation like virtio-net
  or netmap.
- For the callers that call qemu_sendv_packet() that calls
  qemu_sendv_packet_async() indirectly, they often ignore the return
  value. In this case qemu will just the drop packets if peer can't
  receive.

Qemu will copy the packet if it was queued. So it was safe for both
kinds of the callers to assume the packet was sent.

Since we move the check from qemu_deliver_packet_iov() to
qemu_sendv_packet_async(), it would be safer to make
qemu_deliver_packet_iov() static to prevent any external user in the
future.

This is a revised patch of CVE-2018-17963.

Cc: qemu-stable@nongnu.org
Cc: Li Qiang <liq3ea@163.com>
Fixes: 1592a9947036 ("net: ignore packet size greater than INT_MAX")
Reported-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20181204035347.6148-2-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181203-pull-request...
Peter Maydell [Mon, 3 Dec 2018 19:57:59 +0000 (19:57 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181203-pull-request' into staging

usb: mtp fixes.

# gpg: Signature made Mon 03 Dec 2018 19:50:26 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/fixes-31-20181203-pull-request:
  usb-mtp: outlaw slashes in filenames
  usb-mtp: fix utf16_to_str

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agousb-mtp: outlaw slashes in filenames
Gerd Hoffmann [Mon, 3 Dec 2018 10:10:45 +0000 (11:10 +0100)]
usb-mtp: outlaw slashes in filenames

Slash is unix directory separator, so they are not allowed in filenames.
Note this also stops the classic escape via "../".

Fixes: CVE-2018-16867
Reported-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181203101045.27976-3-kraxel@redhat.com

5 years agousb-mtp: fix utf16_to_str
Gerd Hoffmann [Mon, 3 Dec 2018 10:10:44 +0000 (11:10 +0100)]
usb-mtp: fix utf16_to_str

Make utf16_to_str return an allocated string.  Remove the assumtion that
the number of string bytes equals the number of utf16 chars (which is
only true for ascii chars).  Instead call wcstombs twice, once to figure
the storage size and once for the actual conversion (as suggested by the
wcstombs manpage).

FIXME: surrogate pairs are not working correctly.  Pre-existing bug,
fixing that is left for another day.

Reported-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20181203101045.27976-2-kraxel@redhat.com

5 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-12-03' into staging
Peter Maydell [Mon, 3 Dec 2018 17:43:20 +0000 (17:43 +0000)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-12-03' into staging

nbd patches for 2018-12-03

Improve x-dirty-bitmap handling for experimenting with pull mode
incremental backups.

- Eric Blake: 0/3 NBD dirty bitmap cleanups

# gpg: Signature made Mon 03 Dec 2018 15:56:23 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-nbd-2018-12-03:
  nbd/client: Send NBD_CMD_DISC if open fails after connect
  nbd/client: Make x-dirty-bitmap more reliable
  nbd/server: Advertise all contexts in response to bare LIST

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Mon, 3 Dec 2018 17:12:48 +0000 (17:12 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- mirror: Fix deadlock

# gpg: Signature made Mon 03 Dec 2018 16:57:33 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:
  iotests: simple mirror test with kvm on 1G image
  mirror: fix dead-lock

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotpm: Remove unused locty parameter from tpm_tis_abort()
Stefan Berger [Tue, 20 Nov 2018 18:06:19 +0000 (13:06 -0500)]
tpm: Remove unused locty parameter from tpm_tis_abort()

Remove the unused locty parameter from tpm_tis_abort() function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoiotests: simple mirror test with kvm on 1G image
Vladimir Sementsov-Ogievskiy [Mon, 3 Dec 2018 15:12:09 +0000 (16:12 +0100)]
iotests: simple mirror test with kvm on 1G image

This test is broken without previous commit fixing dead-lock in mirror.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Acked-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agomirror: fix dead-lock
Vladimir Sementsov-Ogievskiy [Thu, 29 Nov 2018 10:18:00 +0000 (13:18 +0300)]
mirror: fix dead-lock

Let start from the beginning:

Commit b9e413dd375 (in 2.9)
"block: explicitly acquire aiocontext in aio callbacks that need it"
added pairs of aio_context_acquire/release to mirror_write_complete and
mirror_read_complete, when they were aio callbacks for blk_aio_* calls.

Then, commit 2e1990b26e5 (in 3.0) "block/mirror: Convert to coroutines"
dropped these blk_aio_* calls, than mirror_write_complete and
mirror_read_complete are not callbacks more, and don't need additional
aiocontext acquiring. Furthermore, mirror_read_complete calls
blk_co_pwritev inside these pair of aio_context_acquire/release, which
leads to the following dead-lock with mirror:

 (gdb) info thr
   Id   Target Id         Frame
   3    Thread (LWP 145412) "qemu-system-x86" syscall ()
   2    Thread (LWP 145416) "qemu-system-x86" __lll_lock_wait ()
 * 1    Thread (LWP 145411) "qemu-system-x86" __lll_lock_wait ()

 (gdb) bt
 #0  __lll_lock_wait ()
 #1  _L_lock_812 ()
 #2  __GI___pthread_mutex_lock
 #3  qemu_mutex_lock_impl (mutex=0x561032dce420 <qemu_global_mutex>,
     file=0x5610327d8654 "util/main-loop.c", line=236) at
     util/qemu-thread-posix.c:66
 #4  qemu_mutex_lock_iothread_impl
 #5  os_host_main_loop_wait (timeout=480116000) at util/main-loop.c:236
 #6  main_loop_wait (nonblocking=0) at util/main-loop.c:497
 #7  main_loop () at vl.c:1892
 #8  main

Printing contents of qemu_global_mutex, I see that "__owner = 145416",
so, thr1 is main loop, and now it wants BQL, which is owned by thr2.

 (gdb) thr 2
 (gdb) bt
 #0  __lll_lock_wait ()
 #1  _L_lock_870 ()
 #2  __GI___pthread_mutex_lock
 #3  qemu_mutex_lock_impl (mutex=0x561034d25dc0, ...
 #4  aio_context_acquire (ctx=0x561034d25d60)
 #5  dma_blk_cb
 #6  dma_blk_io
 #7  dma_blk_read
 #8  ide_dma_cb
 #9  bmdma_cmd_writeb
 #10 bmdma_write
 #11 memory_region_write_accessor
 #12 access_with_adjusted_size
 #15 flatview_write
 #16 address_space_write
 #17 address_space_rw
 #18 kvm_handle_io
 #19 kvm_cpu_exec
 #20 qemu_kvm_cpu_thread_fn
 #21 qemu_thread_start
 #22 start_thread
 #23 clone ()

Printing mutex in fr 2, I see "__owner = 145411", so thr2 wants aio
context mutex, which is owned by thr1. Classic dead-lock.

Then, let's check that aio context is hold by mirror coroutine: just
print coroutine stack of first tracked request in mirror job target:

 (gdb) [...]
 (gdb) qemu coroutine 0x561035dd0860
 #0  qemu_coroutine_switch
 #1  qemu_coroutine_yield
 #2  qemu_co_mutex_lock_slowpath
 #3  qemu_co_mutex_lock
 #4  qcow2_co_pwritev
 #5  bdrv_driver_pwritev
 #6  bdrv_aligned_pwritev
 #7  bdrv_co_pwritev
 #8  blk_co_pwritev
 #9  mirror_read_complete () at block/mirror.c:232
 #10 mirror_co_read () at block/mirror.c:370
 #11 coroutine_trampoline
 #12 __start_context

Yes it is mirror_read_complete calling blk_co_pwritev after acquiring
aio context.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoi386: hvf: Fix overrun of _decode_tbl1
Roman Bolshakov [Mon, 3 Dec 2018 10:04:14 +0000 (13:04 +0300)]
i386: hvf: Fix overrun of _decode_tbl1

Single opcode instructions in ff group were incorrectly processed
because an overrun of _decode_tbl1[0xff] resulted in access of
_decode_tbl2[0x0]. Thus, decode_sldtgroup was called instead of
decode_ffgroup:
  7d71: decode_sldtgroup: 1
  Unimplemented handler (7d71) for 108 (ff 0)

While at it correct maximum length for _decode_tbl2 and _decode_tbl3.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoi2c: Add a length check to the SMBus write handling
Corey Minyard [Mon, 3 Dec 2018 12:52:50 +0000 (06:52 -0600)]
i2c: Add a length check to the SMBus write handling

Avoid an overflow.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: QEMU Stable <qemu-stable@nongnu.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonbd/client: Send NBD_CMD_DISC if open fails after connect
Eric Blake [Fri, 30 Nov 2018 02:32:32 +0000 (20:32 -0600)]
nbd/client: Send NBD_CMD_DISC if open fails after connect

If nbd_client_init() fails after we are already connected,
then the server will spam logs with:

Disconnect client, due to: Unexpected end-of-file before all bytes were read

unless we gracefully disconnect before closing the connection.

Ways to trigger this:

$ opts=driver=nbd,export=foo,server.type=inet,server.host=localhost,server.port=10809
$  qemu-img map --output=json --image-opts $opts,read-only=off
$  qemu-img map --output=json --image-opts $opts,x-dirty-bitmap=nosuch:

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181130023232.3079982-4-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd/client: Make x-dirty-bitmap more reliable
Eric Blake [Fri, 30 Nov 2018 02:32:31 +0000 (20:32 -0600)]
nbd/client: Make x-dirty-bitmap more reliable

The implementation of x-dirty-bitmap in qemu 3.0 (commit 216ee365)
silently falls back to treating the server as not supporting
NBD_CMD_BLOCK_STATUS if a requested meta_context name was not
negotiated, which in turn means treating the _entire_ image as
data. Since our hack relied on using 'qemu-img map' to view
which portions of the image were dirty by seeing what the
redirected bdrv_block_status() treats as holes, this means
that our fallback treats the entire image as clean.  Better
would have been to treat the entire image as dirty, or to fail
to connect because the user's request for a specific context
could not be honored. This patch goes with the latter.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181130023232.3079982-3-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd/server: Advertise all contexts in response to bare LIST
Eric Blake [Fri, 30 Nov 2018 02:32:30 +0000 (20:32 -0600)]
nbd/server: Advertise all contexts in response to bare LIST

The NBD spec, and even our code comment, says that if the client
asks for NBD_OPT_LIST_META_CONTEXT with 0 queries, then we should
reply with (a possibly-compressed representation of) ALL contexts
that we are willing to let them try.  But commit 3d068aff forgot
to advertise qemu:dirty-bitmap:FOO.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181130023232.3079982-2-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agoUpdate version for v3.1.0-rc3 release
Peter Maydell [Wed, 28 Nov 2018 17:37:34 +0000 (17:37 +0000)]
Update version for v3.1.0-rc3 release

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm/sve_helper: Fix compilation with clang 3.4
Thomas Huth [Wed, 28 Nov 2018 09:58:14 +0000 (10:58 +0100)]
target/arm/sve_helper: Fix compilation with clang 3.4

Clang 3.4 does not know the "flatten" attribute yet. We've already
introduced the QEMU_FLATTEN macro for this in commit 97ff87c0ed020c2,
so use this macro now here, too, to fix this issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1543399094-2260-1-git-send-email-thuth@redhat.com
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/arm/aspeed: Fix build issue with clang 3.4
Thomas Huth [Wed, 28 Nov 2018 09:35:36 +0000 (10:35 +0100)]
hw/arm/aspeed: Fix build issue with clang 3.4

When using clang 3.4.2, compilation of QEMU fails like this:

  CC      aarch64-softmmu/hw/arm/aspeed.o
hw/arm/aspeed.c:36:3: error: redefinition of typedef 'AspeedBoardState' is a C11
      feature [-Werror,-Wtypedef-redefinition]
} AspeedBoardState;
  ^
include/hw/arm/aspeed.h:14:33: note: previous definition is here
typedef struct AspeedBoardState AspeedBoardState;
                                ^
1 error generated.
make[1]: *** [hw/arm/aspeed.o] Error 1
make: *** [subdir-aarch64-softmmu] Error 2

Remove the duplicated typedef to fix this issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-id: 1543397736-8198-1-git-send-email-thuth@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>