OSDN Git Service

qmiga/qemu.git
8 years agocuda: port SET_TIME command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:14 +0000 (21:34 +0100)]
cuda: port SET_TIME command to new framework

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port GET_TIME command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:13 +0000 (21:34 +0100)]
cuda: port GET_TIME command to new framework

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port SET_POWER_MESSAGES command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:12 +0000 (21:34 +0100)]
cuda: port SET_POWER_MESSAGES command to new framework

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port FILE_SERVER_FLAG command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:11 +0000 (21:34 +0100)]
cuda: port FILE_SERVER_FLAG command to new framework

This command tells if computer should automatically wake-up after a power loss.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port RESET_SYSTEM command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:10 +0000 (21:34 +0100)]
cuda: port RESET_SYSTEM command to new framework

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port POWERDOWN command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:09 +0000 (21:34 +0100)]
cuda: port POWERDOWN command to new framework

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port SET_DEVICE_LIST command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:08 +0000 (21:34 +0100)]
cuda: port SET_DEVICE_LIST command to new framework

Also implement the command, by taking device list mask into account
when polling ADB devices.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port SET_AUTO_RATE command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:07 +0000 (21:34 +0100)]
cuda: port SET_AUTO_RATE command to new framework

Also implement the command, by removing the hardcoded period of 20 ms/50 Hz
and replacing it by the one requested by user.
Update VMState version to store this new parameter.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: port AUTOPOLL command to new framework
Hervé Poussineau [Sun, 7 Feb 2016 20:34:06 +0000 (21:34 +0100)]
cuda: port AUTOPOLL command to new framework

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: move unknown commands reject out of switch
Hervé Poussineau [Sun, 7 Feb 2016 20:34:05 +0000 (21:34 +0100)]
cuda: move unknown commands reject out of switch

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agocuda: add a framework to handle commands
Hervé Poussineau [Sun, 7 Feb 2016 20:34:04 +0000 (21:34 +0100)]
cuda: add a framework to handle commands

Next commits will port existing CUDA commands to this framework.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agohw/ppc/spapr: Implement the h_set_xdabr hypercall
Thomas Huth [Thu, 11 Feb 2016 12:47:20 +0000 (13:47 +0100)]
hw/ppc/spapr: Implement the h_set_xdabr hypercall

The H_SET_XDABR hypercall is similar to H_SET_DABR, but also sets
the extended DABR (DABRX) register.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agohw/ppc/spapr: Implement h_set_dabr
Thomas Huth [Thu, 11 Feb 2016 12:47:19 +0000 (13:47 +0100)]
hw/ppc/spapr: Implement h_set_dabr

According to LoPAPR, h_set_dabr should simply set DABRX to 3
(if the register is available), and load the parameter into DABR.
If DABRX is not available, the hypervisor has to check the
"Breakpoint Translation" bit of the DABR register first.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agohw/ppc/spapr: Add h_set_sprg0 hypercall
Thomas Huth [Thu, 11 Feb 2016 12:47:18 +0000 (13:47 +0100)]
hw/ppc/spapr: Add h_set_sprg0 hypercall

This is a very simple hypercall that only sets up the SPRG0
register for the guest (since writing to SPRG0 was only permitted
to the hypervisor in older versions of the PowerISA).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agomigration: ensure htab_save_first completes after timeout
David Gibson [Thu, 11 Feb 2016 00:40:44 +0000 (10:40 +1000)]
migration: ensure htab_save_first completes after timeout

htab_save_first_pass could return without finishing its work due to
timeout. The patch checks if another invocation of it is necessary and
will call it in htab_save_complete if necessary.

Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
[removed overlong line]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agotarget-ppc: Remove hack for ppc_hash64_load_hpte*() with HV KVM
David Gibson [Mon, 8 Feb 2016 23:30:21 +0000 (09:30 +1000)]
target-ppc: Remove hack for ppc_hash64_load_hpte*() with HV KVM

With HV KVM, the guest's hash page table (HPT) is managed by the kernel and
not directly accessible to QEMU.  This means that spapr->htab is NULL
and normally env->external_htab would also be NULL for each cpu.

However, that would cause ppc_hash64_load_hpte*() to do the wrong thing in
the few cases where QEMU does need to load entries from the in-kernel HPT.
Specifically, seeing external_htab is NULL, they would look for an HPT
within the guest's address space instead.

To stop that we have an ugly hack in the pseries machine type code to
set external htab to (void *)1 instead.

This patch removes that hack by having ppc_hash64_load_hpte*() explicitly
check kvmppc_kern_htab instead, which makes more sense.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Move hash page table allocation to reset time
David Gibson [Tue, 9 Feb 2016 00:21:56 +0000 (10:21 +1000)]
pseries: Move hash page table allocation to reset time

At the moment the size of the hash page table (HPT) is fixed based on the
maximum memory allowed to the guest.  As such, we allocate the table during
machine construction, and just clear it at reset.

However, we're planning to implement a PAPR extension allowing the hash
page table to be resized at runtime.  This will mean that on reset we want
to revert it to the default size.  It also means that when migrating, we
need to make sure the destination allocates an HPT of size matching the
host, since the guest could have changed it before the migration.

