OSDN Git Service

qmiga/qemu.git
4 years agotarget/arm: Display helpful message when hflags mismatch
Philippe Mathieu-Daudé [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
target/arm: Display helpful message when hflags mismatch

Instead of crashing in a confuse way, give some hint to the user
about why we aborted. He might report the issue without having
to use a debugger.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20191209134552.27733-1-philmd@redhat.com
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/smmuv3: Report F_STE_FETCH fault address in correct word position
Simon Veith [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
hw/arm/smmuv3: Report F_STE_FETCH fault address in correct word position

The smmuv3_record_event() function that generates the F_STE_FETCH error
uses the EVT_SET_ADDR macro to record the fetch address, placing it in
32-bit words 4 and 5.

The correct position for this address is in words 6 and 7, per the
SMMUv3 Architecture Specification.

Update the function to use the EVT_SET_ADDR2 macro instead, which is the
macro intended for writing to these words.

ref. ARM IHI 0070C, section 7.3.4.

Signed-off-by: Simon Veith <sveith@amazon.de>
Acked-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1576509312-13083-7-git-send-email-sveith@amazon.de
Cc: Eric Auger <eric.auger@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Acked-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/smmuv3: Use correct bit positions in EVT_SET_ADDR2 macro
Simon Veith [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
hw/arm/smmuv3: Use correct bit positions in EVT_SET_ADDR2 macro

The bit offsets in the EVT_SET_ADDR2 macro do not match those specified
in the ARM SMMUv3 Architecture Specification. In all events that use
this macro, e.g. F_WALK_EABT, the faulting fetch address or IPA actually
occupies the 32-bit words 6 and 7 in the event record contiguously, with
the upper and lower unused bits clear due to alignment or maximum
supported address bits. How many bits are clear depends on the
individual event type.

Update the macro to write to the correct words in the event record so
that guest drivers can obtain accurate address information on events.

ref. ARM IHI 0070C, sections 7.3.12 through 7.3.16.

Signed-off-by: Simon Veith <sveith@amazon.de>
Acked-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1576509312-13083-6-git-send-email-sveith@amazon.de
Cc: Eric Auger <eric.auger@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Acked-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/smmuv3: Align stream table base address to table size
Simon Veith [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
hw/arm/smmuv3: Align stream table base address to table size

Per the specification, and as observed in hardware, the SMMUv3 aligns
the SMMU_STRTAB_BASE address to the size of the table by masking out the
respective least significant bits in the ADDR field.

Apply this masking logic to our smmu_find_ste() lookup function per the
specification.

ref. ARM IHI 0070C, section 6.3.23.

Signed-off-by: Simon Veith <sveith@amazon.de>
Acked-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1576509312-13083-5-git-send-email-sveith@amazon.de
Cc: Eric Auger <eric.auger@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/smmuv3: Check stream IDs against actual table LOG2SIZE
Simon Veith [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
hw/arm/smmuv3: Check stream IDs against actual table LOG2SIZE

When checking whether a stream ID is in range of the stream table, we
have so far been only checking it against our implementation limit
(SMMU_IDR1_SIDSIZE). However, the guest can program the
STRTAB_BASE_CFG.LOG2SIZE field to a size that is smaller than this
limit.

Check the stream ID against this limit as well to match the hardware
behavior of raising C_BAD_STREAMID events in case the limit is exceeded.
Also, ensure that we do not go one entry beyond the end of the table by
checking that its index is strictly smaller than the table size.

ref. ARM IHI 0070C, section 6.3.24.

Signed-off-by: Simon Veith <sveith@amazon.de>
Acked-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1576509312-13083-4-git-send-email-sveith@amazon.de
Cc: Eric Auger <eric.auger@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/smmuv3: Correct SMMU_BASE_ADDR_MASK value
Simon Veith [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
hw/arm/smmuv3: Correct SMMU_BASE_ADDR_MASK value

There are two issues with the current value of SMMU_BASE_ADDR_MASK:

- At the lower end, we are clearing bits [4:0]. Per the SMMUv3 spec,
  we should also be treating bit 5 as zero in the base address.
- At the upper end, we are clearing bits [63:48]. Per the SMMUv3 spec,
  only bits [63:52] must be explicitly treated as zero.

Update the SMMU_BASE_ADDR_MASK value to mask out bits [63:52] and [5:0].

ref. ARM IHI 0070C, section 6.3.23.

Signed-off-by: Simon Veith <sveith@amazon.de>
Acked-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1576509312-13083-3-git-send-email-sveith@amazon.de
Cc: Eric Auger <eric.auger@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/smmuv3: Apply address mask to linear strtab base address
Simon Veith [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
hw/arm/smmuv3: Apply address mask to linear strtab base address

In the SMMU_STRTAB_BASE register, the stream table base address only
occupies bits [51:6]. Other bits, such as RA (bit [62]), must be masked
out to obtain the base address.

The branch for 2-level stream tables correctly applies this mask by way
of SMMU_BASE_ADDR_MASK, but the one for linear stream tables does not.

Apply the missing mask in that case as well so that the correct stream
base address is used by guests which configure a linear stream table.

Linux guests are unaffected by this change because they choose a 2-level
stream table layout for the QEMU SMMUv3, based on the size of its stream
ID space.

ref. ARM IHI 0070C, section 6.3.23.

Signed-off-by: Simon Veith <sveith@amazon.de>
Acked-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1576509312-13083-2-git-send-email-sveith@amazon.de
Cc: Eric Auger <eric.auger@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Acked-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoast2600: Configure CNTFRQ at 1125MHz
Andrew Jeffery [Fri, 20 Dec 2019 14:03:00 +0000 (14:03 +0000)]
ast2600: Configure CNTFRQ at 1125MHz

This matches the configuration set by u-boot on the AST2600.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 080ca1267a09381c43cf3c50d434fb6c186f2b6e.1576215453.git-series.andrew@aj.id.au
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Prepare generic timer for per-platform CNTFRQ
Andrew Jeffery [Fri, 20 Dec 2019 14:02:59 +0000 (14:02 +0000)]
target/arm: Prepare generic timer for per-platform CNTFRQ

The ASPEED AST2600 clocks the generic timer at the rate of HPLL. On
recent firmwares this is at 1125MHz, which is considerably quicker than
the assumed 62.5MHz of the current generic timer implementation. The
delta between the value as read from CNTFRQ and the true rate of the
underlying QEMUTimer leads to sticky behaviour in AST2600 guests.

Add a feature-gated property exposing CNTFRQ for ARM CPUs providing the
generic timer. This allows platforms to configure CNTFRQ (and the
associated QEMUTimer) to the appropriate frequency prior to starting the
guest.

As the platform can now determine the rate of CNTFRQ we're exposed to
limitations of QEMUTimer that didn't previously materialise: In the
course of emulation we need to arbitrarily and accurately convert
between guest ticks and time, but we're constrained by QEMUTimer's use
of an integer scaling factor. The effect is QEMUTimer cannot exactly
capture the period of frequencies that do not cleanly divide
NANOSECONDS_PER_SECOND for scaling ticks to time. As such, provide an
equally inaccurate scaling factor for scaling time to ticks so at least
a self-consistent inverse relationship holds.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: a22db9325f96e39f76e3c2baddcb712149f46bf2.1576215453.git-series.andrew@aj.id.au
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Abstract the generic timer frequency
Andrew Jeffery [Fri, 20 Dec 2019 14:02:59 +0000 (14:02 +0000)]
target/arm: Abstract the generic timer frequency

Prepare for SoCs such as the ASPEED AST2600 whose firmware configures
CNTFRQ to values significantly larger than the static 62.5MHz value
currently derived from GTIMER_SCALE. As the OS potentially derives its
timer periods from the CNTFRQ value the lack of support for running
QEMUTimers at the appropriate rate leads to sticky behaviour in the
guest.

Substitute the GTIMER_SCALE constant with use of a helper to derive the
period from gt_cntfrq_hz stored in struct ARMCPU. Initially set
gt_cntfrq_hz to the frequency associated with GTIMER_SCALE so current
behaviour is maintained.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 40bd8df043f66e1ccfb3e9482999d099ac72bb2e.1576215453.git-series.andrew@aj.id.au
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: Remove redundant scaling of nexttick
Andrew Jeffery [Fri, 20 Dec 2019 14:02:59 +0000 (14:02 +0000)]
target/arm: Remove redundant scaling of nexttick

The corner-case codepath was adjusting nexttick such that overflow
wouldn't occur when timer_mod() scaled the value back up. Remove a use
of GTIMER_SCALE and avoid unnecessary operations by calling
timer_mod_ns() directly.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-id: f8c680720e3abe55476e6d9cb604ad27fdbeb2e0.1576215453.git-series.andrew@aj.id.au
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into...
Peter Maydell [Fri, 20 Dec 2019 12:46:10 +0000 (12:46 +0000)]
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging

Trivial fixes (20191218)

# gpg: Signature made Wed 18 Dec 2019 13:00:34 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/trivial-branch-pull-request:
  qemu-doc: Remove the unused "Guest Agent" node
  Revert "qemu-options.hx: Update for reboot-timeout parameter"
  target/sparc: Remove old TODO file
  test-keyval: Tighten test of trailing crap after size
  util/cutils: Turn FIXME comment into QEMU_BUILD_BUG_ON()
  monitor: Remove unused define
  MAINTAINERS: Add hw/sd/ssi-sd.c in the SD section

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Fri, 20 Dec 2019 11:20:25 +0000 (11:20 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* More uses of RCU_READ_LOCK_GUARD (Dave, myself)
* QOM doc improvments (Greg)
* Cleanups from the Meson conversion (Marc-André)
* Support for multiple -accel options (myself)
* Many x86 machine cleanup (Philippe, myself)
* tests/migration-test cleanup (Juan)
* PC machine removal and next round of deprecation (Thomas)
* kernel-doc integration (Peter, myself)

# gpg: Signature made Wed 18 Dec 2019 01:35:02 GMT
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (87 commits)
  vga: cleanup mapping of VRAM for non-PCI VGA
  hw/display: Remove "rombar" hack from vga-pci and vmware_vga
  hw/pci: Remove the "command_serr_enable" property
  hw/audio: Remove the "use_broken_id" hack from the AC97 device
  hw/i386: Remove the deprecated machines 0.12 up to 0.15
  hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  hw/pci-host/i440fx: Extract the IGD passthrough host bridge device
  hw/pci-host/i440fx: Use definitions instead of magic values
  hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h"
  hw/pci-host/i440fx: Correct the header description
  Fix some comment spelling errors.
  target/i386: remove unused pci-assign codes
  WHPX: refactor load library
  migration: check length directly to make sure the range is aligned
  memory: include MemoryListener documentation and some missing function parameters
  docs: add memory API reference
  memory.h: Silence kernel-doc complaints
  docs: Create bitops.rst as example of kernel-docs
  bitops.h: Silence kernel-doc complaints
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-error-2019-12-17-v2' into...
Peter Maydell [Thu, 19 Dec 2019 11:39:20 +0000 (11:39 +0000)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2019-12-17-v2' into staging

Error reporting patches for 2019-12-17

# gpg: Signature made Wed 18 Dec 2019 07:45:24 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2019-12-17-v2: (35 commits)
  nbd: assert that Error** is not NULL in nbd_iter_channel_error
  hw/vfio/ap: drop local_err from vfio_ap_realize
  backends/cryptodev: drop local_err from cryptodev_backend_complete()
  include/qom/object.h: rename Error ** parameter to more common errp
  hw/usb: rename Error ** parameter to more common errp
  hw/tpm: rename Error ** parameter to more common errp
  hw/sd: drop extra whitespace in sdhci_sysbus_realize() header
  hw/s390x: rename Error ** parameter to more common errp
  monitor/qmp-cmds: rename Error ** parameter to more common errp
  qga: rename Error ** parameter to more common errp
  hw/i386/amd_iommu: rename Error ** parameter to more common errp
  block/snapshot: rename Error ** parameter to more common errp
  hw/core/qdev: cleanup Error ** variables
  9pfs: make Error **errp const where it is appropriate
  ppc: make Error **errp const where it is appropriate
  Revert "ppc: well form kvmppc_hint_smt_possible error hint helper"
  qdev-monitor: make Error **errp const where it is appropriate
  vnc: drop Error pointer indirection in vnc_client_io_error
  hmp: drop Error pointer indirection in hmp_handle_error
  error: make Error **errp const where it is appropriate
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoqemu-doc: Remove the unused "Guest Agent" node
Thomas Huth [Mon, 16 Dec 2019 13:29:41 +0000 (14:29 +0100)]
qemu-doc: Remove the unused "Guest Agent" node

The node has been removed from the texi file some months ago, so we
should remove it from the menu section, too.

Fixes: 27a296fce982 ("qemu-ga: Convert invocation documentation to rST")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191216132941.25729-1-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agoRevert "qemu-options.hx: Update for reboot-timeout parameter"
Han Han [Thu, 5 Dec 2019 02:48:21 +0000 (10:48 +0800)]
Revert "qemu-options.hx: Update for reboot-timeout parameter"

This reverts commit bbd9e6985ff342cbe15b9cb7eb30e842796fbbe8.

In 20a1922032 we allowed reboot-timeout=-1 again, so update the doc
accordingly.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191205024821.245435-1-hhan@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agotarget/sparc: Remove old TODO file
Thomas Huth [Mon, 30 Sep 2019 17:10:44 +0000 (19:10 +0200)]
target/sparc: Remove old TODO file

This file hasn't seen a real (non-trivial) update since 2008 anymore,
so we can assume that it is pretty much out of date and nobody cares
for it anymore. Let's simply remove it.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
Message-Id: <20190930171044.25312-1-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agotest-keyval: Tighten test of trailing crap after size
Markus Armbruster [Mon, 25 Nov 2019 13:38:46 +0000 (14:38 +0100)]
test-keyval: Tighten test of trailing crap after size

test_keyval_visit_size() should test for trailing crap after size with
and without suffix.  It does test the latter: "sz2=16Gi" has size
"16G" followed by crap "i".  It fails to test the former "sz1=16E" is
a syntactically valid size that overflows uint64_t.  Replace by
"sz1=0Z".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20191125133846.27790-3-armbru@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agoutil/cutils: Turn FIXME comment into QEMU_BUILD_BUG_ON()
Markus Armbruster [Mon, 25 Nov 2019 13:38:45 +0000 (14:38 +0100)]
util/cutils: Turn FIXME comment into QEMU_BUILD_BUG_ON()

qemu_strtoi64() assumes int64_t is long long.  This is marked FIXME.
Replace by a QEMU_BUILD_BUG_ON() to avoid surprises.

Same for qemu_strtou64().

Fix a typo in qemu_strtoul()'s contract while there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191125133846.27790-2-armbru@redhat.com>
[lv: removed trailing whitespace]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agomonitor: Remove unused define
Yury Kotov [Tue, 19 Nov 2019 11:07:09 +0000 (14:07 +0300)]
monitor: Remove unused define

Remove the definition of QMP_ACCEPT_UNKNOWNS as it is unused since
refactoring 5c678ee8d940

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191119110709.13827-1-yury-kotov@yandex-team.ru>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agoMAINTAINERS: Add hw/sd/ssi-sd.c in the SD section
Philippe Mathieu-Daudé [Sat, 12 Oct 2019 06:54:24 +0000 (08:54 +0200)]
MAINTAINERS: Add hw/sd/ssi-sd.c in the SD section

The hw/sd/ssi-sd.c file is orphean, add it to the SD section.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191012065426.10772-2-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
4 years agonbd: assert that Error** is not NULL in nbd_iter_channel_error
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:35 +0000 (20:46 +0300)]
nbd: assert that Error** is not NULL in nbd_iter_channel_error

All callers of nbd_iter_channel_error() pass the address of a
local_err variable, and only call this function if an error has
already occurred, using this function to propagate that error.
This is already implied by its name (local_err instead of the classic
errp), but it is worth additionally stressing this by adding an
assertion to make it part of the function contract.

The local_err parameter is not here to return information about
nbd_iter_channel_error failure. Instead it's assumed to be filled when
passed to the function. This is already stressed by its name
(local_err, instead of classic errp). Stress it additionally by
assertion.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20191205174635.18758-22-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohw/vfio/ap: drop local_err from vfio_ap_realize
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:34 +0000 (20:46 +0300)]
hw/vfio/ap: drop local_err from vfio_ap_realize

No reason for local_err here, use errp directly instead.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20191205174635.18758-21-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agobackends/cryptodev: drop local_err from cryptodev_backend_complete()
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:33 +0000 (20:46 +0300)]
backends/cryptodev: drop local_err from cryptodev_backend_complete()

No reason for local_err here, use errp directly instead.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <20191205174635.18758-20-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoinclude/qom/object.h: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:32 +0000 (20:46 +0300)]
include/qom/object.h: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191205174635.18758-19-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohw/usb: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:31 +0000 (20:46 +0300)]
hw/usb: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20191205174635.18758-18-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohw/tpm: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:30 +0000 (20:46 +0300)]
hw/tpm: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20191205174635.18758-17-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohw/sd: drop extra whitespace in sdhci_sysbus_realize() header
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:29 +0000 (20:46 +0300)]
hw/sd: drop extra whitespace in sdhci_sysbus_realize() header

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20191205174635.18758-16-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohw/s390x: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:28 +0000 (20:46 +0300)]
hw/s390x: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20191205174635.18758-15-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agomonitor/qmp-cmds: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:27 +0000 (20:46 +0300)]
monitor/qmp-cmds: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20191205174635.18758-14-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoqga: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:26 +0000 (20:46 +0300)]
qga: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20191205174635.18758-13-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohw/i386/amd_iommu: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:25 +0000 (20:46 +0300)]
hw/i386/amd_iommu: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20191205174635.18758-12-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoblock/snapshot: rename Error ** parameter to more common errp
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:24 +0000 (20:46 +0300)]
block/snapshot: rename Error ** parameter to more common errp

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@Redhat.com>
Message-Id: <20191205174635.18758-11-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohw/core/qdev: cleanup Error ** variables
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:23 +0000 (20:46 +0300)]
hw/core/qdev: cleanup Error ** variables

