]> Git Repo - qemu.git/log
qemu.git
7 years agopflash_cfi01: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:49 +0000 (17:35 -0300)]
pflash_cfi01: Remove user_creatable flag

TYPE_CFI_PFLASH01 devices need to be mapped by
pflash_cfi01_register() (or equivalent) and can't be used with
-device. Remove user_creatable from the device class.

Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: [email protected]
Cc: Laszlo Ersek <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agofdc: Remove user_creatable flag from sysbus-fdc & SUNW,fdtwo
Eduardo Habkost [Wed, 3 May 2017 20:35:48 +0000 (17:35 -0300)]
fdc: Remove user_creatable flag from sysbus-fdc & SUNW,fdtwo

sysbus-fdc and SUNW,fdtwo devices need IRQs to be wired and mmio
to be mapped, and can't be used with -device. Unset
user_creatable on their device classes.

Cc: John Snow <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: [email protected]
Cc: Thomas Huth <[email protected]>
Acked-by: John Snow <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoiommu: Remove FIXME comment about user_creatable=true
Eduardo Habkost [Wed, 3 May 2017 20:35:47 +0000 (17:35 -0300)]
iommu: Remove FIXME comment about user_creatable=true

amd-iommu and intel-iommu are really meant to be used with
-device, so they need user_creatable=true. Remove the FIXME
comment.

Cc: Marcel Apfelbaum <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoxen-backend: Remove FIXME comment about user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:46 +0000 (17:35 -0300)]
xen-backend: Remove FIXME comment about user_creatable flag

xen-backend can be plugged/unplugged dynamically when using the
Xen accelerator, so keep the user_creatable flag on the device
class and remove the FIXME comment.

Cc: Juergen Gross <[email protected]>,
Cc: Peter Maydell <[email protected]>,
Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Cc: Markus Armbruster <[email protected]>,
Cc: Marcel Apfelbaum <[email protected]>,
Cc: Laszlo Ersek <[email protected]>
Acked-by: Juergen Gross <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agosysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE
Eduardo Habkost [Wed, 3 May 2017 20:35:45 +0000 (17:35 -0300)]
sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE

commit 33cd52b5d7b9adfd009e95f07e6c64dd88ae2a31 unset
cannot_instantiate_with_device_add_yet in TYPE_SYSBUS, making all
sysbus devices appear on "-device help" and lack the "no-user"
flag in "info qdm".

To fix this, we can set user_creatable=false by default on
TYPE_SYS_BUS_DEVICE, but this requires setting
user_creatable=true explicitly on the sysbus devices that
actually work with -device.

Fortunately today we have just a few has_dynamic_sysbus=1
machines: virt, pc-q35-*, ppce500, and spapr.

virt, ppce500, and spapr have extra checks to ensure just a few
device types can be instantiated:

* virt supports only TYPE_VFIO_CALXEDA_XGMAC, TYPE_VFIO_AMD_XGBE.
* ppce500 supports only TYPE_ETSEC_COMMON.
* spapr supports only TYPE_SPAPR_PCI_HOST_BRIDGE.

This patch sets user_creatable=true explicitly on those 4 device
classes.

Now, the more complex cases:

pc-q35-*: q35 has no sysbus device whitelist yet (which is a
separate bug). We are in the process of fixing it and building a
sysbus whitelist on q35, but in the meantime we can fix the
"-device help" and "info qdm" bugs mentioned above. Also, despite
not being strictly necessary for fixing the q35 bug, reducing the
list of user_creatable=true devices will help us be more
confident when building the q35 whitelist.

xen: We also have a hack at xen_set_dynamic_sysbus(), that sets
has_dynamic_sysbus=true at runtime when using the Xen
accelerator. This hack is only used to allow xen-backend devices
to be dynamically plugged/unplugged.

This means today we can use -device with the following 22 device
types, that are the ones compiled into the qemu-system-x86_64 and
qemu-system-i386 binaries:

* allwinner-ahci
* amd-iommu
* cfi.pflash01
* esp
* fw_cfg_io
* fw_cfg_mem
* generic-sdhci
* hpet
* intel-iommu
* ioapic
* isabus-bridge
* kvmclock
* kvm-ioapic
* kvmvapic
* SUNW,fdtwo
* sysbus-ahci
* sysbus-fdc
* sysbus-ohci
* unimplemented-device
* virtio-mmio
* xen-backend
* xen-sysdev

This patch adds user_creatable=true explicitly to those devices,
temporarily, just to keep 100% compatibility with existing
behavior of q35. Subsequent patches will remove
user_creatable=true from the devices that are really not meant to
user-creatable on any machine, and remove the FIXME comment from
the ones that are really supposed to be user-creatable. This is
being done in separate patches because we still don't have an
obvious list of devices that will be whitelisted by q35, and I
would like to get each device reviewed individually.

Cc: Alexander Graf <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Beniamino Galvani <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: David Gibson <[email protected]>
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Frank Blaschka <[email protected]>
Cc: Gabriel L. Somlo <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: John Snow <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Prasad J Pandit <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Shannon Zhao <[email protected]>
Cc: [email protected]
Cc: Thomas Huth <[email protected]>
Cc: Yi Min Zhao <[email protected]>
Acked-by: John Snow <[email protected]>
Acked-by: Juergen Gross <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
[ehabkost: Small changes at sysbus_device_class_init() comments]
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable
Eduardo Habkost [Wed, 3 May 2017 20:35:44 +0000 (17:35 -0300)]
qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable

cannot_instantiate_with_device_add_yet was introduced by commit
efec3dd631d94160288392721a5f9c39e50fb2bc to replace no_user. It was
supposed to be a temporary measure.

When it was introduced, we had 54
cannot_instantiate_with_device_add_yet=true lines in the code.
Today (3 years later) this number has not shrunk: we now have
57 cannot_instantiate_with_device_add_yet=true lines. I think it
is safe to say it is not a temporary measure, and we won't see
the flag go away soon.

Instead of a long field name that misleads people to believe it
is temporary, replace it a shorter and less misleading field:
user_creatable.

Except for code comments, changes were generated using the
following Coccinelle patch:

  @@
  expression DC;
  @@
  (
  -DC->cannot_instantiate_with_device_add_yet = false;
  +DC->user_creatable = true;
  |
  -DC->cannot_instantiate_with_device_add_yet = true;
  +DC->user_creatable = false;
  )

  @@
  typedef ObjectClass;
  expression dc;
  identifier class, data;
  @@
   static void device_class_init(ObjectClass *class, void *data)
   {
   ...
   dc->hotpluggable = true;
  +dc->user_creatable = true;
   ...
   }

  @@
  @@
   struct DeviceClass {
   ...
  -bool cannot_instantiate_with_device_add_yet;
  +bool user_creatable;
   ...
  }

  @@
  expression DC;
  @@
  (
  -!DC->cannot_instantiate_with_device_add_yet
  +DC->user_creatable
  |
  -DC->cannot_instantiate_with_device_add_yet
  +!DC->user_creatable
  )

Cc: Alistair Francis <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Thomas Huth <[email protected]>
Acked-by: Alistair Francis <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
[ehabkost: kept "TODO remove once we're there" comment]
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoMerge remote-tracking branch 'sstabellini/tags/xen-20170516-tag' into staging
Stefan Hajnoczi [Wed, 17 May 2017 13:03:32 +0000 (14:03 +0100)]
Merge remote-tracking branch 'sstabellini/tags/xen-20170516-tag' into staging

Xen 2017/05/16

# gpg: Signature made Tue 16 May 2017 08:18:32 PM BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <[email protected]>"
# gpg:                 aka "Stefano Stabellini <[email protected]>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* sstabellini/tags/xen-20170516-tag:
  xen: call qemu_set_cloexec instead of fcntl
  xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
  configure: Remove -lxencall for Xen detection
  xen/mapcache: store dma information in revmapcache entries for debugging

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'jtc/tags/block-pull-request' into staging
Stefan Hajnoczi [Wed, 17 May 2017 12:52:02 +0000 (13:52 +0100)]
Merge remote-tracking branch 'jtc/tags/block-pull-request' into staging