This patch replaces the spapr_alloc_htab() and spapr_reset_htab() functions
with a new spapr_reallocate_hpt() function.  This is called at reset and
inbound migration only, not during machine init any more.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Add helper to calculate recommended hash page table size
David Gibson [Tue, 9 Feb 2016 00:15:12 +0000 (10:15 +1000)]
pseries: Add helper to calculate recommended hash page table size

At present we calculate the recommended hash page table (HPT) size for a
pseries guest just once in ppc_spapr_init() before allocating the HPT.
In future patches we're going to want this calculation in other places, so
this splits it out into a helper function.  While we're at it, change the
calculation to use ctz() instead of an explicit loop.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agopseries: Simplify handling of the hash page table fd
David Gibson [Mon, 8 Feb 2016 23:28:58 +0000 (09:28 +1000)]
pseries: Simplify handling of the hash page table fd

When migrating the 'pseries' machine type with KVM, we use a special fd
to access the hash page table stored within KVM.  Usually, this fd is
opened at the beginning of migration, and kept open until the migration
is complete.

However, if there is a guest reset during the migration, the fd can become
stale and we need to re-open it.  At the moment we use an 'htab_fd_stale'
flag in sPAPRMachineState to signal this, which is checked in the migration
iterators.

But that's rather ugly.  It's simpler to just close and invalidate the
fd on reset, and lazily re-open it in migration if necessary.  This patch
implements that change.

This requires a small addition to the machine state's instance_init,
so that htab_fd is initialized to -1 (telling the migration code it
needs to open it) instead of 0, which could be a valid fd.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agotarget-ppc: Include missing MMU models for SDR1 in info registers
David Gibson [Mon, 8 Feb 2016 23:28:43 +0000 (09:28 +1000)]
target-ppc: Include missing MMU models for SDR1 in info registers

The HMP command "info registers" produces somewhat different information on
different ppc cpu variants.  For those with a hash MMU it's supposed to
include the SDR1, DAR and DSISR registers related to the MMU.  However,
the switch is missing a couple of MMU model variants, meaning we will
miss out this information on certain CPUs which should have it.

This patch corrects the oversight.  (Really these MMU model IDs need a big
cleanup, but we might as well fix the bug in the interim).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agotarget-ppc: Remove unused kvmppc_update_sdr1() stub
David Gibson [Mon, 8 Feb 2016 23:28:25 +0000 (09:28 +1000)]
target-ppc: Remove unused kvmppc_update_sdr1() stub

This KVM stub implementation isn't used anywhere.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
8 years agohw: fix some debug message format strings
Alyssa Milburn [Thu, 4 Feb 2016 18:40:57 +0000 (18:40 +0000)]
hw: fix some debug message format strings

Signed-off-by: Alyssa Milburn <fuzzie@fuzzie.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Tue, 16 Feb 2016 17:31:56 +0000 (17:31 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* Coverity fixes for IPMI and mptsas
* qemu-char fixes from Daniel and Marc-André
* Bug fixes that break qemu-iotests
* Changes to fix reset from panicked state
* checkpatch false positives for designated initializers
* TLS support in the NBD servers and clients

# gpg: Signature made Tue 16 Feb 2016 16:27:17 GMT using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"

* remotes/bonzini/tags/for-upstream: (28 commits)
  nbd: enable use of TLS with nbd-server-start command
  nbd: enable use of TLS with qemu-nbd server
  nbd: enable use of TLS with NBD block driver
  nbd: implement TLS support in the protocol negotiation
  nbd: use "" as a default export name if none provided
  nbd: always query export list in fixed new style protocol
  nbd: allow setting of an export name for qemu-nbd server
  nbd: make client request fixed new style if advertised
  nbd: make server compliant with fixed newstyle spec
  nbd: invert client logic for negotiating protocol version
  nbd: convert to using I/O channels for actual socket I/O
  nbd: convert blockdev NBD server to use I/O channels for connection setup
  nbd: convert qemu-nbd server to use I/O channels for connection setup
  nbd: convert block client to use I/O channels for connection setup
  qemu-nbd: add support for --object command line arg
  qom: add helpers for UserCreatable object types
  ipmi: sensor number should not exceed MAX_SENSORS
  mptsas: fix wrong formula
  mptsas: fix memory leak
  mptsas: add missing va_end
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agonbd: enable use of TLS with nbd-server-start command
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:14 +0000 (18:41 +0000)]
nbd: enable use of TLS with nbd-server-start command

This modifies the nbd-server-start QMP command so that it
is possible to request use of TLS. This is done by adding
a new optional parameter "tls-creds" which provides the ID
of a previously created QCryptoTLSCreds object instance.

TLS is only supported when using an IPv4/IPv6 socket listener.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-17-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: enable use of TLS with qemu-nbd server
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:13 +0000 (18:41 +0000)]
nbd: enable use of TLS with qemu-nbd server

This modifies the qemu-nbd program so that it is possible to
request the use of TLS with the server. It simply adds a new
command line option --tls-creds which is used to provide the
ID of a QCryptoTLSCreds object previously created via the
--object command line option.

For example

  qemu-nbd --object tls-creds-x509,id=tls0,endpoint=server,\
                    dir=/home/berrange/security/qemutls \
           --tls-creds tls0 \
           --exportname default

TLS requires the new style NBD protocol, so if no export name
is set (via --export-name), then we use the default NBD protocol
export name ""

TLS is only supported when using an IPv4/IPv6 socket listener.
It is not possible to use with UNIX sockets, which includes
when connecting the NBD server to a host device.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-16-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: enable use of TLS with NBD block driver
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:12 +0000 (18:41 +0000)]
nbd: enable use of TLS with NBD block driver