Rename Error ** parameter in check_only_migratable to common errp.

In device_set_realized:

 - Move "if (local_err != NULL)" closer to error setters.

 - Drop 'Error **local_errp': it doesn't save any LoCs, but it's very
   unusual.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191205174635.18758-10-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years ago9pfs: make Error **errp const where it is appropriate
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:22 +0000 (20:46 +0300)]
9pfs: make Error **errp const where it is appropriate

Mostly, Error ** is for returning error from the function, so the
callee sets it. However error_append_security_model_hint and
error_append_socket_sockfd_hint get already filled errp
parameter. They don't change the pointer itself, only change the
internal state of referenced Error object. So we can make it Error
*const * errp, to stress the behavior. It will also help coccinelle
script (in future) to distinguish such cases from common errp usage.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Acked-by: Greg Kurz <groug@kaod.org>
Message-Id: <20191205174635.18758-9-vsementsov@virtuozzo.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message replaced]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoppc: make Error **errp const where it is appropriate
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:21 +0000 (20:46 +0300)]
ppc: make Error **errp const where it is appropriate

Mostly, Error ** is for returning error from the function, so the
callee sets it. However kvmppc_hint_smt_possible gets already filled
errp parameter. It doesn't change the pointer itself, only change the
internal state of referenced Error object. So we can make it Error
*const * errp, to stress the behavior. It will also help coccinelle
script (in future) to distinguish such cases from common errp usage.

