]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
7 years agoMerge remote-tracking branch 'remotes/yongbok/tags/mips-20160929' into staging
Peter Maydell [Fri, 30 Sep 2016 22:14:39 +0000 (23:14 +0100)]
Merge remote-tracking branch 'remotes/yongbok/tags/mips-20160929' into staging

MIPS patches 2016-09-29

Changes:
* MIPS Maintainer update
* vmstateify rc4030

# gpg: Signature made Thu 29 Sep 2016 13:09:09 BST
# gpg:                using RSA key 0x2238EB86D5F797C2
# gpg: Good signature from "Yongbok Kim <yongbok.kim@imgtec.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 8600 4CF5 3415 A5D9 4CFA  2B5C 2238 EB86 D5F7 97C2

* remotes/yongbok/tags/mips-20160929:
  hw/dma: vmstateify rc4030
  MAINTAINERS: update target-mips maintainers

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging
Peter Maydell [Thu, 29 Sep 2016 23:42:08 +0000 (00:42 +0100)]
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging

# gpg: Signature made Thu 29 Sep 2016 21:13:46 BST
# gpg:                using RSA key 0x7DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jnsnow/tags/ide-pull-request:
  ide: Fix memory leak in ide_register_restart_cb()
  MAINTAINERS: Add some more headers to the IDE section
  ahci: clear aiocb in ncq_cb
  ide: fix DMA register transitions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoide: Fix memory leak in ide_register_restart_cb()
Ashijeet Acharya [Tue, 27 Sep 2016 16:53:32 +0000 (22:23 +0530)]
ide: Fix memory leak in ide_register_restart_cb()

Fix a memory leak in ide_register_restart_cb() in hw/ide/core.c and add
idebus_unrealize() in hw/ide/qdev.c to have calls to
qemu_del_vm_change_state_handler() to deal with the dangling change
state handler during hot-unplugging ide devices which might lead to a
crash.

Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1474995212-10580-1-git-send-email-ashijeetacharya@gmail.com
[Minor whitespace fix --js]
Signed-off-by: John Snow <jsnow@redhat.com>
7 years agoMAINTAINERS: Add some more headers to the IDE section
Thomas Huth [Fri, 23 Sep 2016 16:09:56 +0000 (18:09 +0200)]
MAINTAINERS: Add some more headers to the IDE section

The folder include/hw/ide/ belongs to the IDE section.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1474646996-30421-1-git-send-email-thuth@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
7 years agoahci: clear aiocb in ncq_cb
John Snow [Mon, 26 Sep 2016 18:33:37 +0000 (14:33 -0400)]
ahci: clear aiocb in ncq_cb

Similar to existing fixes for IDE (87ac25fd) and ATAPI (7f951b2d), the
AIOCB must be cleared in the callback. Otherwise, we may accidentally
try to reset a dangling pointer in bdrv_aio_cancel() from a port reset.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1474575040-32079-2-git-send-email-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
7 years agoide: fix DMA register transitions
John Snow [Thu, 29 Sep 2016 18:46:15 +0000 (14:46 -0400)]
ide: fix DMA register transitions

ATA8-APT defines the state transitions for both a host controller and
for the hardware device during the lifecycle of a DMA transfer, in
section 9.7 "DMA command protocol."

One of the interesting tidbits here is that when a device transitions
from DDMA0 ("Prepare state") to DDMA1 ("Data_Transfer State"), it can
choose to set either BSY or DRQ to signal this transition, but not both.

as ide_sector_dma_start is the last point in our preparation process
before we begin the real data transfer process (for either AHCI or BMDMA),
this is the correct transition point for DDMA0 to DDMA1.

I have chosen !BSY && DRQ for QEMU to make the transition from DDMA0 the
most obvious.

Reported-by: Benjamin David Lunt <fys@fysnet.net>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1470175541-19344-1-git-send-email-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
7 years agohw/dma: vmstateify rc4030
Dr. David Alan Gilbert [Wed, 24 Aug 2016 10:40:43 +0000 (11:40 +0100)]
hw/dma: vmstateify rc4030

Convert rc4030 to VMState.
Now saving the whole 16 entries rather than 15.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
[Yongbok Kim: edited commit message]
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
7 years agoMAINTAINERS: update target-mips maintainers
Leon Alrae [Thu, 22 Sep 2016 13:34:14 +0000 (14:34 +0100)]
MAINTAINERS: update target-mips maintainers