This modifies the NBD driver so that it is possible to request
use of TLS. This is done by providing the 'tls-creds' parameter
with the ID of a previously created QCryptoTLSCreds object.

For example

  $QEMU -object tls-creds-x509,id=tls0,endpoint=client,\
                dir=/home/berrange/security/qemutls \
        -drive driver=nbd,host=localhost,port=9000,tls-creds=tls0

The client will drop the connection if the NBD server does not
provide TLS.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-15-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: implement TLS support in the protocol negotiation
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:11 +0000 (18:41 +0000)]
nbd: implement TLS support in the protocol negotiation

This extends the NBD protocol handling code so that it is capable
of negotiating TLS support during the connection setup. This involves
requesting the STARTTLS protocol option before any other NBD options.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-14-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: use "" as a default export name if none provided
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:10 +0000 (18:41 +0000)]
nbd: use "" as a default export name if none provided

If the user does not provide an export name and the server
is running the new style protocol, where export names are
mandatory, use "" as the default export name if the user
has not specified any. "" is defined in the NBD protocol
as the default name to use in such scenarios.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-13-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: always query export list in fixed new style protocol
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:09 +0000 (18:41 +0000)]
nbd: always query export list in fixed new style protocol

With the new style protocol, the NBD client will currenetly
send NBD_OPT_EXPORT_NAME as the first (and indeed only)
option it wants. The problem is that the NBD protocol spec
does not allow for returning an error message with the
NBD_OPT_EXPORT_NAME option. So if the server mandates use
of TLS, the client will simply see an immediate connection
close after issuing NBD_OPT_EXPORT_NAME which is not user
friendly.

To improve this situation, if we have the fixed new style
protocol, we can sent NBD_OPT_LIST as the first option
to query the list of server exports. We can check for our
named export in this list and raise an error if it is not
found, instead of going ahead and sending NBD_OPT_EXPORT_NAME
with a name that we know will be rejected.

This improves the error reporting both in the case that the
server required TLS, and in the case that the client requested
export name does not exist on the server.

If the server does not support NBD_OPT_LIST, we just ignore
that and carry on with NBD_OPT_EXPORT_NAME as before.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-12-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: allow setting of an export name for qemu-nbd server
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:08 +0000 (18:41 +0000)]
nbd: allow setting of an export name for qemu-nbd server

The qemu-nbd server currently always uses the old style protocol
since it never sets any export name. This is a problem because
future TLS support will require use of the new style protocol
negotiation.

This adds "--exportname NAME" / "-x NAME" arguments to qemu-nbd
which allow the user to set an explicit export name. When an
export name is set the server will always use the new style
NBD protocol.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-11-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: make client request fixed new style if advertised
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:07 +0000 (18:41 +0000)]
nbd: make client request fixed new style if advertised

If the server advertises support for the fixed new style
negotiation, the client should in turn enable new style.
This will allow the client to negotiate further NBD
options besides the export name.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-10-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: make server compliant with fixed newstyle spec
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:06 +0000 (18:41 +0000)]
nbd: make server compliant with fixed newstyle spec

If the client does not request the fixed new style protocol,
then we should only accept NBD_OPT_EXPORT_NAME. All other
options are only valid when fixed new style has been activated.

The qemu-nbd client doesn't currently request fixed new style
protocol, but this change won't break qemu-nbd, because it
fortunately only ever uses NBD_OPT_EXPORT_NAME, so was never
triggering the non-compliant server behaviour.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-9-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: invert client logic for negotiating protocol version
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:05 +0000 (18:41 +0000)]
nbd: invert client logic for negotiating protocol version

The nbd_receive_negotiate() method takes different code
paths based on whether 'name == NULL', and then checks
the expected protocol version in each branch.

This patch inverts the logic, so that it takes different
code paths based on what protocol version it receives and
then checks if name is NULL or not as needed.

This facilitates later code which allows the client to
be capable of using the new style protocol regardless
of whether an export name is listed or not.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-8-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: convert to using I/O channels for actual socket I/O
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:04 +0000 (18:41 +0000)]
nbd: convert to using I/O channels for actual socket I/O

Now that all callers are converted to use I/O channels for
initial connection setup, it is possible to switch the core
NBD protocol handling core over to use QIOChannel APIs for
actual sockets I/O.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-7-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: convert blockdev NBD server to use I/O channels for connection setup
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:03 +0000 (18:41 +0000)]
nbd: convert blockdev NBD server to use I/O channels for connection setup

This converts the blockdev NBD server to use the QIOChannelSocket
class for initial listener socket setup and accepting of client
connections. Actual I/O is still being performed against the
socket file descriptor using the POSIX socket APIs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-6-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: convert qemu-nbd server to use I/O channels for connection setup
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:02 +0000 (18:41 +0000)]
nbd: convert qemu-nbd server to use I/O channels for connection setup

This converts the qemu-nbd server to use the QIOChannelSocket
class for initial listener socket setup and accepting of client
connections. Actual I/O is still being performed against the
socket file descriptor using the POSIX socket APIs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-5-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agonbd: convert block client to use I/O channels for connection setup
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:01 +0000 (18:41 +0000)]
nbd: convert block client to use I/O channels for connection setup