While there, rename the function to
kvmppc_error_append_smt_possible_hint().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <20191205174635.18758-8-vsementsov@virtuozzo.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message replaced]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoRevert "ppc: well form kvmppc_hint_smt_possible error hint helper"
Markus Armbruster [Wed, 18 Dec 2019 07:36:27 +0000 (08:36 +0100)]
Revert "ppc: well form kvmppc_hint_smt_possible error hint helper"

This reverts commit cdcca22aabafc0496894ce05c80097684832c7d9.

Commit cdcca22aaba is a superseded version of the next commit that
crept in by accident.  Revert it, so the final version applies.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoqdev-monitor: make Error **errp const where it is appropriate
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:20 +0000 (20:46 +0300)]
qdev-monitor: make Error **errp const where it is appropriate

Mostly, Error ** is for returning error from the function, so the
callee sets it. However qbus_list_bus and qbus_list_dev get already
filled errp parameter. They don't change the pointer itself, only
change the internal state of referenced Error object. So we can make
it Error *const * errp, to stress the behavior. It will also help
coccinelle script (in future) to distinguish such cases from common
errp usage.

While there, rename the functions to
qbus_error_append_bus_list_hint(), qbus_error_append_dev_list_hint().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20191205174635.18758-7-vsementsov@virtuozzo.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message replaced]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agovnc: drop Error pointer indirection in vnc_client_io_error
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:19 +0000 (20:46 +0300)]
vnc: drop Error pointer indirection in vnc_client_io_error

