]> Git Repo - qemu.git/log
qemu.git
7 years agoppc: spapr: use generic cpu_model parsing
Igor Mammedov [Mon, 9 Oct 2017 19:51:05 +0000 (21:51 +0200)]
ppc: spapr: use generic cpu_model parsing

use generic cpu_model parsing introduced by
 (6063d4c0f vl.c: convert cpu_model to cpu type and set of global properties before machine_init())

it allows to:
  * replace sPAPRMachineClass::tcg_default_cpu with
    MachineClass::default_cpu_type
  * drop cpu_parse_cpu_model() from hw/ppc/spapr.c and reuse
    one in vl.c
  * simplify spapr_get_cpu_core_type() by removing
    not needed anymore recurrsion since alias look up
    happens earlier at vl.c and spapr_get_cpu_core_type()
    works only with resulted from that cpu type.
  * spapr no more needs to parse/depend on being phased out
    MachineState::cpu_model, all tha parsing done by generic
    code and target specific callback.

Signed-off-by: Igor Mammedov <[email protected]>
[dwg: Correct minor compile error]
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: move ppc_cpu_lookup_alias() before its first user
Igor Mammedov [Mon, 9 Oct 2017 19:51:04 +0000 (21:51 +0200)]
ppc: move ppc_cpu_lookup_alias() before its first user

next commit will drop ppc_cpu_lookup_alias() declaration from header
and make it static which will break its last user ppc_cpu_class_by_name()
since ppc_cpu_class_by_name() defined before ppc_cpu_lookup_alias().

To avoid this move ppc_cpu_lookup_alias() right before
ppc_cpu_class_by_name().

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: spapr: use cpu model names as tcg defaults instead of aliases
Igor Mammedov [Mon, 9 Oct 2017 19:51:03 +0000 (21:51 +0200)]
ppc: spapr: use cpu model names as tcg defaults instead of aliases

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: spapr: register 'host' core type along with the rest of core types
Igor Mammedov [Mon, 9 Oct 2017 19:51:02 +0000 (21:51 +0200)]
ppc: spapr: register 'host' core type along with the rest of core types

consolidate 'host' core type registration by moving it from
KVM specific code into spapr_cpu_core.c, similar like it's
done in x86 target.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: spapr: use cpu type name directly
Igor Mammedov [Mon, 9 Oct 2017 19:51:01 +0000 (21:51 +0200)]
ppc: spapr: use cpu type name directly

replace sPAPRCPUCoreClass::cpu_class with cpu type name
since it were needed just to get that at points it were
accessed.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: spapr: define core types statically
Igor Mammedov [Mon, 9 Oct 2017 19:51:00 +0000 (21:51 +0200)]
ppc: spapr: define core types statically

spapr core type definition doesn't have any fields that
require it to be defined at runtime. So replace code
that fills in TypeInfo at runtime with static TypeInfo
array that does the same at complie time.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: move '-cpu foo,compat=xxx' parsing into ppc_cpu_parse_featurestr()
Igor Mammedov [Mon, 9 Oct 2017 19:50:59 +0000 (21:50 +0200)]
ppc: move '-cpu foo,compat=xxx' parsing into ppc_cpu_parse_featurestr()

there is a dedicated callback CPUClass::parse_features
which purpose is to convert -cpu features into a set of
global properties AND deal with compat/legacy features
that couldn't be directly translated into CPU's properties.

Create ppc variant of it (ppc_cpu_parse_featurestr) and
move 'compat=val' handling from spapr_cpu_core.c into it.
That removes a dependency of board/core code on cpu_model
parsing and would let to reuse common -cpu parsing
introduced by 6063d4c0

Set "max-cpu-compat" property only if it exists, in practice
it should limit 'compat' hack to spapr machine and allow
to avoid including machine/spapr headers in target/ppc/cpu.c

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: spapr: replace ppc_cpu_parse_features() with cpu_parse_cpu_model()
Igor Mammedov [Mon, 9 Oct 2017 19:50:58 +0000 (21:50 +0200)]
ppc: spapr: replace ppc_cpu_parse_features() with cpu_parse_cpu_model()

ppc_cpu_parse_features() is doing practically the same thing as
generic cpu_parse_cpu_model(). So remove duplicated impl. and
reuse generic one.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: 40p/prep: replace cpu_model with cpu_type
Igor Mammedov [Mon, 9 Oct 2017 19:50:57 +0000 (21:50 +0200)]
ppc: 40p/prep: replace cpu_model with cpu_type

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: virtex-ml507: replace cpu_model with cpu_type
Igor Mammedov [Mon, 9 Oct 2017 19:50:56 +0000 (21:50 +0200)]
ppc: virtex-ml507: replace cpu_model with cpu_type

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: replace cpu_model with cpu_type on ref405ep,taihu boards
Igor Mammedov [Mon, 9 Oct 2017 19:50:55 +0000 (21:50 +0200)]
ppc: replace cpu_model with cpu_type on ref405ep,taihu boards

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: bamboo: use generic cpu_model parsing
Igor Mammedov [Mon, 9 Oct 2017 19:50:54 +0000 (21:50 +0200)]
ppc: bamboo: use generic cpu_model parsing

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: mac_oldworld: use generic cpu_model parsing
Igor Mammedov [Mon, 9 Oct 2017 19:50:53 +0000 (21:50 +0200)]
ppc: mac_oldworld: use generic cpu_model parsing

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: mac_newworld: use generic cpu_model parsing
Igor Mammedov [Mon, 9 Oct 2017 19:50:52 +0000 (21:50 +0200)]
ppc: mac_newworld: use generic cpu_model parsing

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc: mpc8544ds/e500plat: use generic cpu_model parsing
Igor Mammedov [Mon, 9 Oct 2017 19:50:51 +0000 (21:50 +0200)]
ppc: mpc8544ds/e500plat: use generic cpu_model parsing

Signed-off-by: Igor Mammedov <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoqom: add helper macro DEFINE_TYPES()
Igor Mammedov [Mon, 9 Oct 2017 19:50:50 +0000 (21:50 +0200)]
qom: add helper macro DEFINE_TYPES()

DEFINE_TYPES() will help to simplify following routine patterns:

 static void foo_register_types(void)
 {
    type_register_static(&foo1_type_info);
    type_register_static(&foo2_type_info);
    ...
 }

 type_init(foo_register_types)

or

 static void foo_register_types(void)
 {
    int i;

    for (i = 0; i < ARRAY_SIZE(type_infos); i++) {
        type_register_static(&type_infos[i]);
    }
 }

 type_init(foo_register_types)

with a single line

 DEFINE_TYPES(type_infos)

where types have static definition which could be consolidated in
a single array of TypeInfo structures.
It saves us ~6-10LOC per use case and would help to replace
imperative foo_register_types() there with declarative style of
type registration.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoqom: introduce type_register_static_array()
Igor Mammedov [Mon, 9 Oct 2017 19:50:49 +0000 (21:50 +0200)]
qom: introduce type_register_static_array()