# gpg: Signature made Tue 16 May 2017 04:47:09 PM BST
# gpg:                using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* jtc/tags/block-pull-request:
  curl: do not do aio_poll when waiting for a free CURLState
  curl: convert readv to coroutines
  curl: convert CURLAIOCB to byte values
  curl: split curl_find_state/curl_init_state
  curl: avoid recursive locking of BDRVCURLState mutex
  curl: never invoke callbacks with s->mutex held
  curl: strengthen assertion in curl_clean_state
  block: curl: Allow passing cookies via QCryptoSecret

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoxen: call qemu_set_cloexec instead of fcntl
Stefano Stabellini [Tue, 9 May 2017 19:04:53 +0000 (12:04 -0700)]
xen: call qemu_set_cloexec instead of fcntl

Use the common utility function, which contains checks on return values
and first calls F_GETFD as recommended by POSIX.1-2001, instead of
manually calling fcntl.

CID: 1374831

Signed-off-by: Stefano Stabellini <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: Eric Blake <[email protected]>
7 years agoxen/9pfs: fix two resource leaks on error paths, discovered by Coverity
Stefano Stabellini [Tue, 9 May 2017 19:04:51 +0000 (12:04 -0700)]
xen/9pfs: fix two resource leaks on error paths, discovered by Coverity

CID: 1374836

Signed-off-by: Stefano Stabellini <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
7 years agoconfigure: Remove -lxencall for Xen detection
Anthony PERARD [Thu, 11 May 2017 11:35:42 +0000 (12:35 +0100)]
configure: Remove -lxencall for Xen detection

QEMU does not depends on libxencall, it was added because it was a
missing link dependency of libxendevicemodel, but now the later should
be built properly.

Signed-off-by: Anthony PERARD <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
7 years agoxen/mapcache: store dma information in revmapcache entries for debugging
Stefano Stabellini [Wed, 3 May 2017 21:00:35 +0000 (14:00 -0700)]
xen/mapcache: store dma information in revmapcache entries for debugging

The Xen mapcache is able to create long term mappings, they are called
"locked" mappings. The third parameter of the xen_map_cache call
specifies if a mapping is a "locked" mapping.

>From the QEMU point of view there are two kinds of long term mappings:

[a] device memory mappings, such as option roms and video memory
[b] dma mappings, created by dma_memory_map & friends

After certain operations, ballooning a VM in particular, Xen asks QEMU
kindly to destroy all mappings. However, certainly [a] mappings are
present and cannot be removed. That's not a problem as they are not
affected by balloonning. The *real* problem is that if there are any
mappings of type [b], any outstanding dma operations could fail. This is
a known shortcoming. In other words, when Xen asks QEMU to destroy all
mappings, it is an error if any [b] mappings exist.

However today we have no way of distinguishing [a] from [b]. Because of
that, we cannot even print a decent warning.

This patch introduces a new "dma" bool field to MapCacheRev entires, to
remember if a given mapping is for dma or is a long term device memory
mapping. When xen_invalidate_map_cache is called, we print a warning if
any [b] mappings exist. We ignore [a] mappings.

Mappings created by qemu_map_ram_ptr are assumed to be [a], while
mappings created by address_space_map->qemu_ram_ptr_length are assumed
to be [b].

The goal of the patch is to make debugging and system understanding
easier.

Signed-off-by: Stefano Stabellini <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
7 years agocurl: do not do aio_poll when waiting for a free CURLState
Paolo Bonzini [Mon, 15 May 2017 10:00:59 +0000 (12:00 +0200)]
curl: do not do aio_poll when waiting for a free CURLState

Instead, put the CURLAIOCB on a wait list and yield; curl_clean_state will
wake the corresponding coroutine.

Because of CURL's callback-based structure, we cannot easily convert
everything to CoMutex/CoQueue; keeping the QemuMutex is simpler.  However,
CoQueue is a simple wrapper around a linked list, so we can easily
use QSIMPLEQ and open-code a CoQueue, protected by the BDRVCURLState
QemuMutex instead of a CoMutex.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: convert readv to coroutines
Paolo Bonzini [Mon, 15 May 2017 10:00:58 +0000 (12:00 +0200)]
curl: convert readv to coroutines

This is pretty simple.  The bottom half goes away because, unlike
bdrv_aio_readv, coroutine-based read can return immediately without
yielding.  However, for simplicity I kept the former bottom half
handler in a separate function.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: convert CURLAIOCB to byte values
Paolo Bonzini [Mon, 15 May 2017 10:00:57 +0000 (12:00 +0200)]
curl: convert CURLAIOCB to byte values

This is in preparation for the conversion from bdrv_aio_readv to
bdrv_co_preadv, and it also requires changing some of the size_t values
to uint64_t.  This was broken before for disks > 2TB, but now it would
break at 4GB.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: split curl_find_state/curl_init_state
Paolo Bonzini [Mon, 15 May 2017 10:00:56 +0000 (12:00 +0200)]
curl: split curl_find_state/curl_init_state

If curl_easy_init fails, a CURLState is left with s->in_use = 1.  Split
curl_init_state in two, so that we can distinguish the two failures and
call curl_clean_state if needed.