We don't need Error **, as all callers pass local Error object, which
isn't used after the call, or NULL. Use Error * instead.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191205174635.18758-6-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agohmp: drop Error pointer indirection in hmp_handle_error
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:18 +0000 (20:46 +0300)]
hmp: drop Error pointer indirection in hmp_handle_error

We don't need Error **, as all callers pass local Error object, which
isn't used after the call. Use Error * instead.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191205174635.18758-5-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoerror: make Error **errp const where it is appropriate
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:17 +0000 (20:46 +0300)]
error: make Error **errp const where it is appropriate

Mostly, Error ** is for returning error from the function, so the
callee sets it. However these three functions get already filled errp
parameter. They don't change the pointer itself, only change the
internal state of referenced Error object. So we can make it
Error *const * errp, to stress the behavior. It will also help
coccinelle script (in future) to distinguish such cases from common
errp usage.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20191205174635.18758-4-vsementsov@virtuozzo.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message typo fixed]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agonet/net: Clean up variable shadowing in net_client_init()
Vladimir Sementsov-Ogievskiy [Thu, 5 Dec 2019 17:46:16 +0000 (20:46 +0300)]
net/net: Clean up variable shadowing in net_client_init()

Variable int err in inner scope shadows Error *err in outer scope.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191205174635.18758-3-vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agotests-blockjob: Use error_free_or_abort()
Markus Armbruster [Wed, 4 Dec 2019 09:36:25 +0000 (10:36 +0100)]
tests-blockjob: Use error_free_or_abort()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20191204093625.14836-19-armbru@redhat.com>

4 years agohw/intc/s390: Simplify error handling in kvm_s390_flic_realize()
Markus Armbruster [Wed, 4 Dec 2019 09:36:24 +0000 (10:36 +0100)]
hw/intc/s390: Simplify error handling in kvm_s390_flic_realize()

Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Message-Id: <20191204093625.14836-18-armbru@redhat.com>

4 years agoerror: Clean up unusual names of Error * variables
Markus Armbruster [Wed, 4 Dec 2019 09:36:23 +0000 (10:36 +0100)]
error: Clean up unusual names of Error * variables

Local Error * variables are conventionally named @err or @local_err,
and Error ** parameters @errp.  Naming local variables like parameters
is confusing.  Clean that up.