it will help to remove code duplication of registration
static types in places that have open coded loop to
perform batch type registering.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/ppc/spapr.c: abort unplug_request if previous unplug isn't done
Daniel Henrique Barboza [Mon, 9 Oct 2017 21:11:36 +0000 (18:11 -0300)]
hw/ppc/spapr.c: abort unplug_request if previous unplug isn't done

LMB removal is completed only when the spapr_lmb_release callback
is called after all DRCs of the dimm are detached. During this
time, it is possible that a unplug request for the same dimm
arrives, trying to detach DRCs that were detached by the guest
in the first unplug_request.

BQL doesn't help in this case - the lock will prevent any concurrent
removal from happening until the end of spapr_memory_unplug_request
only. What happens is that the second unplug_request ends up calling
spapr_drc_detach in a DRC that were detached already, causing an
assert error in spapr_drc_detach (e.g
https://bugs.launchpad.net/qemu/+bug/1718118).

spapr_lmb_release uses a structure called sPAPRDIMMState, stored in the
spapr->pending_dimm_unplugs QTAIL, to track how many LMB DRCs are left
to be detached by the guest. When there are no more DRCs left, this
structure is deleted and the pc-dimm unplug handler is called to
finish the process.

This patch reuses the sPAPRDIMMState to allow unplug_request to know
if there is an ongoing unplug process for a given dimm, aborting the
unplug request in this case, by doing the following changes:

- in spapr_lmb_release callback, move the dimm state removal to the
end, after pc-dimm unplug handler. With this change we can check for
the existence of the dimm state to see if the unplug process is
done.

- use spapr_pending_dimm_unplugs_find in spapr_memory_unplug_request
to check if the dimm state exists. If positive, there is an unplug
operation already in progress for this dimm, meaning that we should
abort it and warn the user about it.

Fixes: https://bugs.launchpad.net/qemu/+bug/1718118
Signed-off-by: Daniel Henrique Barboza <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc: Fix carry flag setting for shift algebraic instructions
Sandipan Das [Fri, 6 Oct 2017 06:42:44 +0000 (12:12 +0530)]
target/ppc: Fix carry flag setting for shift algebraic instructions

For POWER ISA v3.0, the XER bit CA32 needs to be set by the shift
right algebraic instructions whenever the CA bit is to be set. This
change affects the following instructions:
  * Shift Right Algebraic Word (sraw[.])
  * Shift Right Algebraic Word Immediate (srawi[.])
  * Shift Right Algebraic Doubleword (srad[.])
  * Shift Right Algebraic Doubleword Immediate (sradi[.])

Signed-off-by: Sandipan Das <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc: Add POWER9 DD2.0 model information
David Gibson [Fri, 6 Oct 2017 11:21:18 +0000 (22:21 +1100)]
target/ppc: Add POWER9 DD2.0 model information

At the moment the only POWER9 model which is listed in qemu is v1.0 (aka
"DD1").  This is a very early (read, buggy) version which will never be
released to the public - it was included in qemu only for the convenience
of those doing bringup on the early silicon.  For bonus points, we actually
had its PVR incorrect in the table (0x004e0000 instead of 0x004e0100).  We
also never actually implemented the differences in behaviour (read, bugs)
that marked DD1 in qemu.

Now that we know the PVR for the substantially better v2.0 (DD2) chip,
include it and make it the default POWER9 in qemu.  For the time being we
leave the DD1 definition in place for the poor souls (read, me) who still
need to work with DD1 hardware.

Signed-off-by: David Gibson <[email protected]>
7 years agospapr: sanity check size of the CAS buffer
Greg Kurz [Wed, 4 Oct 2017 09:02:31 +0000 (11:02 +0200)]
spapr: sanity check size of the CAS buffer

The CAS buffer is provided by SLOF. A broken SLOF could pass a silly
size: either smaller than the diff header, in which case the current
code will try to allocate 16 Exabytes of memory and g_malloc0() will
abort, or bigger than the maximum memory provisioned for SLOF (ie,
40 Megabytes), which doesn't make sense. Both cases indicate that
SLOF has a bug.

Let's print out an explicit error message and exit since rebooting as
we do with other errors would only result in a reset loop.

Signed-off-by: Greg Kurz <[email protected]>
[dwg: Fix format specifier that broke 32-bit builds]
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: fix OF word name in comment
Greg Kurz [Wed, 4 Oct 2017 08:43:18 +0000 (10:43 +0200)]
spapr: fix OF word name in comment

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc: Remove unused PPC 460 and 460F definitions
Thomas Huth [Tue, 3 Oct 2017 10:14:04 +0000 (12:14 +0200)]
target/ppc: Remove unused PPC 460 and 460F definitions

We don't have any 460 or 460F CPUs in QEMU, so the init functions
are just dead code. Let's simply remove them (translate_init.c
is already big enough without them).

Signed-off-by: Thomas Huth <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agohw/ppc: use 0 instead of fdt_path_offset(fdt, "/")
Greg Kurz [Tue, 3 Oct 2017 14:13:11 +0000 (16:13 +0200)]
hw/ppc: use 0 instead of fdt_path_offset(fdt, "/")

The offset of the root node is guaranteed to be 0.

This doesn't fix anything, it's just trivial cleanup of the two
remaining places where this was done under hw/ppc.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Daniel Henrique Barboza <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agomacio: add missing registers to VMStateDescription
Mark Cave-Ayland [Sat, 30 Sep 2017 16:49:35 +0000 (17:49 +0100)]
macio: add missing registers to VMStateDescription

Commit 4f7265f "ppc/ide/macio: Add missing registers" added two extra macio
registers but forgot to add them to the corresponding VMStateDescription.

The version number is bumped accordingly, although this will have little
effect given that the Mac machines are practically unmigratable.