Yongbok Kim takes over the target-mips maintenance from me.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Acked-by: Yongbok Kim <yongbok.kim@imgtec.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
7 years agoMerge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Peter Maydell [Wed, 28 Sep 2016 23:34:20 +0000 (00:34 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

# gpg: Signature made Wed 28 Sep 2016 22:30:45 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# 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/tracing-pull-request:
  trace: Document the execution mode of guest events
  trace: Add event "guest_cpu_reset"
  trace: Add event "guest_cpu_enter"
  trace: Properly initialize dynamic event states in hot-plugged vCPUs
  trace: move hw/virtio/virtio-balloon.c trace points into correct file
  trace: move hw/mem/pc-dimm.c trace points into correct file
  trace: move util/qemu-coroutine*.c trace points into correct file
  trace: move util/buffer.c trace points into correct file

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Wed, 28 Sep 2016 22:02:56 +0000 (23:02 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* thread-safe tb_flush (Fred, Alex, Sergey, me, Richard, Emilio,... :-)
* license clarification for compiler.h (Felipe)
* glib cflags improvement (Marc-André)
* checkpatch silencing (Paolo)
* SMRAM migration fix (Paolo)
* Replay improvements (Pavel)
* IOMMU notifier improvements (Peter)
* IOAPIC now defaults to version 0x20 (Peter)

# gpg: Signature made Tue 27 Sep 2016 10:57:40 BST
# gpg:                using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (28 commits)
  replay: allow replay stopping and restarting
  replay: vmstate for replay module
  replay: move internal data to the structure
  cpus-common: lock-free fast path for cpu_exec_start/end
  tcg: Make tb_flush() thread safe
  cpus-common: Introduce async_safe_run_on_cpu()
  cpus-common: simplify locking for start_exclusive/end_exclusive
  cpus-common: remove redundant call to exclusive_idle()
  cpus-common: always defer async_run_on_cpu work items
  docs: include formal model for TCG exclusive sections
  cpus-common: move exclusive work infrastructure from linux-user
  cpus-common: fix uninitialized variable use in run_on_cpu
  cpus-common: move CPU work item management to common code
  cpus-common: move CPU list management to common code
  linux-user: Add qemu_cpu_is_self() and qemu_cpu_kick()
  linux-user: Use QemuMutex and QemuCond
  cpus: Rename flush_queued_work()
  cpus: Move common code out of {async_, }run_on_cpu()
  cpus: pass CPUState to run_on_cpu helpers
  build-sys: put glib_cflags in QEMU_CFLAGS
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Wed, 28 Sep 2016 19:13:05 +0000 (20:13 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Wed 28 Sep 2016 19:15:22 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# 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:
  linux-aio: fix re-entrant completion processing
  test-coroutine: test qemu_coroutine_entered()
  coroutine: add qemu_coroutine_entered() function
  libqos: fix qvring_init()
  iothread: check iothread->ctx before aio_context_unref to avoid assertion
  aio-posix: avoid unnecessary aio_epoll_enabled() calls
  block: mirror: fix wrong comment of mirror_start

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agotrace: Document the execution mode of guest events
Lluís Vilanova [Thu, 22 Sep 2016 18:40:21 +0000 (20:40 +0200)]
trace: Document the execution mode of guest events

Explicitly state in which execution mode (user, softmmu, all) are guest
events available for tracing.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147456962135.11114.6146034359114598596.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotrace: Add event "guest_cpu_reset"
Lluís Vilanova [Mon, 19 Sep 2016 12:55:18 +0000 (14:55 +0200)]
trace: Add event "guest_cpu_reset"

Signals the reset of the state a virtual (guest) CPU.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147428971851.15111.8799439252178273840.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotrace: Add event "guest_cpu_enter"
Lluís Vilanova [Mon, 19 Sep 2016 12:55:13 +0000 (14:55 +0200)]
trace: Add event "guest_cpu_enter"

Signals the hot-plugging of a new virtual (guest) CPU.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147428971313.15111.18023030883528426840.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotrace: Properly initialize dynamic event states in hot-plugged vCPUs
Lluís Vilanova [Mon, 19 Sep 2016 12:55:07 +0000 (14:55 +0200)]
trace: Properly initialize dynamic event states in hot-plugged vCPUs

Every time a vCPU is hot-plugged, it will "inherit" its tracing state
from the global state array. That is, if *any* existing vCPU has an
event enabled, new vCPUs will have too.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147428970768.15111.7664565956870423529.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotrace: move hw/virtio/virtio-balloon.c trace points into correct file
Daniel P. Berrange [Wed, 14 Sep 2016 17:03:44 +0000 (18:03 +0100)]
trace: move hw/virtio/virtio-balloon.c trace points into correct file

The trace points for hw/virtio/virtio-balloon.c were mistakenly put
in the top level trace-events file, instead of util/trace-events in

  commit 270ab88f7c1112389a02cee0e3e03b20fcc7547e
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:39:57 2016 +0100

    trace: split out trace events for hw/virtio/ directory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-5-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotrace: move hw/mem/pc-dimm.c trace points into correct file
Daniel P. Berrange [Wed, 14 Sep 2016 17:03:43 +0000 (18:03 +0100)]
trace: move hw/mem/pc-dimm.c trace points into correct file

The trace points for hw/mem/pc-dimm.c were mistakenly put
in the hw/i386/trace-events file, instead of hw/mem/trace-events
in

  commit 5eb76e480b42206d3640c1aab8a376ba350f70bb
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:40:10 2016 +0100

    trace: split out trace events for hw/i386/ directory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-4-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotrace: move util/qemu-coroutine*.c trace points into correct file
Daniel P. Berrange [Wed, 14 Sep 2016 17:03:42 +0000 (18:03 +0100)]
trace: move util/qemu-coroutine*.c trace points into correct file

The trace points for util/qemu-coroutine*.c were mistakenly left
in the top level trace-events file, instead of util/trace-events
in

  commit 492bb2dd651e780c0723580880acbedb5661e5ad
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:39:48 2016 +0100

    trace: split out trace events for util/ directory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-3-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotrace: move util/buffer.c trace points into correct file
Daniel P. Berrange [Wed, 14 Sep 2016 17:03:41 +0000 (18:03 +0100)]
trace: move util/buffer.c trace points into correct file

The trace points for util/buffer.c were mistakenly put
in the io/trace-events file, instead of util/trace-events
in

  commit 892bd32ea38bbe9709ff0b6db3053bdf06eec9fb
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:39:50 2016 +0100

    trace: split out trace events for io/ directory

    Move all trace-events for files in the io/ directory to

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-2-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-20160928-1' into staging
Peter Maydell [Wed, 28 Sep 2016 16:44:05 +0000 (17:44 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20160928-1' into staging

input queue: ps2 kbd cleanups and improvements

# gpg: Signature made Wed 28 Sep 2016 13:52:16 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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/pull-input-20160928-1:
  ps2: do not generate invalid key codes for unknown keys
  ps2: use QEMU qcodes instead of scancodes
  ps2: allow keycode translation for all scancode sets
  ps2: correctly handle 'get/set scancode' command
  ps2: reject unknown commands, instead of blindly accepting them

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160928-1' into staging
Peter Maydell [Wed, 28 Sep 2016 16:15:43 +0000 (17:15 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160928-1' into staging

ui: console+vnc fixes, switch spice to pure opengl with gl=on.

# gpg: Signature made Wed 28 Sep 2016 11:57:35 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# 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/pull-ui-20160928-1:
  ui/vnc-enc-tight: remove switch and have single return
  spice/gl: render DisplaySurface via opengl
  console: track gl_block state in QemuConsole
  console: skip same-size resize

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agolinux-aio: fix re-entrant completion processing
Stefan Hajnoczi [Tue, 27 Sep 2016 15:18:36 +0000 (16:18 +0100)]
linux-aio: fix re-entrant completion processing

Commit 0ed93d84edabc7656f5c998ae1a346fe8b94ca54 ("linux-aio: process
completions from ioq_submit()") added an optimization that processes
completions each time ioq_submit() returns with requests in flight.
This commit introduces a "Co-routine re-entered recursively" error which
can be triggered with -drive format=qcow2,aio=native.

Fam Zheng <famz@redhat.com>, Kevin Wolf <kwolf@redhat.com>, and I
debugged the following backtrace:

  (gdb) bt
  #0  0x00007ffff0a046f5 in raise () at /lib64/libc.so.6
  #1  0x00007ffff0a062fa in abort () at /lib64/libc.so.6
  #2  0x0000555555ac0013 in qemu_coroutine_enter (co=0x5555583464d0) at util/qemu-coroutine.c:113
  #3  0x0000555555a4b663 in qemu_laio_process_completions (s=s@entry=0x555557e2f7f0) at block/linux-aio.c:218
  #4  0x0000555555a4b874 in ioq_submit (s=s@entry=0x555557e2f7f0) at block/linux-aio.c:331
  #5  0x0000555555a4ba12 in laio_do_submit (fd=fd@entry=13, laiocb=laiocb@entry=0x555559d38ae0, offset=offset@entry=2932727808, type=type@entry=1) at block/linux-aio.c:383
  #6  0x0000555555a4bbd3 in laio_co_submit (bs=<optimized out>, s=0x555557e2f7f0, fd=13, offset=2932727808, qiov=0x555559d38e20, type=1) at block/linux-aio.c:402
  #7  0x0000555555a4fd23 in bdrv_driver_preadv (bs=bs@entry=0x55555663bcb0, offset=offset@entry=2932727808, bytes=bytes@entry=8192, qiov=qiov@entry=0x555559d38e20, flags=0) at block/io.c:804
  #8  0x0000555555a52b34 in bdrv_aligned_preadv (bs=bs@entry=0x55555663bcb0, req=req@entry=0x555559d38d20, offset=offset@entry=2932727808, bytes=bytes@entry=8192, align=align@entry=512, qiov=qiov@entry=0x555559d38e20, flags=0) at block/io.c:1041
  #9  0x0000555555a52db8 in bdrv_co_preadv (child=<optimized out>, offset=2932727808, bytes=8192, qiov=qiov@entry=0x555559d38e20, flags=flags@entry=0) at block/io.c:1133
  #10 0x0000555555a29629 in qcow2_co_preadv (bs=0x555556635890, offset=6178725888, bytes=8192, qiov=0x555557527840, flags=<optimized out>) at block/qcow2.c:1509
  #11 0x0000555555a4fd23 in bdrv_driver_preadv (bs=bs@entry=0x555556635890, offset=offset@entry=6178725888, bytes=bytes@entry=8192, qiov=qiov@entry=0x555557527840, flags=0) at block/io.c:804
  #12 0x0000555555a52b34 in bdrv_aligned_preadv (bs=bs@entry=0x555556635890, req=req@entry=0x555559d39000, offset=offset@entry=6178725888, bytes=bytes@entry=8192, align=align@entry=1, qiov=qiov@entry=0x555557527840, flags=0) at block/io.c:1041
  #13 0x0000555555a52db8 in bdrv_co_preadv (child=<optimized out>, offset=offset@entry=6178725888, bytes=bytes@entry=8192, qiov=qiov@entry=0x555557527840, flags=flags@entry=0) at block/io.c:1133
  #14 0x0000555555a4515a in blk_co_preadv (blk=0x5555566356d0, offset=6178725888, bytes=8192, qiov=0x555557527840, flags=0) at block/block-backend.c:783
  #15 0x0000555555a45266 in blk_aio_read_entry (opaque=0x5555577025e0) at block/block-backend.c:991
  #16 0x0000555555ac0cfa in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at util/coroutine-ucontext.c:78

It turned out that re-entrant ioq_submit() and completion processing
between three requests caused this error.  The following check is not
sufficient to prevent recursively entering coroutines:

  if (laiocb->co != qemu_coroutine_self()) {
      qemu_coroutine_enter(laiocb->co);
  }

As the following coroutine backtrace shows, not just the current
coroutine (self) can be entered.  There might also be other coroutines
that are currently entered and transferred control due to the qcow2 lock
(CoMutex):

  (gdb) qemu coroutine 0x5555583464d0
  #0  0x0000555555ac0c90 in qemu_coroutine_switch (from_=from_@entry=0x5555583464d0, to_=to_@entry=0x5555572f9890, action=action@entry=COROUTINE_ENTER) at util/coroutine-ucontext.c:175
  #1  0x0000555555abfe54 in qemu_coroutine_enter (co=0x5555572f9890) at util/qemu-coroutine.c:117
  #2  0x0000555555ac031c in qemu_co_queue_run_restart (co=co@entry=0x5555583462c0) at util/qemu-coroutine-lock.c:60
  #3  0x0000555555abfe5e in qemu_coroutine_enter (co=0x5555583462c0) at util/qemu-coroutine.c:119
  #4  0x0000555555a4b663 in qemu_laio_process_completions (s=s@entry=0x555557e2f7f0) at block/linux-aio.c:218
  #5  0x0000555555a4b874 in ioq_submit (s=s@entry=0x555557e2f7f0) at block/linux-aio.c:331
  #6  0x0000555555a4ba12 in laio_do_submit (fd=fd@entry=13, laiocb=laiocb@entry=0x55555a338b40, offset=offset@entry=2911477760, type=type@entry=1) at block/linux-aio.c:383
  #7  0x0000555555a4bbd3 in laio_co_submit (bs=<optimized out>, s=0x555557e2f7f0, fd=13, offset=2911477760, qiov=0x55555a338e80, type=1) at block/linux-aio.c:402
  #8  0x0000555555a4fd23 in bdrv_driver_preadv (bs=bs@entry=0x55555663bcb0, offset=offset@entry=2911477760, bytes=bytes@entry=8192, qiov=qiov@entry=0x55555a338e80, flags=0) at block/io.c:804
  #9  0x0000555555a52b34 in bdrv_aligned_preadv (bs=bs@entry=0x55555663bcb0, req=req@entry=0x55555a338d80, offset=offset@entry=2911477760, bytes=bytes@entry=8192, align=align@entry=512, qiov=qiov@entry=0x55555a338e80, flags=0) at block/io.c:1041
  #10 0x0000555555a52db8 in bdrv_co_preadv (child=<optimized out>, offset=2911477760, bytes=8192, qiov=qiov@entry=0x55555a338e80, flags=flags@entry=0) at block/io.c:1133
  #11 0x0000555555a29629 in qcow2_co_preadv (bs=0x555556635890, offset=6157475840, bytes=8192, qiov=0x5555575df720, flags=<optimized out>) at block/qcow2.c:1509
  #12 0x0000555555a4fd23 in bdrv_driver_preadv (bs=bs@entry=0x555556635890, offset=offset@entry=6157475840, bytes=bytes@entry=8192, qiov=qiov@entry=0x5555575df720, flags=0) at block/io.c:804
  #13 0x0000555555a52b34 in bdrv_aligned_preadv (bs=bs@entry=0x555556635890, req=req@entry=0x55555a339060, offset=offset@entry=6157475840, bytes=bytes@entry=8192, align=align@entry=1, qiov=qiov@entry=0x5555575df720, flags=0) at block/io.c:1041
  #14 0x0000555555a52db8 in bdrv_co_preadv (child=<optimized out>, offset=offset@entry=6157475840, bytes=bytes@entry=8192, qiov=qiov@entry=0x5555575df720, flags=flags@entry=0) at block/io.c:1133
  #15 0x0000555555a4515a in blk_co_preadv (blk=0x5555566356d0, offset=6157475840, bytes=8192, qiov=0x5555575df720, flags=0) at block/block-backend.c:783
  #16 0x0000555555a45266 in blk_aio_read_entry (opaque=0x555557231aa0) at block/block-backend.c:991
  #17 0x0000555555ac0cfa in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at util/coroutine-ucontext.c:78

Use the new qemu_coroutine_entered() function instead of comparing
against qemu_coroutine_self().  This is correct because:

1. If a coroutine is not entered then it must have yielded to wait for
   I/O completion.  It is therefore safe to enter.

2. If a coroutine is entered then it must be in
   ioq_submit()/qemu_laio_process_completions() because otherwise it
   would be yielded while waiting for I/O completion.  Therefore it will
   check laio->ret and return from ioq_submit() instead of yielding,
   i.e. it's guaranteed not to hang.

Reported-by: Fam Zheng <famz@redhat.com>
Tested-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1474989516-18255-4-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotest-coroutine: test qemu_coroutine_entered()
Stefan Hajnoczi [Tue, 27 Sep 2016 15:18:35 +0000 (16:18 +0100)]
test-coroutine: test qemu_coroutine_entered()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1474989516-18255-3-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agocoroutine: add qemu_coroutine_entered() function
Stefan Hajnoczi [Tue, 27 Sep 2016 15:18:34 +0000 (16:18 +0100)]
coroutine: add qemu_coroutine_entered() function

See the doc comments for a description of this new coroutine API.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1474989516-18255-2-git-send-email-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/xen-20160927-tag' into staging
Peter Maydell [Wed, 28 Sep 2016 15:12:13 +0000 (16:12 +0100)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20160927-tag' into staging

Xen 2016/09/27

# gpg: Signature made Wed 28 Sep 2016 02:33:42 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <sstabellini@kernel.org>"
# gpg:                 aka "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20160927-tag:
  qdisk - hw/block/xen_disk: grant copy implementation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agops2: do not generate invalid key codes for unknown keys
Hervé Poussineau [Thu, 15 Sep 2016 20:06:27 +0000 (22:06 +0200)]
ps2: do not generate invalid key codes for unknown keys

Instead, print a warning message.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-id: 1473969987-5890-6-git-send-email-hpoussin@reactos.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agops2: use QEMU qcodes instead of scancodes
Hervé Poussineau [Thu, 15 Sep 2016 20:06:26 +0000 (22:06 +0200)]
ps2: use QEMU qcodes instead of scancodes

This fixes problems with translated set 1, where most make code were wrong.
This fixes problems with set 3 for extended keys (like arrows) and lot of other keys.
Added a FIXME for set 3, where most keys must not (by default) deliver a break code.

Detailed list of changes on untranslated set 2:
- change of ALTGR break code from 0xe4 to 0xf0 0x08
- change of ALTGR_R break code from 0xe0 0xe4 to 0xe0 0xf0 0x08
- change of F7 make code from 0x02 to 0x83
- change of F7 break code from 0xf0 0x02 to 0xf0 0x83
- change of PRINT make code from 0xe0 0x7c to 0xe0 0x12 0xe0 0x7c
- change of PRINT break code from 0xe0 0xf0 0x7c to 0xe0 0xf0 0x7c 0xe0 0xf0 0x12
- change of PAUSE key: new make code = old make code + old break code, no more break code
- change on RO break code from 0xf3 to 0xf0 0x51
- change on KP_COMMA break code from 0xfe to 0xf0 0x6d

Detailed list of changes on translated set 2 (the most commonly used):
- change of PRINT make code from 0xe0 0x37 to 0xe0 0x2a 0xe0 0x37
- change of PRINT break code from 0xe0 0xb7 to 0xe0 0xb7 0xe0 0xaa
- change of PAUSE key: new make code = old make code + old break code, no more break code

Reference:
http://www.computer-engineering.org/ps2keyboard/scancodes1.html
http://www.computer-engineering.org/ps2keyboard/scancodes2.html
http://www.computer-engineering.org/ps2keyboard/scancodes3.html
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-id: 1473969987-5890-5-git-send-email-hpoussin@reactos.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agops2: allow keycode translation for all scancode sets
Hervé Poussineau [Thu, 15 Sep 2016 20:06:25 +0000 (22:06 +0200)]
ps2: allow keycode translation for all scancode sets

Change ps2_put_keycode to get an untranslated scancode, which is translated if needed.

As qemu_input_key_value_to_scancode() gives translated scancodes, untranslate them
in ps2_keyboard_event first before giving them to ps2_put_keycode.

Results are not changed, except for some keys in translated set 3.

Translation table is available at
https://www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-id: 1473969987-5890-4-git-send-email-hpoussin@reactos.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agops2: correctly handle 'get/set scancode' command
Hervé Poussineau [Thu, 15 Sep 2016 20:06:24 +0000 (22:06 +0200)]
ps2: correctly handle 'get/set scancode' command

When getting scancode, current scancode must be preceded from reply ack.
When setting scancode, we must reject invalid scancodes.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-id: 1473969987-5890-3-git-send-email-hpoussin@reactos.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agops2: reject unknown commands, instead of blindly accepting them
Hervé Poussineau [Thu, 15 Sep 2016 20:06:23 +0000 (22:06 +0200)]
ps2: reject unknown commands, instead of blindly accepting them

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Message-id: 1473969987-5890-2-git-send-email-hpoussin@reactos.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoui/vnc-enc-tight: remove switch and have single return
Alex Bennée [Thu, 22 Sep 2016 10:13:08 +0000 (11:13 +0100)]
ui/vnc-enc-tight: remove switch and have single return

When enabling the sanitizer build it will complain about control
reaching a non-void function. Normally the compiler should detect that
there is only one possible exit given a static VNC_SERVER_FB_BYTES.

As we always expect a static VNC_SERVER_FB_BYTES I've added a compile
time assert and just called the sub-function directly.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agospice/gl: render DisplaySurface via opengl
Gerd Hoffmann [Fri, 23 Sep 2016 07:50:28 +0000 (09:50 +0200)]
spice/gl: render DisplaySurface via opengl

This switches over spice (in opengl mode) to render DisplaySurface
updates into a opengl texture, using the helper functions in
ui/console-gl.c.  With this patch applied spice (with gl=on) will
stop using qxl rendering ops, it will use dma-buf passing all the
time, i.e. for bios/bootloader (before virtio-gpu driver is loaded)
too.

This should improve performance even using spice (with gl=on) with
non-accelerated stdvga because we stop squeezing all display updates
through a unix/tcp socket and basically using a shared memory transport
instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1474617028-3979-3-git-send-email-kraxel@redhat.com

7 years agoconsole: track gl_block state in QemuConsole
Gerd Hoffmann [Fri, 23 Sep 2016 07:50:27 +0000 (09:50 +0200)]
console: track gl_block state in QemuConsole

Keep track of gl_block state (added in bba19b8 console: block rendering
until client is done) in QemuConsole and allow to query it.  This way
we can avoid state inconsistencies in case different code paths make use
of this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 1474617028-3979-2-git-send-email-kraxel@redhat.com

7 years agoconsole: skip same-size resize
Marc-André Lureau [Fri, 26 Aug 2016 09:47:11 +0000 (13:47 +0400)]
console: skip same-size resize

virtio-gpu does a set-scanout at each frame (it might be a driver
regression). qemu_console_resize() recreate a surface even if the size
didn't change, and this shows up in profiling reports because the
surface is cleared. With this patch, I get a +15-20% glmark2
improvement.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20160826094711.14470-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agolibqos: fix qvring_init()
Laurent Vivier [Mon, 26 Sep 2016 15:24:10 +0000 (17:24 +0200)]
libqos: fix qvring_init()

"vq->desc[i].addr" is a 64bit value,
so write it with writeq(), not writew().

struct vring_desc {
    __virtio64 addr;
    __virtio32 len;
    __virtio16 flags;
    __virtio16 next;
};

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-id: 1474903450-9605-1-git-send-email-lvivier@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoiothread: check iothread->ctx before aio_context_unref to avoid assertion
Lin Ma [Mon, 26 Sep 2016 05:29:58 +0000 (13:29 +0800)]
iothread: check iothread->ctx before aio_context_unref to avoid assertion

if iothread->ctx is set to NULL, aio_context_unref triggers the assertion:
g_source_unref: assertion 'source != NULL' failed.
The patch fixes it.

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20160926052958.10716-1-lma@suse.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoaio-posix: avoid unnecessary aio_epoll_enabled() calls
Yaowei Bai [Wed, 14 Sep 2016 11:03:39 +0000 (07:03 -0400)]
aio-posix: avoid unnecessary aio_epoll_enabled() calls

As epoll whether enabled or not is a global setting, we can just
check it only once rather than checking it with every node iteration.
Through this we can avoid a lot of checks when epoll is not enabled.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Reviewed-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Message-id: 1473851019-7005-3-git-send-email-baiyaowei@cmss.chinamobile.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoblock: mirror: fix wrong comment of mirror_start
Yaowei Bai [Wed, 14 Sep 2016 11:03:38 +0000 (07:03 -0400)]
block: mirror: fix wrong comment of mirror_start

Obviously, we should write to '@target'.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Reviewed-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473851019-7005-2-git-send-email-baiyaowei@cmss.chinamobile.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotests: cris: add v17 ADDC test
Rabin Vincent [Wed, 24 Aug 2016 08:42:16 +0000 (10:42 +0200)]
tests: cris: add v17 ADDC test

Add a test for the newly implemented ADDC instruction in the v17 CRIS
CPU.

Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7 years agotarget-cris: add v17 CPU
Rabin Vincent [Mon, 15 Aug 2016 11:59:32 +0000 (13:59 +0200)]
target-cris: add v17 CPU

In the CRIS v17 CPU an ADDC (add with carry) instruction has been added
compared to the v10 instruction set.

 Assembler syntax:

  ADDC [Rs],Rd
  ADDC [Rs+],Rd

 Size: Dword

 Description:

  The source data is added together with the carry flag to the
  destination register. The size of the operation is dword.

 Operation:

  Rd += s + C-flag;

 Flags affected:

  S R P U I X N Z V C
  - - - - - 0 * * * *

 Instruction format: ADDC [Rs],Rd

  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  |Destination(Rd)| 1   0   0   1   1   0   1   0 |   Source(Rs)  |
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

 Instruction format: ADDC [Rs+],Rd

  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  |Destination(Rd)| 1   1   0   1   1   0   1   0 |   Source(Rs)  |
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

[EI: Shorten 80+ lines]
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7 years agotarget-cris: reduce v32isms from v10 log dumps
Hans-Peter Nilsson [Mon, 15 Aug 2016 11:44:46 +0000 (13:44 +0200)]
target-cris: reduce v32isms from v10 log dumps

Use the correct register names for v10 and don't dump support function
registers for pre-v32.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7 years agotests: cris: remove check_time1
Rabin Vincent [Tue, 23 Aug 2016 14:50:18 +0000 (16:50 +0200)]
tests: cris: remove check_time1

This test, borrowed from the GDB simulator test suite, checks that every
syscall increments the time returned by gettimeofday() by exactly 1 ms.
This is not guaranteed or even desirable on QEMU so remove this test.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7 years agotests: cris: remove openpf4 test
Rabin Vincent [Tue, 23 Aug 2016 14:44:15 +0000 (16:44 +0200)]
tests: cris: remove openpf4 test

This test, borrowed from the GDB simulator test suite, is meant to test
the GDB simulator's --sysroot feature and always fails in QEMU.  Remove
it.  openpf3 tests the same sequence of system calls (without assuming
the precence of --sysroot).

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7 years agotests: cris: fix syscall inline asm
Rabin Vincent [Wed, 24 Aug 2016 07:08:21 +0000 (09:08 +0200)]
tests: cris: fix syscall inline asm

Add the appropriate register constraints for the inline asm for the
write and exit system calls.  Without the correct constraints for the
write() function, correct failure messages are not printed succesfully
on newer version of GCC.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7 years agotests: cris: force inlining
Rabin Vincent [Tue, 23 Aug 2016 14:34:59 +0000 (16:34 +0200)]
tests: cris: force inlining

The CRIS tests expect that functions marked inline are always inline.
With newer versions of GCC, building them results warnings like the
following and spurious failures when they are run.

In file included from tests/tcg/cris/check_moveq.c:5:0:
tests/tcg/cris/crisutils.h:66:20: warning: inlining failed in call to
'cris_tst_cc.constprop.0': call is unlikely and code size would grow [-Winline]
tests/tcg/cris/check_moveq.c:28:13: warning: called from here [-Winline]

Use the always_inline attribute when building them to fix this.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7 years agoqdisk - hw/block/xen_disk: grant copy implementation
Paulina Szubarczyk [Wed, 14 Sep 2016 19:10:03 +0000 (21:10 +0200)]
qdisk - hw/block/xen_disk: grant copy implementation

Copy data operated on during request from/to local buffers to/from
the grant references.

Before grant copy operation local buffers must be allocated what is
done by calling ioreq_init_copy_buffers. For the 'read' operation,
first, the qemu device invokes the read operation on local buffers
and on the completion grant copy is called and buffers are freed.
For the 'write' operation grant copy is performed before invoking
write by qemu device.

A new value 'feature_grant_copy' is added to recognize when the
grant copy operation is supported by a guest.

Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
7 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging
Peter Maydell [Tue, 27 Sep 2016 22:10:12 +0000 (23:10 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging

x86 and machine queue, 2016-09-27

# gpg: Signature made Tue 27 Sep 2016 21:10:06 BST
# gpg:                using RSA key 0x2807936F984DC5A6
# 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-pull-request:
  sysbus: Remove ignored return value of FindSysbusDeviceFunc
  target-i386: Remove has_msr_* global vars for KVM features
  target-i386: Clear KVM CPUID features if KVM is disabled
  target-i386: Remove has_msr_hv_tsc global variable
  target-i386: Remove has_msr_hv_apic global variable
  target-i386: Remove has_msr_mtrr global variable
  target-i386: Move xsave component mask to features array
  target-i386: xsave: Calculate set of xsave components on realize
  target-i386: xsave: Helper function to calculate xsave area size
  target-i386: xsave: Simplify CPUID[0xD,0].{EAX,EDX} calculation
  target-i386: xsave: Calculate enabled components only once
  target-i386: Don't try to enable PT State xsave component
  target-i386: Move feature name arrays inside FeatureWordInfo
  linux-user: remove #define smp_{cores, threads}
  target-i386: Enable CPUID[0x8000000A] if SVM is enabled
  target-i386: Automatically set level/xlevel/xlevel2 when needed
  tests: Test CPUID level handling for old machines
  tests: Add test code for CPUID level/xlevel handling
  target-i386: Add a marker to end of the region zeroed on reset
  target-i386: Remove unused X86CPUDefinition::xlevel2 field

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agosysbus: Remove ignored return value of FindSysbusDeviceFunc
David Gibson [Wed, 21 Sep 2016 05:23:53 +0000 (15:23 +1000)]
sysbus: Remove ignored return value of FindSysbusDeviceFunc

Functions of type FindSysbusDeviceFunc currently return an integer.
However, this return value is always ignored by the caller in
find_sysbus_device().

This changes the function type to return void, to avoid confusion over
the function semantics.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Remove has_msr_* global vars for KVM features
Eduardo Habkost [Mon, 26 Sep 2016 22:03:24 +0000 (19:03 -0300)]
target-i386: Remove has_msr_* global vars for KVM features

The global variables are not necessary because we can check KVM
feature flags in X86CPU directly.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Clear KVM CPUID features if KVM is disabled
Eduardo Habkost [Mon, 26 Sep 2016 22:11:14 +0000 (19:11 -0300)]
target-i386: Clear KVM CPUID features if KVM is disabled

This will ensure all checks for features[FEAT_KVM] in the code
will be correct in case the KVM CPUID leaf is completely
disabled.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Remove has_msr_hv_tsc global variable
Eduardo Habkost [Fri, 15 Jul 2016 17:05:36 +0000 (14:05 -0300)]
target-i386: Remove has_msr_hv_tsc global variable

The global variable is not necessary because we can check
cpu->hyperv_time directly.

We just need to ensure cpu->hyperv_time will be cleared if the
feature is not really being exposed to the guest due to missing
KVM_CAP_HYPERV_TIME capability.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Remove has_msr_hv_apic global variable
Eduardo Habkost [Thu, 14 Jul 2016 18:55:37 +0000 (15:55 -0300)]
target-i386: Remove has_msr_hv_apic global variable

The global variable is not necessary because we can check
cpu->hyperv_vapic directly.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Remove has_msr_mtrr global variable
Eduardo Habkost [Mon, 26 Sep 2016 22:03:29 +0000 (19:03 -0300)]
target-i386: Remove has_msr_mtrr global variable

The global variable is not necessary because we can check the CPU
feature flags directly.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Move xsave component mask to features array
Eduardo Habkost [Thu, 22 Sep 2016 20:41:35 +0000 (17:41 -0300)]
target-i386: Move xsave component mask to features array

This will reuse the existing check/enforce logic in
x86_cpu_filter_features() to check the xsave component bits
against GET_SUPPORTED_CPUID.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: xsave: Calculate set of xsave components on realize
Eduardo Habkost [Thu, 22 Sep 2016 20:27:56 +0000 (17:27 -0300)]
target-i386: xsave: Calculate set of xsave components on realize

Instead of doing complex calculations and calling
kvm_arch_get_supported_cpuid() inside cpu_x86_cpuid(), calculate
the set of required XSAVE components earlier, at realize time.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: xsave: Helper function to calculate xsave area size
Eduardo Habkost [Thu, 22 Sep 2016 20:14:07 +0000 (17:14 -0300)]
target-i386: xsave: Helper function to calculate xsave area size

Move the xsave area size calculation from cpu_x86_cpuid() inside
its own function. While doing it, change it to use the XSAVE area
struct sizes for the initial size, instead of the magic 0x240
number.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: xsave: Simplify CPUID[0xD,0].{EAX,EDX} calculation
Eduardo Habkost [Thu, 22 Sep 2016 17:58:32 +0000 (14:58 -0300)]
target-i386: xsave: Simplify CPUID[0xD,0].{EAX,EDX} calculation

Instead of assigning individual bits in a loop, just copy the
values from ena_mask.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: xsave: Calculate enabled components only once
Eduardo Habkost [Thu, 22 Sep 2016 17:33:01 +0000 (14:33 -0300)]
target-i386: xsave: Calculate enabled components only once

Instead of checking both env->features and ena_mask at two
different places in the CPUID code, initialize ena_mask based on
the features that are enabled for the CPU, and then clear
unsupported bits based on kvm_arch_get_supported_cpuid().

The results should be exactly the same, but it will make it
easier to move the mask calculation elsewhare, and reuse
x86_cpu_filter_features() for the kvm_arch_get_supported_cpuid()
check.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Don't try to enable PT State xsave component
Eduardo Habkost [Thu, 22 Sep 2016 21:58:39 +0000 (18:58 -0300)]
target-i386: Don't try to enable PT State xsave component

The code that calculates the set of supported XSAVE components on
CPUID looks at ext_save_areas to find out which components should
be enabled. However, if there are zeroed entries in the
ext_save_areas array, the
  ((env->features[esa->feature] & esa->bits) == esa->bits)
check will always succeed and QEMU will unconditionally try to
enable the component.

Luckily this never caused any problems because the only missing
entry in ext_save_areas is the PT State component (bit 8), and
KVM currently doesn't support it (so it was cleared on ena_mask).
But the code was still incorrect and would break if KVM starts
returning CPUID[EAX=0xD,ECX=0].EAX[bit 8] as supported on
GET_SUPPORTED_CPUID.

Fix the problem by changing the code to not enable a XSAVE
component if ExtSaveArea::bits is zero.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Move feature name arrays inside FeatureWordInfo
Eduardo Habkost [Thu, 12 May 2016 14:24:04 +0000 (11:24 -0300)]
target-i386: Move feature name arrays inside FeatureWordInfo

It makes it easier to guarantee the arrays are the right size,
and to find information when looking at the code.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agolinux-user: remove #define smp_{cores, threads}
Marc-André Lureau [Fri, 16 Sep 2016 15:50:24 +0000 (19:50 +0400)]
linux-user: remove #define smp_{cores, threads}

Those are unneeded now that CPUState nr_{cores,threads} is always
initialized.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Enable CPUID[0x8000000A] if SVM is enabled
Eduardo Habkost [Wed, 21 Sep 2016 18:01:35 +0000 (15:01 -0300)]
target-i386: Enable CPUID[0x8000000A] if SVM is enabled

SVM needs CPUID[0x8000000A] to be available. So if SVM is enabled
in a CPU model or explicitly in the command-line, adjust CPUID
xlevel to expose the CPUID[0x8000000A] leaf.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Automatically set level/xlevel/xlevel2 when needed
Eduardo Habkost [Wed, 21 Sep 2016 16:30:12 +0000 (13:30 -0300)]
target-i386: Automatically set level/xlevel/xlevel2 when needed

Instead of requiring users and management software to be aware of
required CPUID level/xlevel/xlevel2 values for each feature,
automatically increase those values when features need them.

This was already done for CPUID[7].EBX, and is now made generic
for all CPUID feature flags. Unit test included, to make sure we
don't break ABI on older machine-types and don't mess with the
CPUID level values if they are explicitly set by the user.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotests: Test CPUID level handling for old machines
Eduardo Habkost [Tue, 20 Sep 2016 23:57:00 +0000 (20:57 -0300)]
tests: Test CPUID level handling for old machines

We're going to change the way level/xlevel/xlevel2 are handled
when enabling features, but we need to keep the old behavior on
existing machine types. Add test cases for that.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotests: Add test code for CPUID level/xlevel handling
Eduardo Habkost [Tue, 20 Sep 2016 20:11:39 +0000 (17:11 -0300)]
tests: Add test code for CPUID level/xlevel handling

Add test code that will check if the automatic CPUID level
changes are working as expected.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Add a marker to end of the region zeroed on reset
Eduardo Habkost [Fri, 24 Apr 2015 18:49:15 +0000 (15:49 -0300)]
target-i386: Add a marker to end of the region zeroed on reset

Instead of using cpuid_level, use an empty struct as a marker
(like we already did with {start,end}_init_save). This will avoid
accidentaly resetting the wrong fields if we change the field
ordering on CPUX86State.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agotarget-i386: Remove unused X86CPUDefinition::xlevel2 field
Eduardo Habkost [Tue, 20 Sep 2016 21:57:40 +0000 (18:57 -0300)]
target-i386: Remove unused X86CPUDefinition::xlevel2 field

No CPU model in builtin_x86_defs has xlevel2 set, so it is always
zero. Delete the field.

Note that this is not an user-visible change. It doesn't remove
the ability to set xlevel2 on the command-line, it just removes
an unused field in builtin_x86_defs.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
Peter Maydell [Tue, 27 Sep 2016 15:23:08 +0000 (16:23 +0100)]
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Tue 27 Sep 2016 11:05:56 BST
# gpg:                using RSA key 0xEF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request: (27 commits)
  imx_fec: fix error in qemu_send_packet argument
  mcf_fec: fix error in qemu_send_packet argument
  net: mcf: limit buffer descriptor count
  e1000e: Fix EIAC register implementation
  e1000e: Fix spurious RX TCP ACK interrupts
  e1000e: Fix OTHER interrupts processing for MSI-X
  e1000e: Fix PBACLR implementation
  e1000e: Fix CTRL_EXT.EIAME behavior
  e1000e: Flush receive queues on link up
  e1000e: Flush all receive queues on receive enable
  net: limit allocation in nc_sendv_compat
  tap: Allow specifying a bridge
  e1000: fix buliding complaint
  docs: Add documentation for COLO-proxy
  MAINTAINERS: add maintainer for COLO-proxy
  filter-rewriter: rewrite tcp packet to keep secondary connection
  filter-rewriter: track connection and parse packet
  filter-rewriter: introduce filter-rewriter initialization
  colo-compare: add TCP, UDP, ICMP packet comparison
  colo-compare: introduce packet comparison thread
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoreplay: allow replay stopping and restarting
Pavel Dovgalyuk [Mon, 26 Sep 2016 08:08:16 +0000 (11:08 +0300)]
replay: allow replay stopping and restarting

This patch fixes bug with stopping and restarting replay
through monitor.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20160926080815.6992.71818.stgit@PASHA-ISP>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoreplay: vmstate for replay module
Pavel Dovgalyuk [Mon, 26 Sep 2016 08:08:10 +0000 (11:08 +0300)]
replay: vmstate for replay module

This patch introduces vmstate for replay data structures.
It allows saving and loading vmstate while replaying.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20160926080810.6992.68420.stgit@PASHA-ISP>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoreplay: move internal data to the structure
Pavel Dovgalyuk [Mon, 26 Sep 2016 08:08:04 +0000 (11:08 +0300)]
replay: move internal data to the structure

This patch moves replay static variables into the structure
to allow saving and loading them with savevm/loadvm.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20160926080804.6992.87687.stgit@PASHA-ISP>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: lock-free fast path for cpu_exec_start/end
Paolo Bonzini [Wed, 31 Aug 2016 19:33:58 +0000 (21:33 +0200)]
cpus-common: lock-free fast path for cpu_exec_start/end

Set cpu->running without taking the cpu_list lock, only requiring it if
there is a concurrent exclusive section.  This requires adding a new
field to CPUState, which records whether a running CPU is being counted
in pending_cpus.

When an exclusive section is started concurrently with cpu_exec_start,
cpu_exec_start can use the new field to determine if it has to wait for
the end of the exclusive section.  Likewise, cpu_exec_end can use it to
see if start_exclusive is waiting for that CPU.

This a separate patch for easier bisection of issues.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotcg: Make tb_flush() thread safe
Sergey Fedorov [Tue, 2 Aug 2016 17:27:43 +0000 (18:27 +0100)]
tcg: Make tb_flush() thread safe

Use async_safe_run_on_cpu() to make tb_flush() thread safe.  This is
possible now that code generation does not happen in the middle of
execution.

It can happen that multiple threads schedule a safe work to flush the
translation buffer. To keep statistics and debugging output sane, always
check if the translation buffer has already been flushed.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
[AJB: minor re-base fixes]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-13-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: Introduce async_safe_run_on_cpu()
Paolo Bonzini [Sun, 28 Aug 2016 03:38:24 +0000 (05:38 +0200)]
cpus-common: Introduce async_safe_run_on_cpu()

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: simplify locking for start_exclusive/end_exclusive
Paolo Bonzini [Fri, 2 Sep 2016 21:33:38 +0000 (23:33 +0200)]
cpus-common: simplify locking for start_exclusive/end_exclusive

It is not necessary to hold qemu_cpu_list_mutex throughout the
exclusive section, because no other exclusive section can run
while pending_cpus != 0.

exclusive_idle() is called in cpu_exec_start(), and that prevents
any CPUs created after start_exclusive() from entering cpu_exec()
during an exclusive section.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: remove redundant call to exclusive_idle()
Paolo Bonzini [Fri, 2 Sep 2016 19:02:10 +0000 (21:02 +0200)]
cpus-common: remove redundant call to exclusive_idle()

No need to call exclusive_idle() from cpu_exec_end since it is done
immediately afterwards in cpu_exec_start.  Any exclusive section could
run as soon as cpu_exec_end leaves, because cpu->running is false and the
mutex is not taken, so the call does not add any protection either.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: always defer async_run_on_cpu work items
Paolo Bonzini [Wed, 31 Aug 2016 16:03:39 +0000 (18:03 +0200)]
cpus-common: always defer async_run_on_cpu work items

async_run_on_cpu is only called from the I/O thread, not from CPU threads,
so it doesn't make any difference.  It will make a difference however
for async_safe_run_on_cpu.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agodocs: include formal model for TCG exclusive sections
Paolo Bonzini [Fri, 2 Sep 2016 21:35:55 +0000 (23:35 +0200)]
docs: include formal model for TCG exclusive sections

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: move exclusive work infrastructure from linux-user
Paolo Bonzini [Wed, 31 Aug 2016 14:56:04 +0000 (16:56 +0200)]
cpus-common: move exclusive work infrastructure from linux-user

This will serve as the base for async_safe_run_on_cpu.  Because
start_exclusive uses CPU_FOREACH, merge exclusive_lock with
qemu_cpu_list_lock: together with a call to exclusive_idle (via
cpu_exec_start/end) in cpu_list_add, this protects exclusive work
against concurrent CPU addition and removal.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: fix uninitialized variable use in run_on_cpu
Paolo Bonzini [Tue, 6 Sep 2016 15:28:03 +0000 (17:28 +0200)]
cpus-common: fix uninitialized variable use in run_on_cpu

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: move CPU work item management to common code
Sergey Fedorov [Mon, 29 Aug 2016 07:51:00 +0000 (09:51 +0200)]
cpus-common: move CPU work item management to common code

Make CPU work core functions common between system and user-mode
emulation. User-mode does not use run_on_cpu, so do not implement it.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-10-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus-common: move CPU list management to common code
Paolo Bonzini [Sun, 28 Aug 2016 01:45:14 +0000 (03:45 +0200)]
cpus-common: move CPU list management to common code

Add a mutex for the CPU list to system emulation, as it will be used to
manage safe work.  Abstract manipulation of the CPU list in new functions
cpu_list_add and cpu_list_remove.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agolinux-user: Add qemu_cpu_is_self() and qemu_cpu_kick()
Sergey Fedorov [Tue, 2 Aug 2016 17:27:39 +0000 (18:27 +0100)]
linux-user: Add qemu_cpu_is_self() and qemu_cpu_kick()

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-9-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agolinux-user: Use QemuMutex and QemuCond
Sergey Fedorov [Tue, 2 Aug 2016 17:27:37 +0000 (18:27 +0100)]
linux-user: Use QemuMutex and QemuCond

Convert pthread_mutex_t and pthread_cond_t to QemuMutex and QemuCond.
This will allow to make some locks and conditional variables common
between user and system mode emulation.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-7-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus: Rename flush_queued_work()
Sergey Fedorov [Tue, 2 Aug 2016 17:27:36 +0000 (18:27 +0100)]
cpus: Rename flush_queued_work()

To avoid possible confusion, rename flush_queued_work() to
process_queued_cpu_work().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-6-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus: Move common code out of {async_, }run_on_cpu()
Sergey Fedorov [Tue, 2 Aug 2016 17:27:34 +0000 (18:27 +0100)]
cpus: Move common code out of {async_, }run_on_cpu()

Move the code common between run_on_cpu() and async_run_on_cpu() into a
new function queue_work_on_cpu().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-4-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocpus: pass CPUState to run_on_cpu helpers
Alex Bennée [Tue, 2 Aug 2016 17:27:33 +0000 (18:27 +0100)]
cpus: pass CPUState to run_on_cpu helpers

CPUState is a fairly common pointer to pass to these helpers. This means
if you need other arguments for the async_run_on_cpu case you end up
having to do a g_malloc to stuff additional data into the routine. For
the current users this isn't a massive deal but for MTTCG this gets
cumbersome when the only other parameter is often an address.

This adds the typedef run_on_cpu_func for helper functions which has an
explicit CPUState * passed as the first parameter. All the users of
run_on_cpu and async_run_on_cpu have had their helpers updated to use
CPUState where available.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
[Sergey Fedorov:
 - eliminate more CPUState in user data;
 - remove unnecessary user data passing;
 - fix target-s390x/kvm.c and target-s390x/misc_helper.c]
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au> (ppc parts)
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> (s390 parts)
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1470158864-17651-3-git-send-email-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agobuild-sys: put glib_cflags in QEMU_CFLAGS
Marc-André Lureau [Sun, 25 Sep 2016 20:57:48 +0000 (00:57 +0400)]
build-sys: put glib_cflags in QEMU_CFLAGS

This way, overriding CFLAGS on make command line keeps glib-cflags
and doesn't break the build.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20160925205748.6280-2-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agobuild-sys: remove unused GLIB_CFLAGS
Marc-André Lureau [Sun, 25 Sep 2016 20:57:47 +0000 (00:57 +0400)]
build-sys: remove unused GLIB_CFLAGS

Message-Id: <20160925205748.6280-1-marcandre.lureau@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agomigration: sync all address spaces
Paolo Bonzini [Thu, 22 Sep 2016 14:08:31 +0000 (16:08 +0200)]
migration: sync all address spaces

Migrating a VM during reboot sometimes results in differences
between the source and destination in the SMRAM area.

This is because migration_bitmap_sync() only fetches from KVM
the dirty log of address_space_memory.  SMRAM memory slots
are ignored and the modifications to SMRAM are not sent to the
destination.

Reported-by: He Rongguang <herongguang.he@huawei.com>
Reviewed-by: He Rongguang <herongguang.he@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocompiler: Swap 'public domain' header for license
Felipe Franciosi [Fri, 23 Sep 2016 15:02:51 +0000 (16:02 +0100)]
compiler: Swap 'public domain' header for license

As discussed on the list [1], having a comment stating that this file
is "public domain" is arguably wrong and not legally binding. This patch
replaces that comment with a clear GPLv2+ license as proposed in [2].

[1] http://lists.nongnu.org/archive/html/qemu-devel/2016-09/msg06151.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2016-09/msg06217.html

Worth noting, compiler.h was originally created on 5c026320 by splitting
qemu-common.h. At the time, qemu-common.h was already GPLv2+.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Message-Id: <1474642971-11866-1-git-send-email-felipe@nutanix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agocheckpatch: downgrade "architecture specific defines should be avoided"
Paolo Bonzini [Wed, 21 Sep 2016 16:49:07 +0000 (18:49 +0200)]
checkpatch: downgrade "architecture specific defines should be avoided"

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agox86: ioapic: boost default version to 0x20
Peter Xu [Fri, 23 Sep 2016 05:33:15 +0000 (13:33 +0800)]
x86: ioapic: boost default version to 0x20

It's 2.8 now, and maybe it's time to switch IOAPIC default version to
0x20.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1474608795-23058-1-git-send-email-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agointel_iommu, amd_iommu: allow UNMAP notifiers
Peter Xu [Fri, 23 Sep 2016 05:02:28 +0000 (13:02 +0800)]
intel_iommu, amd_iommu: allow UNMAP notifiers

x86 vIOMMUs still lack of a complete IOMMU notifier mechanism.
Before that is achieved, let's open a door for vhost DMAR support,
which only requires cache invalidations (UNMAP operations).

Meanwhile, convert hw_error() to error_report() and exit(1), to make
the error messages cleaner and obvious (no CPU registers will be dumped).

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1474606948-14391-4-git-send-email-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agoimx_fec: fix error in qemu_send_packet argument
Paolo Bonzini [Thu, 22 Sep 2016 14:28:30 +0000 (16:28 +0200)]
imx_fec: fix error in qemu_send_packet argument

This uses the wrong frame size for packets composed of multiple
descriptors.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
7 years agomcf_fec: fix error in qemu_send_packet argument
Paolo Bonzini [Thu, 22 Sep 2016 14:28:29 +0000 (16:28 +0200)]
mcf_fec: fix error in qemu_send_packet argument

This uses the wrong frame size for packets composed of multiple
descriptors.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
7 years agonet: mcf: limit buffer descriptor count
Prasad J Pandit [Thu, 22 Sep 2016 10:32:37 +0000 (16:02 +0530)]
net: mcf: limit buffer descriptor count

ColdFire Fast Ethernet Controller uses buffer descriptors to manage
data flow to/fro receive & transmit queues. While transmitting
packets, it could continue to read buffer descriptors if a buffer
descriptor has length of zero and has crafted values in bd.flags.
Set upper limit to number of buffer descriptors.

Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
7 years agoe1000e: Fix EIAC register implementation
Dmitry Fleytman [Thu, 15 Sep 2016 06:14:30 +0000 (09:14 +0300)]
e1000e: Fix EIAC register implementation

This patch fixes 2 issues:

1. Bits set in EIAC register should be cleared
   from IMS when EIAM is not used.
2. Only bit that corresonds to the interrupt being
   raised should be cleared.

See spec. 10.2.4.7 Interrupt Auto Clear

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
7 years agoe1000e: Fix spurious RX TCP ACK interrupts
Dmitry Fleytman [Thu, 15 Sep 2016 06:14:29 +0000 (09:14 +0300)]
e1000e: Fix spurious RX TCP ACK interrupts

Do not raise ACK interrupts when
RFCTL.ACKDIS bit is set (see spec. 10.2.5.16).

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
7 years agoe1000e: Fix OTHER interrupts processing for MSI-X
Dmitry Fleytman [Thu, 15 Sep 2016 06:14:28 +0000 (09:14 +0300)]
e1000e: Fix OTHER interrupts processing for MSI-X

Interrupt mask for legacy OTHER causes should
not apply to MSI-X OTHER cause.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>