OSDN Git Service

qmiga/qemu.git
7 years agoqemu-iotests: Block migration test
Kevin Wolf [Tue, 23 May 2017 12:53:10 +0000 (14:53 +0200)]
qemu-iotests: Block migration test

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agomigration/block: Clean up BBs in block_save_complete()
Kevin Wolf [Mon, 22 May 2017 15:17:49 +0000 (17:17 +0200)]
migration/block: Clean up BBs in block_save_complete()

We need to release any block migrations BlockBackends on the source
before successfully completing the migration because otherwise
inactivating the images will fail (inactivation only tolerates device
BBs).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
7 years agomigration: Inactivate images after .save_live_complete_precopy()
Kevin Wolf [Mon, 22 May 2017 15:10:38 +0000 (17:10 +0200)]
migration: Inactivate images after .save_live_complete_precopy()

Block migration may still access the image during its
.save_live_complete_precopy() implementation, so we should only
inactivate the image afterwards.

Another reason for the change is that inactivating an image fails when
there is still a non-device BlockBackend using it, which includes the
BBs used by block migration. We want to give block migration a chance to
release the BBs before trying to inactivate the image (this will be done
in another patch).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
7 years agoblock: Fix anonymous BBs in blk_root_inactivate()
Kevin Wolf [Mon, 22 May 2017 15:03:39 +0000 (17:03 +0200)]
block: Fix anonymous BBs in blk_root_inactivate()

blk->name isn't an array, but a pointer that can be NULL. Checking for
an anonymous BB must involve a NULL check first, otherwise we get
crashes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
7 years agoarm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented
Peter Maydell [Wed, 7 Jun 2017 15:29:29 +0000 (16:29 +0100)]
arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented

If EL3 is not implemented (ie only one security state) then the
one and only ICC_BPR1 register behaves like the Non-secure
ICC_BPR1 in an EL3-present configuration. In particular, its
reset value is GIC_MIN_BPR_NS, not GIC_MIN_BPR.

Correct the erroneous reset value; this fixes a problem where
we might hit the assert added in commit a89ff39ee901.

Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1496849369-30282-1-git-send-email-peter.maydell@linaro.org