Signed-off-by: Mark Cave-Ayland <[email protected]>
Acked-by: John Snow <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Mon, 16 Oct 2017 16:29:16 +0000 (17:29 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc, pci, virtio: fixes, features

A bunch of fixes all over the place.
A new vmcore device - the user interface around it is still somewhat
controversial, but I feel most of the code is fine, suggestions can be
addressed by adding patches on top.

Signed-off-by: Michael S. Tsirkin <[email protected]>
# gpg: Signature made Sun 15 Oct 2017 04:02:23 BST
# gpg:                using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <[email protected]>"
# gpg:                 aka "Michael S. Tsirkin <[email protected]>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream: (26 commits)
  tests/pxe: Test more NICs when running in SPEED=slow mode
  pc: remove useless hot_add_cpu initialisation
  isapc: Remove unnecessary migration compatibility code
  virtio-pci: Replace modern_as with direct access to modern_bar
  virtio: fix descriptor counting in virtqueue_pop
  hw/gen_pcie_root_port: make IO RO 0 on IO disabled
  pci: Validate interfaces on base_class_init
  xen/pt: Mark TYPE_XEN_PT_DEVICE as hybrid
  pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices
  pci: Add INTERFACE_PCIE_DEVICE to all PCIe devices
  pci: Add interface names to hybrid PCI devices
  pci: conventional-pci-device and pci-express-device interfaces
  PCI: PCIe access should always be little endian
  virtio/pci/migration: Convert to VMState
  hw/pci-bridge/pcie_pci_bridge: properly handle MSI unavailability case
  pci: allow 32-bit PCI IO accesses to pass through the PCI bridge
  virtio/vhost: reset dev->log after syncing
  MAINTAINERS: add Dump maintainers
  scripts/dump-guest-memory.py: add vmcoreinfo
  kdump: set vmcoreinfo location
  ...

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-10-14' into staging
Peter Maydell [Mon, 16 Oct 2017 14:54:42 +0000 (15:54 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-10-14' into staging

nbd patches for 2017-10-14

- Marc-André Lureau - NBD: use g_new() family of functions
- Vladimir Sementsov-Ogievskiy - first half of 00/13 nbd minimal structured read

# gpg: Signature made Sun 15 Oct 2017 01:38:47 BST
# gpg:                using RSA key 0xA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <[email protected]>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <[email protected]>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2017-10-14:
  nbd: header constants indenting
  nbd/server: simplify reply transmission
  nbd/server: refactor nbd_co_send_simple_reply parameters
  nbd/server: do not use NBDReply structure
  nbd/server: structurize simple reply header sending
  nbd: rename some simple-request related objects to be _simple_
  block/nbd-client: refactor nbd_co_receive_reply
  block/nbd-client: assert qiov len once in nbd_co_request
  NBD: use g_new() family of functions

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Mon, 16 Oct 2017 13:28:13 +0000 (14:28 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Fri 13 Oct 2017 14:49:22 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <[email protected]>"
# gpg:                 aka "Stefan Hajnoczi <[email protected]>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  block/throttle.c: add bdrv_co_drain_begin/end callbacks
  block: rename bdrv_co_drain to bdrv_co_drain_begin
  block: add bdrv_co_drain_end callback

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2017-10-04-3' into...
Peter Maydell [Mon, 16 Oct 2017 12:04:43 +0000 (13:04 +0100)]
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2017-10-04-3' into staging

Merge tpm 2017/10/04 v3

# gpg: Signature made Fri 13 Oct 2017 12:37:07 BST
# gpg:                using RSA key 0x75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2017-10-04-3:
  specs: Describe the TPM support in QEMU
  tpm: Move tpm_cleanup() to right place
  tpm: Added support for TPM emulator
  tpm-passthrough: move reusable code to utils
  tpm-backend: Move realloc_buffer() implementation to tpm-tis model
  tpm-backend: Add new API to read backend TpmInfo
  tpm-backend: Made few interface methods optional
  tpm-backend: Initialize and free data members in it's own methods
  tpm-backend: Move thread handling inside TPMBackend
  tpm-backend: Remove unneeded member variable from backend class
  tpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/elmarco/tags/vu-pull-request' into staging
Peter Maydell [Mon, 16 Oct 2017 09:22:39 +0000 (10:22 +0100)]
Merge remote-tracking branch 'remotes/elmarco/tags/vu-pull-request' into staging

# gpg: Signature made Thu 12 Oct 2017 21:52:28 BST
# gpg:                using RSA key 0xDAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <[email protected]>"
# gpg:                 aka "Marc-André Lureau <[email protected]>"
# 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: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/vu-pull-request:
  libvhost-user: Support VHOST_USER_SET_SLAVE_REQ_FD
  libvhost-user: Update and fix feature and request lists
  vhost-user-bridge: Only process received packets on started queues
  libvhost-user: vu_queue_started

Signed-off-by: Peter Maydell <[email protected]>
7 years agotests/pxe: Test more NICs when running in SPEED=slow mode
Thomas Huth [Wed, 20 Sep 2017 09:02:07 +0000 (11:02 +0200)]
tests/pxe: Test more NICs when running in SPEED=slow mode

The pxe-test is a very good test to excercise NICs, thus we should use
it to test all NICs that can be used by the BIOS for booting via network.
However, to avoid that the default testing time increases too much, the
additional NICs are only tested in the "make check SPEED=slow" mode.

The virtio-net NIC on ppc64 is now also only tested in slow mode, since
the test on ppc64 is really quite slow and we've got test coverage for
virtio-net in big endian mode now on s390x, too.

Signed-off-by: Thomas Huth <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopc: remove useless hot_add_cpu initialisation
Laurent Vivier [Tue, 10 Oct 2017 13:32:41 +0000 (15:32 +0200)]
pc: remove useless hot_add_cpu initialisation

Since 4458fb3a79 (pc: Eliminate pc_default_machine_options()),
hot_add_cpu is set in pc_machine_class_init(), so we don't
need to set it in pc_q35_machine_options(), pc_i440fx_machine_options()
and xenfv_machine_options(), except to clear it in
pc_i440fx_1_4_machine_opt().

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoisapc: Remove unnecessary migration compatibility code
Eduardo Habkost [Fri, 6 Oct 2017 13:25:02 +0000 (10:25 -0300)]
isapc: Remove unnecessary migration compatibility code

We don't touch isapc when we change guest ABI and add new entries
to PC_COMPAT_* or new PCMachineClass compat flags.  This means
isapc never guaranteed guest ABI and cross-QEMU-version live
migration compatibility.  There's no point in keeping code for
kvm-pv-eoi and APIC ID compatibility in pc_init_isa().

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovirtio-pci: Replace modern_as with direct access to modern_bar
Alexey Kardashevskiy [Mon, 9 Oct 2017 03:19:41 +0000 (14:19 +1100)]
virtio-pci: Replace modern_as with direct access to modern_bar

The modern bar is accessed now via yet another address space created just
for that purpose and it does not really need FlatView and dispatch tree
as it has a single memory region so it is just a waste of memory. Things
get even worse when there are dozens or hundreds of virtio-pci devices -
since these address spaces are global, changing any of them triggers
rebuilding all address spaces.

This replaces indirect accesses to the modern BAR with a simple lookup
and direct calls to memory_region_dispatch_read/write.

This is expected to save lots of memory at boot time after applying:
[Qemu-devel] [PULL 00/32] Misc changes for 2017-09-22

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovirtio: fix descriptor counting in virtqueue_pop
Wolfgang Bumiller [Wed, 20 Sep 2017 06:09:33 +0000 (08:09 +0200)]
virtio: fix descriptor counting in virtqueue_pop

While changing the s/g list allocation, commit 3b3b0628
also changed the descriptor counting to count iovec entries
as split by cpu_physical_memory_map(). Previously only the
actual descriptor entries were counted and the split into
the iovec happened afterwards in virtqueue_map().
Count the entries again instead to avoid erroneous
"Looped descriptor" errors.

Reported-by: Hans Middelhoek <[email protected]>
Link: https://forum.proxmox.com/threads/vm-crash-with-memory-hotplug.35904/
Fixes: 3b3b0628217e ("virtio: slim down allocation of VirtQueueElements")
Signed-off-by: Wolfgang Bumiller <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agohw/gen_pcie_root_port: make IO RO 0 on IO disabled
Marcel Apfelbaum [Mon, 2 Oct 2017 10:31:35 +0000 (13:31 +0300)]
hw/gen_pcie_root_port: make IO RO 0 on IO disabled

IO_LIMIT and IO_BASE registers should not be writable if
gen_pcie_root_port's io-reserve property is set to 0.
The COMMAND register should have the IO flag read only.

Signed-off-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: Validate interfaces on base_class_init
Eduardo Habkost [Wed, 27 Sep 2017 19:56:35 +0000 (16:56 -0300)]
pci: Validate interfaces on base_class_init

Make sure we don't forget to add the Conventional PCI or PCI
Express interface names on PCI device classes in the future.

Signed-off-by: Eduardo Habkost <[email protected]>
Revieed-by: David Gibson <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoxen/pt: Mark TYPE_XEN_PT_DEVICE as hybrid
Eduardo Habkost [Thu, 5 Oct 2017 12:45:07 +0000 (09:45 -0300)]
xen/pt: Mark TYPE_XEN_PT_DEVICE as hybrid

xen-pt doesn't set the is_express field, but is supposed to be
able to handle PCI Express devices too.  Mark it as hybrid.

Suggested-by: Jan Beulich <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices
Eduardo Habkost [Wed, 27 Sep 2017 19:56:34 +0000 (16:56 -0300)]
pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices

Add INTERFACE_CONVENTIONAL_PCI_DEVICE to all direct subtypes of
TYPE_PCI_DEVICE, except:

1) The ones that already have INTERFACE_PCIE_DEVICE set:

* base-xhci
* e1000e
* nvme
* pvscsi
* vfio-pci
* virtio-pci
* vmxnet3

2) base-pci-bridge

Not all PCI bridges are Conventional PCI devices, so
INTERFACE_CONVENTIONAL_PCI_DEVICE is added only to the subtypes
that are actually Conventional PCI:

* dec-21154-p2p-bridge
* i82801b11-bridge
* pbm-bridge
* pci-bridge

The direct subtypes of base-pci-bridge not touched by this patch
are:

* xilinx-pcie-root: Already marked as PCIe-only.
* pcie-pci-bridge: Already marked as PCIe-only.
* pcie-port: all non-abstract subtypes of pcie-port are already
  marked as PCIe-only devices.

3) megasas-base

Not all megasas devices are Conventional PCI devices, so the
interface names are added to the subclasses registered by
megasas_register_types(), according to information in the
megasas_devices[] array.

"megasas-gen2" already implements INTERFACE_PCIE_DEVICE, so add
INTERFACE_CONVENTIONAL_PCI_DEVICE only to "megasas".

Acked-by: Alberto Garcia <[email protected]>
Acked-by: John Snow <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Acked-by: David Gibson <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: Add INTERFACE_PCIE_DEVICE to all PCIe devices
Eduardo Habkost [Wed, 27 Sep 2017 19:56:33 +0000 (16:56 -0300)]
pci: Add INTERFACE_PCIE_DEVICE to all PCIe devices

Change all devices that set is_express=1 to implement
INTERFACE_PCIE_DEVICE.

Cc: Keith Busch <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: Dmitry Fleytman <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: [email protected]
Reviewed-by: Alistair Francis <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: Add interface names to hybrid PCI devices
Eduardo Habkost [Wed, 27 Sep 2017 19:56:32 +0000 (16:56 -0300)]
pci: Add interface names to hybrid PCI devices

The following devices support both PCI Express and Conventional
PCI, by including special code to handle the QEMU_PCI_CAP_EXPRESS
flag and/or conditional pcie_endpoint_cap_init() calls:

* vfio-pci (is_express=1, but legacy PCI handled by
  vfio_populate_device())
* vmxnet3 (is_express=0, but PCIe handled by vmxnet3_realize())
* pvscsi (is_express=0, but PCIe handled by pvscsi_realize())
* virtio-pci (is_express=0, but PCIe handled by
  virtio_pci_dc_realize(), and additional legacy PCI code at
  virtio_pci_realize())
* base-xhci (is_express=1, but pcie_endpoint_cap_init() call
  is conditional on pci_bus_is_express(dev->bus)
  * Note that xhci does not clear QEMU_PCI_CAP_EXPRESS like the
    other hybrid devices

Cc: Dmitry Fleytman <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: conventional-pci-device and pci-express-device interfaces
Eduardo Habkost [Wed, 27 Sep 2017 19:56:31 +0000 (16:56 -0300)]
pci: conventional-pci-device and pci-express-device interfaces

Those two interfaces will be used to indicate which device types
support Conventional PCI or PCI Express buses.  Management
software will be able to use the qom-list-types QMP command to
query that information.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoPCI: PCIe access should always be little endian
Matt Redfearn [Tue, 15 Aug 2017 14:44:17 +0000 (15:44 +0100)]
PCI: PCIe access should always be little endian

PCIe busses are always little endian, so set the endianness of the
memory region to little endian rather than native such that operations
work as expected on big endian targets.

Signed-off-by: Matt Redfearn <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovirtio/pci/migration: Convert to VMState
Dr. David Alan Gilbert [Mon, 25 Sep 2017 16:05:17 +0000 (17:05 +0100)]
virtio/pci/migration: Convert to VMState

Convert the 'modern_state' part of virtio-pci to modern migration
macros.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agohw/pci-bridge/pcie_pci_bridge: properly handle MSI unavailability case
Aleksandr Bezzubikov [Sun, 24 Sep 2017 23:21:58 +0000 (02:21 +0300)]
hw/pci-bridge/pcie_pci_bridge: properly handle MSI unavailability case

QEMU with the pcie-pci-bridge device crashes if the guest board doesn't support MSI,
e.g. 'qemu-system-ppc64 -M prep -device pcie-pci-bridge'.
This is caused by wrong pcie-pci-bridge instantiation error handling. This patch fixes this issue
by falling back to legacy INTx if MSI is not available.
Also set the bridge's 'msi' property default value to 'auto' in order to trigger errors
only when user explicitly set msi=on.

Reported-by: Eduardo Habkost <[email protected]>
Signed-off-by: Aleksandr Bezzubikov <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Tested-by: Thomas Huth <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: allow 32-bit PCI IO accesses to pass through the PCI bridge
Mark Cave-Ayland [Fri, 22 Sep 2017 12:18:31 +0000 (13:18 +0100)]
pci: allow 32-bit PCI IO accesses to pass through the PCI bridge

Whilst the underlying PCI bridge implementation supports 32-bit PCI IO
accesses, unfortunately they are truncated at the legacy 64K limit.

Signed-off-by: Mark Cave-Ayland <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovirtio/vhost: reset dev->log after syncing
Felipe Franciosi [Wed, 20 Sep 2017 18:53:06 +0000 (11:53 -0700)]
virtio/vhost: reset dev->log after syncing

vhost_log_put() is called to decomission the dirty log between qemu and
a vhost device when stopping the device. Such a call can happen from
migration_completion().

Present code sets dev->log_size to zero too early in vhost_log_put(),
causing the sync check to always return false. As a consequence, the
last pass on the dirty bitmap never happens at the end of migration.

If a vhost device was busy (writing to guest memory) until the last
moments before vhost_virtqueue_stop(), this error will result in guest
memory corruption (at least) following migrations.

Signed-off-by: Felipe Franciosi <[email protected]>
Acked-by: Jason Wang <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoMAINTAINERS: add Dump maintainers
Marc-André Lureau [Mon, 11 Sep 2017 16:59:29 +0000 (18:59 +0200)]
MAINTAINERS: add Dump maintainers

Proposing myself, since I have some familiarity with the code now.

Signed-off-by: Marc-André Lureau <[email protected]>
Acked-by: Laszlo Ersek <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoscripts/dump-guest-memory.py: add vmcoreinfo
Marc-André Lureau [Mon, 11 Sep 2017 16:59:28 +0000 (18:59 +0200)]
scripts/dump-guest-memory.py: add vmcoreinfo

Add a vmcoreinfo ELF note in the dump if vmcoreinfo device has the
memory location details.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agokdump: set vmcoreinfo location
Marc-André Lureau [Mon, 11 Sep 2017 16:59:27 +0000 (18:59 +0200)]
kdump: set vmcoreinfo location

kdump header provides offset and size of the vmcoreinfo content,
append it if available (skip the ELF note header).

crash-7.1.9 was the first version that started looking in the
vmcoreinfo data for phys_base instead of in the kdump_sub_header.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agodump: update phys_base header field based on VMCOREINFO content
Marc-André Lureau [Mon, 11 Sep 2017 16:59:26 +0000 (18:59 +0200)]
dump: update phys_base header field based on VMCOREINFO content

If the guest note is VMCOREINFO, try to get phys_base from it.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agodump: add guest ELF note
Marc-André Lureau [Mon, 11 Sep 2017 16:59:25 +0000 (18:59 +0200)]
dump: add guest ELF note

Read the guest ELF PT_NOTE from guest memory when fw_cfg
etc/vmcoreinfo entry provides the location, and write it as an
additional note in the dump.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agohw/misc: add vmcoreinfo device
Marc-André Lureau [Mon, 11 Sep 2017 16:59:24 +0000 (18:59 +0200)]
hw/misc: add vmcoreinfo device

See docs/specs/vmcoreinfo.txt for details.

"etc/vmcoreinfo" fw_cfg entry is added when using "-device vmcoreinfo".

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agofw_cfg: add write callback
Marc-André Lureau [Mon, 11 Sep 2017 16:59:23 +0000 (18:59 +0200)]
fw_cfg: add write callback

Reintroduce the write callback that was removed when write support was
removed in commit 023e3148567ac898c7258138f8e86c3c2bb40d07.

Contrary to the previous callback implementation, the write_cb
callback is called whenever a write happened, so handlers must be
ready to handle partial write as necessary.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: Set err to errp directly rather than through error_propagate()
Mao Zhongyi [Sat, 9 Sep 2017 06:22:26 +0000 (14:22 +0800)]
pci: Set err to errp directly rather than through error_propagate()

ioh3420_interrupts_init() pass error message to local_err, then
propagate it to errp by error_propagate(), which is not necessary.
So eliminate it and pass errp directly instead of local_err.

Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Signed-off-by: Mao Zhongyi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoxio3130_downstream: Report error if pcie_chassis_add_slot() failed
Eduardo Habkost [Fri, 25 Aug 2017 19:54:06 +0000 (16:54 -0300)]
xio3130_downstream: Report error if pcie_chassis_add_slot() failed

On commit f8cd1b02 ("pci: Convert to realize"), no error_set*()
call was added for the pcie_chassis_add_slot() error case.
pcie_chassis_add_slot() errors get ignored, making QEMU crash
later.  e.g.:

  $ qemu-system-x86_64 -device ioh3420 -device xio3130-downstream
  qemu-system-x86_64: memory.c:2166: memory_region_del_subregion: Assertion `subregion->container == mr' failed.
  Aborted (core dumped)

Fix it by reporting the error using error_setg().

Fixes: f8cd1b0201c41d88bb97dcafb80348a0e88d8805
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agonbd: header constants indenting
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 09:53:14 +0000 (12:53 +0300)]
nbd: header constants indenting

Prepare indenting for the following commit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20171012095319[email protected]>
Signed-off-by: Eric Blake <[email protected]>
7 years agonbd/server: simplify reply transmission
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 22:29:00 +0000 (17:29 -0500)]
nbd/server: simplify reply transmission

Send qiov via qio_channel_writev_all instead of calling nbd_write twice
with a cork.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20171012095319[email protected]>
[eblake: rebase to tweaks earlier in series]
Signed-off-by: Eric Blake <[email protected]>
7 years agonbd/server: refactor nbd_co_send_simple_reply parameters
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 09:53:12 +0000 (12:53 +0300)]
nbd/server: refactor nbd_co_send_simple_reply parameters

Pass client and buffer (*data) parameters directly, to make the function
consistent with further structured reply sending functions.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20171012095319[email protected]>
Signed-off-by: Eric Blake <[email protected]>
7 years agonbd/server: do not use NBDReply structure
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 22:05:06 +0000 (17:05 -0500)]
nbd/server: do not use NBDReply structure

NBDReply structure will be upgraded in future patches to handle both
simple and structured replies and will be used only in the client

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20171012095319[email protected]>
[eblake: rebase to tweaks earlier in series]
Signed-off-by: Eric Blake <[email protected]>
7 years agoblock/throttle.c: add bdrv_co_drain_begin/end callbacks
Manos Pitsidianakis [Sat, 23 Sep 2017 11:14:11 +0000 (14:14 +0300)]
block/throttle.c: add bdrv_co_drain_begin/end callbacks

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Manos Pitsidianakis <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoblock: rename bdrv_co_drain to bdrv_co_drain_begin
Manos Pitsidianakis [Sat, 23 Sep 2017 11:14:10 +0000 (14:14 +0300)]
block: rename bdrv_co_drain to bdrv_co_drain_begin

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Manos Pitsidianakis <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoblock: add bdrv_co_drain_end callback
Manos Pitsidianakis [Sat, 23 Sep 2017 11:14:09 +0000 (14:14 +0300)]
block: add bdrv_co_drain_end callback

BlockDriverState has a bdrv_co_drain() callback but no equivalent for
the end of the drain. The throttle driver (block/throttle.c) needs a way
to mark the end of the drain in order to toggle io_limits_disabled
correctly, thus bdrv_co_drain_end is needed.

Signed-off-by: Manos Pitsidianakis <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agospecs: Describe the TPM support in QEMU
Stefan Berger [Wed, 4 Oct 2017 17:12:09 +0000 (13:12 -0400)]
specs: Describe the TPM support in QEMU

This patch adds a description of the current TPM support in QEMU
to the specs.

Several public specs are referenced via their landing page on the
trustedcomputinggroup.org website.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
7 years agotpm: Move tpm_cleanup() to right place
Amarnath Valluri [Fri, 29 Sep 2017 11:10:21 +0000 (14:10 +0300)]
tpm: Move tpm_cleanup() to right place

As Emulator TPM backend uses chardev, tpm cleanup should happen before chardev
similar to other vhost-users.

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm: Added support for TPM emulator
Amarnath Valluri [Fri, 29 Sep 2017 11:10:20 +0000 (14:10 +0300)]
tpm: Added support for TPM emulator

This change introduces a new TPM backend driver that can communicate with
swtpm(software TPM emulator) using unix domain socket interface. QEMU talks to
the TPM emulator using QEMU's socket-based chardev backend device.

Swtpm uses two Unix sockets for communications, one for plain TPM commands and
responses, and one for out-of-band control messages. QEMU passes the data
socket to be used over the control channel.

The swtpm and associated tools can be found here:
    https://github.com/stefanberger/swtpm

The swtpm's control channel protocol specification can be found here:
    https://github.com/stefanberger/swtpm/wiki/Control-Channel-Specification

Usage:
    # setup TPM state directory
    mkdir /tmp/mytpm
    chown -R tss:root /tmp/mytpm
    /usr/bin/swtpm_setup --tpm-state /tmp/mytpm --createek

    # Ask qemu to use TPM emulator with given tpm state directory
    qemu-system-x86_64 \
        [...] \
        -chardev socket,id=chrtpm,path=/tmp/swtpm-sock \
        -tpmdev emulator,id=tpm0,chardev=chrtpm \
        -device tpm-tis,tpmdev=tpm0 \
        [...]

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Tested-by: Stefan Berger <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm-passthrough: move reusable code to utils
Amarnath Valluri [Fri, 29 Sep 2017 11:10:19 +0000 (14:10 +0300)]
tpm-passthrough: move reusable code to utils

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm-backend: Move realloc_buffer() implementation to tpm-tis model
Amarnath Valluri [Fri, 29 Sep 2017 11:10:18 +0000 (14:10 +0300)]
tpm-backend: Move realloc_buffer() implementation to tpm-tis model

buffer reallocation is very unlikely to be backend specific. Hence move inside
the tis.

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm-backend: Add new API to read backend TpmInfo
Amarnath Valluri [Fri, 29 Sep 2017 11:10:17 +0000 (14:10 +0300)]
tpm-backend: Add new API to read backend TpmInfo

TPM configuration options are backend implementation details and shall not be
part of base TPMBackend object, and these shall not be accessed directly outside
of the class, hence added a new interface method, get_tpm_options() to
TPMDriverOps., which shall be implemented by the derived classes to return
configured tpm options.

A new tpm backend api - tpm_backend_query_tpm() which uses _get_tpm_options() to
prepare TpmInfo.

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm-backend: Made few interface methods optional
Amarnath Valluri [Fri, 29 Sep 2017 11:10:16 +0000 (14:10 +0300)]
tpm-backend: Made few interface methods optional

This allows backend implementations left optional interface methods.
For mandatory methods assertion checks added.

Took the opportunity to remove unused methods:
 - tpm_backend_get_desc()
 - TPMDriverOps->handle_startup_error

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Stefan Berger<[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm-backend: Initialize and free data members in it's own methods
Amarnath Valluri [Fri, 29 Sep 2017 11:10:15 +0000 (14:10 +0300)]
tpm-backend: Initialize and free data members in it's own methods

Initialize and free TPMBackend data members in it's own instance_init() and
instance_finalize methods.

Took the opportunity to remove unneeded destroy() method from TpmDriverOps
interface as TPMBackend is a Qemu Object, we can use object_unref() inplace of
tpm_backend_destroy() to free the backend object, hence removed destroy() from
TPMDriverOps interface.

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm-backend: Move thread handling inside TPMBackend
Amarnath Valluri [Fri, 29 Sep 2017 11:10:14 +0000 (14:10 +0300)]
tpm-backend: Move thread handling inside TPMBackend

Move thread handling inside TPMBackend, this way backend implementations need
not to maintain their own thread life cycle, instead they needs to implement
'handle_request()' class method that always been called from a thread.

This change made tpm_backend_int.h kind of useless, hence removed it.

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm-backend: Remove unneeded member variable from backend class
Amarnath Valluri [Fri, 29 Sep 2017 11:10:13 +0000 (14:10 +0300)]
tpm-backend: Remove unneeded member variable from backend class

TPMDriverOps inside TPMBackend is not required, as it is supposed to be a class
member. The only possible reason for keeping in TPMBackend was, to get the
backend type in tpm.c where dedicated backend api, tpm_backend_get_type() is
present.

Signed-off-by: Amarnath Valluri <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Signed-off-by: Stefan Berger <[email protected]>
7 years agotpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD
Stefan Berger [Wed, 11 Oct 2017 12:52:43 +0000 (08:52 -0400)]
tpm: Use EMSGSIZE instead of EBADMSG to compile on OpenBSD

EBADMSG was only added to OpenBSD very recently. To make QEMU compilable
on older OpenBSD versions use EMSGSIZE instead when a mismatch between
number of received bytes and message size indicated in the header was
found.

Return -EMSGSIZE and convert all other errnos in the same functions to
return the negative errno.

Signed-off-by: Stefan Berger <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
7 years agonbd/server: structurize simple reply header sending
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 09:53:10 +0000 (12:53 +0300)]
nbd/server: structurize simple reply header sending

Use packed structure instead of pointer arithmetics.

Also, merge two redundant traces into one.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20171012095319[email protected]>
[eblake: tweak and mention impact on traces, fix errp usage]
Signed-off-by: Eric Blake <[email protected]>
7 years agonbd: rename some simple-request related objects to be _simple_
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 09:53:09 +0000 (12:53 +0300)]
nbd: rename some simple-request related objects to be _simple_

To be consistent when their _structured_ analogs will be introduced.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20171012095319[email protected]>
[eblake: also tweak trace message contents]
Signed-off-by: Eric Blake <[email protected]>
7 years agoblock/nbd-client: refactor nbd_co_receive_reply
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 09:53:08 +0000 (12:53 +0300)]
block/nbd-client: refactor nbd_co_receive_reply

Pass handle parameter directly, as the whole request isn't needed.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20171012095319[email protected]>
Signed-off-by: Eric Blake <[email protected]>
7 years agoblock/nbd-client: assert qiov len once in nbd_co_request
Vladimir Sementsov-Ogievskiy [Thu, 12 Oct 2017 09:53:07 +0000 (12:53 +0300)]
block/nbd-client: assert qiov len once in nbd_co_request

Also improve the assertion: check that qiov is NULL for other commands
than CMD_READ and CMD_WRITE.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20171012095319[email protected]>
Signed-off-by: Eric Blake <[email protected]>
7 years agoNBD: use g_new() family of functions
Marc-André Lureau [Fri, 6 Oct 2017 23:49:16 +0000 (20:49 -0300)]
NBD: use g_new() family of functions

Signed-off-by: Marc-André Lureau <[email protected]>
Message-Id: <20171006235023[email protected]>
Signed-off-by: Eric Blake <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171012' into...
Peter Maydell [Thu, 12 Oct 2017 16:06:50 +0000 (17:06 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171012' into staging

target-arm queue:
 * v8M: SG, BLXNS, secure-return
 * v8M: fixes for coverity issues in previous patches
 * arm: fix armv7m_init() declaration to match definition
 * watchdog/aspeed: fix variable type to store reload value

# gpg: Signature made Thu 12 Oct 2017 17:02:49 BST
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20171012:
  nvic: Fix miscalculation of offsets into ITNS array
  nvic: Add missing 'break'
  target/arm: Implement SG instruction corner cases
  target/arm: Support some Thumb insns being always unconditional
  target-arm: Simplify insn_crosses_page()
  target/arm: Pull Thumb insn word loads up to top level
  target-arm: Don't check for "Thumb2 or M profile" for not-Thumb1
  target/arm: Implement secure function return
  target/arm: Implement BLXNS
  target/arm: Implement SG instruction
  target/arm: Add M profile secure MMU index values to get_a32_user_mem_index()
  arm: fix armv7m_init() declaration to match definition
  watchdog/aspeed: fix variable type to store reload value

Signed-off-by: Peter Maydell <[email protected]>
7 years agonvic: Fix miscalculation of offsets into ITNS array
Peter Maydell [Tue, 10 Oct 2017 15:54:16 +0000 (16:54 +0100)]
nvic: Fix miscalculation of offsets into ITNS array

This calculation of the first exception vector in
the ITNS<n> register being accessed:
        int startvec = 32 * (offset - 0x380) + NVIC_FIRST_IRQ;

is incorrect, because offset is in bytes, so we only want
to multiply by 8.

Spotted by Coverity (CID 1381484, CID 1381488), though it is
not correct that it actually overflows the buffer, because
we have a 'startvec + i < s->num_irq' guard.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507650856[email protected]

7 years agolibvhost-user: Support VHOST_USER_SET_SLAVE_REQ_FD
Dr. David Alan Gilbert [Mon, 2 Oct 2017 19:15:21 +0000 (20:15 +0100)]
libvhost-user: Support VHOST_USER_SET_SLAVE_REQ_FD

Allow the qemu to pass us a slave fd.  We don't do anything
with it yet.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20171002191521[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Maxime Coquelin <[email protected]>
7 years agolibvhost-user: Update and fix feature and request lists
Dr. David Alan Gilbert [Mon, 2 Oct 2017 19:15:20 +0000 (20:15 +0100)]
libvhost-user: Update and fix feature and request lists

Update the ProtocolFeature and UserRequest lists to
match hw/virtio/vhost-user.c.
Fix the text labelling in libvhost-user.c to match the list.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20171002191521[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Maxime Coquelin <[email protected]>
7 years agovhost-user-bridge: Only process received packets on started queues
Dr. David Alan Gilbert [Mon, 2 Oct 2017 19:15:19 +0000 (20:15 +0100)]
vhost-user-bridge: Only process received packets on started queues

Only process received packets if the queue has been started.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20171002191521[email protected]>
Reviewed-by: Maxime Coquelin <[email protected]>
7 years agolibvhost-user: vu_queue_started
Dr. David Alan Gilbert [Mon, 2 Oct 2017 19:15:18 +0000 (20:15 +0100)]
libvhost-user: vu_queue_started

Add a vu_queue_started method to complement vu_queue_enabled.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20171002191521[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Maxime Coquelin <[email protected]>
7 years agonvic: Add missing 'break'
Peter Maydell [Wed, 11 Oct 2017 17:24:36 +0000 (18:24 +0100)]
nvic: Add missing 'break'

Coverity points out that we forgot the 'break' for
the SAU_CTRL write case (CID1381683). This has
no actual visible consequences because it happens
that the following case is effectively a no-op.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 1507742676[email protected]
Reviewed-by: Richard Henderson <[email protected]>
7 years agotarget/arm: Implement SG instruction corner cases
Peter Maydell [Mon, 9 Oct 2017 13:48:39 +0000 (14:48 +0100)]
target/arm: Implement SG instruction corner cases

The common situation of the SG instruction is that it is
executed from S&NSC memory by a CPU in NS state. That case
is handled by v7m_handle_execute_nsc(). However the instruction
also has defined behaviour in a couple of other cases:
 * SG instruction in NS memory (behaves as a NOP)
 * SG in S memory but CPU already secure (clears IT bits and
   does nothing else)
 * SG instruction in v8M without Security Extension (NOP)

These can be implemented in translate.c.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget/arm: Support some Thumb insns being always unconditional
Peter Maydell [Mon, 9 Oct 2017 13:48:38 +0000 (14:48 +0100)]
target/arm: Support some Thumb insns being always unconditional

A few Thumb instructions are always unconditional even inside an
IT block (as opposed to being UNPREDICTABLE if used inside an
IT block): BKPT, the v8M SG instruction, and the A profile
HLT (debug halt) instruction.

This means we need to suppress the jump-over-instruction-on-condfail
code generation (though the IT state still advances as usual and
subsequent insns in the IT block may be conditional).

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget-arm: Simplify insn_crosses_page()
Peter Maydell [Mon, 9 Oct 2017 13:48:37 +0000 (14:48 +0100)]
target-arm: Simplify insn_crosses_page()

Recent changes have left insn_crosses_page() more complicated
than it needed to be:
 * it's only called from thumb_tr_translate_insn() so we know
   for certain that we're looking at a Thumb insn
 * the caller's check for dc->pc >= dc->next_page_start - 3
   means that dc->pc can't possibly be 4 aligned, so there's
   no need to check that (the check was partly there to ensure
   that we didn't treat an ARM insn as Thumb, I think)
 * we now have thumb_insn_is_16bit() which lets us do a precise
   check of the length of the next insn, rather than opencoding
   an inaccurate check

Simplify it down to just loading the first half of the insn
and calling thumb_insn_is_16bit() on it.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget/arm: Pull Thumb insn word loads up to top level
Peter Maydell [Mon, 9 Oct 2017 13:48:36 +0000 (14:48 +0100)]
target/arm: Pull Thumb insn word loads up to top level

Refactor the Thumb decode to do the loads of the instruction words at
the top level rather than only loading the second half of a 32-bit
Thumb insn in the middle of the decode.

This is simple apart from the awkward case of Thumb1, where the
BL/BLX prefix and suffix instructions live in what in Thumb2 is the
32-bit insn space.  To handle these we decode enough to identify
whether we're looking at a prefix/suffix that we handle as a 16 bit
insn, or a prefix that we're going to merge with the following suffix
to consider as a 32 bit insn.  The translation of the 16 bit cases
then moves from disas_thumb2_insn() to disas_thumb_insn().

The refactoring has the benefit that we don't need to pass the
CPUARMState* down into the decoder code any more, but the major
reason for doing this is that some Thumb instructions must be always
unconditional regardless of the IT state bits, so we need to know the
whole insn before we emit the "skip this insn if the IT bits and cond
state tell us to" code.  (The always unconditional insns are BKPT,
HLT and SG; the last of these is 32 bits.)

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget-arm: Don't check for "Thumb2 or M profile" for not-Thumb1
Peter Maydell [Mon, 9 Oct 2017 13:48:35 +0000 (14:48 +0100)]
target-arm: Don't check for "Thumb2 or M profile" for not-Thumb1

The code which implements the Thumb1 split BL/BLX instructions
is guarded by a check on "not M or THUMB2". All we really need
to check here is "not THUMB2" (and we assume that elsewhere too,
eg in the ARCH(6T2) test that UNDEFs the Thumb2 insns).

This doesn't change behaviour because all M profile cores
have Thumb2 and so ARM_FEATURE_M implies ARM_FEATURE_THUMB2.
(v6M implements a very restricted subset of Thumb2, but we
can cross that bridge when we get to it with appropriate
feature bits.)

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget/arm: Implement secure function return
Peter Maydell [Mon, 9 Oct 2017 13:48:34 +0000 (14:48 +0100)]
target/arm: Implement secure function return

Secure function return happens when a non-secure function has been
called using BLXNS and so has a particular magic LR value (either
0xfefffffe or 0xfeffffff). The function return via BX behaves
specially when the new PC value is this magic value, in the same
way that exception returns are handled.

Adjust our BX excret guards so that they recognize the function
return magic number as well, and perform the function-return
unstacking in do_v7m_exception_exit().

Signed-off-by: Peter Maydell <[email protected]>
Acked-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget/arm: Implement BLXNS
Peter Maydell [Mon, 9 Oct 2017 13:48:33 +0000 (14:48 +0100)]
target/arm: Implement BLXNS

Implement the BLXNS instruction, which allows secure code to
call non-secure code.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget/arm: Implement SG instruction
Peter Maydell [Mon, 9 Oct 2017 13:48:32 +0000 (14:48 +0100)]
target/arm: Implement SG instruction

Implement the SG instruction, which we emulate 'by hand' in the
exception handling code path.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agotarget/arm: Add M profile secure MMU index values to get_a32_user_mem_index()
Peter Maydell [Mon, 9 Oct 2017 13:48:31 +0000 (14:48 +0100)]
target/arm: Add M profile secure MMU index values to get_a32_user_mem_index()

Add the M profile secure MMU index values to the switch in
get_a32_user_mem_index() so that LDRT/STRT work correctly
rather than asserting at translate time.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1507556919[email protected]

7 years agoarm: fix armv7m_init() declaration to match definition
Igor Mammedov [Thu, 12 Oct 2017 12:20:07 +0000 (13:20 +0100)]
arm: fix armv7m_init() declaration to match definition

s/cpu_model/cpu_type/ that has been forgotten during
conversion (ba1ba5cc), while touching the line also
fixup alignment.

Signed-off-by: Igor Mammedov <[email protected]>
Message-id: 1507710805[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agowatchdog/aspeed: fix variable type to store reload value
Cédric Le Goater [Thu, 12 Oct 2017 12:20:06 +0000 (13:20 +0100)]
watchdog/aspeed: fix variable type to store reload value

Initially from Anton D. Kachalov" <[email protected]> but the SoB was
missing.

Signed-off-by: Cédric Le Goater <[email protected]>
Acked-by: Andrew Jeffery <[email protected]>
Message-id: 20170920064915[email protected]
[clg: change commit log and subject
      replace UL suffix by ULL ]
Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into...
Peter Maydell [Thu, 12 Oct 2017 09:02:09 +0000 (10:02 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging

Python queue, 2017-10-11

# gpg: Signature made Wed 11 Oct 2017 19:49:40 BST
# gpg:                using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <[email protected]>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request:
  scripts: Remove debug parameter from QEMUMachine
  scripts: Remove debug parameter from QEMUMonitorProtocol
  guestperf: Configure logging on all shell frontends
  basevm: Call logging.basicConfig()
  iotests: Set up Python logging

Signed-off-by: Peter Maydell <[email protected]>
7 years agoscripts: Remove debug parameter from QEMUMachine
Eduardo Habkost [Thu, 5 Oct 2017 17:20:13 +0000 (14:20 -0300)]
scripts: Remove debug parameter from QEMUMachine

All scripts that use the QEMUMachine and QEMUQtestMachine classes
(device-crash-test, tests/migration/*, iotests.py, basevm.py)
already configure logging.

The basicConfig() call inside QEMUMachine.__init__() is being
kept just to make sure a script would still work if it didn't
configure logging.

Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20171005172013[email protected]>
Reviewed-by: Lukáš Doktor <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoscripts: Remove debug parameter from QEMUMonitorProtocol
Eduardo Habkost [Thu, 5 Oct 2017 17:20:12 +0000 (14:20 -0300)]
scripts: Remove debug parameter from QEMUMonitorProtocol

Use logging module for the QMP debug messages.  The only scripts
that set debug=True are iotests.py and guestperf/engine.py, and
they already call logging.basicConfig() to set up logging.

Scripts that don't configure logging are safe as long as they
don't need debugging output, because debug messages don't trigger
the "No handlers could be found for logger" message from the
Python logging module.

Scripts that already configure logging but don't use debug=True
(e.g. scripts/vm/basevm.py) will get QMP debugging enabled for
free.

Cc: "Alex Bennée" <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20171005172013[email protected]>
Reviewed-by: Lukáš Doktor <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
This page took 0.093666 seconds and 4 git commands to generate.