This converts the NBD block driver client to use the QIOChannelSocket
class for initial connection setup. The NbdClientSession struct has
two pointers, one to the master QIOChannelSocket providing the raw
data channel, and one to a QIOChannel which is the current channel
used for I/O. Initially the two point to the same object, but when
TLS support is added, they will point to different objects.

The qemu-img & qemu-io tools now need to use MODULE_INIT_QOM to
ensure the QIOChannel object classes are registered. The qemu-nbd
tool already did this.

In this initial conversion though, all I/O is still actually done
using the raw POSIX sockets APIs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-4-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-nbd: add support for --object command line arg
Daniel P. Berrange [Wed, 10 Feb 2016 18:41:00 +0000 (18:41 +0000)]
qemu-nbd: add support for --object command line arg

Allow creation of user creatable object types with qemu-nbd
via a new --object command line arg. This will be used to supply
passwords and/or encryption keys to the various block driver
backends via the recently added 'secret' object type.

 # printf letmein > mypasswd.txt
 # qemu-nbd --object secret,id=sec0,file=mypasswd.txt \
      ...other nbd args...

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-3-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqom: add helpers for UserCreatable object types
Daniel P. Berrange [Wed, 10 Feb 2016 18:40:59 +0000 (18:40 +0000)]
qom: add helpers for UserCreatable object types

The QMP monitor code has two helper methods object_add
and qmp_object_del that are called from several places
in the code (QMP, HMP and main emulator startup).

The HMP and main emulator startup code also share
further logic that extracts the qom-type & id
values from a qdict.

We soon need to use this logic from qemu-img, qemu-io
and qemu-nbd too, but don't want those to depend on
the monitor, nor do we want to duplicate the code.

To avoid this, move some code out of qmp.c and hmp.c
adding new methods to qom/object_interfaces.c

 - user_creatable_add - takes a QDict holding a full
   object definition & instantiates it
 - user_creatable_add_type - takes an ID, type name,
   and QDict holding object properties & instantiates
   it
 - user_creatable_add_opts - takes a QemuOpts holding
   a full object definition & instantiates it
 - user_creatable_add_opts_foreach - variant on
   user_creatable_add_opts which can be directly used
   in conjunction with qemu_opts_foreach.
 - user_creatable_del - takes an ID and deletes the
   corresponding object

The existing code is updated to use these new methods.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-2-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/berrange/tags/pull-io-next-2016-02-16-1' into...
Peter Maydell [Tue, 16 Feb 2016 15:47:35 +0000 (15:47 +0000)]
Merge remote-tracking branch 'remotes/berrange/tags/pull-io-next-2016-02-16-1' into staging

Merge I/O fixes 2016/02/16 v1

# gpg: Signature made Tue 16 Feb 2016 15:42:29 GMT using RSA key ID 15104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"

* remotes/berrange/tags/pull-io-next-2016-02-16-1:
  io: convert QIOChannelBuffer to use uint8_t instead of char
  io: introduce helper for creating channels from file descriptors
  io: improve docs for QIOChannelSocket async functions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoipmi: sensor number should not exceed MAX_SENSORS
Cédric Le Goater [Tue, 16 Feb 2016 08:05:44 +0000 (09:05 +0100)]
ipmi: sensor number should not exceed MAX_SENSORS

Fix a number of off-by-ones, one of them spotted by Coverity.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomptsas: fix wrong formula
Paolo Bonzini [Tue, 16 Feb 2016 07:49:15 +0000 (08:49 +0100)]
mptsas: fix wrong formula

MPI_DOORBELL_WHO_INIT_SHIFT is being repeated twice.  Reported
by Coverity.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomptsas: fix memory leak
Paolo Bonzini [Tue, 16 Feb 2016 07:41:52 +0000 (08:41 +0100)]
mptsas: fix memory leak

Reported by Coverity.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomptsas: add missing va_end
Paolo Bonzini [Tue, 16 Feb 2016 07:35:49 +0000 (08:35 +0100)]
mptsas: add missing va_end

Reported by Coverity.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomigration: fix incorrect memory_global_dirty_log_start outside BQL
Paolo Bonzini [Mon, 15 Feb 2016 18:57:57 +0000 (19:57 +0100)]
migration: fix incorrect memory_global_dirty_log_start outside BQL

This can cause various segmentation faults or aborts in qemu-iotests
test 091.

Fixes: 5b82b703b69acc67b78b98a5efc897a3912719eb
Cc: Dave Gilbert <dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agooslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h
Peter Maydell [Mon, 8 Feb 2016 19:08:10 +0000 (19:08 +0000)]
oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h

The right place for "work around issues with system headers" code
is osdep.h. Move the workaround for OSX's stdlib.h emitting a
deprecation warning for daemon() to that header.

This also fixes a problem where running clean-includes on
oslib-posix.c would erroneously remove the #include <stdlib.h>
from it, breaking the workaround.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoall: Clean up includes
Peter Maydell [Mon, 8 Feb 2016 19:01:23 +0000 (19:01 +0000)]
all: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoscripts/tracetool: Include qemu/osdep.h in generated .c files
Peter Maydell [Mon, 8 Feb 2016 18:53:31 +0000 (18:53 +0000)]
scripts/tracetool: Include qemu/osdep.h in generated .c files