Naming parameters like local variables is also confusing.  Left for
another day.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191204093625.14836-17-armbru@redhat.com>

4 years agomemory-device: Fix memory pre-plug error API violations
Markus Armbruster [Wed, 4 Dec 2019 09:36:17 +0000 (10:36 +0100)]
memory-device: Fix memory pre-plug error API violations

memory_device_get_free_addr() dereferences @errp when
memory_device_check_addable() fails.  That's wrong; see the big
comment in error.h.  Introduced in commit 1b6d6af21b "pc-dimm: factor
out capacity and slot checks into MemoryDevice".

No caller actually passes null.

Fix anyway: splice in a local Error *err, and error_propagate().

Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20191204093625.14836-11-armbru@redhat.com>

4 years agoqga: Fix guest-get-fsinfo error API violations
Markus Armbruster [Wed, 4 Dec 2019 09:36:16 +0000 (10:36 +0100)]
qga: Fix guest-get-fsinfo error API violations

build_guest_fsinfo_for_virtual_device() dereferences @errp when
build_guest_fsinfo_for_device() fails.  That's wrong; see the big
comment in error.h.  Introduced in commit 46d4c5723e "qga: Add
guest-get-fsinfo command".

No caller actually passes null.

Fix anyway: splice in a local Error *err, and error_propagate().

Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191204093625.14836-10-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4 years agohw/ipmi: Fix realize() error API violations
Markus Armbruster [Wed, 4 Dec 2019 09:36:15 +0000 (10:36 +0100)]
hw/ipmi: Fix realize() error API violations

isa_ipmi_bt_realize(), ipmi_isa_realize(), pci_ipmi_bt_realize(), and
pci_ipmi_kcs_realize() dereference @errp when IPMIInterfaceClass
method init() fails.  That's wrong; see the big comment in error.h.
Introduced in commit 0719029c47 "ipmi: Add an ISA KCS low-level
interface", then imitated in commit a9b74079cb "ipmi: Add a BT
low-level interface" and commit 12f983c6aa "ipmi: Add PCI IPMI
interfaces".

No caller actually passes null.

Fix anyway: splice in a local Error *err, and error_propagate().

Cc: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191204093625.14836-9-armbru@redhat.com>

4 years agohw/core: Fix fit_load_fdt() error API violations
Markus Armbruster [Wed, 4 Dec 2019 09:36:14 +0000 (10:36 +0100)]
hw/core: Fix fit_load_fdt() error API violations

fit_load_fdt() passes @errp to fit_image_addr(), then recovers from
ENOENT failures.  Passing @errp is wrong, because it works only as
long as @errp is neither @error_fatal nor @error_abort.  Error
recovery dereferences @errp.  That's also wrong; see the big comment
in error.h.  Error recovery can leave *errp pointing to a freed
Error object.  Wrong, it must be null on success.  Messed up in
commit 3eb99edb48 "loader-fit: Wean off error_printf()".

No caller actually passes such values, or uses *errp on success.

Fix anyway: splice in a local Error *err, and error_propagate().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191204093625.14836-8-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4 years agohw/acpi: Fix legacy CPU plug error API violations
Markus Armbruster [Wed, 4 Dec 2019 09:36:13 +0000 (10:36 +0100)]
hw/acpi: Fix legacy CPU plug error API violations

legacy_acpi_cpu_plug_cb() dereferences @errp when
acpi_set_cpu_present_bit() fails.  That's wrong; see the big comment
in error.h.  Introduced in commit cc43364de7 "acpi/cpu-hotplug:
introduce helper function to keep bit setting in one place".

No caller actually passes null, and acpi_set_cpu_present_bit() can't
actually fail.

Fix anyway: drop acpi_set_cpu_present_bit()'s @errp parameter.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20191204093625.14836-7-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4 years agoexec: Fix file_ram_alloc() error API violations
Markus Armbruster [Wed, 4 Dec 2019 09:36:12 +0000 (10:36 +0100)]
exec: Fix file_ram_alloc() error API violations

When os_mem_prealloc() fails, file_ram_alloc() calls qemu_ram_munmap()
and returns null.  Except it doesn't when its @errp argument is null,
because it checks for failure with (errp && *errp).  Introduced in
commit 056b68af77 "fix qemu exit on memory hotplug when allocation
fails at prealloc time".

No caller actually passes null.

Fix anyway: splice in a local Error *err, and error_propagate().

Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20191204093625.14836-6-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests: Clean up initialization of Error *err variables
Markus Armbruster [Wed, 4 Dec 2019 09:36:11 +0000 (10:36 +0100)]
tests: Clean up initialization of Error *err variables

Declaring a local Error *err without initializer looks suspicious.
Fuse the declaration with the initialization to avoid that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191204093625.14836-5-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4 years agoio: Fix Error usage in a comment <example>
Markus Armbruster [Wed, 4 Dec 2019 09:36:10 +0000 (10:36 +0100)]
io: Fix Error usage in a comment <example>

Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191204093625.14836-4-armbru@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4 years agocrypto: Fix typo in QCryptoTLSSession's <example> comment
Markus Armbruster [Wed, 4 Dec 2019 09:36:09 +0000 (10:36 +0100)]
crypto: Fix typo in QCryptoTLSSession's <example> comment

Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191204093625.14836-3-armbru@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4 years agocrypto: Fix certificate file error handling crash bug
Markus Armbruster [Wed, 4 Dec 2019 09:36:08 +0000 (10:36 +0100)]
crypto: Fix certificate file error handling crash bug

qcrypto_tls_creds_load_cert() passes uninitialized GError *gerr by
reference to g_file_get_contents().  When g_file_get_contents() fails,
it'll try to set a GError.  Unless @gerr is null by dumb luck, this
logs a ERROR_OVERWRITTEN_WARNING warning message and leaves @gerr
unchanged.  qcrypto_tls_creds_load_cert() then dereferences the
uninitialized @gerr.

Fix by initializing @gerr properly.

