sdk/emulator/qemu.git
9 years agotcg: Merge memop and mmu_idx parameters to qemu_ld/st
Richard Henderson [Tue, 12 May 2015 18:51:44 +0000 (11:51 -0700)]
tcg: Merge memop and mmu_idx parameters to qemu_ld/st

At the tcg opcode level, not at the tcg-op.h generator level.
This requires minor changes through all of the tcg backends,
but none of the cpu translators.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
9 years agoMerge remote-tracking branch 'remotes/agraf/tags/signed-s390-for-upstream' into staging
Peter Maydell [Wed, 13 May 2015 15:06:07 +0000 (16:06 +0100)]
Merge remote-tracking branch 'remotes/agraf/tags/signed-s390-for-upstream' into staging

Patch queue for s390 - 2015-05-13

A few TCG fixes for the s390x target. Nothing special, but with these
applied I can run most of the SLE12 binaries in Linux-user emulation.

# gpg: Signature made Wed May 13 13:49:25 2015 BST using RSA key ID 03FEDC60
# gpg: Good signature from "Alexander Graf <agraf@suse.de>"
# gpg:                 aka "Alexander Graf <alex@csgraf.de>"

* remotes/agraf/tags/signed-s390-for-upstream:
  s390x: Add interlocked access facility 1 instructions
  s390x: Add some documentation in opcode list
  s390x: Fix stoc direction

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/jnsnow/tags/ide-cve-pull-request' into staging
Peter Maydell [Wed, 13 May 2015 12:57:44 +0000 (13:57 +0100)]
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-cve-pull-request' into staging

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

* remotes/jnsnow/tags/ide-cve-pull-request:
  fdc: force the fifo access to be in bounds of the allocated buffer

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agos390x: Add interlocked access facility 1 instructions
Alexander Graf [Fri, 8 May 2015 01:07:53 +0000 (03:07 +0200)]
s390x: Add interlocked access facility 1 instructions

We're currently missing all instructions defined by the "interlocked-access
facility 1" which is part of zEC12. This patch implements all of them except
for LPD and LPDG.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agos390x: Add some documentation in opcode list
Alexander Graf [Fri, 8 May 2015 01:06:41 +0000 (03:06 +0200)]
s390x: Add some documentation in opcode list

I find it really hard to grasp what each field in the opcode list means.
Slowly walking through its semantics myself, I figured I'd write a small
summary at the top of the file to make life easier for me and whoever
looks at the file next.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agos390x: Fix stoc direction
Alexander Graf [Wed, 15 Apr 2015 01:45:41 +0000 (03:45 +0200)]
s390x: Fix stoc direction

The store conditional instruction wants to store when the condition
is fulfilled, so we should branch out when it's not true.

The code today branches out when the condition is true, clearly
reversing the logic. Fix it up by negating the condition.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
9 years agofdc: force the fifo access to be in bounds of the allocated buffer
Petr Matousek [Wed, 6 May 2015 07:48:59 +0000 (09:48 +0200)]
fdc: force the fifo access to be in bounds of the allocated buffer

During processing of certain commands such as FD_CMD_READ_ID and
FD_CMD_DRIVE_SPECIFICATION_COMMAND the fifo memory access could
get out of bounds leading to memory corruption with values coming
from the guest.

Fix this by making sure that the index is always bounded by the
allocated memory.

This is CVE-2015-3456.