Include qemu/osdep.h as the first include in generated .c files,
so they don't implicitly rely on some other included header
to pull it in.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoscripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h
Peter Maydell [Mon, 8 Feb 2016 19:17:08 +0000 (19:17 +0000)]
scripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h

In the .c files generated by this script, include qemu/osdep.h
as the first included header, not config.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoqapi: Clean up includes in generated files
Eric Blake [Mon, 8 Feb 2016 15:36:46 +0000 (08:36 -0700)]
qapi: Clean up includes in generated files

As a followup to commit cbf2115, clean up the includes in files
generated by QAPI so that osdep.h is included first in .c files,
and headers which it implies are not included manually.  This
patch is done manually, since Coccinelle (and therefore
scripts/clean-includes) doesn't see into the generator scripts.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agotests: Clean up includes
Peter Maydell [Mon, 8 Feb 2016 18:08:51 +0000 (18:08 +0000)]
tests: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
8 years agotests/i440fx-test: Don't define ARRAY_SIZE locally
Peter Maydell [Mon, 8 Feb 2016 18:37:01 +0000 (18:37 +0000)]
tests/i440fx-test: Don't define ARRAY_SIZE locally

Don't define ARRAY_SIZE locally; instead include osdep.h for it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agolibdecnumber: Clean up includes
Peter Maydell [Tue, 9 Feb 2016 11:02:46 +0000 (11:02 +0000)]
libdecnumber: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agocris: Clean up includes
Peter Maydell [Tue, 9 Feb 2016 10:55:48 +0000 (10:55 +0000)]
cris: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agotarget-cris: Remove unnecessary ifdef from mmu.c
Peter Maydell [Tue, 9 Feb 2016 10:54:10 +0000 (10:54 +0000)]
target-cris: Remove unnecessary ifdef from mmu.c

mmu.c is only built for CONFIG_SOFTMMU targets, so there is
no need to redundantly surround the whole file contents with
an #ifndef CONFIG_USER_ONLY. The ifdef also confuses the
Coccinelle tool.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agohw/block/nand.c: Include osdep.h first
Peter Maydell [Mon, 8 Feb 2016 19:11:45 +0000 (19:11 +0000)]
hw/block/nand.c: Include osdep.h first

Include osdep.h as the first header in nand.c; this has to be
done manually because coccinelle gets confused by the way that
this C file includes itself.

We fix some odd spacing in #includes while we are in the area.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agobuild: Don't redefine 'inline'
Eric Blake [Tue, 9 Feb 2016 18:49:48 +0000 (11:49 -0700)]
build: Don't redefine 'inline'

Actively redefining 'inline' is wrong for C++, where gcc has an
extension 'inline namespace' which fails to compile if the
keyword 'inline' is replaced by a macro expansion.  This will
matter once we start to include "qemu/osdep.h" first from C++
files, depending also on whether the system headers are new
enough to be using the gcc extension.

But rather than just guard things by __cplusplus, let's look at
the overall picture.  Commit df2542c737ea2 in 2007 defined 'inline'
to the gcc attribute __always_inline__, with the rationale "To
avoid discarded inlining bug".  But compilers have improved since
then, and we are probably better off trusting the compiler rather
than trying to force its hand.

So just nuke our craziness.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1455043788-28112-1-git-send-email-eblake@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agovl: fix migration from prelaunch state
Paolo Bonzini [Mon, 15 Feb 2016 18:40:04 +0000 (19:40 +0100)]
vl: fix migration from prelaunch state

Reproducer is simply to migrate a virtual machine that was started with -S,
or that was already migrated.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agovl: change QEMU state machine for system reset
Denis V. Lunev [Sat, 13 Feb 2016 13:26:26 +0000 (16:26 +0300)]
vl: change QEMU state machine for system reset

This patch implements proposal from Paolo to handle system reset when
the guest is not running.

"After a reset, main_loop_should_exit should actually transition
to VM_STATE_PRELAUNCH (*not* RUN_STATE_PAUSED) for *all* states except
RUN_STATE_INMIGRATE, RUN_STATE_SAVE_VM (which I think cannot happen
there) and (of course) RUN_STATE_RUNNING."

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1455369986-20353-1-git-send-email-den@openvz.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agobuild: Don't redefine 'inline'
Eric Blake [Tue, 9 Feb 2016 18:49:48 +0000 (11:49 -0700)]
build: Don't redefine 'inline'

Actively redefining 'inline' is wrong for C++, where gcc has an
extension 'inline namespace' which fails to compile if the
keyword 'inline' is replaced by a macro expansion.  This will
matter once we start to include "qemu/osdep.h" first from C++
files, depending also on whether the system headers are new
enough to be using the gcc extension.

But rather than just guard things by __cplusplus, let's look at
the overall picture.  Commit df2542c737ea2 in 2007 defined 'inline'
to the gcc attribute __always_inline__, with the rationale "To
avoid discarded inlining bug".  But compilers have improved since
then, and we are probably better off trusting the compiler rather
than trying to force its hand.

So just nuke our craziness.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1455043788-28112-1-git-send-email-eblake@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agochar: fix handling of QIO_CHANNEL_ERR_BLOCK
Daniel P. Berrange [Fri, 12 Feb 2016 14:46:50 +0000 (14:46 +0000)]
char: fix handling of QIO_CHANNEL_ERR_BLOCK

If io_channel_send_full gets QIO_CHANNEL_ERR_BLOCK it
and has already sent some of the data, it should return
that amount of data, not EAGAIN, as that would cause
the caller to re-try already sent data.