Fixes: 9a2fd4347c40321f5cbb4ab4220e759fcbf87d03
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191204093625.14836-2-armbru@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
4 years agoerror: Fix -msg timestamp default
Markus Armbruster [Thu, 10 Oct 2019 08:15:08 +0000 (10:15 +0200)]
error: Fix -msg timestamp default

-msg parameter "timestamp" defaults to "off" if you don't specify msg,
and to "on" if you do.  Messed up right in commit 5e2ac51917 "add
timestamp to error_report()".  Mostly harmless, because "timestamp" is
the only parameter, so "if you do" is "-msg ''", which nobody does.

Change the default to "off" no matter what.

While there, rename enable_timestamp_msg to error_with_timestamp, and
polish documentation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191010081508.8978-1-armbru@redhat.com>

4 years agovga: cleanup mapping of VRAM for non-PCI VGA
Paolo Bonzini [Mon, 9 Dec 2019 13:30:08 +0000 (14:30 +0100)]
vga: cleanup mapping of VRAM for non-PCI VGA

vga_init_vbe is now used only from ISA VGA cards.  Since the alias is
not needed anymore, remove it (effectively reverting commit 8294a64d7f,
"vga: fix vram double-mapping with -vga std and -M pc-0.12", 2012-05-29)
and the now unused vbe_mapped field of VGACommonState.  The function now
consists of a single memory_region_add_subregion call, so we can inline
it; this avoids incorrect usage from PCI cards.

Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Based-on: <05af415a-5058-98b4-4a12-9d093a30b1e3@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/display: Remove "rombar" hack from vga-pci and vmware_vga
Thomas Huth [Mon, 9 Dec 2019 12:52:48 +0000 (13:52 +0100)]
hw/display: Remove "rombar" hack from vga-pci and vmware_vga

Now that the old pc-0.x machine types have been removed, we do not need
the old "rombar" hacks anymore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209125248.5849-5-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/pci: Remove the "command_serr_enable" property
Thomas Huth [Mon, 9 Dec 2019 12:52:47 +0000 (13:52 +0100)]
hw/pci: Remove the "command_serr_enable" property

Now that the old pc-0.x machine types have been removed, this config
knob is not required anymore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209125248.5849-4-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/audio: Remove the "use_broken_id" hack from the AC97 device
Thomas Huth [Mon, 9 Dec 2019 12:52:46 +0000 (13:52 +0100)]
hw/audio: Remove the "use_broken_id" hack from the AC97 device

Now that the old pc-0.x machine types are gone, we do not need
the "use_broken_id" hack anymore.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209125248.5849-3-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/i386: Remove the deprecated machines 0.12 up to 0.15
Thomas Huth [Mon, 9 Dec 2019 12:52:45 +0000 (13:52 +0100)]
hw/i386: Remove the deprecated machines 0.12 up to 0.15

These machines can't be used reliably for migration anymore, quoting
https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg04516.html :

"
 due to the introduction of the memory API, the firmware is not
 migrated correctly from source to destination.  On QEMU <1.3 the
 0xf0000-0xfffff area is basically a copy of the higher
 0xffff0000-0xffffffff area, while on more recent versions it is
 initialized with zeroes and the firmware copies from 0xffff0000 to
 0xf0000.  When you migrate from old to new QEMU, after reboot there's
 nothing at 0xf0000 and bugs ensue.
"

The pc-0.x machines have been marked as deprecated since QEMU v4.0, so
it is time to remove them now.

And while we're at it, mark the remaining pc-1.x machine types
as deprecated now, too, so that we finally only have "pc-i440fx"
and "pc-q35" machine types left (apart from the non-versioned
"isapc" and "microvm") once we remove them in a couple of releases.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209125248.5849-2-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
Philippe Mathieu-Daudé [Mon, 9 Dec 2019 09:50:02 +0000 (10:50 +0100)]
hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge

Add the XEN_IGD_PASSTHROUGH Kconfig option.

Xen build has that option selected by default. Non-Xen builds now
have to select this feature manually.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191209095002.32194-7-philmd@redhat.com>
Acked-by: Paul Durrant <paul@xen.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/pci-host/i440fx: Extract the IGD passthrough host bridge device
Philippe Mathieu-Daudé [Mon, 9 Dec 2019 09:50:01 +0000 (10:50 +0100)]
hw/pci-host/i440fx: Extract the IGD passthrough host bridge device

We can use a i440FX without the IGD passthrough host bridge.
Extract it into a new file, 'hw/pci-host/xen_igd_pt.c'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191209095002.32194-6-philmd@redhat.com>
Acked-by: Paul Durrant <paul@xen.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/pci-host/i440fx: Use definitions instead of magic values
Philippe Mathieu-Daudé [Mon, 9 Dec 2019 09:50:00 +0000 (10:50 +0100)]
hw/pci-host/i440fx: Use definitions instead of magic values

Use definitions from "hw/pci/pci_regs.h".
This also helps when using git-grep.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209095002.32194-5-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
Philippe Mathieu-Daudé [Mon, 9 Dec 2019 09:49:59 +0000 (10:49 +0100)]
hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()

We don't enforce the -Wsign-conversion CPPFLAG, but it doesn't hurt
to avoid this warning:

  warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209095002.32194-4-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h"
Philippe Mathieu-Daudé [Mon, 9 Dec 2019 09:49:58 +0000 (10:49 +0100)]
hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h"

Make the PCII440FXState structure public, so it can be used out of
this source file. This will allow us to extract the IGD Passthrough
Host Bridge, which is a children of the TYPE_I440FX_PCI_DEVICE.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209095002.32194-3-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/pci-host/i440fx: Correct the header description
Philippe Mathieu-Daudé [Mon, 9 Dec 2019 09:49:57 +0000 (10:49 +0100)]
hw/pci-host/i440fx: Correct the header description