Signed-off-by: Petr Matousek <pmatouse@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150512' into...
Peter Maydell [Tue, 12 May 2015 11:11:32 +0000 (12:11 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20150512' into staging

target-arm queue:
 * Support TZ and grouping in the GIC
 * hw/sd: sd_reset cleanup
 * armv7m_nvic: fix bug in systick device

# gpg: Signature made Tue May 12 12:02:26 2015 BST using RSA key ID 14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"

* remotes/pmaydell/tags/pull-target-arm-20150512:
  hw/arm/highbank.c: Wire FIQ between CPU <> GIC
  hw/arm/vexpress.c: Wire FIQ between CPU <> GIC
  hw/arm/virt.c: Wire FIQ between CPU <> GIC
  hw/intc/arm_gic: Add grouping support to gic_update()
  hw/intc/arm_gic: Change behavior of IAR writes
  hw/intc/arm_gic: Change behavior of EOIR writes
  hw/intc/arm_gic: Handle grouping for GICC_HPPIR
  hw/intc/arm_gic: Restrict priority view
  hw/intc/arm_gic: Implement Non-secure view of RPR
  hw/intc/arm_gic: Make ICCICR/GICC_CTLR banked
  hw/intc/arm_gic: Make ICCBPR/GICC_BPR banked
  hw/intc/arm_gic: Make ICDDCR/GICD_CTLR banked
  hw/intc/arm_gic_kvm.c: Save and restore GICD_IGROUPRn state
  hw/intc/arm_gic: Add Interrupt Group Registers
  hw/intc/arm_gic: Switch to read/write callbacks with tx attributes
  hw/intc/arm_gic: Add Security Extensions property
  hw/intc/arm_gic: Create outbound FIQ lines
  hw/sd: Don't pass BlockBackend to sd_reset()
  armv7m_nvic: systick: Reload the RELOAD value and count down only if ENABLE bit is set

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/highbank.c: Wire FIQ between CPU <> GIC
Peter Maydell [Tue, 12 May 2015 10:57:19 +0000 (11:57 +0100)]
hw/arm/highbank.c: Wire FIQ between CPU <> GIC

Connect FIQ output of the GIC CPU interfaces to the CPUs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-18-git-send-email-peter.maydell@linaro.org

9 years agohw/arm/vexpress.c: Wire FIQ between CPU <> GIC
Fabian Aggeler [Tue, 12 May 2015 10:57:18 +0000 (11:57 +0100)]
hw/arm/vexpress.c: Wire FIQ between CPU <> GIC

Connect FIQ output of the GIC CPU interfaces to the CPUs.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-17-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-3-git-send-email-greg.bellows@linaro.org
[PMM: minor format tweak]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/arm/virt.c: Wire FIQ between CPU <> GIC
Greg Bellows [Tue, 12 May 2015 10:57:18 +0000 (11:57 +0100)]
hw/arm/virt.c: Wire FIQ between CPU <> GIC

Connect FIQ output of the GIC CPU interfaces to the CPUs.

Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-16-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-4-git-send-email-greg.bellows@linaro.org
[PMM: minor format tweak]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Add grouping support to gic_update()
Peter Maydell [Tue, 12 May 2015 10:57:18 +0000 (11:57 +0100)]
hw/intc/arm_gic: Add grouping support to gic_update()

Add support to gic_update() for determining the current IRQ
and FIQ status when interrupt grouping is supported. This
simply requires that instead of always raising IRQ we
check the group of the highest priority pending interrupt
and the GICC_CTLR.FIQEn bit to see whether we should raise
IRQ or FIQ.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1430502643-25909-15-git-send-email-peter.maydell@linaro.org

9 years agohw/intc/arm_gic: Change behavior of IAR writes
Fabian Aggeler [Tue, 12 May 2015 10:57:18 +0000 (11:57 +0100)]
hw/intc/arm_gic: Change behavior of IAR writes

Grouping (GICv2) and Security Extensions change the behavior of IAR
reads. Acknowledging Group0 interrupts is only allowed from Secure
state and acknowledging Group1 interrupts from Secure state is only
allowed if AckCtl bit is set.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-14-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-14-git-send-email-greg.bellows@linaro.org
[PMM: simplify significantly by reusing the existing
 gic_get_current_pending_irq() rather than reimplementing the
 same logic here]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Change behavior of EOIR writes
Fabian Aggeler [Tue, 12 May 2015 10:57:18 +0000 (11:57 +0100)]
hw/intc/arm_gic: Change behavior of EOIR writes

Grouping (GICv2) and Security Extensions change the behavior of EOIR
writes. Completing Group0 interrupts is only allowed from Secure state.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-13-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-13-git-send-email-greg.bellows@linaro.org
[PMM: Rather than go to great lengths to ignore the UNPREDICTABLE case
 of a Secure EOI of a Group1 (NS) irq with AckCtl == 0, we just let
 it fall through; add a comment about it.]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Handle grouping for GICC_HPPIR
Fabian Aggeler [Tue, 12 May 2015 10:57:18 +0000 (11:57 +0100)]
hw/intc/arm_gic: Handle grouping for GICC_HPPIR

Grouping (GICv2) and Security Extensions change the behaviour of reads
of the highest priority pending interrupt register (ICCHPIR/GICC_HPPIR).

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-12-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-12-git-send-email-greg.bellows@linaro.org
[PMM: make utility fn static; coding style fixes; AckCtl has an effect
 for GICv2 without security extensions as well; removed checks on enable
 bits because these are done when we set current_pending[cpu]]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Restrict priority view
Fabian Aggeler [Tue, 12 May 2015 10:57:17 +0000 (11:57 +0100)]
hw/intc/arm_gic: Restrict priority view

GICs with Security Extensions restrict the non-secure view of the
interrupt priority and priority mask registers.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-11-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-15-git-send-email-greg.bellows@linaro.org
[PMM: minor code tweaks; fixed missing masking in gic_set_priority_mask
and gic_set_priority]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Implement Non-secure view of RPR
Fabian Aggeler [Tue, 12 May 2015 10:57:17 +0000 (11:57 +0100)]
hw/intc/arm_gic: Implement Non-secure view of RPR

For GICs with Security Extensions Non-secure reads have a restricted
view on the current running priority.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-10-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-11-git-send-email-greg.bellows@linaro.org
[PMM: make function static, minor comment tweak]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Make ICCICR/GICC_CTLR banked
Fabian Aggeler [Tue, 12 May 2015 10:57:17 +0000 (11:57 +0100)]
hw/intc/arm_gic: Make ICCICR/GICC_CTLR banked

ICCICR/GICC_CTLR is banked in GICv1 implementations with Security
Extensions or in GICv2 in independent from Security Extensions.
This makes it possible to enable forwarding of interrupts from
the CPU interfaces to the connected processors for Group0 and Group1.

We also allow to set additional bits like AckCtl and FIQEn by changing
the type from bool to uint32. Since the field does not only store the
enable bit anymore and since we are touching the vmstate, we use the
opportunity to rename the field to cpu_ctlr.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-9-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-9-git-send-email-greg.bellows@linaro.org
[PMM: rewrote to store state in a single uint32_t rather than
 keeping the NS and S banked variants separate; this considerably
 simplifies the get/set functions]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Make ICCBPR/GICC_BPR banked
Fabian Aggeler [Tue, 12 May 2015 10:57:17 +0000 (11:57 +0100)]
hw/intc/arm_gic: Make ICCBPR/GICC_BPR banked

This register is banked in GICs with Security Extensions. Storing the
non-secure copy of BPR in the abpr, which is an alias to the non-secure
copy for secure access. ABPR itself is only accessible from secure state
if the GIC implements Security Extensions.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-8-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-10-git-send-email-greg.bellows@linaro.org
[PMM: rewrote to fix style issues and correct handling of GICv2
 without security extensions]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Make ICDDCR/GICD_CTLR banked
Fabian Aggeler [Tue, 12 May 2015 10:57:17 +0000 (11:57 +0100)]
hw/intc/arm_gic: Make ICDDCR/GICD_CTLR banked

ICDDCR/GICD_CTLR is banked if the GIC has the security extensions,
and the S (or only) copy has separate enable bits for Group0 and
Group1 enable if the GIC implements interrupt groups.

EnableGroup0 (Bit [1]) in GICv1 is architecturally IMPDEF. Since this
bit (Enable Non-secure) is present in the integrated GIC of the Cortex-A9
MPCore, we support this bit in our GICv1 implementation too.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-7-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-8-git-send-email-greg.bellows@linaro.org
[PMM: rewritten to store the state in a single s->ctlr uint32,
 with the NS register handled as an alias of bit 1 in that value;
 added vmstate version bump]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic_kvm.c: Save and restore GICD_IGROUPRn state
Peter Maydell [Tue, 12 May 2015 10:57:17 +0000 (11:57 +0100)]
hw/intc/arm_gic_kvm.c: Save and restore GICD_IGROUPRn state

Now that the GIC base class has state fields for the GICD_IGROUPRn
registers, make kvm_arm_gic_get() and kvm_arm_gic_put() write and
read them. This allows us to remove the check that made us
fail migration if the guest had set any of the group register bits.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-6-git-send-email-peter.maydell@linaro.org

9 years agohw/intc/arm_gic: Add Interrupt Group Registers
Fabian Aggeler [Tue, 12 May 2015 10:57:17 +0000 (11:57 +0100)]
hw/intc/arm_gic: Add Interrupt Group Registers

The Interrupt Group Registers allow the guest to configure interrupts
into one of two groups, where Group0 are higher priority and may
be routed to IRQ or FIQ, and Group1 are lower priority and always
routed to IRQ. (In a GIC with the security extensions Group0 is
Secure interrupts and Group 1 is NonSecure.)
The GICv2 always supports interrupt grouping; the GICv1 does only
if it implements the security extensions.

This patch implements the ability to read and write the registers;
the actual functionality the bits control will be added in a
subsequent patch.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-5-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-7-git-send-email-greg.bellows@linaro.org
[PMM: bring GIC_*_GROUP macros into line with the others, ie a
 simple SET/CLEAR/TEST rather than GROUP0/GROUP1;
 utility gic_has_groups() function;
 minor style fixes;
 bump vmstate version]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Switch to read/write callbacks with tx attributes
Peter Maydell [Tue, 12 May 2015 10:57:16 +0000 (11:57 +0100)]
hw/intc/arm_gic: Switch to read/write callbacks with tx attributes

Switch the GIC's MMIO callback functions to the read_with_attrs
and write_with_attrs functions which provide MemTxAttrs. This will
allow the GIC to correctly handle secure and nonsecure register
accesses.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1430502643-25909-4-git-send-email-peter.maydell@linaro.org

9 years agohw/intc/arm_gic: Add Security Extensions property
Fabian Aggeler [Tue, 12 May 2015 10:57:16 +0000 (11:57 +0100)]
hw/intc/arm_gic: Add Security Extensions property

Add a QOM property which allows the GIC Security Extensions to be
enabled. These are an optional part of the GICv1 and GICv2 architecture.
This commit just adds the property and some sanity checks that it
is only enabled on GIC revisions that support it.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-3-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-5-git-send-email-greg.bellows@linaro.org
[PMM: changed property name, added checks that it isn't set for
 older GIC revisions or if using the KVM VGIC; reworded commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/intc/arm_gic: Create outbound FIQ lines
Fabian Aggeler [Tue, 12 May 2015 10:57:16 +0000 (11:57 +0100)]
hw/intc/arm_gic: Create outbound FIQ lines

Create the outbound FIQ lines from the GIC to the CPUs; these are
used if the GIC has security extensions or grouping support.

Signed-off-by: Fabian Aggeler <aggelerf@ethz.ch>
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1430502643-25909-2-git-send-email-peter.maydell@linaro.org
Message-id: 1429113742-8371-2-git-send-email-greg.bellows@linaro.org
[PMM: added FIQ lines to kvm-arm-gic so its interface is the same;
tweaked commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/sd: Don't pass BlockBackend to sd_reset()
Peter Maydell [Tue, 12 May 2015 10:57:16 +0000 (11:57 +0100)]
hw/sd: Don't pass BlockBackend to sd_reset()

The only valid BlockBackend to pass to sd_reset() is the one for
the SD card, which is sd->blk. Drop the second argument from this
function in favour of having it just use sd->blk.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1430683444-9797-1-git-send-email-peter.maydell@linaro.org

9 years agoarmv7m_nvic: systick: Reload the RELOAD value and count down only if ENABLE bit is set
Adrian Huang [Tue, 12 May 2015 10:57:16 +0000 (11:57 +0100)]
armv7m_nvic: systick: Reload the RELOAD value and count down only if ENABLE bit is set

Consider the following pseudo code to configure SYSTICK (The
recommended programming sequence from "the definitive guide to the
arm cortex-m3"):
    SYSTICK Reload Value Register = 0xffff
    SYSTICK Current Value Register = 0
    SYSTICK Control and Status Register = 0x7

The pseudo code "SYSTICK Current Value Register = 0" leads to invoking
systick_reload(). As a consequence, the systick.tick member is updated
and the systick timer starts to count down when the ENABLE bit of
SYSTICK Control and Status Register is cleared.

The worst case is that: during the system initialization, the reset
value of the SYSTICK Control and Status Register is 0x00000000.
When the code "SYSTICK Current Value Register = 0" is executed, the
systick.tick member is accumulated with "(s->systick.reload + 1) *
systick_scale(s)". The systick_scale() gets the external_ref_clock
scale because the CLKSOURCE bit of the SYSTICK Control and Status
Register is cleared. This is the incorrect behavior because of the
code "SYSTICK Control and Status Register = 0x7". Actually, we want
the processor clock instead of the external reference clock.

This incorrect behavior defers the generation of the first interrupt.

The patch fixes the above-mentioned issue by setting the systick.tick
member and modifying the systick timer only if the ENABLE bit of
the SYSTICK Control and Status Register is set.

In addition, the Cortex-M3 Devices Generic User Guide mentioned that
"When ENABLE is set to 1, the counter loads the RELOAD value from the
SYST RVR register and then counts down". This patch adheres to the
statement of the user guide.

Signed-off-by: Adrian Huang <adrianhuang0701@gmail.com>
Reviewed-by: Jim Huang <jserv.tw@gmail.com>
[PMM: minor tweak to comment text]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging
Peter Maydell [Tue, 12 May 2015 09:40:31 +0000 (10:40 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging

# gpg: Signature made Mon May 11 16:25:58 2015 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/net-pull-request:
  rocker: timestamp on the debug logs helps correlate with events in the VM
  MAINTAINERS: add rocker
  rocker: add tests
  rocker: add new rocker switch device
  pci: add network device class 'other' for network switches
  pci: add rocker device ID
  rocker: add register programming guide
  virtio-net: use qemu_mac_strdup_printf
  net: add MAC address string printer

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging
Peter Maydell [Tue, 12 May 2015 08:01:51 +0000 (09:01 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into staging

QMP pull request

# gpg: Signature made Mon May 11 14:15:19 2015 BST using RSA key ID E24ED5A7
# gpg: Good signature from "Luiz Capitulino <lcapitulino@gmail.com>"

* remotes/qmp-unstable/tags/for-upstream:
  scripts: qmp-shell: Add verbose flag
  scripts: qmp-shell: add transaction subshell
  scripts: qmp-shell: Expand support for QMP expressions
  scripts: qmp-shell: refactor helpers
  MAINTAINERS: New maintainer for QMP and QAPI
  json-parser: Accept 'null' in QMP
  qobject: Add a special null QObject
  qobject: Clean up around qtype_code
  QJSON: Use OBJECT_CHECK

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Mon, 11 May 2015 15:21:50 +0000 (16:21 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc, virtio enhancements

Memory hot-unplug support for pc, MSI-X
mapping update speedup for virtio-pci,
misc refactorings and bugfixes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon May 11 08:23:43 2015 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (28 commits)
  acpi: update expected files for memory unplug
  virtio-scsi: Move DEFINE_VIRTIO_SCSI_FEATURES to virtio-scsi
  virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net
  pci: Merge pci_nic_init() into pci_nic_init_nofail()
  acpi: add a missing backslash to the \_SB scope.
  qmp-event: add event notification for memory hot unplug error
  acpi: add hardware implementation for memory hot unplug
  acpi: fix "Memory device control fields" register
  acpi: extend aml_field() to support UpdateRule
  acpi, mem-hotplug: add unplug cb for memory device
  acpi, mem-hotplug: add unplug request cb for memory device
  acpi, mem-hotplug: add acpi_memory_slot_status() to get MemStatus
  docs: update documentation for memory hot unplug
  virtio: coding style tweak
  pci: remove hard-coded bar size in msix_init_exclusive_bar()
  virtio-pci: speedup MSI-X masking and unmasking
  virtio: introduce vector to virtqueues mapping
  virtio-ccw: using VIRTIO_NO_VECTOR instead of 0 for invalid virtqueue
  monitor: check return value of qemu_find_net_clients_except()
  monitor: replace the magic number 255 with MAX_QUEUE_NUM
  ...

Conflicts:
hw/s390x/s390-virtio-bus.c

[PMM: fixed conflict in s390_virtio_scsi_properties and
s390_virtio_net_properties arrays; since the result of the
two conflicting patches is to empty the property arrays
completely, the conflict resolution is to remove them entirely.]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150511' into...
Peter Maydell [Mon, 11 May 2015 14:07:12 +0000 (15:07 +0100)]
Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150511' into staging

TriCore bugfixes

# gpg: Signature made Mon May 11 13:26:40 2015 BST using RSA key ID 6B69CA14
# gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>"

* remotes/bkoppelmann/tags/pull-tricore-20150511:
  target-tricore: fix rfe not restoring the PC
  target-tricore: fix rslcx restoring the upper context instead of the lower
  target-tricore: fix BO_OFF10_SEXT calculating the wrong offset
  target-tricore: fix SLR_LD_W and SLR_LD_W_POSTINC insn being a 2 byte memory access insted of 4
  target-tricore: Fix LOOP using wrong register for compare

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agorocker: timestamp on the debug logs helps correlate with events in the VM
David Ahern [Sat, 14 Mar 2015 04:09:33 +0000 (21:09 -0700)]
rocker: timestamp on the debug logs helps correlate with events in the VM

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Message-id: 1426306173-24884-10-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoMAINTAINERS: add rocker
Scott Feldman [Sat, 14 Mar 2015 04:09:32 +0000 (21:09 -0700)]
MAINTAINERS: add rocker

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Message-id: 1426306173-24884-9-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agorocker: add tests
Scott Feldman [Sat, 14 Mar 2015 04:09:31 +0000 (21:09 -0700)]
rocker: add tests

Add some basic test for rocker to test L2/L3/L4 functionality.  Requires an
external test environment, simp, located here:

https://github.com/scottfeldman/simp

To run tests, simp environment must be installed and a suitable VM image built
and installed with a Linux 3.18 (or greater) kernel with rocker driver support
enabled.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Message-id: 1426306173-24884-8-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agorocker: add new rocker switch device
Scott Feldman [Sat, 14 Mar 2015 04:09:30 +0000 (21:09 -0700)]
rocker: add new rocker switch device

Rocker is a simulated ethernet switch device.  The device supports up to 62
front-panel ports and supports L2 switching and L3 routing functions, as well
as L2/L3/L4 ACLs.  The device presents a single PCI device for each switch,
with a memory-mapped register space for device driver access.

Rocker device is invoked with -device, for example a 4-port switch:

  -device rocker,name=sw1,len-ports=4,ports[0]=dev0,ports[1]=dev1, \
         ports[2]=dev2,ports[3]=dev3

Each port is a netdev and can be paired with using -netdev id=<port name>.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David Ahern <dsahern@gmail.com>
Message-id: 1426306173-24884-7-git-send-email-sfeldma@gmail.com

rocker: fix clang compiler errors

Consolidate all forward typedef declarations to rocker.h.

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
rocker: add support for flow modification

We had support for flow add/del.  This adds support for flow mod.  I needed
this for L3 support where an existing route is modified using NLM_F_REPLACE.
For example:

  ip route add 12.0.0.0/30 nexthop via 11.0.0.1 dev swp1
  ip route change 12.0.0.0/30 nexthop via 11.0.0.9 dev swp2

The first cmd adds the route.  The second cmd changes the existing route by
changing its nexthop info.

In the device, a mod operation results in the matching flow enty being modified
with the new settings.  This is atomic to the device.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agopci: add network device class 'other' for network switches
Scott Feldman [Sat, 14 Mar 2015 04:09:29 +0000 (21:09 -0700)]
pci: add network device class 'other' for network switches

Rocker is an ethernet switch device, so add 'other' network device class as
defined by PCI to cover these types of devices.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Message-id: 1426306173-24884-6-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agopci: add rocker device ID
Scott Feldman [Sat, 14 Mar 2015 04:09:28 +0000 (21:09 -0700)]
pci: add rocker device ID

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Message-id: 1426306173-24884-5-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agorocker: add register programming guide
Scott Feldman [Sat, 14 Mar 2015 04:09:27 +0000 (21:09 -0700)]
rocker: add register programming guide

This is the register programming guide for the Rocker device.  It's intended
for driver writers and device writers.  It covers the device's PCI space,
the register set, DMA interface, and interrupts.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Message-id: 1426306173-24884-4-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agovirtio-net: use qemu_mac_strdup_printf
Scott Feldman [Sat, 14 Mar 2015 04:09:26 +0000 (21:09 -0700)]
virtio-net: use qemu_mac_strdup_printf

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1426306173-24884-3-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agonet: add MAC address string printer
Scott Feldman [Sat, 14 Mar 2015 04:09:25 +0000 (21:09 -0700)]
net: add MAC address string printer

We can use this in virtio-net code as well as new Rocker driver code, so
up-level this.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1426306173-24884-2-git-send-email-sfeldma@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 years agoscripts: qmp-shell: Add verbose flag
John Snow [Wed, 29 Apr 2015 19:14:04 +0000 (15:14 -0400)]
scripts: qmp-shell: Add verbose flag

Add a verbose flag that shows the QMP command that was
constructed, to allow for later copy/pasting, reference,
debugging, etc.

The QMP is converted from a Python literal to JSON first,
to ensure that it is viable input to the actual QMP parser.

As a side-effect, this JSON output will helpfully show all
the necessary conversions that were performed on the input,
illustrating that "True" was transformed back into "true",
literal values are now escaped with "" instead of '', and so on.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoscripts: qmp-shell: add transaction subshell
John Snow [Wed, 29 Apr 2015 19:14:03 +0000 (15:14 -0400)]
scripts: qmp-shell: add transaction subshell

Add a special processing mode to craft transactions.

By entering "transaction(" the shell will enter a special
mode where each subsequent command will be saved as a transaction
instead of executed as an individual command.

The transaction can be submitted by entering ")" on a line by itself.

Examples:

Separate lines:

(QEMU) transaction(
TRANS> block-dirty-bitmap-add node=drive0 name=bitmap1
TRANS> block-dirty-bitmap-clear node=drive0 name=bitmap0
TRANS> )

With a transaction action included on the first line:

(QEMU) transaction( block-dirty-bitmap-add node=drive0 name=bitmap2
TRANS> block-dirty-bitmap-add node=drive0 name=bitmap3
TRANS> )

As a one-liner, with just one transaction action:

(QEMU) transaction( block-dirty-bitmap-add node=drive0 name=bitmap0 )

As a side-effect of this patch, blank lines are now parsed as no-ops,
regardless of which shell mode you are in.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoscripts: qmp-shell: Expand support for QMP expressions
John Snow [Wed, 29 Apr 2015 19:14:02 +0000 (15:14 -0400)]
scripts: qmp-shell: Expand support for QMP expressions

This includes support for [] expressions, single-quotes in
QMP expressions (which is not strictly a part of JSON), and
the ability to use "True", "False" and "None" literals instead
of JSON's equivalent true, false, and null literals.

qmp-shell currently allows you to describe values as
JSON expressions:
key={"key":{"key2":"val"}}

But it does not currently support arrays, which are needed
for serializing and deserializing transactions:
key=[{"type":"drive-backup","data":{...}}]

qmp-shell also only currently accepts doubly quoted strings
as-per JSON spec, but QMP allows single quotes.

Lastly, python allows you to utilize "True" or "False" as
boolean literals, but JSON expects "true" or "false". Expand
qmp-shell to allow the user to type either, converting to the
correct type.

As a consequence of the above, the key=val parsing is also improved
to give better error messages if a key=val token is not provided.

CAVEAT: The parser is still extremely rudimentary and does not
expect to find spaces in {} nor [] expressions. This patch does
not improve this functionality.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoscripts: qmp-shell: refactor helpers
John Snow [Wed, 29 Apr 2015 19:14:01 +0000 (15:14 -0400)]
scripts: qmp-shell: refactor helpers

Refactor the qmp-shell command line processing function
into two components. This will be used to allow sub-expressions,
which will assist us in adding transactional support to qmp-shell.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoMAINTAINERS: New maintainer for QMP and QAPI
Luiz Capitulino [Tue, 5 May 2015 14:39:15 +0000 (10:39 -0400)]
MAINTAINERS: New maintainer for QMP and QAPI

Markus is taking over maintership of QMP and the QAPI from
me. Markus has always been a great reviewer and contributor
to those subsystems. In the last few months he's also doing
pull requests that are a lot more relevant than the ones I
was able to do. So, this is a natural move.

I'm still the maintainer of HMP and QObjects, but I'm
looking for someone to take over those too.

PS: This commit also fixes the file listing for the QMP
    entry.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9 years agojson-parser: Accept 'null' in QMP
Eric Blake [Wed, 29 Apr 2015 21:35:06 +0000 (15:35 -0600)]
json-parser: Accept 'null' in QMP

We document that in QMP, the client may send any json-value
for the optional "id" key, and then return that same value
on reply (both success and failures, insofar as the failure
happened after parsing the id).  [Note that the output may
not be identical to the input, as whitespace may change and
since we may reorder keys within a json-object, but that this
still constitutes the same json-value].  However, we were not
handling the JSON literal null, which counts as a json-value
per RFC 7159.

Also, down the road, given the QAPI schema of {'*foo':'str'} or
{'*foo':'ComplexType'}, we could decide to allow the QMP client
to pass { "foo":null } instead of the current representation of
{ } where omitting the key is the only way to get at the default
NULL value.  Such a change might be useful for argument
introspection (if a type in older qemu lacks 'foo' altogether,
then an explicit "foo":null probe will force an easily
distinguished error message for whether the optional "foo" key
is even understood in newer qemu).  And if we add default values
to optional arguments, allowing an explicit null would be
required for getting a NULL value associated with an optional
string that has a non-null default.  But all that can come at a
later day.

The 'check-unit' testsuite is enhanced to test that parsing
produces the same object as explicitly requesting a reference
to the special qnull object.  In addition, I tested with:

$ ./x86_64-softmmu/qemu-system-x86_64 -qmp stdio -nodefaults
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 2, "major": 2}, "package": ""}, "capabilities": []}}
{"execute":"qmp_capabilities","id":null}
{"return": {}, "id": null}
{"id":{"a":null,"b":[1,null]},"execute":"quit"}
{"return": {}, "id": {"a": null, "b": [1, null]}}
{"timestamp": {"seconds": 1427742379, "microseconds": 423128}, "event": "SHUTDOWN"}

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqobject: Add a special null QObject
Markus Armbruster [Wed, 29 Apr 2015 21:35:05 +0000 (15:35 -0600)]
qobject: Add a special null QObject

I'm going to fix the JSON parser to recognize null.  The obvious
representation of JSON null as (QObject *)NULL doesn't work, because
the parser already uses it as an error value.  Perhaps we should
change it to free NULL for null, but that's more than I can do right
now.  Create a special null QObject instead.

The existing QDict, QList, and QString all represent something that
is a pointer in C and could therefore be associated with NULL.  But
right now, all three of these sub-types are always non-null once
created, so the new null sentinel object is intentionally unrelated
to them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoqobject: Clean up around qtype_code
Markus Armbruster [Wed, 29 Apr 2015 21:35:04 +0000 (15:35 -0600)]
qobject: Clean up around qtype_code

QTYPE_NONE is a sentinel value.  No QObject has this type code.
Document it properly.

Fix dump_qobject() to abort() on QTYPE_NONE, just like for any other
invalid type code.

Fix to_json() to abort() on all invalid type codes, not just
QTYPE_MAX.

Clean up Property member qtype's type: it's a qtype_code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoQJSON: Use OBJECT_CHECK
Eduardo Habkost [Sat, 25 Apr 2015 15:28:06 +0000 (12:28 -0300)]
QJSON: Use OBJECT_CHECK

The QJSON code used casts to (QJSON*) directly, instead of OBJECT_CHECK.
There were even some functions using object_dynamic_cast() calls
followed by assert(), which is exactly what OBJECT_CHECK does (by
calling object_dynamic_cast_assert()).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-05-09' into...
Peter Maydell [Mon, 11 May 2015 12:54:00 +0000 (13:54 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2015-05-09' into staging

trivial patches for 2015-05-09

# gpg: Signature made Fri May  8 22:58:42 2015 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"

* remotes/mjt/tags/pull-trivial-patches-2015-05-09:
  docs: update BLOCK_IMAGE_CORRUPTED documentation
  glib-compat.h: change assert to g_assert
  Remove various unused functions
  sheepdog: fix resource leak with sd_snapshot_create
  xhci: remove unused code

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-tricore: fix rfe not restoring the PC
Bastian Koppelmann [Tue, 5 May 2015 17:41:10 +0000 (19:41 +0200)]
target-tricore: fix rfe not restoring the PC

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: fix rslcx restoring the upper context instead of the lower
Bastian Koppelmann [Tue, 5 May 2015 17:39:18 +0000 (19:39 +0200)]
target-tricore: fix rslcx restoring the upper context instead of the lower

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: fix BO_OFF10_SEXT calculating the wrong offset
Bastian Koppelmann [Tue, 5 May 2015 17:36:55 +0000 (19:36 +0200)]
target-tricore: fix BO_OFF10_SEXT calculating the wrong offset

The lower part of the combined offset was sign extended and could lead to
wrong results.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: fix SLR_LD_W and SLR_LD_W_POSTINC insn being a 2 byte memory access...
Bastian Koppelmann [Fri, 3 Apr 2015 12:29:22 +0000 (14:29 +0200)]
target-tricore: fix SLR_LD_W and SLR_LD_W_POSTINC insn being a 2 byte memory access insted of 4

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agotarget-tricore: Fix LOOP using wrong register for compare
Bastian Koppelmann [Tue, 9 Dec 2014 16:04:46 +0000 (16:04 +0000)]
target-tricore: Fix LOOP using wrong register for compare

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
9 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Mon, 11 May 2015 11:01:09 +0000 (12:01 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

- build bugfix from Fam and new configure check from Emilio
- two improvements to "info mtere" from Gerd
- KVM support for memory transaction attributes
- one more small step towards unlocked MMIO dispatch
- one piece of the qemu-nbd errno fixes
- trivial-ish patches from Denis and Thomas

# gpg: Signature made Fri May  8 13:47:29 2015 BST using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@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: 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:
  qemu-nbd: only send a limited number of errno codes on the wire
  rules.mak: Force CFLAGS for all objects in DSO
  configure: require __thread support
  exec: move rcu_read_lock/unlock to address_space_translate callers
  kvm: add support for memory transaction attributes
  mtree: also print disabled regions
  mtree: tag & indent a bit better
  apic_common: improve readability of apic_reset_common
  kvm: Silence warning from valgrind

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150508-1' into staging
Peter Maydell [Mon, 11 May 2015 09:43:08 +0000 (10:43 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150508-1' into staging

gtk: add ui_info support, cleanups + fixes.

# gpg: Signature made Fri May  8 12:47:04 2015 BST using RSA key ID D3E87138
# 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>"

* remotes/kraxel/tags/pull-gtk-20150508-1:
  gtk: update mouse position in mouse_set()
  gtk: create gtk.h
  gtk: add ui_info support
  console: add dpy_ui_info_supported
  console: delayed ui_info guest notification

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20150508-1' into staging
Peter Maydell [Mon, 11 May 2015 08:42:20 +0000 (09:42 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20150508-1' into staging

usb: qomify, bugfixes for xhci & uhci.

# gpg: Signature made Fri May  8 12:39:28 2015 BST using RSA key ID D3E87138
# 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>"

* remotes/kraxel/tags/pull-usb-20150508-1:
  uhci: controller is halted after reset
  usb: usb-serial QOMify
  usb: usb-redir QOMify
  usb: usb-wacom-tablet QOMify
  usb: usb-uas QOMify
  usb: usb-storage QOMify
  usb: usb-ccid QOMify
  usb: usb-net QOMify
  usb-mtp: fix segmentation fault
  usb: usb-mtp QOMify
  usb: usb-hub QOMify
  usb: usb-hid QOMify
  usb: usb-bt QOMify
  usb: usb-audio QOMify
  uhci: QOMify
  xhci: fix events for setup trb.
  Revert "xhci: generate a Transfer Event for each Transfer TRB with the IOC bit set"
  xhci: set timer to retry xfers
  usb: fix usb-net segfault

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoacpi: update expected files for memory unplug
Michael S. Tsirkin [Mon, 11 May 2015 07:21:37 +0000 (09:21 +0200)]
acpi: update expected files for memory unplug

commit c06b2ffb02bfcc642c67300d2c4dffd5aa54932b
    acpi: add hardware implementation for memory hot unplug

Changed both the DSDT and the SSDT. Update the expected files
accordingly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20150508' into staging
Peter Maydell [Sun, 10 May 2015 20:40:54 +0000 (21:40 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20150508' into staging

Assorted s390x patches:
- updates for virtio-ccw and s390-virtio, making them more similar
  to virtio-pci
- improvements regarding per-vcpu interrupts and migration

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

* remotes/cohuck/tags/s390x-20150508:
  s390x/kvm: migrate vcpu interrupt state
  s390x: move fpu regs into a subsection of the vmstate
  s390x/kvm: use ioctl KVM_S390_IRQ for vcpu interrupts
  virtio-ccw: implement ->device_plugged
  virtio-ccw: change realization sequence
  s390-virtio: clear {used,avail}_event_idx on reset as well
  s390-virtio: use common features
  s390-virtio: Accommodate guests using virtqueues too early

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoqemu-nbd: only send a limited number of errno codes on the wire
Paolo Bonzini [Thu, 7 May 2015 15:25:10 +0000 (17:25 +0200)]
qemu-nbd: only send a limited number of errno codes on the wire

Right now, NBD includes potentially platform-specific error values in
the wire protocol.

Luckily, most common error values are more or less universal: in
particular, of all errno values <= 34 (up to ERANGE), they are all the
same on supported platforms except for 11 (which is EAGAIN on Windows and
Linux, but EDEADLK on Darwin and the *BSDs).  So, in order to guarantee
some portability, only keep a handful of possible error codes and squash
everything else to EINVAL.

This patch defines a limited set of errno values that are valid for the
NBD protocol, and specifies recommendations for what error to return
in specific corner cases.  The set of errno values is roughly based on
the errors listed in the read(2) and write(2) man pages, with some
exceptions:

- ENOMEM is added for servers that implement copy-on-write or other
  formats that require dynamic allocation.

- EDQUOT is not part of the universal set of errors; it can be changed
  to ENOSPC on the wire format.

- EFBIG is part of the universal set of errors, but it is also changed
  to ENOSPC because it is pretty similar to ENOSPC or EDQUOT.

Incoming values will in general match system errno values, but not
on the Hurd which has different errno values (they have a "subsystem
code" equal to 0x10 in bits 24-31).  The Hurd is probably not something
to which QEMU has been ported, but still do the right thing and
reverse-map the NBD errno values to the system errno values.

The corresponding patch to the NBD protocol description can be found at
http://article.gmane.org/gmane.linux.drivers.nbd.general/3154.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agorules.mak: Force CFLAGS for all objects in DSO
Fam Zheng [Thu, 7 May 2015 06:55:15 +0000 (14:55 +0800)]
rules.mak: Force CFLAGS for all objects in DSO

Because of the trick of process-archive-undefs, all .mo objects, even
with --enable-modules, are dependencies of executables.

This breaks CFLAGS propogation because the compiling of module object
will happen too early before building for DSO.

With GCC 5, the linking would fail because .o doesn't have -fPIC. Also,
BUILD_DSO will be missed. (module-common.o will have it, so the stamp
symbol was still liked in .so).

Fix the problem by forcing the CFLAGS on individual .o-cflags during
unnest-vars.

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Fam Zheng <famz@redhat.com>
Cc: qemu-stable@nongnu.org # 2.3
Message-Id: <1430981715-31465-1-git-send-email-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agodocs: update BLOCK_IMAGE_CORRUPTED documentation
Alberto Garcia [Thu, 7 May 2015 14:58:26 +0000 (17:58 +0300)]
docs: update BLOCK_IMAGE_CORRUPTED documentation

Label the "size" and "offset" fields in BLOCK_IMAGE_CORRUPTED as
optional, and clarify that the latter refers to the host's offset into
the image.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoglib-compat.h: change assert to g_assert
Michael Tokarev [Thu, 7 May 2015 10:38:02 +0000 (13:38 +0300)]
glib-compat.h: change assert to g_assert

include/glib-compat.h defines a bunch of functions based on glib primitives,
and uses assert() without including assert.h.  Replace assert() with
g_assert() to make the file more self-contained, and to fix compilation
breakage after 28507a415a9b1e.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
9 years agoRemove various unused functions
Thomas Huth [Sun, 3 May 2015 08:47:22 +0000 (10:47 +0200)]
Remove various unused functions

The functions tpm_backend_thread_tpm_reset() and iothread_find()
are completely unused, let's remove them.

Signed-off-by: Thomas Huth <huth@tuxfamily.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agosheepdog: fix resource leak with sd_snapshot_create
zhanghailiang [Tue, 5 May 2015 01:48:03 +0000 (09:48 +0800)]
sheepdog: fix resource leak with sd_snapshot_create

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoxhci: remove unused code
Gonglei [Tue, 28 Apr 2015 09:11:03 +0000 (17:11 +0800)]
xhci: remove unused code

Value from xfer->packet.ep is assigned to ep here, but that
stored value is not used before it is overwritten. Remove it.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agouhci: controller is halted after reset
Gerd Hoffmann [Thu, 7 May 2015 07:24:00 +0000 (09:24 +0200)]
uhci: controller is halted after reset

... and the status register should say so.

Fixes "usbus0: controller did not stop" error printed by freebsd.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-serial QOMify
Gonglei [Wed, 6 May 2015 12:55:36 +0000 (20:55 +0800)]
usb: usb-serial QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-redir QOMify
Gonglei [Wed, 6 May 2015 12:55:35 +0000 (20:55 +0800)]
usb: usb-redir QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-wacom-tablet QOMify
Gonglei [Wed, 6 May 2015 12:55:34 +0000 (20:55 +0800)]
usb: usb-wacom-tablet QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-uas QOMify
Gonglei [Wed, 6 May 2015 12:55:33 +0000 (20:55 +0800)]
usb: usb-uas QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-storage QOMify
Gonglei [Wed, 6 May 2015 12:55:32 +0000 (20:55 +0800)]
usb: usb-storage QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-ccid QOMify
Gonglei [Wed, 6 May 2015 12:55:31 +0000 (20:55 +0800)]
usb: usb-ccid QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-net QOMify
Gonglei [Wed, 6 May 2015 12:55:30 +0000 (20:55 +0800)]
usb: usb-net QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb-mtp: fix segmentation fault
Gonglei [Wed, 6 May 2015 12:55:29 +0000 (20:55 +0800)]
usb-mtp: fix segmentation fault

When x-root property not be configured, will cause segfault
because of null pointer accessing. Add a check for s->root
property avoid segfault.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-mtp QOMify
Gonglei [Wed, 6 May 2015 12:55:28 +0000 (20:55 +0800)]
usb: usb-mtp QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-hub QOMify
Gonglei [Wed, 6 May 2015 12:55:27 +0000 (20:55 +0800)]
usb: usb-hub QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-hid QOMify
Gonglei [Wed, 6 May 2015 12:55:26 +0000 (20:55 +0800)]
usb: usb-hid QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-bt QOMify
Gonglei [Wed, 6 May 2015 12:55:25 +0000 (20:55 +0800)]
usb: usb-bt QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: usb-audio QOMify
Gonglei [Wed, 6 May 2015 12:55:24 +0000 (20:55 +0800)]
usb: usb-audio QOMify

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agouhci: QOMify
Gonglei [Wed, 6 May 2015 12:55:23 +0000 (20:55 +0800)]
uhci: QOMify

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoxhci: fix events for setup trb.
Gerd Hoffmann [Tue, 28 Apr 2015 07:31:44 +0000 (09:31 +0200)]
xhci: fix events for setup trb.

When we find a IOC bit set on a setup trb and therefore queue an event,
that should not stop events being generated for following data trbs.
So clear the 'reported' flag.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoRevert "xhci: generate a Transfer Event for each Transfer TRB with the IOC bit set"
Gerd Hoffmann [Tue, 28 Apr 2015 07:19:35 +0000 (09:19 +0200)]
Revert "xhci: generate a Transfer Event for each Transfer TRB with the IOC bit set"

This makes xhci generate multiple short packet events in case of
multi-trb transfers.  Which is wrong.  We need to fix this in a
different way.

This reverts commit aa6857891df614c620e6e9fc4bc4af6e0e49cafd.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoxhci: set timer to retry xfers
Gerd Hoffmann [Tue, 28 Apr 2015 07:19:14 +0000 (09:19 +0200)]
xhci: set timer to retry xfers

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agousb: fix usb-net segfault
Michal Kazior [Wed, 29 Apr 2015 11:34:59 +0000 (11:34 +0000)]
usb: fix usb-net segfault

The dev->config pointer isn't set until guest
system initializes usb devices (via
usb_desc_set_config). However qemu networking can
go through some motions prior to that, e.g.:

 #0  is_rndis (s=0x555557261970) at hw/usb/dev-network.c:653
 #1  0x000055555585f723 in usbnet_can_receive (nc=0x55555641e820) at hw/usb/dev-network.c:1315
 #2  0x000055555587635e in qemu_can_send_packet (sender=0x5555572660a0) at net/net.c:470
 #3  0x0000555555878e34 in net_hub_port_can_receive (nc=0x5555562d7800) at net/hub.c:101
 #4  0x000055555587635e in qemu_can_send_packet (sender=0x5555562d7980) at net/net.c:470
 #5  0x000055555587dbca in tap_can_send (opaque=0x5555562d7980) at net/tap.c:172

The command to reproduce most reliably was:

 qemu-system-i386 -usb -device usb-net,vlan=0 -net tap,vlan=0

This wasn't strictly a problem with tap. Other
networking endpoints (vde, user) could trigger
this problem as well.

Fixes: https://bugs.launchpad.net/qemu/+bug/1050823
Cc: qemu-stable@nongnu.org
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoconfigure: require __thread support
Emilio G. Cota [Wed, 29 Apr 2015 11:09:02 +0000 (13:09 +0200)]
configure: require __thread support

The codebase doesn't build without __thread support.
Formalise this requirement by adding a check for it in the
configure script.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agos390x/kvm: migrate vcpu interrupt state
Jens Freimann [Mon, 2 Mar 2015 16:44:24 +0000 (17:44 +0100)]
s390x/kvm: migrate vcpu interrupt state

This patch adds support to migrate vcpu interrupts.
We use ioctl KVM_S390_GET_IRQ_STATE and _SET_IRQ_STATE
to get/set the complete interrupt state for a vcpu.

Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x: move fpu regs into a subsection of the vmstate
David Hildenbrand [Mon, 30 Mar 2015 11:22:47 +0000 (13:22 +0200)]
s390x: move fpu regs into a subsection of the vmstate

Let's move the floating point registers into a seperate subsection and
bump up the version id. This cleans up the current vmstate and will
allow for a future extension with vector registers in a compatible way.

This patch is based on a patch from Eric Farman.

Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390x/kvm: use ioctl KVM_S390_IRQ for vcpu interrupts
Jens Freimann [Thu, 18 Dec 2014 16:38:05 +0000 (17:38 +0100)]
s390x/kvm: use ioctl KVM_S390_IRQ for vcpu interrupts

KVM_S390_INT uses only two parameter fields. This is not
enough to pass all required information for certain interrupts.

A new ioctl KVM_S390_IRQ is available which allows us to
inject all local interrupts as defined in the Principles of
Operation. It takes a struct kvm_s390_irq as a parameter
which can store interrupt payload data for all interrupts.

Let's use the new ioctl for injecting vcpu interrupts.

Tested-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agovirtio-ccw: implement ->device_plugged
Cornelia Huck [Tue, 21 Apr 2015 14:36:56 +0000 (16:36 +0200)]
virtio-ccw: implement ->device_plugged

Let's move operations that are only valid after the backend has been
realized to a ->device_plugged callback, just as virtio-pci does.
Also reorder setting up the host feature bits to the sequence used
by virtio-pci.

While we're at it, also add a ->device_unplugged callback to stop
ioeventfd, just to be on the safe side.

Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-Id: <1429627016-30656-3-git-send-email-cornelia.huck@de.ibm.com>

9 years agovirtio-ccw: change realization sequence
Cornelia Huck [Tue, 21 Apr 2015 14:36:55 +0000 (16:36 +0200)]
virtio-ccw: change realization sequence

virtio-ccw has an odd sequence of realizing devices: first the
device-specific relization (net, block, ...), then the generic
realization. It feels less odd to have the generic realization
callback trigger the device-specific realization instead (and this
also matches what virtio-pci does).

One thing to note: We need to defer initializing the cu model in the
sense id data until after the device-specific realization has been
performed, as we need to refer to the virtio device's device_id.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-Id: <1429627016-30656-2-git-send-email-cornelia.huck@de.ibm.com>

9 years agos390-virtio: clear {used,avail}_event_idx on reset as well
Christian Borntraeger [Mon, 4 May 2015 13:27:25 +0000 (15:27 +0200)]
s390-virtio: clear {used,avail}_event_idx on reset as well

The old s390-virtio transport clears the vring used/avail indices in
the shared area on reset. When we enabled event_idx for virtio-blk, we
noticed that this is not enough: We also need to clear the published
used/avail event indices, or reboot will fail.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390-virtio: use common features
Cornelia Huck [Wed, 29 Apr 2015 13:30:58 +0000 (15:30 +0200)]
s390-virtio: use common features

We used to avoid enabling event_idx for virtio-blk devices via
s390-virtio, but we now have a workaround in place for guests trying
to use the device before setting DRIVER_OK. Therefore, let's add
DEFINE_VIRTIO_COMMON_FEATURES to the base device so all devices get
those common features - and make s390-virtio use the same mechanism
as the other transports do.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agos390-virtio: Accommodate guests using virtqueues too early
Christian Borntraeger [Thu, 30 Apr 2015 15:53:13 +0000 (17:53 +0200)]
s390-virtio: Accommodate guests using virtqueues too early

Feature updates are not a synchronuous operation for the legacy
s390-virtio transport. This transport syncs the guest feature bits
(those from finalize) on the set_status hypercall. Before that qemu
thinks that features are zero, which means QEMU will misbehave, e.g.
it will not write the event index, even if the guest asks for it.

Let's detect the case where a kick happens before the driver is ready
and force sync the features.
With this workaround, it is now safe to switch to the common feature
bit handling code as used by all other transports.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
9 years agohw/ptimer: Do not artificially limit timers when using icount
Edgar E. Iglesias [Wed, 10 Sep 2014 08:33:58 +0000 (18:33 +1000)]
hw/ptimer: Do not artificially limit timers when using icount

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20150507-1' into...
Peter Maydell [Thu, 7 May 2015 17:22:03 +0000 (18:22 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150507-1' into staging

migration/next for 20150507

# gpg: Signature made Thu May  7 17:42:19 2015 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20150507-1:
  migration: Fix migration state update issue
  migration: avoid divide by zero in xbzrle cache miss rate
  migration: Add hmp interface to set and query parameters
  migration: Add qmp commands to set and query parameters
  migration: Use an array instead of 3 parameters
  migration: Add interface to control compression
  migration: Add the core code for decompression
  migration: Make compression co-work with xbzrle
  migration: Add the core code of multi-thread compression
  migration: Split save_zero_page from ram_save_page
  arch_init: Add and free data struct for decompression
  arch_init: Alloc and free data struct for compression
  qemu-file: Add compression functions to QEMUFile
  migration: Add the framework of multi-thread decompression
  migration: Add the framework of multi-thread compression
  docs: Add a doc about multiple thread compression

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agomigration: Fix migration state update issue
Liang Li [Thu, 7 May 2015 18:31:22 +0000 (02:31 +0800)]
migration: Fix migration state update issue

If live migration is very fast and can be completed in 1 second,
the dirty_sync_count of MigrationState will not be updated.
Then you will see "dirty sync count: 0" in qemu monitor even if
the actual dirty sync count is not 0.

Signed-off-by: Liang Li <liang.z.li@intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr.David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agomigration: avoid divide by zero in xbzrle cache miss rate
Michael Chapman [Wed, 15 Apr 2015 03:59:14 +0000 (13:59 +1000)]
migration: avoid divide by zero in xbzrle cache miss rate

This bug manifested itself as a VM that could not be resumed by libvirt
following a migration:

  # virsh resume example
  error: Failed to resume domain example
  error: internal error: cannot parse json {"return":
    {"xbzrle-cache":
      {..., "cache-miss-rate": -nan, ...},
      ...
    }
  }: lexical error: malformed number, a digit is required after the minus sign.

This patch also ensures xbzrle_cache_miss_prev and iterations_prev are
cleared at the start of the migration.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agomigration: Add hmp interface to set and query parameters
Liang Li [Mon, 23 Mar 2015 08:32:29 +0000 (16:32 +0800)]
migration: Add hmp interface to set and query parameters

Add the hmp interface to tune and query the parameters used in
live migration.

Signed-off-by: Liang Li <liang.z.li@intel.com>
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>