Unfortunately due to a previous rebase conflict resolution
error, the code for dealing with this was in the wrong
part of the conditional, and so mistakenly ran on other
I/O errors.

This be seen running

   qemu-system-x86_64 -monitor stdio

and entering 'info mtree', when running on a slow console
(eg a slow remote ssh session). The monitor would get into
an indefinite loop writing the same data until it managed
to send it all without getting EAGAIN.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455288410-27046-1-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoRevert "qemu-char: Keep pty slave file descriptor open until the master is closed"
Paolo Bonzini [Fri, 12 Feb 2016 15:05:10 +0000 (16:05 +0100)]
Revert "qemu-char: Keep pty slave file descriptor open until the master is closed"

This reverts commit 34689e206abddac87a5217d458534e24f2a05562.

Marc-André Lureau provided the following commentary: "It looks like if
a the slave is opened, then Linux will buffer the master writes, up to
a few kb and then throttle, so it's not entirely blocked but eventually
the guest VM dies.  However, not having any slave open it will simply let
the write go and discard the data.  At least, virt-install configures
a pty for the serial but viewers like virt-manager do not necessarily
open it.  And, if there are no viewers, it will just hang.  If qemu
starts reading all the data from the slave, I don't think interactions
with other slaves will work. I don't see much options but to close the
slave, thus reverting this patch."

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agocheckpatch: Eliminate false positive in case of space before square bracket in a...
Leonid Bloch [Thu, 29 Oct 2015 09:48:38 +0000 (11:48 +0200)]
checkpatch: Eliminate false positive in case of space before square bracket in a definition

Now, macro definition such as "#define abc(x) [x] = y" should pass
without an error.

Signed-off-by: Leonid Bloch <leonid@daynix.com>
Message-Id: <1446112118-12376-3-git-send-email-leonid@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agocheckpatch: Eliminate false positive in case of comma-space-square bracket
Leonid Bloch [Thu, 29 Oct 2015 09:48:37 +0000 (11:48 +0200)]
checkpatch: Eliminate false positive in case of comma-space-square bracket

Previously, an error was printed in cases such as:
{ [1] = 5, [2] = 6 }
The space passed OK after a curly brace, but not after a comma.
Now, a space before a square bracket is allowed, if a comma comes before
it.

Signed-off-by: Leonid Bloch <leonid@daynix.com>
Message-Id: <1446112118-12376-2-git-send-email-leonid@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoio: convert QIOChannelBuffer to use uint8_t instead of char
Daniel P. Berrange [Fri, 12 Feb 2016 16:45:31 +0000 (16:45 +0000)]
io: convert QIOChannelBuffer to use uint8_t instead of char

The QIOChannelBuffer struct uses a 'char *' for its data
buffer. It will give simpler type compatibility with the
migration APIs if it uses 'uint8_t *' instead, avoiding
several casts.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoio: introduce helper for creating channels from file descriptors
Daniel P. Berrange [Wed, 3 Feb 2016 14:00:28 +0000 (14:00 +0000)]
io: introduce helper for creating channels from file descriptors

Depending on what object a file descriptor refers to a different
type of IO channel will be needed - either a QIOChannelFile or
a QIOChannelSocket. Introduce a qio_channel_new_fd() method
which will return the appropriate channel implementation.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoio: improve docs for QIOChannelSocket async functions
Daniel P. Berrange [Wed, 3 Feb 2016 13:47:36 +0000 (13:47 +0000)]
io: improve docs for QIOChannelSocket async functions

In the docs for qio_channel_socket_connect_async,
qio_channel_socket_listen_async and
qio_channel_socket_dgram_async, mention that the
SocketAddress parameters are copied, so can be freed
immediately.