While at it, simplify curl_find_state, removing a dummy loop.  The
aio_poll loop is moved to the sole caller that needs it.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agoblock/win32: fix 'ret not initialized' warning
Gerd Hoffmann [Tue, 16 May 2017 07:42:55 +0000 (09:42 +0200)]
block/win32: fix 'ret not initialized' warning

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Stefan Weil <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Message-id: 20170516074256[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agocurl: avoid recursive locking of BDRVCURLState mutex
Paolo Bonzini [Mon, 15 May 2017 10:00:55 +0000 (12:00 +0200)]
curl: avoid recursive locking of BDRVCURLState mutex

The curl driver has a ugly hack where, if it cannot find an empty CURLState,
it just uses aio_poll to wait for one to be empty.  This is probably
buggy when used together with dataplane, and the simplest way to fix it
is to use coroutines instead.

A more immediate effect of the bug however is that it can cause a
recursive call to curl_readv_bh_cb and recursively taking the
BDRVCURLState mutex.  This causes a deadlock.

The fix is to unlock the mutex around aio_poll, but for cleanliness we
should also take the mutex around all calls to curl_init_state, even if
reaching the unlock/lock pair is impossible.  The same is true for
curl_clean_state.

Reported-by: Kun Wei <[email protected]>
Tested-by: Richard W.M. Jones <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Message-id: 20170515100059[email protected]
Cc: [email protected]
Cc: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: never invoke callbacks with s->mutex held
Paolo Bonzini [Mon, 15 May 2017 10:00:54 +0000 (12:00 +0200)]
curl: never invoke callbacks with s->mutex held

All curl callbacks go through curl_multi_do, and hence are called with
s->mutex held.  Note that with comments, and make curl_read_cb drop the
lock before invoking the callback.

Likewise for curl_find_buf, where the callback can be invoked by the
caller.

Cc: [email protected]
Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: strengthen assertion in curl_clean_state
Paolo Bonzini [Mon, 15 May 2017 10:00:53 +0000 (12:00 +0200)]
curl: strengthen assertion in curl_clean_state

curl_clean_state should only be called after all AIOCBs have been
completed.  This is not so obvious for the call from curl_detach_aio_context,
so assert that.

Cc: [email protected]
Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agofix mingw build failure
Gerd Hoffmann [Tue, 16 May 2017 05:24:39 +0000 (07:24 +0200)]
fix mingw build failure

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Stefan Weil <[email protected]>
Reviewed-by: Daniel P. Berrange <[email protected]>
Message-id: 20170516052439[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agomaintainers: Add myself as a NetBSD reviewer
Kamil Rytarowski [Sat, 13 May 2017 02:21:43 +0000 (04:21 +0200)]
maintainers: Add myself as a NetBSD reviewer

I volunteer to review NetBSD patches.
Adding myself will help to not miss some of them.

Restore NetBSD as a maintained host.

All patches to make qemu/pkgsrc building have been emitted to review.

Signed-off-by: Kamil Rytarowski <[email protected]>
Message-id: 20170513022143[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoblock: curl: Allow passing cookies via QCryptoSecret
Peter Krempa [Thu, 4 May 2017 14:00:06 +0000 (16:00 +0200)]
block: curl: Allow passing cookies via QCryptoSecret

Since cookies can contain sensitive data (session ID, etc ...) it is
desired to hide them from the prying eyes of users. Add a possibility to
pass them via the secret infrastructure.

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

Signed-off-by: Peter Krempa <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
Message-id: f4a22cdebdd0bca6a13a43a2a6deead7f2ec4bb3.1493906281[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agoMerge remote-tracking branch 'gkurz/tags/security-fix-for-2.10' into staging
Stefan Hajnoczi [Tue, 16 May 2017 14:26:24 +0000 (15:26 +0100)]
Merge remote-tracking branch 'gkurz/tags/security-fix-for-2.10' into staging

Fix for CVE-2017-7493.

# gpg: Signature made Mon 15 May 2017 07:48:20 PM BST
# gpg:                using DSA key 0x02FC3AEB0101DBC2
# gpg: Good signature from "Greg Kurz <[email protected]>"
# gpg:                 aka "Greg Kurz <[email protected]>"
# gpg:                 aka "Greg Kurz <[email protected]>"
# gpg:                 aka "Greg Kurz <[email protected]>"
# gpg:                 aka "Gregory Kurz (Groug) <[email protected]>"
# gpg:                 aka "Gregory Kurz (Cimai Technology) <[email protected]>"
# gpg:                 aka "Gregory Kurz (Meiosys Technology) <[email protected]>"
# 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: 2BD4 3B44 535E C0A7 9894  DBA2 02FC 3AEB 0101 DBC2

* gkurz/tags/security-fix-for-2.10:
  9pfs: local: forbid client access to metadata (CVE-2017-7493)

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'aurel32/tags/pull-target-sh4-20170513' into staging
Stefan Hajnoczi [Tue, 16 May 2017 14:26:17 +0000 (15:26 +0100)]
Merge remote-tracking branch 'aurel32/tags/pull-target-sh4-20170513' into staging

Queued target/sh4 patches

# gpg: Signature made Sat 13 May 2017 10:25:41 AM BST
# gpg:                using RSA key 0xBA9C78061DDD8C9B
# gpg: Good signature from "Aurelien Jarno <[email protected]>"
# gpg:                 aka "Aurelien Jarno <[email protected]>"
# gpg:                 aka "Aurelien Jarno <[email protected]>"
# Primary key fingerprint: 7746 2642 A9EF 94FD 0F77  196D BA9C 7806 1DDD 8C9B

* aurel32/tags/pull-target-sh4-20170513:
  target/sh4: use cpu_loop_exit_restore
  target/sh4: trap unaligned accesses
  target/sh4: movua.l is an SH4-A only instruction
  target/sh4: implement tas.b using atomic helper
  target/sh4: generate fences for SH4
  target/sh4: optimize gen_write_sr using extract op
  target/sh4: optimize gen_store_fpr64
  target/sh4: fold ctx->bstate = BS_BRANCH into gen_conditional_jump
  target/sh4: only save flags state at the end of the TB
  target/sh4: fix BS_EXCP exit
  target/sh4: fix BS_STOP exit
  target/sh4: move DELAY_SLOT_TRUE flag into a separate global
  target/sh4: do not include DELAY_SLOT_TRUE in the TB state
  target/sh4: get rid of DELAY_SLOT_CLEARME
  target/sh4: split ctx->flags into ctx->tbflags and ctx->envflags

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'rth/tags/pull-s390-20170512' into staging
Stefan Hajnoczi [Tue, 16 May 2017 14:26:06 +0000 (15:26 +0100)]
Merge remote-tracking branch 'rth/tags/pull-s390-20170512' into staging

Queued target/s390 patches

# gpg: Signature made Sat 13 May 2017 12:33:08 AM BST
# gpg:                using RSA key 0xAD1270CC4DD0279B
# gpg: Good signature from "Richard Henderson <[email protected]>"
# gpg:                 aka "Richard Henderson <[email protected]>"
# gpg:                 aka "Richard Henderson <[email protected]>"
# Primary key fingerprint: 9CB1 8DDA F8E8 49AD 2AFC  16A4 AD12 70CC 4DD0 279B

* rth/tags/pull-s390-20170512:
  target/s390x: implement serialization in BRANCH CONDITION
  target/s390x: fix SIGNAL PROCESSOR return value
  target/s390x: mask the SIGP order_code using SIGP_ORDER_MASK
  target/s390x: Use atomic operations for LOAD AND OP
  target/s390x: Use atomic operations for COMPARE SWAP
  target/s390x: Implement LOAD PAIR DISJOINT
  target/s390x: Diagnose specification exception for atomics
  target/s390x: Implement LOAD PROGRAM PARAMETER
  target/s390x: Implement STORE FACILITIES LIST EXTENDED

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'kraxel/tags/pull-usb-20170512-1' into staging
Stefan Hajnoczi [Mon, 15 May 2017 13:29:53 +0000 (14:29 +0100)]
Merge remote-tracking branch 'kraxel/tags/pull-usb-20170512-1' into staging

usb: bugfixes, doc update

# gpg: Signature made Fri 12 May 2017 01:20:29 PM BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* kraxel/tags/pull-usb-20170512-1:
  hw/usb/dev-serial: Do not try to set vendorid or productid properties
  xhci: relax link check
  usb-hub: clear PORT_STAT_SUSPEND on wakeup
  xhci: fix logging
  usb-redir: fix stack overflow in usbredir_log_data
  qemu-doc: Update to use the new way of attaching USB devices

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'kraxel/tags/pull-ui-20170512-1' into staging
Stefan Hajnoczi [Mon, 15 May 2017 13:26:02 +0000 (14:26 +0100)]
Merge remote-tracking branch 'kraxel/tags/pull-ui-20170512-1' into staging

ui: add egl-headless
ui: some vnc cleanups
ui: absolute events for input-linux

# gpg: Signature made Fri 12 May 2017 12:50:07 PM BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* kraxel/tags/pull-ui-20170512-1:
  vnc: replace hweight_long() with ctpopl()
  vnc: simple clean up
  opengl: add egl-headless display
  egl: explicitly ask for core context
  egl-helpers: add missing error check
  egl-helpers: fix display init for x11
  egl-helpers: drop support for gles and debug logging
  virtio-gpu: move virtio_gpu_gl_block
  ui: input-linux: Add absolute event support
  ui: Support non-zero minimum values for absolute input axes

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years ago9pfs: local: forbid client access to metadata (CVE-2017-7493)
Greg Kurz [Fri, 5 May 2017 12:48:08 +0000 (14:48 +0200)]
9pfs: local: forbid client access to metadata (CVE-2017-7493)

When using the mapped-file security mode, we shouldn't let the client mess
with the metadata. The current code already tries to hide the metadata dir
from the client by skipping it in local_readdir(). But the client can still
access or modify it through several other operations. This can be used to
escalate privileges in the guest.

Affected backend operations are:
- local_mknod()
- local_mkdir()
- local_open2()
- local_symlink()
- local_link()
- local_unlinkat()
- local_renameat()
- local_rename()
- local_name_to_path()

Other operations are safe because they are only passed a fid path, which
is computed internally in local_name_to_path().

This patch converts all the functions listed above to fail and return
EINVAL when being passed the name of the metadata dir. This may look
like a poor choice for errno, but there's no such thing as an illegal
path name on Linux and I could not think of anything better.

This fixes CVE-2017-7493.

Reported-by: Leo Gaspard <[email protected]>
Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
7 years agoMerge remote-tracking branch 'ehabkost/tags/x86-and-machine-pull-request' into staging
Stefan Hajnoczi [Mon, 15 May 2017 13:11:55 +0000 (14:11 +0100)]
Merge remote-tracking branch 'ehabkost/tags/x86-and-machine-pull-request' into staging

x86 and machine queue, 2017-05-11

Highlights:
* New "-numa cpu" option
* NUMA distance configuration
* migration/i386 vmstatification

# gpg: Signature made Thu 11 May 2017 08:16:07 PM BST
# gpg:                using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <[email protected]>"
# gpg: Note: This key has expired!
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* ehabkost/tags/x86-and-machine-pull-request: (29 commits)
  migration/i386: Remove support for pre-0.12 formats
  vmstatification: i386 FPReg
  migration/i386: Remove old non-softfloat 64bit FP support
  tests: check -numa node,cpu=props_list usecase
  numa: add '-numa cpu,...' option for property based node mapping
  numa: remove node_cpu bitmaps as they are no longer used
  numa: use possible_cpus for not mapped CPUs check
  machine: call machine init from wrapper
  numa: remove no longer need numa_post_machine_init()
  tests: numa: add case for QMP command query-cpus
  QMP: include CpuInstanceProperties into query_cpus output output
  virt-arm: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()
  spapr: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()
  pc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()
  numa: do default mapping based on possible_cpus instead of node_cpu bitmaps
  numa: mirror cpu to node mapping in MachineState::possible_cpus
  numa: add check that board supports cpu_index to node mapping
  virt-arm: add node-id property to CPU
  pc: add node-id property to CPU
  spapr: add node-id property to sPAPR core
  ...

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'kraxel/tags/pull-vga-20170511-1' into staging
Stefan Hajnoczi [Mon, 15 May 2017 13:07:01 +0000 (14:07 +0100)]
Merge remote-tracking branch 'kraxel/tags/pull-vga-20170511-1' into staging

make display updates thread safe, batch #2

# gpg: Signature made Thu 11 May 2017 03:41:51 PM BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* kraxel/tags/pull-vga-20170511-1:
  vga: fix display update region calculation
  sm501: make display updates thread safe
  tcx: make display updates thread safe
  cg3: make display updates thread safe

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'dgibson/tags/ppc-for-2.10-20170511' into staging
Stefan Hajnoczi [Mon, 15 May 2017 13:00:06 +0000 (14:00 +0100)]
Merge remote-tracking branch 'dgibson/tags/ppc-for-2.10-20170511' into staging

ppc patch queue for 2017-05-11

This pull request supersedes the one from yesterday (20170510), fixing
an important style bug in one patch, and adding an extra couple of
simple patches.

Highlights of this set:
  * Some fixes for POWER9
  * TCG support for POWER9 radix MMU
  * VGA rom for Mac machine types
  * Fixes for the XICS interrupt controller
  * MTTCG support for ppc targets

As suggested by Paolo, I've tried to add the Docker tests to my
standard pre-pull-request tests.  I haven't wholly suceeded; this has
been tested with some of the Docker images, but others I haven't
managed due to problems that as best I can tell are not due to
problems in this patch series.  I'll continue working on this for
future pull requests.  Specifically, 'travis', 'fedora', and 'centos6'
seem to work.  'min-glib' jammed while gtesting moxie, which seems
very unlikely to be caused by this series.  'ubuntu', 'debian' and
'debian-bootstrap' hit build errors almost immediately that look like
problems with the container configuration, and 'debian-*-cross' hit
build errors later on which also look like missing dependencies from
the container.

# gpg: Signature made Thu 11 May 2017 05:13:46 AM BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <[email protected]>"
# gpg:                 aka "David Gibson (kernel.org) <[email protected]>"
# gpg:                 aka "David Gibson (Red Hat) <[email protected]>"
# gpg:                 aka "David Gibson (ozlabs.org) <[email protected]>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* dgibson/tags/ppc-for-2.10-20170511: (23 commits)
  target/ppc: Avoid printing wrong aliases in CPU help text
  pnv: Fix build failures on some host platforms
  target/ppc: Allow workarounds for POWER9 DD1
  spapr: Don't accidentally advertise HTM support on POWER9
  ppc: xics: fix compilation with CentOS 6
  target/ppc: Enable RADIX mmu mode for pseries TCG guest
  target/ppc: Implement ISA V3.00 radix page fault handler
  target/ppc: Change tlbie invalid fields for POWER9 support
  target/ppc: Update tlbie to check privilege level based on GTSE
  target/ppc: Set UPRT and GTSE on all cpus in H_REGISTER_PROCESS_TABLE
  ppc: add qemu_vga.ndrv ROM to fw_cfg interface for NewWorld Macs
  ppc: add qemu_vga.ndrv ROM to fw_cfg interface for OldWorld Macs
  Add QemuMacDrivers qemu_vga.ndrv revision d4e7d7a built as submodule
  Add QemuMacDrivers as submodule
  ppc/xics: preserve P and Q bits for KVM IRQs
  ppc/xics: Fix stale irq->status bits after get
  target/ppc: do not reset reserve_addr in exec_enter
  tcg: enable MTTCG by default for PPC64 on x86
  cpus: Fix CPU unplug for MTTCG
  target/ppc: Generate fence operations
  ...

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agotarget/sh4: use cpu_loop_exit_restore
Aurelien Jarno [Wed, 10 May 2017 06:58:27 +0000 (08:58 +0200)]
target/sh4: use cpu_loop_exit_restore

Use cpu_loop_exit_restore when using cpu_restore_state and cpu_loop_exit
together.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: trap unaligned accesses
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: trap unaligned accesses

SH4 requires that memory accesses are naturally aligned, except for the
SH4-A movua.l instructions which can do unaligned loads.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: movua.l is an SH4-A only instruction
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: movua.l is an SH4-A only instruction

At the same time change the comment describing the instruction the same
way than other instruction, so that the code is easier to read and search.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: implement tas.b using atomic helper
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: implement tas.b using atomic helper

We only emulate UP SH4, however as the tas.b instruction is used in the GNU
libc, this improve linux-user emulation.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: generate fences for SH4
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: generate fences for SH4

synco is a SH4-A only instruction.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: optimize gen_write_sr using extract op
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: optimize gen_write_sr using extract op

This doesn't change the generated code on x86, but optimizes it on most
RISC architectures and makes the code simpler to read.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: optimize gen_store_fpr64
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: optimize gen_store_fpr64

Using extr and avoiding intermediate temps.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: fold ctx->bstate = BS_BRANCH into gen_conditional_jump
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: fold ctx->bstate = BS_BRANCH into gen_conditional_jump

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: only save flags state at the end of the TB
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: only save flags state at the end of the TB

There is no need to save flags when entering and exiting the delay slot.
They can be saved only when reaching the end of the TB. If the TB is
interrupted before by an exception, they will be restored using
restore_state_to_opc.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: fix BS_EXCP exit
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: fix BS_EXCP exit

In case of exception, there is no need to call tcg_gen_exit_tb as the
exception helper won't return.

Also fix a few cases where BS_BRANCH is called instead of BS_EXCP.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: fix BS_STOP exit
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: fix BS_STOP exit

When stopping the translation because the state has changed, goto_tb
should not be used as it might link TB with different flags.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: move DELAY_SLOT_TRUE flag into a separate global
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: move DELAY_SLOT_TRUE flag into a separate global

Instead of using one bit of the env flags to store the condition of the
next delay slot, use a separate global. It simplifies reading and
writing the flags variable and also removes some confusion between
ctx->envflags and env->flags.

Note that the global is first transfered to a temp in order to be
able to discard the global before the brcond.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: do not include DELAY_SLOT_TRUE in the TB state
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: do not include DELAY_SLOT_TRUE in the TB state

DELAY_SLOT_TRUE is used as a dynamic condition for the branch after the
delay slot instruction. It is not used in code generation, so there is
no need to including in the TB state.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: get rid of DELAY_SLOT_CLEARME
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: get rid of DELAY_SLOT_CLEARME

Now that ctx->flags has been split, it becomes clear that
DELAY_SLOT_CLEARME has not impact on the code generation: in both case
ctx->envflags is cleared, either by clearing all the flags, or by
setting it to 0. This is left-over from pre-TCG era.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/sh4: split ctx->flags into ctx->tbflags and ctx->envflags
Aurelien Jarno [Mon, 1 May 2017 21:20:43 +0000 (23:20 +0200)]
target/sh4: split ctx->flags into ctx->tbflags and ctx->envflags

There is a confusion (and not only in the SH4 target) between tb->flags,
env->flags and ctx->flags. To avoid it, split ctx->flags into
ctx->tbflags and ctx->envflags. ctx->tbflags stays unchanged during the
whole TB translation, while ctx->envflags evolves and is kept in sync
with env->flags using TCG instructions. ctx->envflags now only contains
the part that of env->flags that is contained in the TB state, i.e. the
DELAY_SLOT* flags.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
7 years agotarget/s390x: implement serialization in BRANCH CONDITION
Aurelien Jarno [Tue, 9 May 2017 08:28:00 +0000 (10:28 +0200)]
target/s390x: implement serialization in BRANCH CONDITION

Signed-off-by: Aurelien Jarno <[email protected]>
Message-Id: <20170509082800[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: fix SIGNAL PROCESSOR return value
Aurelien Jarno [Tue, 9 May 2017 08:27:59 +0000 (10:27 +0200)]
target/s390x: fix SIGNAL PROCESSOR return value

The SIGNAL PROCESSOR helper returns its value through the CC register.
set_cc_static should be called just after the helper.

Signed-off-by: Aurelien Jarno <[email protected]>
Message-Id: <20170509082800[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: mask the SIGP order_code using SIGP_ORDER_MASK
Aurelien Jarno [Tue, 9 May 2017 08:27:58 +0000 (10:27 +0200)]
target/s390x: mask the SIGP order_code using SIGP_ORDER_MASK

For that move the definition from kvm.c to cpu.h

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
Message-Id: <20170509082800[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: Use atomic operations for LOAD AND OP
Richard Henderson [Thu, 2 Mar 2017 01:28:54 +0000 (12:28 +1100)]
target/s390x: Use atomic operations for LOAD AND OP

Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: Use atomic operations for COMPARE SWAP
Richard Henderson [Wed, 1 Mar 2017 00:39:01 +0000 (11:39 +1100)]
target/s390x: Use atomic operations for COMPARE SWAP

Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: Implement LOAD PAIR DISJOINT
Eric Bischoff [Tue, 28 Feb 2017 12:01:34 +0000 (13:01 +0100)]
target/s390x: Implement LOAD PAIR DISJOINT

Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Eric Bischoff <[email protected]>
Message-Id: <20170228120134[email protected]>
[rth: Combine the two via insn->data; free the address temps.]
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: Diagnose specification exception for atomics
Richard Henderson [Thu, 2 Mar 2017 02:06:18 +0000 (13:06 +1100)]
target/s390x: Diagnose specification exception for atomics

All of the interlocked access facility instructions raise a
specification exception for unaligned accesses.  Do this by
using the (previously unused) unaligned_access hook.

Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: Implement LOAD PROGRAM PARAMETER
Miroslav Benes [Mon, 27 Feb 2017 08:53:53 +0000 (09:53 +0100)]
target/s390x: Implement LOAD PROGRAM PARAMETER

Linux arch/s390/kernel/head(64).S uses LPP instruction if it is
available in facilities list provided by stfl/stfle instruction.
This is the case of newer z/System generations and their qemu
definition.

The description of LPP is at
http://www-01.ibm.com/support/docview.wss?uid=isg26fcd1cc32246f4c8852574ce0044734a

Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Miroslav Benes <[email protected]>
Message-Id: <20170227085353[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
7 years agotarget/s390x: Implement STORE FACILITIES LIST EXTENDED
Richard Henderson [Mon, 25 Mar 2013 22:10:06 +0000 (15:10 -0700)]
target/s390x: Implement STORE FACILITIES LIST EXTENDED

At the same time, improve STORE FACILITIES LIST
so that we don't hard-code the list for all cpus.

Signed-off-by: Richard Henderson <[email protected]>
7 years agoMerge tag 'tracing-pull-request' into staging
Stefan Hajnoczi [Fri, 12 May 2017 14:39:32 +0000 (10:39 -0400)]
Merge tag 'tracing-pull-request' into staging

# gpg: Signature made Fri 12 May 2017 10:38:07 AM EDT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <[email protected]>"
# gpg:                 aka "Stefan Hajnoczi <[email protected]>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'tracing-pull-request':
  trace: add sanity check

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge tag 'block-pull-request' into staging
Stefan Hajnoczi [Fri, 12 May 2017 14:39:19 +0000 (10:39 -0400)]
Merge tag 'block-pull-request' into staging

# gpg: Signature made Fri 12 May 2017 10:37:12 AM EDT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <[email protected]>"
# gpg:                 aka "Stefan Hajnoczi <[email protected]>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'block-pull-request':
  aio: add missing aio_notify() to aio_enable_external()
  block: Simplify BDRV_BLOCK_RAW recursion
  coroutine: remove GThread implementation

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'kwolf/tags/for-upstream' into staging
Stefan Hajnoczi [Fri, 12 May 2017 13:29:49 +0000 (09:29 -0400)]
Merge remote-tracking branch 'kwolf/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Thu 11 May 2017 10:31:37 AM EDT
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <[email protected]>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* kwolf/tags/for-upstream: (58 commits)
  MAINTAINERS: Add qemu-progress to the block layer
  qcow2: Discard/zero clusters by byte count
  qcow2: Assert that cluster operations are aligned
  qcow2: Optimize write zero of unaligned tail cluster
  iotests: Add test 179 to cover write zeroes with unmap
  iotests: Improve _filter_qemu_img_map
  qcow2: Optimize zero_single_l2() to minimize L2 churn
  qcow2: Make distinction between zero cluster types obvious
  qcow2: Name typedef for cluster type
  qcow2: Correctly report status of preallocated zero clusters
  block: Update comments on BDRV_BLOCK_* meanings
  qcow2: Use consistent switch indentation
  qcow2: Nicer variable names in qcow2_update_snapshot_refcount()
  tests: Add coverage for recent block geometry fixes
  blkdebug: Add ability to override unmap geometries
  blkdebug: Simplify override logic
  blkdebug: Add pass-through write_zero and discard support
  blkdebug: Refactor error injection
  blkdebug: Sanity check block layer guarantees
  qemu-io: Switch 'map' output to byte-based reporting
  ...

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agotrace: add sanity check
Anthony Xu [Tue, 9 May 2017 22:37:12 +0000 (15:37 -0700)]
trace: add sanity check

If trace backend is set to TRACE_NOP, trace_get_vcpu_event_count
returns 0, cause bitmap_new call abort.

The abort can be triggered as follows:

  $ ./configure --enable-trace-backend=nop --target-list=x86_64-softmmu
  $ gdb ./x86_64-softmmu/qemu-system-x86_64 -M q35,accel=kvm -m 1G
  (gdb) bt
  #0  0x00007ffff04e25f7 in raise () from /lib64/libc.so.6
  #1  0x00007ffff04e3ce8 in abort () from /lib64/libc.so.6
  #2  0x00005555559de905 in bitmap_new (nbits=<optimized out>)
      at /home/root/git/qemu2.git/include/qemu/bitmap.h:96
  #3  cpu_common_initfn (obj=0x555556621d30) at qom/cpu.c:399
  #4  0x0000555555a11869 in object_init_with_type (obj=0x555556621d30, ti=0x55555656bbb0) at qom/object.c:341
  #5  0x0000555555a11869 in object_init_with_type (obj=0x555556621d30, ti=0x55555656bd30) at qom/object.c:341
  #6  0x0000555555a11efc in object_initialize_with_type (data=data@entry=0x555556621d30, size=76560,
      type=type@entry=0x55555656bd30) at qom/object.c:376
  #7  0x0000555555a12061 in object_new_with_type (type=0x55555656bd30) at qom/object.c:484
  #8  0x0000555555a121c5 in object_new (typename=typename@entry=0x555556550340 "qemu64-x86_64-cpu")
      at qom/object.c:494
  #9  0x00005555557f6e3d in pc_new_cpu (typename=typename@entry=0x555556550340 "qemu64-x86_64-cpu", apic_id=0,
      errp=errp@entry=0x5555565391b0 <error_fatal>) at /home/root/git/qemu2.git/hw/i386/pc.c:1101
  #10 0x00005555557fa33e in pc_cpus_init (pcms=pcms@entry=0x5555565f9690)
      at /home/root/git/qemu2.git/hw/i386/pc.c:1184
  #11 0x00005555557fe0f6 in pc_q35_init (machine=0x5555565f9690) at /home/root/git/qemu2.git/hw/i386/pc_q35.c:121
  #12 0x000055555574fbad in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4562

Signed-off-by: Anthony Xu <[email protected]>
Message-id: 1494369432[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoaio: add missing aio_notify() to aio_enable_external()
Stefan Hajnoczi [Mon, 8 May 2017 18:07:05 +0000 (14:07 -0400)]
aio: add missing aio_notify() to aio_enable_external()

The main loop uses aio_disable_external()/aio_enable_external() to
temporarily disable processing of external AioContext clients like
device emulation.

This allows monitor commands to quiesce I/O and prevent the guest from
submitting new requests while a monitor command is in progress.

The aio_enable_external() API is currently broken when an IOThread is in
aio_poll() waiting for fd activity when the main loop re-enables
external clients.  Incrementing ctx->external_disable_cnt does not wake
the IOThread from ppoll(2) so fd processing remains suspended and leads
to unresponsive emulated devices.

This patch adds an aio_notify() call to aio_enable_external() so the
IOThread is kicked out of ppoll(2) and will re-arm the file descriptors.

The bug can be reproduced as follows:

  $ qemu -M accel=kvm -m 1024 \
         -object iothread,id=iothread0 \
         -device virtio-scsi-pci,iothread=iothread0,id=virtio-scsi-pci0 \
         -drive if=none,id=drive0,aio=native,cache=none,format=raw,file=test.img \
         -device scsi-hd,id=scsi-hd0,drive=drive0 \
         -qmp tcp::5555,server,nowait

  $ scripts/qmp/qmp-shell localhost:5555
  (qemu) blockdev-snapshot-sync device=drive0 snapshot-file=sn1.qcow2
         mode=absolute-paths format=qcow2

After blockdev-snapshot-sync completes the SCSI disk will be
unresponsive.  This leads to request timeouts inside the guest.

Reported-by: Qianqian Zhu <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-id: 20170508180705[email protected]
Suggested-by: Fam Zheng <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoblock: Simplify BDRV_BLOCK_RAW recursion
Eric Blake [Thu, 4 May 2017 17:37:45 +0000 (12:37 -0500)]
block: Simplify BDRV_BLOCK_RAW recursion

Since we are already in coroutine context during the body of
bdrv_co_get_block_status(), we can shave off a few layers of
wrappers when recursing to query the protocol when a format driver
returned BDRV_BLOCK_RAW.

Note that we are already using the correct recursion later on in
the same function, when probing whether the protocol layer is sparse
in order to find out if we can add BDRV_BLOCK_ZERO to an existing
BDRV_BLOCK_DATA|BDRV_BLOCK_OFFSET_VALID.

Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Message-id: 20170504173745[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agocoroutine: remove GThread implementation
Daniel P. Berrange [Fri, 28 Apr 2017 12:24:44 +0000 (13:24 +0100)]
coroutine: remove GThread implementation

The GThread implementation is not functional enough to actually
run QEMU reliably. While it was potentially useful for debugging,
we have a scripts/qemugdb/coroutine.py to enable tracing of
ucontext coroutines in GDB, so that removes the only reason for
GThread to exist.

Signed-off-by: Daniel P. Berrange <[email protected]>
Acked-by: Alex Bennée <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agovnc: replace hweight_long() with ctpopl()
Cédric Le Goater [Mon, 13 Mar 2017 14:33:25 +0000 (15:33 +0100)]
vnc: replace hweight_long() with ctpopl()

ctpopl() has a better implementation than hweight_long() and ui/vnc.c
being the last user of hweight_long(), we can simply remove it.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 1489415605[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agovnc: simple clean up
Wei Qi [Fri, 7 Apr 2017 06:58:58 +0000 (14:58 +0800)]
vnc: simple clean up

It is unnecessary to assign 'packed_bytes' to 'estimated_bytes', because 'estimated_bytes' unused after assignment.

Signed-off-by: Wei Qi <[email protected]>
Reviewed-by: Sahid Orentino Ferdjaoui <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agohw/usb/dev-serial: Do not try to set vendorid or productid properties
Thomas Huth [Thu, 4 May 2017 07:41:44 +0000 (09:41 +0200)]
hw/usb/dev-serial: Do not try to set vendorid or productid properties

When starting QEMU with the legacy USB serial device like this:

 qemu-system-x86_64 -usbdevice serial:vendorid=0x1234:stdio

it currently aborts since the vendorid property does not exist
anymore (it has been removed by commit f29783f72ea77dfbd7ea0c9):

 Unexpected error in object_property_find() at qemu/qom/object.c:1008:
 qemu-system-x86_64: -usbdevice serial:vendorid=0x1234:stdio: Property
                     '.vendorid' not found
 Aborted (core dumped)

Fix this crash by issuing a more friendly error message instead
(and simplify the code also a little bit this way).

Signed-off-by: Thomas Huth <[email protected]>
Message-id: 1493883704[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoxhci: relax link check
Ladi Prosek [Fri, 12 May 2017 10:21:00 +0000 (12:21 +0200)]
xhci: relax link check

The strict td link limit added by commit "05f43d4 xhci: limit the
number of link trbs we are willing to process" causes problems with
Windows guests. Let's raise the limit.

This change is analogous to:

  commit ab6b1105a2259c7072905887f71caa850ce63190
  Author: Gerd Hoffmann <[email protected]>
  Date:   Tue Mar 7 09:40:18 2017 +0100

      ohci: relax link check

Signed-off-by: Ladi Prosek <[email protected]>
Message-id: 20170512102100[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agousb-hub: clear PORT_STAT_SUSPEND on wakeup
Ladi Prosek [Thu, 11 May 2017 12:53:14 +0000 (14:53 +0200)]
usb-hub: clear PORT_STAT_SUSPEND on wakeup

The spec says:

  Suspend: (PORT_SUSPEND) This field indicates whether or not the device
  on this port is suspended. Setting this field causes the device to
  suspend by not propagating bus traffic downstream. This field may be
  reset by a request or by resume signaling from the device attached to
  the port.

I can't find any specific statement like "the PORT_SUSPEND field is reset
automatically on remote wakeup", but without this patch, the only way to
reset it is via the ClearPortFeature request so the ".. or by resume
signaling from the device" clause is clearly not implemented on the remote
wakeup path.

The default xhci Windows driver does not issue the ClearPortFeature request
and suspended devices attached to a hub don't properly get out of the
suspended state. Interestingly, the default uhci Windows driver *does*
issue the ClearPortFeature request and does not exhibit this problem.

Signed-off-by: Ladi Prosek <[email protected]>
Message-id: 20170511125314[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoxhci: fix logging
Ladi Prosek [Thu, 11 May 2017 12:53:13 +0000 (14:53 +0200)]
xhci: fix logging

slotid and epid were deleted from XHCITransfer in commit d6fcb29.
Also deleting one unused forward declaration.

Signed-off-by: Ladi Prosek <[email protected]>
Message-id: 20170511125314[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agousb-redir: fix stack overflow in usbredir_log_data
Gerd Hoffmann [Tue, 9 May 2017 11:01:28 +0000 (13:01 +0200)]
usb-redir: fix stack overflow in usbredir_log_data

Don't reinvent a broken wheel, just use the hexdump function we have.

Impact: low, broken code doesn't run unless you have debug logging
enabled.

Reported-by: 李强 <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
Message-id: 20170509110128[email protected]

7 years agoqemu-doc: Update to use the new way of attaching USB devices
Thomas Huth [Mon, 8 May 2017 15:13:49 +0000 (17:13 +0200)]
qemu-doc: Update to use the new way of attaching USB devices

The preferred way of adding USB devices is via "-device" and
"device_add" nowadays, so let's start to get rid of "-usbdevice"
and "usb_add" in the documentation. While we're at it, also
add the new USB devices there which have been added to QEMU
during the last years, and get rid of the old "vendorid" and
"productid" parameters of "-usbdevice serial" which have been
removed in QEMU version 0.14.0 already.

Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
Message-id: 1494256429[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoopengl: add egl-headless display
Gerd Hoffmann [Fri, 5 May 2017 10:41:01 +0000 (12:41 +0200)]
opengl: add egl-headless display

Add egl-headless user interface.  It doesn't provide a real user
interface, it only provides opengl support using drm render nodes.
It will copy back the bits rendered by the guest using virgl back
to a DisplaySurface and kick the usual display update code paths,
so spice and vnc and screendump can pick it up.

Use it this way:
  qemu -display egl-headless -vnc $display
  qemu -display egl-headless -spice gl=off,$args

Note that you should prefer native spice opengl support (-spice
gl=on) if possible because that delivers better performance.

Signed-off-by: Gerd Hoffmann <[email protected]>
Message-id: 20170505104101[email protected]

7 years agoegl: explicitly ask for core context
Gerd Hoffmann [Fri, 5 May 2017 10:41:00 +0000 (12:41 +0200)]
egl: explicitly ask for core context

Signed-off-by: Gerd Hoffmann <[email protected]>
Message-id: 20170505104101[email protected]

7 years agoegl-helpers: add missing error check
Gerd Hoffmann [Fri, 5 May 2017 10:40:59 +0000 (12:40 +0200)]
egl-helpers: add missing error check

Code didn't check for qemu_egl_init_dpy_mesa() failures, add it.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20170505104101[email protected]

7 years agoegl-helpers: fix display init for x11
Gerd Hoffmann [Fri, 5 May 2017 10:40:58 +0000 (12:40 +0200)]
egl-helpers: fix display init for x11

When running on gtk we need X11 platform not mesa platform.
Create separate functions for mesa and x11 so we can keep
the egl #ifdef mess local to egl-helpers.c

Fixes: 0ea1523fb6703aa0dcd65e66b59e96fec028e60a
Signed-off-by: Gerd Hoffmann <[email protected]>
Message-id: 20170505104101[email protected]

7 years agoegl-helpers: drop support for gles and debug logging
Gerd Hoffmann [Fri, 5 May 2017 10:40:57 +0000 (12:40 +0200)]
egl-helpers: drop support for gles and debug logging

Leftover from the early opengl days.
Unused now, so delete the dead code.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-id: 20170505104101[email protected]

7 years agovirtio-gpu: move virtio_gpu_gl_block
Gerd Hoffmann [Fri, 5 May 2017 10:40:56 +0000 (12:40 +0200)]
virtio-gpu: move virtio_gpu_gl_block

Move to virtio-gpu-3d.c where all the other virgl code lives too.

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20170505104101[email protected]

7 years agomigration/i386: Remove support for pre-0.12 formats
Dr. David Alan Gilbert [Wed, 5 Apr 2017 19:00:24 +0000 (20:00 +0100)]
migration/i386: Remove support for pre-0.12 formats

Remove support for versions of the CPU state prior to 11
which is the version used in qemu 0.12 - you'd be pretty
lucky if you got a migration stream to work from anything
that old anyway.  This doesn't affect the machine type
definition in any way.

My main reason for doing this is the hack for sysenter_esp/eip
that uses .get/.put's in state versions less than 7 (that's
prior to somewhere before 0.10).

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20170405190024[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agovmstatification: i386 FPReg
Dr. David Alan Gilbert [Wed, 5 Apr 2017 19:00:23 +0000 (20:00 +0100)]
vmstatification: i386 FPReg

Convert the fpreg save/restore to use VMSTATE_ macros rather than
.get/.put.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20170405190024[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agomigration/i386: Remove old non-softfloat 64bit FP support
Dr. David Alan Gilbert [Wed, 5 Apr 2017 19:00:22 +0000 (20:00 +0100)]
migration/i386: Remove old non-softfloat 64bit FP support

Long long ago, we used to support storing the x86 FP registers in
a 64bit format.

Then c31da136a0bf8caad70c348f5ffc283206e9c7fc in v0.14-rc0 removed
the last support for writing that in the migration format.
Even before that, it was only used if you had softfloat disabled
 (i.e. !USE_X86LDOUBLE) so in practice use of it in even earlier
qemu is unlikely for most users.

Kill it off, it's complicated, and possibly broken.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20170405190024[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agotests: check -numa node,cpu=props_list usecase
Igor Mammedov [Wed, 10 May 2017 11:30:02 +0000 (13:30 +0200)]
tests: check -numa node,cpu=props_list usecase

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: add '-numa cpu,...' option for property based node mapping
Igor Mammedov [Wed, 10 May 2017 11:30:01 +0000 (13:30 +0200)]
numa: add '-numa cpu,...' option for property based node mapping

legacy cpu to node mapping is using cpu index values to map
VCPU to node with help of '-numa node,nodeid=node,cpus=x[-y]'
option. However cpu index is internal concept and QEMU users
have to guess /reimplement qemu's logic/ to map it to
a concrete cpu socket/core/thread to make sane CPUs
placement across numa nodes.

This patch allows to map cpu objects to numa nodes using
the same properties as used for cpus with -device/device_add
(socket-id/core-id/thread-id/node-id).

At present valid properties/values to address CPUs could be
fetched using hotpluggable-cpus monitor/qmp command, it will
require user to start qemu twice when creating domain to fetch
possible CPUs for a machine type/-smp layout first and
then the second time with numa explicit mapping for actual
usage. The first step results could be saved and reused to
set/change mapping later as far as machine type/-smp stays
the same.

Proposed impl. supports exact and wildcard matching to
simplify CLI and allow to set mapping for a specific cpu
or group of cpu objects specified by matched properties.

For example:

   # exact mapping x86
   -numa cpu,node-id=x,socket-id=y,core-id=z,thread-id=n

   # exact mapping SPAPR
   -numa cpu,node-id=x,core-id=y

   # wildcard mapping, all cpu objects that match socket-id=y
   # are mapped to node-id=x
   -numa cpu,node-id=x,socket-id=y

Signed-off-by: Igor Mammedov <[email protected]>
Message-Id: <1494415802[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: remove node_cpu bitmaps as they are no longer used
Igor Mammedov [Wed, 10 May 2017 11:30:00 +0000 (13:30 +0200)]
numa: remove node_cpu bitmaps as they are no longer used

Postfactum "CPU(s) present in multiple NUMA nodes" check
was the last user of node_cpu bitmaps, but it's not need
as machine_set_cpu_numa_node() does the similar check at
the time mapping is set for cpus (i.e. when -numa cpus=
is parsed) and ensures that cpu can be mapped only to
one node.

Remove duplicate check based on node_cpu bitmaps and
since the last user is gone remove node_cpu as well,
which completes internal transition from legacy bitmap
based mapping storage to possible_cpus storage.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: use possible_cpus for not mapped CPUs check
Igor Mammedov [Wed, 10 May 2017 11:29:59 +0000 (13:29 +0200)]
numa: use possible_cpus for not mapped CPUs check

and remove corresponding part in numa.c that uses
node_cpu bitmaps.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agomachine: call machine init from wrapper
Igor Mammedov [Wed, 10 May 2017 11:29:58 +0000 (13:29 +0200)]
machine: call machine init from wrapper

add machine_run_board_init() wrapper that calls machine
init for now but in follow up patches it will be used
to run generic machine code that should run before
machine init.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: remove no longer need numa_post_machine_init()
Igor Mammedov [Wed, 10 May 2017 11:29:57 +0000 (13:29 +0200)]
numa: remove no longer need numa_post_machine_init()

CPUState::numa_node is still in use but now it's set by
board when it creates CPU objects. So there isn't any
need to set it again after all CPU's are created,
since it's been already set.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agotests: numa: add case for QMP command query-cpus
Igor Mammedov [Wed, 10 May 2017 11:29:56 +0000 (13:29 +0200)]
tests: numa: add case for QMP command query-cpus

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoQMP: include CpuInstanceProperties into query_cpus output output
Igor Mammedov [Wed, 10 May 2017 11:29:55 +0000 (13:29 +0200)]
QMP: include CpuInstanceProperties into query_cpus output output

if board supports CpuInstanceProperties, report them for
each CPU thread listed. Main motivation for this is to
provide these properties introspection via QMP interface
for using in test cases to verify numa node to cpu mapping,
which includes not only boards that support cpu hotplug
and have this info in query-hotpluggable-cpus (pc/spapr)
but also for boards that don't not support hotpluggable-cpus
but support numa mapping (virt-arm).

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <1494415802[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agovirt-arm: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()
Igor Mammedov [Wed, 10 May 2017 11:29:54 +0000 (13:29 +0200)]
virt-arm: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agospapr: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()
Igor Mammedov [Wed, 10 May 2017 11:29:53 +0000 (13:29 +0200)]
spapr: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()

it's safe to remove thread node_id != core node_id error
branch as machine_set_cpu_numa_node() also does mismatch
check and is called even before any CPU is created.

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agopc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()
Igor Mammedov [Wed, 10 May 2017 11:29:52 +0000 (13:29 +0200)]
pc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu()

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: do default mapping based on possible_cpus instead of node_cpu bitmaps
Igor Mammedov [Wed, 10 May 2017 11:29:51 +0000 (13:29 +0200)]
numa: do default mapping based on possible_cpus instead of node_cpu bitmaps

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: mirror cpu to node mapping in MachineState::possible_cpus
Igor Mammedov [Wed, 10 May 2017 11:29:50 +0000 (13:29 +0200)]
numa: mirror cpu to node mapping in MachineState::possible_cpus

Introduce machine_set_cpu_numa_node() helper that stores
node mapping for CPU in MachineState::possible_cpus.
CPU and node it belongs to is specified by 'props' argument.

Patch doesn't remove old way of storing mapping in
numa_info[X].node_cpu as removing it at the same time
makes patch rather big. Instead it just mirrors mapping
in possible_cpus and follow up per target patches will
switch to possible_cpus and numa_info[X].node_cpu will
be removed once there isn't any users left.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: add check that board supports cpu_index to node mapping
Igor Mammedov [Wed, 10 May 2017 11:29:49 +0000 (13:29 +0200)]
numa: add check that board supports cpu_index to node mapping

Default node mapping initialization already checks that board
supports cpu_index to node mapping and refuses to start if
it's not supported. Do the same for explicitly provided
mapping "-numa node,cpus=..."

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agovirt-arm: add node-id property to CPU
Igor Mammedov [Wed, 10 May 2017 11:29:48 +0000 (13:29 +0200)]
virt-arm: add node-id property to CPU

it will allow switching from cpu_index to property based
numa mapping in follow up patches.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agopc: add node-id property to CPU
Igor Mammedov [Wed, 10 May 2017 11:29:47 +0000 (13:29 +0200)]
pc: add node-id property to CPU

it will allow switching from cpu_index to property based
numa mapping in follow up patches.

PS:
patch changes default value of CPUState::numa_node from 0
to CPU_UNSET_NUMA_NODE_ID. The only place for x86 that
would affected is monitor's 'infor numa' command which
uses that field. However legacy 0 value is still preserved
by pc_cpu_pre_plug() in this patch if user/numa.c hasn't
set it explicitly, so there is no change in behavior.

Signed-off-by: Igor Mammedov <[email protected]>
Message-Id: <1494415802[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agospapr: add node-id property to sPAPR core
Igor Mammedov [Wed, 10 May 2017 11:29:46 +0000 (13:29 +0200)]
spapr: add node-id property to sPAPR core

it will allow switching from cpu_index to core based numa
mapping in follow up patches.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Message-Id: <1494415802[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agonuma: move source of default CPUs to NUMA node mapping into boards
Igor Mammedov [Wed, 10 May 2017 11:29:45 +0000 (13:29 +0200)]
numa: move source of default CPUs to NUMA node mapping into boards

Originally CPU threads were by default assigned in
round-robin fashion. However it was causing issues in
guest since CPU threads from the same socket/core could
be placed on different NUMA nodes.
Commit fb43b73b (pc: fix default VCPU to NUMA node mapping)
fixed it by grouping threads within a socket on the same node
introducing cpu_index_to_socket_id() callback and commit
20bb648d (spapr: Fix default NUMA node allocation for threads)
reused callback to fix similar issues for SPAPR machine
even though socket doesn't make much sense there.

As result QEMU ended up having 3 default distribution rules
used by 3 targets /virt-arm, spapr, pc/.

In effort of moving NUMA mapping for CPUs into possible_cpus,
generalize default mapping in numa.c by making boards decide
on default mapping and let them explicitly tell generic
numa code to which node a CPU thread belongs to by replacing
cpu_index_to_socket_id() with @cpu_index_to_instance_props()
which provides default node_id assigned by board to specified
cpu_index.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <1494415802[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agohw/arm/virt: explicitly allocate cpu_index for cpus
Igor Mammedov [Wed, 3 May 2017 12:56:58 +0000 (14:56 +0200)]
hw/arm/virt: explicitly allocate cpu_index for cpus

Currently cpu_index is implicitly auto assigned during
cpu.realize() time cpu_exec_realizefn()->cpu_list_add().

It happens to match index in possible_cpus so take
control over it and make board initialize cpu_index
to possible_cpus index explicitly. It will at least
document that board is in control of it and when
'-device cpu' support comes it will keep cpu_index
stable regardless of order cpus are created so it won't
break migration.
Within this series it will be used for internal
conversion from storing cpu_index based NUMA node
bitmaps to property based mapping with possible_cpus,
And will allow map cpu_index to a CPU entry in
possible_cpus array.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1493816238[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agohw/arm/virt: use machine->possible_cpus for storing possible topology info
Igor Mammedov [Wed, 3 May 2017 12:56:57 +0000 (14:56 +0200)]
hw/arm/virt: use machine->possible_cpus for storing possible topology info

for now precalculate and store mp_afinity in possible_cpus
as ARM cpus don't have socket/core/thread-id properties yet.
In follow patches possible_cpus will be used for storing
and setting NUMA node mapping and replace legacy bitmap
based numa_info[node_id].node_cpu/numa_get_node_for_cpu()

For the lack of better idea, this patch cannibalizes
possible_cpus.cpus[x].props.thread_id so that
*_cpu_index_to_props() callback could return addressable
by props CPU which will be used by machine_set_cpu_numa_node()
in follow up patches to assign a CPU to node. But
cannibalizing is fine for now as that thread_id isn't exposed
to users (no hotpluggable_cpus callback support for ARM yet)
and it will be used only internally until 'device_add cpu'
is supported where we can decide on which properties to use.

Signed-off-by: Igor Mammedov <[email protected]>
Message-Id: <1493816238[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
This page took 0.106786 seconds and 4 git commands to generate.