Missed during the refactor in commits 14a026dd58 and 0f25d865a,
this file is now only about the i440FX chipset.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191209095002.32194-2-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoFix some comment spelling errors.
Cameron Esfahani [Sat, 7 Dec 2019 02:33:30 +0000 (18:33 -0800)]
Fix some comment spelling errors.

Signed-off-by: Cameron Esfahani <dirty@apple.com>
Message-Id: <086c197db928384b8697edfa64755e2cb46c8100.1575685843.git.dirty@apple.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agotarget/i386: remove unused pci-assign codes
Eiichi Tsukata [Mon, 9 Dec 2019 07:29:32 +0000 (16:29 +0900)]
target/i386: remove unused pci-assign codes

Legacy PCI device assignment has been already removed in commit ab37bfc7d641
("pci-assign: Remove"), but some codes remain unused.

CC: qemu-trivial@nongnu.org
Signed-off-by: Eiichi Tsukata <devel@etsukata.com>
Message-Id: <20191209072932.313056-1-devel@etsukata.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoWHPX: refactor load library
Sunil Muthuswamy [Wed, 13 Nov 2019 18:54:39 +0000 (18:54 +0000)]
WHPX: refactor load library

This refactors the load library of WHV libraries to make it more
modular. It makes a helper routine that can be called on demand.
This allows future expansion of load library/functions to support
functionality that is dependent on some feature being available.

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Message-Id: <MW2PR2101MB1116578040BE1F0C1B662318C0760@MW2PR2101MB1116.namprd21.prod.outlook.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomigration: check length directly to make sure the range is aligned
Wei Yang [Fri, 12 Jul 2019 03:27:04 +0000 (11:27 +0800)]
migration: check length directly to make sure the range is aligned

Since the start addr is already checked, to make sure the range is
aligned, checking the length is enough.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190712032704.7826-1-richardw.yang@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomemory: include MemoryListener documentation and some missing function parameters
Paolo Bonzini [Tue, 29 Oct 2019 16:22:48 +0000 (17:22 +0100)]
memory: include MemoryListener documentation and some missing function parameters

These cover the remaining warnings from kernel-doc.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20191029162248.13383-7-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agodocs: add memory API reference
Paolo Bonzini [Tue, 29 Oct 2019 16:22:47 +0000 (17:22 +0100)]
docs: add memory API reference

Add kernel-doc directive to parse and include doc comments from
include/exec/memory.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomemory.h: Silence kernel-doc complaints
Paolo Bonzini [Tue, 29 Oct 2019 16:22:46 +0000 (17:22 +0100)]
memory.h: Silence kernel-doc complaints

Fix a few instances where kernel-doc complains about doc comments
in memory.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agodocs: Create bitops.rst as example of kernel-docs
Peter Maydell [Tue, 21 May 2019 12:25:15 +0000 (13:25 +0100)]
docs: Create bitops.rst as example of kernel-docs

Create a bitops.rst which is just a container for the
kernel-doc comments in qemu/bitops.h.

This is mostly a test of the kernel-doc extension machinery.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190521122519.12573-7-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agobitops.h: Silence kernel-doc complaints
Peter Maydell [Tue, 21 May 2019 12:25:14 +0000 (13:25 +0100)]
bitops.h: Silence kernel-doc complaints

Fix the problems with kernel-doc/sphinx syntax in the
doc comments for the shuffle and unshuffle functions:
 * mismatch between comment and prototype for argument name
 * the inline bit patterns need to be marked up so they
   are processed properly and rendered as monospace

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190521122519.12573-6-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoMakefile: disable Sphinx nitpicking
Peter Maydell [Tue, 21 May 2019 12:25:19 +0000 (13:25 +0100)]
Makefile: disable Sphinx nitpicking

Turn off Sphinx nitpicking as a temporary (?) measure so
sphinx builds complete even with warnings about missing
references.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190521122519.12573-11-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agodocs/conf.py: Enable use of kerneldoc sphinx extension
Peter Maydell [Fri, 29 Nov 2019 13:16:12 +0000 (14:16 +0100)]
docs/conf.py: Enable use of kerneldoc sphinx extension

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190521122519.12573-4-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agodocs: tweak kernel-doc for QEMU coding standards
Paolo Bonzini [Tue, 29 Oct 2019 16:22:44 +0000 (17:22 +0100)]
docs: tweak kernel-doc for QEMU coding standards

Surprisingly, QEMU does have a pretty consistent doc comment style and
it is not very different from the Linux kernel's.  Of the documentation
"sigils", only "#" separates the QEMU doc comment style from Linux's,
and it has 200+ instances vs. 6 for the kernel's '&struct foo' (all in
accel/tcg/translate-all.c), so it's clear that the two standards are
different in this respect.  In addition, our structs are typedefed and
recognized by CamelCase names.

Adjust kernel-doc's parser for these two aspects of the QEMU coding
standards.  The patch has been valid, with hardly any change, for over
two years, so it should not be an issue to keep kernel-doc in sync with
the Linux copy.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agodocs: import Linux kernel-doc script and extension
Paolo Bonzini [Tue, 29 Oct 2019 16:22:43 +0000 (17:22 +0100)]
docs: import Linux kernel-doc script and extension

Import Linux's kernel-doc script as of commit 15e2544ed38a1e, as well
as the Sphinx extension to call kernel-doc according to the arguments
and parameters given to a reStructuredText directive.

The kernel-doc extension accepts a filename, which is relative to
the QEMU source tree root.  The extension also notifies Sphinx about the
document dependency on the file, causing the document to be rebuilt when
the file has been changed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agobuild: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG
Paolo Bonzini [Fri, 29 Nov 2019 10:42:53 +0000 (11:42 +0100)]
build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG

Since we are actually testing for the newer capng library, rename the
symbol to match.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agocolo: fix return without releasing RCU
Paolo Bonzini [Fri, 13 Dec 2019 14:07:22 +0000 (15:07 +0100)]
colo: fix return without releasing RCU