Reviewed-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-i386-20160215' into staging
Peter Maydell [Mon, 15 Feb 2016 11:45:11 +0000 (11:45 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-i386-20160215' into staging

Add XSAVE, MPX, FSGSBASE.

# gpg: Signature made Mon 15 Feb 2016 11:21:50 GMT using RSA key ID 4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"

* remotes/rth/tags/pull-i386-20160215:
  target-i386: Implement FSGSBASE
  target-i386: Enable CR4/XCR0 features for user-mode
  target-i386: Clear bndregs during legacy near jumps
  target-i386: Implement BNDLDX, BNDSTX
  target-i386: Update BNDSTATUS for exceptions raised by BOUND
  target-i386: Implement BNDCL, BNDCU, BNDCN
  target-i386: Implement BNDMOV
  target-i386: Implement BNDMK
  target-i386: Split up gen_lea_modrm
  target-i386: Perform set/reset_inhibit_irq inline
  target-i386: Enable control registers for MPX
  target-i386: Implement XSAVEOPT
  target-i386: Add XSAVE extension
  target-i386: Rearrange processing of 0F AE
  target-i386: Rearrange processing of 0F 01
  target-i386: Split fxsave/fxrstor implementation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-i386: Implement FSGSBASE
Richard Henderson [Wed, 18 Nov 2015 11:55:47 +0000 (12:55 +0100)]
target-i386: Implement FSGSBASE

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Enable CR4/XCR0 features for user-mode
Richard Henderson [Tue, 7 Jul 2015 15:13:10 +0000 (16:13 +0100)]
target-i386: Enable CR4/XCR0 features for user-mode

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Clear bndregs during legacy near jumps
Richard Henderson [Tue, 7 Jul 2015 13:38:58 +0000 (14:38 +0100)]
target-i386: Clear bndregs during legacy near jumps

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Implement BNDLDX, BNDSTX
Richard Henderson [Tue, 7 Jul 2015 13:08:41 +0000 (14:08 +0100)]
target-i386: Implement BNDLDX, BNDSTX

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Update BNDSTATUS for exceptions raised by BOUND
Richard Henderson [Mon, 6 Jul 2015 18:37:40 +0000 (19:37 +0100)]
target-i386: Update BNDSTATUS for exceptions raised by BOUND

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Implement BNDCL, BNDCU, BNDCN
Richard Henderson [Mon, 6 Jul 2015 18:37:00 +0000 (19:37 +0100)]
target-i386: Implement BNDCL, BNDCU, BNDCN

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Implement BNDMOV
Richard Henderson [Mon, 6 Jul 2015 18:10:23 +0000 (19:10 +0100)]
target-i386: Implement BNDMOV

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Implement BNDMK
Richard Henderson [Thu, 9 Jul 2015 07:22:46 +0000 (08:22 +0100)]
target-i386: Implement BNDMK

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Split up gen_lea_modrm
Richard Henderson [Thu, 9 Jul 2015 07:22:01 +0000 (08:22 +0100)]
target-i386: Split up gen_lea_modrm

This is immediately usable by lea and multi-byte nop,
and will be required to implement parts of the mpx spec.

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Perform set/reset_inhibit_irq inline
Richard Henderson [Mon, 6 Jul 2015 16:29:59 +0000 (17:29 +0100)]
target-i386: Perform set/reset_inhibit_irq inline

With helpers that can be reused for other things.

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Enable control registers for MPX
Richard Henderson [Thu, 2 Jul 2015 14:57:14 +0000 (15:57 +0100)]
target-i386: Enable control registers for MPX

Enable and disable at CPL changes, MSR changes, and XRSTOR changes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Implement XSAVEOPT
Richard Henderson [Thu, 2 Jul 2015 14:21:23 +0000 (15:21 +0100)]
target-i386: Implement XSAVEOPT

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Add XSAVE extension
Richard Henderson [Thu, 2 Jul 2015 13:53:40 +0000 (14:53 +0100)]
target-i386: Add XSAVE extension

This includes XSAVE, XRSTOR, XGETBV, XSETBV, which are all related,
as well as the associate cpuid bits.

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Rearrange processing of 0F AE
Richard Henderson [Tue, 17 Nov 2015 14:08:57 +0000 (15:08 +0100)]
target-i386: Rearrange processing of 0F AE

Rather than nesting tests of OP, MOD, and RM, decode them all at once
with a switch.  Also, add some missing #UD checks for e.g. incorrect
LOCK prefix.

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Rearrange processing of 0F 01
Richard Henderson [Thu, 2 Jul 2015 12:59:21 +0000 (13:59 +0100)]
target-i386: Rearrange processing of 0F 01

Rather than nesting tests of OP, MOD, and RM, decode them
all at once with a switch.  Fixes incorrect decoding of
AMD Pacifica extensions (aka vmrun et al) via op==2 path.

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-i386: Split fxsave/fxrstor implementation
Richard Henderson [Wed, 1 Jul 2015 12:01:50 +0000 (13:01 +0100)]
target-i386: Split fxsave/fxrstor implementation

We will be able to reuse these pieces for XSAVE/XRSTOR.

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/xen-2016-02-12' into staging
Peter Maydell [Fri, 12 Feb 2016 17:36:12 +0000 (17:36 +0000)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-2016-02-12' into staging

Xen 2016-02-12

# gpg: Signature made Fri 12 Feb 2016 17:28:09 GMT using RSA key ID 70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"

* remotes/sstabellini/tags/xen-2016-02-12:
  xen: Drop __XEN_LATEST_INTERFACE_VERSION__ checks from prior to Xen 4.2
  xen: move xenforeignmemory compat layer into common place
  xen: drop XenXC and associated interface wrappers
  xen: drop xen_xc_hvm_inject_msi wrapper
  xen: drop support for Xen 4.1 and older.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-02-11' into...
Peter Maydell [Thu, 11 Feb 2016 15:09:33 +0000 (15:09 +0000)]
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-02-11' into staging

trivial patches for 2016-02-11

# gpg: Signature made Thu 11 Feb 2016 12:16:04 GMT 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-2016-02-11:
  w32: include winsock2.h before windows.h
  Adds keycode 86 to the hid_usage_keys translation table.
  s390x: remove s390-zipl.rom
  Passthru CCID card: QOMify
  Emulated CCID card: QOMify
  ES1370: QOMify
  char: fix parameter name / type in BSD codepath
  qmp-spec: fix index in doc
  rdma: remove check on time_spent when calculating mbs
  qemu-sockets: simplify error handling
  cpu: cpu_save/cpu_load is no more
  qom: Correct object_property_get_int() description
  man: virtfs-proxy-helper: Rework awkward sentence
  remove libtool support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging
Peter Maydell [Thu, 11 Feb 2016 13:02:28 +0000 (13:02 +0000)]
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging

# gpg: Signature made Wed 10 Feb 2016 19:23:29 GMT using RSA key ID AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"

* remotes/jnsnow/tags/ide-pull-request:
  ahci: prohibit "restarting" the FIS or CLB engines
  ahci: explicitly reject bad engine states on post_load
  ahci: handle LIST_ON and FIS_ON in map helpers
  ahci: Do not unmap NULL addresses
  fdc: always compile-check debug prints
  ide: fix device_reset to not ignore pending AIO
  ide: Add silent DRQ cancellation
  ide: replace blk_drain_all by blk_drain
  ide: move buffered DMA cancel to core
  ide: code motion
  ide: Prohibit RESET on IDE drives

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agow32: include winsock2.h before windows.h
Paolo Bonzini [Tue, 9 Feb 2016 14:16:57 +0000 (15:16 +0100)]
w32: include winsock2.h before windows.h

Recent Fedora complains while compiling ui/sdl.c:

    /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]

And with this patch we dutifully obey.

Stefan Weil:

Without that patch, windows.h will include winsock.h
(which conflicts with winsock2.h) when compiling sdl.c.

Normally we define WIN32_LEAN_AND_MEAN, and
windows.h won't include winsock.h.

include/ui/sdl2.h and ui/sdl.c undefine that macro,
so the order of the include files is important.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoAdds keycode 86 to the hid_usage_keys translation table.
Daniel Serpell [Thu, 4 Feb 2016 19:03:40 +0000 (16:03 -0300)]
Adds keycode 86 to the hid_usage_keys translation table.

This key is present in international keyboards, between left shift and
the 'Z' key, ant is described in the HID usage tables as "Keyboard
Non-US \ and |": http://www.usb.org/developers/hidpage/Hut1_12v2.pdf

This patch fixes the usb-kbd devices.

Signed-off-by: Daniel Serpell <daniel.serpell@gmail.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agos390x: remove s390-zipl.rom
Michael Tokarev [Wed, 10 Feb 2016 11:02:44 +0000 (14:02 +0300)]
s390x: remove s390-zipl.rom

This is an s390 boot rom which was used in s390-virtio machine.
but since commit 3538fb6f89dd9bb2e7e59de2bfad52a45321c744
"s390x: remove s390-virtio machine", this file isn't used.
The only place it is referenced in the code is an unused
define ZIPL_FILENAME.  There's also comment in hw/s390/ipl.c
which I'm modifying too, to refer to s390-ccw.img instead.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agoPassthru CCID card: QOMify
Cao jin [Wed, 3 Feb 2016 02:36:35 +0000 (10:36 +0800)]
Passthru CCID card: QOMify

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoEmulated CCID card: QOMify
Cao jin [Wed, 3 Feb 2016 02:36:34 +0000 (10:36 +0800)]
Emulated CCID card: QOMify

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoES1370: QOMify
Cao jin [Mon, 1 Feb 2016 07:57:35 +0000 (15:57 +0800)]
ES1370: QOMify

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agochar: fix parameter name / type in BSD codepath
Daniel P. Berrange [Fri, 22 Jan 2016 17:35:25 +0000 (17:35 +0000)]
char: fix parameter name / type in BSD codepath

The BSD impl of qemu_chr_open_pp_fd had mis-declared
its parameter type as ChardevBackend instead of
ChardevCommon. It had also mistakenly used the variable
name 'common' instead of 'backend'.

Tested-by: Sean Bruno <sbruno@freebsd.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoqmp-spec: fix index in doc
Wei Yang [Sun, 24 Jan 2016 14:09:58 +0000 (14:09 +0000)]
qmp-spec: fix index in doc

The index is duplicated. Just change it.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agordma: remove check on time_spent when calculating mbs
Wei Yang [Sun, 24 Jan 2016 14:09:57 +0000 (14:09 +0000)]
rdma: remove check on time_spent when calculating mbs

Within the if statement, time_spent is assured to be non-zero.

This patch just removes the check on time_spent when calculating mbs.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoqemu-sockets: simplify error handling
Paolo Bonzini [Fri, 22 Jan 2016 11:28:33 +0000 (12:28 +0100)]
qemu-sockets: simplify error handling

Just go always through the err label.  (Noticed because Coverity
complains that peer is always non-NULL in the error cleanup code,
but removing the "if" is arguably more prone to introducing the
opposite bug in the future).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agocpu: cpu_save/cpu_load is no more
Paolo Bonzini [Tue, 19 Jan 2016 12:08:28 +0000 (13:08 +0100)]
cpu: cpu_save/cpu_load is no more

Everything has been converted to vmstate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoqom: Correct object_property_get_int() description
Alistair Francis [Mon, 18 Jan 2016 18:42:01 +0000 (10:42 -0800)]
qom: Correct object_property_get_int() description

The description of object_property_get_int() stated that on an error
it returns NULL. This is not the case and the function will return -1
if an error occurs. Update the commented documentation accordingly.

Reported-By: Christian Liebhardt <christian.liebhardt@keysight.com>
Signed-off-by: Christian Liebhardt <christian.liebhardt@keysight.com>
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoman: virtfs-proxy-helper: Rework awkward sentence
Christophe Fergeau [Mon, 18 Jan 2016 09:51:19 +0000 (10:51 +0100)]
man: virtfs-proxy-helper: Rework awkward sentence

There was a 'capbilities' typo in this man page. This commit
reformulates the sentence the typo was in to make it easier to grasp.
This is based on a suggestion from Eric Blake.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>