7 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20170607' into...
Peter Maydell [Wed, 7 Jun 2017 14:06:42 +0000 (15:06 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170607' into staging

migration/next for 20170607

# gpg: Signature made Wed 07 Jun 2017 10:02:01 BST
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* remotes/juanquintela/tags/migration/20170607:
  qemu/migration: fix the double free problem on from_src_file
  ram: Make RAMState dynamic
  ram: Use MigrationStats for statistics
  ram: Move ZERO_TARGET_PAGE inside XBZRLE
  ram: Call migration_page_queue_free() at ram_migration_cleanup()
  ram: We only print throttling information sometimes
  ram: Unfold get_xbzrle_cache_stats() into populate_ram_info()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into...
Peter Maydell [Wed, 7 Jun 2017 10:56:00 +0000 (11:56 +0100)]
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging

# gpg: Signature made Wed 07 Jun 2017 10:29:50 BST
# gpg:                using RSA key 0xF30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/m68k-for-2.10-pull-request:
  target/m68k: implement rtd

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
Peter Maydell [Wed, 7 Jun 2017 10:16:22 +0000 (11:16 +0100)]
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Wed 07 Jun 2017 04:29:20 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:
  Revert "Change net/socket.c to use socket_*() functions" again
  net/rocker: Cleanup the useless return value check

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agotarget/m68k: implement rtd
Laurent Vivier [Mon, 5 Jun 2017 10:00:14 +0000 (12:00 +0200)]
target/m68k: implement rtd

Add "Return and Deallocate" (rtd) instruction.

  RTD #d

    (SP) -> PC
    SP + 4 + d -> SP

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-By: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Message-Id: <20170605100014.22981-1-laurent@vivier.eu>

7 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-s390-20170606' into staging
Peter Maydell [Wed, 7 Jun 2017 09:14:54 +0000 (10:14 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-s390-20170606' into staging

Queued s390 patches

# gpg: Signature made Wed 07 Jun 2017 01:18:29 BST
# gpg:                using RSA key 0xAD1270CC4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"
# Primary key fingerprint: 9CB1 8DDA F8E8 49AD 2AFC  16A4 AD12 70CC 4DD0 279B

* remotes/rth/tags/pull-s390-20170606: (70 commits)
  target/s390x: addressing exceptions are suppressing
  target/s390x: mark ETF2 and ETF2-ENH facilities as available
  target/s390x: check alignment in CDSG in the !CONFIG_ATOMIC128 case
  target/s390x: implement STORE PAIR TO QUADWORD
  target/s390x: implement LOAD PAIR FROM QUADWORD
  target/s390x: implement TRANSLATE ONE/TWO TO ONE/TWO
  target/s390x: implement TEST DECIMAL
  target/s390x: implement UNPACK UNICODE
  target/s390x: implement UNPACK ASCII
  target/s390x: implement PACK UNICODE
  target/s390x: implement PACK ASCII
  target/s390x: implement MOVE LONG UNICODE
  target/s390x: implement COMPARE LOGICAL LONG UNICODE
  target/s390x: improve MOVE LONG and MOVE LONG EXTENDED
  target/s390x: fix adj_len_to_page
  target/s390x: implement COMPARE LOGICAL LONG
  target/s390x: fix COMPARE LOGICAL LONG EXTENDED
  target/s390x: improve 24-bit and 31-bit lengths read/write
  target/s390x: improve 24-bit and 31-bit addresses write
  target/s390x: improve 24-bit and 31-bit addresses read
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoqemu/migration: fix the double free problem on from_src_file
QingFeng Hao [Tue, 6 Jun 2017 05:24:38 +0000 (07:24 +0200)]
qemu/migration: fix the double free problem on from_src_file

In load_snapshot, mis->from_src_file is freed twice, the first free is by
qemu_fclose, the second is by migration_incoming_state_destroy and
it causes Illegal instruction exception. The fix is just to remove the
first free.

This problem is found by qemu-iotests case 068 since commit
"660819b migration: shut src return path unconditionally". The error is:
068 1s ... - output mismatch (see 068.out.bad)
    --- tests/qemu-iotests/068.out 2017-05-06 01:00:26.417270437 +0200
    +++ 068.out.bad 2017-06-03 13:59:55.360274640 +0200
    @@ -6,6 +6,8 @@
     QEMU X.Y.Z monitor - type 'help' for more information
     (qemu) savevm 0
     (qemu) quit
    +./common.config: line 107: 242472 Illegal instruction     (core dumped) ( if [ -n "${QEMU_NEED_PID}" ]; then
    +    echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid";
    +fi; exec "$QEMU_PROG" $QEMU_OPTIONS "$@" )
     QEMU X.Y.Z monitor - type 'help' for more information
    -(qemu) quit
    -*** done
    +(qemu) *** done

Signed-off-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agoram: Make RAMState dynamic
Juan Quintela [Thu, 4 May 2017 09:46:24 +0000 (11:46 +0200)]
ram: Make RAMState dynamic

We create the variable while we are at migration and we remove it
after migration.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agoram: Use MigrationStats for statistics
Juan Quintela [Tue, 6 Jun 2017 17:49:03 +0000 (19:49 +0200)]
ram: Use MigrationStats for statistics

RAM Statistics need to survive migration to make info migrate work, so we
need to store them outside of RAMState.  As we already have an struct
with those fields, just used them. (MigrationStats and XBZRLECacheStats).

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
7 years agoram: Move ZERO_TARGET_PAGE inside XBZRLE
Juan Quintela [Tue, 9 May 2017 14:22:01 +0000 (16:22 +0200)]
ram: Move ZERO_TARGET_PAGE inside XBZRLE

It was only used by XBZRLE anyways.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
7 years agoram: Call migration_page_queue_free() at ram_migration_cleanup()
Juan Quintela [Thu, 4 May 2017 09:45:01 +0000 (11:45 +0200)]
ram: Call migration_page_queue_free() at ram_migration_cleanup()

We shouldn't be using memory later than that.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
7 years agoram: We only print throttling information sometimes
Juan Quintela [Wed, 3 May 2017 11:16:38 +0000 (13:16 +0200)]
ram: We only print throttling information sometimes

Change it to be consistent with everything else.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoram: Unfold get_xbzrle_cache_stats() into populate_ram_info()
Juan Quintela [Thu, 4 May 2017 08:09:21 +0000 (10:09 +0200)]
ram: Unfold get_xbzrle_cache_stats() into populate_ram_info()

They were called consecutively always.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoRevert "Change net/socket.c to use socket_*() functions" again
Daniel P. Berrange [Fri, 5 May 2017 16:23:05 +0000 (17:23 +0100)]
Revert "Change net/socket.c to use socket_*() functions" again

This reverts commit 883e4f7624e10b98d16d9adaffb8b1795664d899.

This code changed net/socket.c from using socket()+connect(),
to using socket_connect(). In theory this is great, but in
practice this has completely broken the ability to connect
the frontend and backend:

  $ ./x86_64-softmmu/qemu-system-x86_64 \
       -device e1000,id=e0,netdev=hn0,mac=DE:AD:BE:EF:AF:05 \
       -netdev socket,id=hn0,connect=localhost:1234
  qemu-system-x86_64: -device e1000,id=e0,netdev=hn0,mac=DE:AD:BE:EF:AF:05: Property 'e1000.netdev' can't find value 'hn0'

The old code would call net_socket_fd_init() synchronously,
while letting the connect() complete in the backgorund. The
new code moved net_socket_fd_init() so that it is only called
after connect() completes in the background.

Thus at the time we initialize the NIC frontend, the backend
does not exist.

The socket_connect() conversion as done is a bad fit for the
current code, since it did not try to change the way it deals
with async connection completion. Rather than try to fix this,
just revert the socket_connect() conversion entirely.

The code is about to be converted to use QIOChannel which
will let the problem be solved in a cleaner manner. This
revert is more suitable for stable branches in the meantime.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
7 years agonet/rocker: Cleanup the useless return value check
Mao Zhongyi [Wed, 24 May 2017 02:57:18 +0000 (10:57 +0800)]
net/rocker: Cleanup the useless return value check

None of pci_dma_read()'s callers check the return value except
rocker. There is no need to check it because it always return
0. So the check work is useless. Remove it entirely.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
7 years agotarget/s390x: addressing exceptions are suppressing
David Hildenbrand [Mon, 29 May 2017 12:12:28 +0000 (14:12 +0200)]
target/s390x: addressing exceptions are suppressing

We have to make the address in the old PSW point at the next
instruction, as addressing exceptions are suppressing and not
nullifying.

I assume that there are a lot of other broken cases (as most instructions
we care about are suppressing) - all trigger_pgm_exception() specifying
and explicit number or ILEN_LATER look suspicious, however this is another
story that might require bigger changes (and I have to understand when
the address might already have been incremented first).

This is needed to make an upcoming kvm-unit-test work.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20170529121228.2789-1-david@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: mark ETF2 and ETF2-ENH facilities as available
Aurelien Jarno [Wed, 31 May 2017 22:01:28 +0000 (00:01 +0200)]
target/s390x: mark ETF2 and ETF2-ENH facilities as available

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-30-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: check alignment in CDSG in the !CONFIG_ATOMIC128 case
Aurelien Jarno [Sun, 4 Jun 2017 20:20:34 +0000 (22:20 +0200)]
target/s390x: check alignment in CDSG in the !CONFIG_ATOMIC128 case

The CDSG instruction requires a 16-byte alignement, as expressed in
the MO_ALIGN_16 passed to helper_atomic_cmpxchgo_be_mmu. In the non
parallel case, use check_alignment to enforce this.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170604202034.16615-4-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement STORE PAIR TO QUADWORD
Aurelien Jarno [Sun, 4 Jun 2017 20:20:33 +0000 (22:20 +0200)]
target/s390x: implement STORE PAIR TO QUADWORD

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170604202034.16615-3-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement LOAD PAIR FROM QUADWORD
Aurelien Jarno [Sun, 4 Jun 2017 20:20:32 +0000 (22:20 +0200)]
target/s390x: implement LOAD PAIR FROM QUADWORD

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170604202034.16615-2-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement TRANSLATE ONE/TWO TO ONE/TWO
Aurelien Jarno [Wed, 31 May 2017 22:01:27 +0000 (00:01 +0200)]
target/s390x: implement TRANSLATE ONE/TWO TO ONE/TWO

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-29-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement TEST DECIMAL
Aurelien Jarno [Wed, 31 May 2017 22:01:26 +0000 (00:01 +0200)]
target/s390x: implement TEST DECIMAL

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-28-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement UNPACK UNICODE
Aurelien Jarno [Wed, 31 May 2017 22:01:25 +0000 (00:01 +0200)]
target/s390x: implement UNPACK UNICODE

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-27-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement UNPACK ASCII
Aurelien Jarno [Wed, 31 May 2017 22:01:24 +0000 (00:01 +0200)]
target/s390x: implement UNPACK ASCII

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-26-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement PACK UNICODE
Aurelien Jarno [Wed, 31 May 2017 22:01:23 +0000 (00:01 +0200)]
target/s390x: implement PACK UNICODE

Use a common helper with PACK ASCII as the differences are limited to
the stride of the source operand.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-25-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement PACK ASCII
Aurelien Jarno [Wed, 31 May 2017 22:01:22 +0000 (00:01 +0200)]
target/s390x: implement PACK ASCII

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-24-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement MOVE LONG UNICODE
Aurelien Jarno [Wed, 31 May 2017 22:01:21 +0000 (00:01 +0200)]
target/s390x: implement MOVE LONG UNICODE

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-23-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement COMPARE LOGICAL LONG UNICODE
Aurelien Jarno [Wed, 31 May 2017 22:01:20 +0000 (00:01 +0200)]
target/s390x: implement COMPARE LOGICAL LONG UNICODE

For that we need to make program_interrupt available to qemu-user.
Fortunately there is almost nothing to change as both kvm_enabled and
CONFIG_KVM evaluate to false in that case.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-22-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: improve MOVE LONG and MOVE LONG EXTENDED
Aurelien Jarno [Wed, 31 May 2017 22:01:19 +0000 (00:01 +0200)]
target/s390x: improve MOVE LONG and MOVE LONG EXTENDED

As MVCL and MVCLE only differ by their operands, use a common
do_mvcl helper. Optimize it calling fast_memmove and fast_memset.
Correctly write back addresses. Check that r1 and r2/r3 registers
are even.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-21-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: fix adj_len_to_page
Aurelien Jarno [Wed, 31 May 2017 22:01:18 +0000 (00:01 +0200)]
target/s390x: fix adj_len_to_page

adj_len_to_page doesn't return the correct result when the address
is already page aligned and the length is bigger than a page. Fix that.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-20-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement COMPARE LOGICAL LONG
Aurelien Jarno [Wed, 31 May 2017 22:01:17 +0000 (00:01 +0200)]
target/s390x: implement COMPARE LOGICAL LONG

As CLCL and CLCLE mostly differ by their operands, use a common do_clcl
helper. Another difference is that CLCL is not interruptible.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-19-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: fix COMPARE LOGICAL LONG EXTENDED
Aurelien Jarno [Wed, 31 May 2017 22:01:16 +0000 (00:01 +0200)]
target/s390x: fix COMPARE LOGICAL LONG EXTENDED

There are multiple issues with the COMPARE LOGICAL LONG EXTENDED
instruction:
- The test between the two operands is inverted, leading to an inversion
  of the cc values 1 and 2.
- The address and length of an operand continue to be decreased after
  reaching the end of this operand. These values are then wrong write
  back to the registers.
- We should limit the amount of bytes to process, so that interrupts can
  be served correctly.

At the same time rename dest into src1 and src into src3 to match the
operand names and make the code less confusing.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-18-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: improve 24-bit and 31-bit lengths read/write
Aurelien Jarno [Wed, 31 May 2017 22:01:15 +0000 (00:01 +0200)]
target/s390x: improve 24-bit and 31-bit lengths read/write

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-17-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: improve 24-bit and 31-bit addresses write
Aurelien Jarno [Wed, 31 May 2017 22:01:14 +0000 (00:01 +0200)]
target/s390x: improve 24-bit and 31-bit addresses write

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-16-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: improve 24-bit and 31-bit addresses read
Aurelien Jarno [Wed, 31 May 2017 22:01:13 +0000 (00:01 +0200)]
target/s390x: improve 24-bit and 31-bit addresses read

Improve fix_address to also handle the 24-bit mode. Rename fix_address
to wrap_address to better explain what is changed.

Replace the calls to get_address with x2 = 0 and b2 = 0 by
call to wrap_address, leading to the removal of this function. Rename
get_address_31fix into get_address.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-15-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement MOVE ZONES
Aurelien Jarno [Wed, 31 May 2017 22:01:12 +0000 (00:01 +0200)]
target/s390x: implement MOVE ZONES

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-14-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement MOVE WITH OFFSET
Aurelien Jarno [Wed, 31 May 2017 22:01:11 +0000 (00:01 +0200)]
target/s390x: implement MOVE WITH OFFSET

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-13-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement MOVE NUMERICS
Aurelien Jarno [Wed, 31 May 2017 22:01:10 +0000 (00:01 +0200)]
target/s390x: implement MOVE NUMERICS

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-12-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement MOVE INVERSE
Aurelien Jarno [Wed, 31 May 2017 22:01:09 +0000 (00:01 +0200)]
target/s390x: implement MOVE INVERSE

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-11-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement COMPARE AND SIGNAL
Aurelien Jarno [Wed, 31 May 2017 22:01:08 +0000 (00:01 +0200)]
target/s390x: implement COMPARE AND SIGNAL

These functions differ from COMPARE by generating an exception for a
QNaN input. Use the non quiet version of floatXX_compare.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-10-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement PACK
Aurelien Jarno [Wed, 31 May 2017 22:01:05 +0000 (00:01 +0200)]
target/s390x: implement PACK

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-7-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement TEST ADDRESSING MODE
Aurelien Jarno [Wed, 31 May 2017 22:01:04 +0000 (00:01 +0200)]
target/s390x: implement TEST ADDRESSING MODE

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-6-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement TEST AND SET
Aurelien Jarno [Wed, 31 May 2017 22:01:03 +0000 (00:01 +0200)]
target/s390x: implement TEST AND SET

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-5-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: implement local-TLB-clearing in IPTE
Aurelien Jarno [Wed, 31 May 2017 22:01:02 +0000 (00:01 +0200)]
target/s390x: implement local-TLB-clearing in IPTE

And at the same time make IPTE SMP aware.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-4-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: remove some Linux assumptions from IPTE
Aurelien Jarno [Wed, 31 May 2017 22:01:01 +0000 (00:01 +0200)]
target/s390x: remove some Linux assumptions from IPTE

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-3-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: remove dead code in translate.c
Aurelien Jarno [Wed, 31 May 2017 22:01:00 +0000 (00:01 +0200)]
target/s390x: remove dead code in translate.c

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <20170531220129.27724-2-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x/cpu_models: Allow some additional feature bits for the "qemu" CPU
Thomas Huth [Thu, 25 May 2017 09:22:12 +0000 (11:22 +0200)]
target/s390x/cpu_models: Allow some additional feature bits for the "qemu" CPU

Currently we only present the plain z900 feature bits to the guest,
but QEMU already emulates some additional features (but not all of
the next CPU generation, so we can not use the next CPU level as
default yet). Since newer Linux kernels are checking the feature bits
and refuse to work if a required feature is missing, it would be nice
to have a way to present more of the supported features when we are
running with the "qemu" CPU.
This patch now adds the supported features to the "full_feat" bitmap,
so that additional features can be enabled on the command line now,
for example with:

 qemu-system-s390x -cpu qemu,stfle=true,ldisp=true,eimm=true,stckf=true

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1495704132-5675-1-git-send-email-thuth@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Re-implement a few EXECUTE target insns directly
Richard Henderson [Wed, 24 May 2017 21:34:10 +0000 (14:34 -0700)]
target/s390x: Re-implement a few EXECUTE target insns directly

While the previous patch is required for proper conformance,
the vast majority of target insns are MVC and XC for implementing
memmove and memset respectively.  The next most common are CLC,
TR, and SVC.

Implementing these (and a few others for which we already have
an implementation) directly is faster than going through full
translation to a TB.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Implement EXECUTE via new TranslationBlock
Richard Henderson [Sun, 21 May 2017 16:50:00 +0000 (09:50 -0700)]
target/s390x: Implement EXECUTE via new TranslationBlock

Previously, helper_ex would construct the insn and then implement
the insn via direct calls other helpers.  This was sufficient to
boot Linux but that is all.

It is easy enough to go the whole nine yards by stashing state for
EXECUTE within the cpu, and then rely on a new TB to be created
that properly and completely interprets the insn.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: End the TB after EXECUTE
Richard Henderson [Wed, 24 May 2017 20:00:16 +0000 (13:00 -0700)]
target/s390x: End the TB after EXECUTE

This split will be required for implementing EXECUTE properly.
Do this now as a separate step to aid comparison of before and
after TB listings.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Save current ilen during translation
Richard Henderson [Wed, 24 May 2017 19:27:36 +0000 (12:27 -0700)]
target/s390x: Save current ilen during translation

Use this saved value instead of recomputing from next_pc difference.

Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Implement CSPG
Richard Henderson [Tue, 23 May 2017 01:58:42 +0000 (18:58 -0700)]
target/s390x: Implement CSPG

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use atomic operations for COMPARE SWAP PURGE
Richard Henderson [Tue, 23 May 2017 01:34:42 +0000 (18:34 -0700)]
target/s390x: Use atomic operations for COMPARE SWAP PURGE

Also provide the cross-cpu tlb flushing required by the PoO.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Fix EXECUTE with R1==0
Richard Henderson [Wed, 24 May 2017 18:56:15 +0000 (11:56 -0700)]
target/s390x: Fix EXECUTE with R1==0

The PoO specifies that when R1==0, no ORing into the insn
loaded from storage takes place.  Load a zero for this case.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Fix some helper_ex problems
Richard Henderson [Wed, 24 May 2017 18:49:53 +0000 (11:49 -0700)]
target/s390x: Fix some helper_ex problems

(1) The OR of the low bits or R1 into INSN were not being done
consistently; it was forgotten along all but the SVC path.
(2) The setting of ILEN was wrong on SVC path for EXRL.
(3) The data load for ICM read too much.

Fix these by consolidating data load at the beginning, using
get_ilen to control the number of bytes loaded, and ORing in
the byte from R1.  Use extract64 from the full aligned insn
to extract arguments.

Pass in ILEN rather than RET as the more natural way to give
the required data along the SVC path.

Modify ENV->CC_OP directly rather than include it in the
functional interface.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_mvcs/mvcp
Richard Henderson [Tue, 23 May 2017 02:45:43 +0000 (19:45 -0700)]
target/s390x: Use unwind data for helper_mvcs/mvcp

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_lra
Richard Henderson [Mon, 22 May 2017 20:59:02 +0000 (13:59 -0700)]
target/s390x: Use unwind data for helper_lra

Fix saving exception_index around mmu_translate; eliminate a dead store.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_tprot
Richard Henderson [Mon, 22 May 2017 19:54:35 +0000 (12:54 -0700)]
target/s390x: Use unwind data for helper_tprot

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_testblock
Richard Henderson [Mon, 22 May 2017 19:53:32 +0000 (12:53 -0700)]
target/s390x: Use unwind data for helper_testblock

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_stctl
Richard Henderson [Mon, 22 May 2017 19:43:23 +0000 (12:43 -0700)]
target/s390x: Use unwind data for helper_stctl

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_lctl
Richard Henderson [Mon, 22 May 2017 19:18:42 +0000 (12:18 -0700)]
target/s390x: Use unwind data for helper_lctl

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_lctlg
Richard Henderson [Mon, 22 May 2017 19:14:58 +0000 (12:14 -0700)]
target/s390x: Use unwind data for helper_lctlg

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_trt
Richard Henderson [Mon, 22 May 2017 18:59:43 +0000 (11:59 -0700)]
target/s390x: Use unwind data for helper_trt

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_tre
Richard Henderson [Fri, 19 May 2017 18:46:25 +0000 (11:46 -0700)]
target/s390x: Use unwind data for helper_tre

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_tr
Richard Henderson [Fri, 19 May 2017 18:43:08 +0000 (11:43 -0700)]
target/s390x: Use unwind data for helper_tr

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_unpk
Richard Henderson [Fri, 19 May 2017 18:37:55 +0000 (11:37 -0700)]
target/s390x: Use unwind data for helper_unpk

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_cksm
Richard Henderson [Fri, 19 May 2017 18:34:43 +0000 (11:34 -0700)]
target/s390x: Use unwind data for helper_cksm

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_clcle
Richard Henderson [Fri, 19 May 2017 18:30:39 +0000 (11:30 -0700)]
target/s390x: Use unwind data for helper_clcle

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_mvcle
Richard Henderson [Fri, 19 May 2017 18:28:30 +0000 (11:28 -0700)]
target/s390x: Use unwind data for helper_mvcle

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_mvcl
Richard Henderson [Fri, 19 May 2017 18:26:27 +0000 (11:26 -0700)]
target/s390x: Use unwind data for helper_mvcl

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_stam
Richard Henderson [Fri, 19 May 2017 18:23:15 +0000 (11:23 -0700)]
target/s390x: Use unwind data for helper_stam

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_lam
Richard Henderson [Fri, 19 May 2017 18:20:48 +0000 (11:20 -0700)]
target/s390x: Use unwind data for helper_lam

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_mvst
Richard Henderson [Fri, 19 May 2017 18:17:50 +0000 (11:17 -0700)]
target/s390x: Use unwind data for helper_mvst

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_mvpg
Richard Henderson [Fri, 19 May 2017 18:15:25 +0000 (11:15 -0700)]
target/s390x: Use unwind data for helper_mvpg

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_clst
Richard Henderson [Fri, 19 May 2017 17:16:24 +0000 (10:16 -0700)]
target/s390x: Use unwind data for helper_clst

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_srst
Richard Henderson [Fri, 19 May 2017 17:13:22 +0000 (10:13 -0700)]
target/s390x: Use unwind data for helper_srst

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_clm
Richard Henderson [Fri, 19 May 2017 17:10:58 +0000 (10:10 -0700)]
target/s390x: Use unwind data for helper_clm

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_clc
Richard Henderson [Fri, 19 May 2017 17:06:23 +0000 (10:06 -0700)]
target/s390x: Use unwind data for helper_clc

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_mvc
Richard Henderson [Fri, 19 May 2017 16:59:53 +0000 (09:59 -0700)]
target/s390x: Use unwind data for helper_mvc

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_xc
Richard Henderson [Fri, 19 May 2017 16:53:31 +0000 (09:53 -0700)]
target/s390x: Use unwind data for helper_xc

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_oc
Richard Henderson [Fri, 19 May 2017 16:42:18 +0000 (09:42 -0700)]
target/s390x: Use unwind data for helper_oc

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use unwind data for helper_nc
Richard Henderson [Fri, 19 May 2017 16:41:29 +0000 (09:41 -0700)]
target/s390x: Use unwind data for helper_nc

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Move helper_ex to end of file
Richard Henderson [Fri, 19 May 2017 18:39:39 +0000 (11:39 -0700)]
target/s390x: Move helper_ex to end of file

This will avoid needing forward declarations in following patches.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Use cpu_loop_exit_restore for tlb_fill
Richard Henderson [Thu, 18 May 2017 19:10:53 +0000 (12:10 -0700)]
target/s390x: Use cpu_loop_exit_restore for tlb_fill

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agotarget/s390x: Add support for the TEST BLOCK instruction
Thomas Huth [Thu, 18 May 2017 17:26:40 +0000 (19:26 +0200)]
target/s390x: Add support for the TEST BLOCK instruction

TEST BLOCK was likely once used to execute basic memory
tests, but nowadays it's just a (slow) way to clear a page.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1495128400-23759-1-git-send-email-thuth@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
7 years agoMerge remote-tracking branch 'remotes/xtensa/tags/20170606-xtensa' into staging
Peter Maydell [Tue, 6 Jun 2017 16:00:12 +0000 (17:00 +0100)]
Merge remote-tracking branch 'remotes/xtensa/tags/20170606-xtensa' into staging

target/xtensa fixes:

- fix read/write simcall mapping flags and return value;
- use -serial option to direct console output of sim machine to QEMU chardev;
- fix handling of unknown registers in the gdbstub.

# gpg: Signature made Tue 06 Jun 2017 11:46:05 BST
# gpg:                using RSA key 0x51F9CC91F83FA044
# gpg: Good signature from "Max Filippov <filippov@cadence.com>"
# gpg:                 aka "Max Filippov <max.filippov@cogentembedded.com>"
# gpg:                 aka "Max Filippov <jcmvbkbc@gmail.com>"
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044

* remotes/xtensa/tags/20170606-xtensa:
  target/xtensa: handle unknown registers in gdbstub
  target/xtensa: support output to chardev console
  target/xtensa: fix return value of read/write simcalls
  target/xtensa: fix mapping direction in read/write simcalls

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-misc-2017-06-06' into staging
Peter Maydell [Tue, 6 Jun 2017 14:37:53 +0000 (15:37 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2017-06-06' into staging

Miscellaneous patches for 2017-06-06

# gpg: Signature made Tue 06 Jun 2017 08:30:43 BST
# gpg:                using RSA key 0x3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-misc-2017-06-06:
  monitor: fix object_del for command-line-created objects
  tests: check-qom-proplist: add checks for cmdline-created objects
  virtio-scsi-test: Use scsi-hd instead of legacy scsi-disk
  block: Clarify documentation of BlockInfo member io-status

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.10-20170606' into staging
Peter Maydell [Tue, 6 Jun 2017 13:30:06 +0000 (14:30 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.10-20170606' into staging

ppc patch queue 2017-06-06

Accumulated patches for ppc targets and the pseries machine type.

The big thing in this batch is a start on a substantial cleanup of the
pseries hotplug mechanisms, which were pretty confusing.  For now
these shouldn't cause substantial behavioural changes, but I am hoping
these lead to clearer code and eventually to fixes for the bugs we
have in hotplug handling, particularly when hotplug and migration are
combined.

The remaining patches are mostly bugfixes.

# gpg: Signature made Tue 06 Jun 2017 03:48:50 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.10-20170606:
  spapr: Remove some non-useful properties on DRC objects
  spapr: Eliminate spapr_drc_get_type_str()
  spapr: Move configure-connector state into DRC
  spapr: Clean up spapr_dr_connector_by_*()
  spapr: Introduce DRC subclasses
  spapr/drc: don't migrate DRC of cold-plugged CPUs and LMBs
  spapr: Allow boot from vhost-*-scsi backends
  ppc/pnv: check the return value of fdt_setprop()
  spapr_nvram: Check return value from blk_getlength()
  target/ppc: Fixup set_spr error in h_register_process_table
  target-ppc: Fix openpic timer read register offset
  spapr: Make DRC get_index and get_type methods into plain functions
  spapr: Abolish DRC set_configured method
  spapr: Abolish DRC get_fdt method
  spapr: Move DRC RTAS calls into spapr_drc.c
  migration: Mark CPU states dirty before incoming migration/loadvm
  migration: remove register_savevm()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agotarget/xtensa: handle unknown registers in gdbstub
Max Filippov [Sat, 3 Jun 2017 09:11:13 +0000 (02:11 -0700)]
target/xtensa: handle unknown registers in gdbstub

Xtensa cores may have registers of types/sizes not supported by the
gdbstub accessors. Ignore writes to such registers and return zero on
read, but always return correct register size, so that gdb on the other
side is able to access all registers in the packet holding unsupported
registers in the middle. This fixes gdb interaction with cores that have
vector/custom TIE registers.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
7 years agotarget/xtensa: support output to chardev console
Max Filippov [Fri, 12 May 2017 18:09:14 +0000 (11:09 -0700)]
target/xtensa: support output to chardev console

In semihosting mode QEMU allows guest to read and write host file
descriptors directly, including descriptors 0..2, a.k.a. stdin, stdout
and stderr. Sometimes it's desirable to have semihosting console
controlled by -serial option, e.g. to connect it to network.

Add semihosting console to xtensa-semi.c, open it in the 'sim' machine
in the presence of -serial option and direct stdout and stderr to it
when it's present.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
7 years agotarget/xtensa: fix return value of read/write simcalls
Max Filippov [Fri, 12 May 2017 19:05:23 +0000 (12:05 -0700)]
target/xtensa: fix return value of read/write simcalls

Return value of read/write simcalls is not calculated correctly in case
of operations crossing page boundary and in case of short reads/writes.
Read and write simcalls should return the size of data actually
read/written or -1 in case of error.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
7 years agotarget/xtensa: fix mapping direction in read/write simcalls
Max Filippov [Fri, 12 May 2017 18:17:01 +0000 (11:17 -0700)]
target/xtensa: fix mapping direction in read/write simcalls

Read and write simcalls map physical memory to access I/O buffers, but
'read' simcall need to map it for writing and 'write' simcall need to
map it for reading, i.e. the opposite of what they do now. Fix that.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
7 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request...
Peter Maydell [Tue, 6 Jun 2017 09:00:34 +0000 (10:00 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging

x86 and machine queue, 2017-06-05

# gpg: Signature made Mon 05 Jun 2017 19:58:01 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-and-machine-pull-request:
  scripts: Test script to look for -device crashes
  qemu.py: Add QEMUMachine.exitcode() method
  qemu.py: Don't set _popen=None on error/shutdown
  spapr: cleanup spapr_fixup_cpu_numa_dt() usage
  numa: move numa_node from CPUState into target specific classes
  numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus() result
  numa: make sure that all cpus have has_node_id set if numa is enabled
  numa: move default mapping init to machine
  numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr
  pc: Use "min-[x]level" on compat_props

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agomonitor: fix object_del for command-line-created objects
Michael Roth [Sat, 3 Jun 2017 23:13:32 +0000 (18:13 -0500)]
monitor: fix object_del for command-line-created objects

Currently objects specified on the command-line are only partially
cleaned up when 'object_del' is issued in either HMP or QMP: the
object itself is fully finalized, but the QemuOpts are not removed.
This results in the following behavior:

  x86_64-softmmu/qemu-system-x86_64 -monitor stdio \
    -object memory-backend-ram,id=ram1,size=256M

  QEMU 2.7.91 monitor - type 'help' for more information
  (qemu) object_del ram1
  (qemu) object_del ram1
  object 'ram1' not found
  (qemu) object_add memory-backend-ram,id=ram1,size=256M
  Duplicate ID 'ram1' for object
  Try "help object_add" for more information

which can be an issue for use-cases like memory hotplug.

This happens on the HMP side because hmp_object_add() attempts to
create a temporary QemuOpts entry with ID 'ram1', which ends up
conflicting with the command-line-created entry, since it was never
cleaned up during the previous hmp_object_del() call.

We address this by adding a check in user_creatable_del(), which
is called by both qmp_object_del() and hmp_object_del() to handle
the actual object cleanup, to determine whether an option group entry
matching the object's ID is present and removing it if it is.

Note that qmp_object_add() never attempts to create a temporary
QemuOpts entry, so it does not encounter the duplicate ID error,
which is why this isn't generally visible in libvirt.

Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Daniel Berrange <berrange@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1496531612-22166-3-git-send-email-mdroth@linux.vnet.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agotests: check-qom-proplist: add checks for cmdline-created objects
Michael Roth [Sat, 3 Jun 2017 23:13:31 +0000 (18:13 -0500)]
tests: check-qom-proplist: add checks for cmdline-created objects

check-qom-proplist originally added tests for verifying that
object-creation helpers object_new_with_{props,propv} behaved in
similar fashion to the "traditional" method involving setting each
individual property separately after object creation rather than
via a single call.

Another similar "helper" for creating Objects exists in the form of
objects specified via -object command-line parameters. By that
rationale, we extend check-qom-proplist to include similar checks
for command-line-created objects by employing the same
qemu_opts_parse()-based parsing the vl.c employs.

This parser has a side-effect of parsing the object's options into
a QemuOpt structure and registering this in the global QemuOptsList
using the Object's ID. This can conflict with future Object instances
that attempt to use the same ID if we don't ensure this is cleaned
up as part of Object finalization, so we include a FIXME stub to test
for this case, which will then be resolved in a subsequent patch.

Suggested-by: Daniel Berrange <berrange@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Daniel Berrange <berrange@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1496531612-22166-2-git-send-email-mdroth@linux.vnet.ibm.com>
[Comment formatting tidied up]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agovirtio-scsi-test: Use scsi-hd instead of legacy scsi-disk
Markus Armbruster [Tue, 9 May 2017 10:56:02 +0000 (12:56 +0200)]
virtio-scsi-test: Use scsi-hd instead of legacy scsi-disk

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1494327362-30727-3-git-send-email-armbru@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>