Use WITH_RCU_READ_LOCK_GUARD to avoid exiting colo_init_ram_cache
without releasing RCU.

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agomemory: use RCU_READ_LOCK_GUARD
Paolo Bonzini [Fri, 13 Dec 2019 14:06:45 +0000 (15:06 +0100)]
memory: use RCU_READ_LOCK_GUARD

Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoqsp: Use WITH_RCU_READ_LOCK_GUARD
Dr. David Alan Gilbert [Fri, 13 Dec 2019 13:19:31 +0000 (13:19 +0000)]
qsp: Use WITH_RCU_READ_LOCK_GUARD

The automatic rcu read lock maintenance works quite
nicely in this case where it previously relied on a comment to
delimit the lifetime and now has a block.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohyperv: Use auto rcu_read macros
Dr. David Alan Gilbert [Fri, 13 Dec 2019 13:19:30 +0000 (13:19 +0000)]
hyperv: Use auto rcu_read macros

Use RCU_READ_LOCK_GUARD and WITH_RCU_READ_LOCK_GUARD
to replace the manual rcu_read_(un)lock calls.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/i386/pc: Extract the port92 device
Philippe Mathieu-Daudé [Fri, 13 Dec 2019 10:51:00 +0000 (11:51 +0100)]
hw/i386/pc: Extract the port92 device

This device is only used by the PC machines. The pc.c file is
already big enough, with 2255 lines. By removing 113 lines of
it, we reduced it by 5%. It is now a bit easier to navigate
the file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/i386/pc: Inline port92_init()
Philippe Mathieu-Daudé [Fri, 13 Dec 2019 10:50:59 +0000 (11:50 +0100)]
hw/i386/pc: Inline port92_init()

This one-line function is not very helpful, so remove it
by inlining the call to qdev_connect_gpio_out_named().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/i386/pc: Use TYPE_PORT92 instead of hardcoded string
Philippe Mathieu-Daudé [Fri, 13 Dec 2019 10:50:58 +0000 (11:50 +0100)]
hw/i386/pc: Use TYPE_PORT92 instead of hardcoded string

By using the TYPE_* definitions for devices, we can:
- quickly find where devices are used with 'git-grep'
- easily rename a device (one-line change).

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/isa/isa-bus: cleanup irq functions
Paolo Bonzini [Fri, 13 Dec 2019 12:00:43 +0000 (13:00 +0100)]
hw/isa/isa-bus: cleanup irq functions

The irq number is unsigned; we reject negative values.  But -1
is used for the isairq array, which is declared unsigned!  And
since we have a definition for the number of ISA IRQs, use it.

Based on a patch by Philippe Mathieu-Daudé.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/i386: Simplify ioapic_init_gsi()
Philippe Mathieu-Daudé [Fri, 13 Dec 2019 11:11:45 +0000 (12:11 +0100)]
hw/i386: Simplify ioapic_init_gsi()

All callers of ioapic_init_gsi() provide a parent. We want new
uses to follow the same good practice and provide the parent
name, so do not make this optional: assert the parent name is
provided, and simplify the code.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler()
Philippe Mathieu-Daudé [Fri, 13 Dec 2019 11:07:36 +0000 (12:07 +0100)]
hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler()

Both gsi_handler() and kvm_pc_gsi_handler() have the same content,
except one comment. Move the comment, and de-duplicate the code.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agopc: stubify x86 iommu
Paolo Bonzini [Thu, 12 Dec 2019 17:10:35 +0000 (18:10 +0100)]
pc: stubify x86 iommu

Allow building microvm without x86-iommu.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoacpi: move PC stubs out of stubs/
Paolo Bonzini [Thu, 12 Dec 2019 17:03:46 +0000 (18:03 +0100)]
acpi: move PC stubs out of stubs/

This is a small cleanup that lets microvm build entirely without
include/hw/i386/pc.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agox86: move more x86-generic functions out of PC files
Paolo Bonzini [Thu, 12 Dec 2019 13:14:40 +0000 (14:14 +0100)]
x86: move more x86-generic functions out of PC files

These are needed by microvm too, so move them outside of PC-specific files.
With this patch, microvm.c need not include pc.h anymore.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw/i386/pc: Convert DPRINTF() to trace events
Philippe Mathieu-Daudé [Fri, 13 Dec 2019 10:50:57 +0000 (11:50 +0100)]
hw/i386/pc: Convert DPRINTF() to trace events

Convert the deprecated DPRINTF() macro to trace events.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agox86: move SMM property to X86MachineState
Paolo Bonzini [Thu, 12 Dec 2019 16:28:01 +0000 (17:28 +0100)]
x86: move SMM property to X86MachineState

Add it to microvm as well, it is a generic property of the x86
architecture.

Suggested-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agopci-stub: add more MSI functions
Paolo Bonzini [Thu, 12 Dec 2019 13:20:05 +0000 (14:20 +0100)]
pci-stub: add more MSI functions

On x86, KVM needs some function from the PCI subsystem in order to set
up interrupt routes.  Provide some stubs to support x86 machines that
lack PCI.

Reviewed-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agohw: replace hw/i386/pc.h with a header just for the i8259
Paolo Bonzini [Thu, 12 Dec 2019 16:15:43 +0000 (17:15 +0100)]
hw: replace hw/i386/pc.h with a header just for the i8259

Remove the need to include i386/pc.h to get to the i8259 functions.
This is enough to remove the inclusion of hw/i386/pc.h from all non-x86
files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agofw_cfg: allow building without other devices
Paolo Bonzini [Thu, 12 Dec 2019 13:12:27 +0000 (14:12 +0100)]
fw_cfg: allow building without other devices

The microvm machine type uses fw_cfg but lacks SMBIOS and ACPI.  Do not
include the files if the symbol is not present in QEMU and remove
dependencies on machine-specific files.

Reviewed-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 years agoi386: conditionally compile more files
Paolo Bonzini [Thu, 12 Dec 2019 10:52:37 +0000 (11:52 +0100)]
i386: conditionally compile more files

Reviewed-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>