]> Git Repo - qemu.git/log
qemu.git
6 years agonet: milkymist_minimac2: convert SysBus init method to a realize method
Cédric Le Goater [Mon, 1 Oct 2018 06:37:57 +0000 (08:37 +0200)]
net: milkymist_minimac2: convert SysBus init method to a realize method

Cc: Michael Walle <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181001063803[email protected]>
Acked-by: Michael Walle <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agonet: lance: convert SysBus init method to a realize method
Cédric Le Goater [Mon, 1 Oct 2018 06:37:56 +0000 (08:37 +0200)]
net: lance: convert SysBus init method to a realize method

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181001063803[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agonet: lan9118: convert SysBus init method to a realize method
Cédric Le Goater [Mon, 1 Oct 2018 06:37:55 +0000 (08:37 +0200)]
net: lan9118: convert SysBus init method to a realize method

Signed-off-by: Cédric Le Goater <[email protected]>
Message-Id: <20181001063803[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agonet: etraxfs_eth: add a reset method
Cédric Le Goater [Mon, 1 Oct 2018 06:37:54 +0000 (08:37 +0200)]
net: etraxfs_eth: add a reset method

Cc: Edgar E. Iglesias <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Message-Id: <20181001063803[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agonet: etraxfs_eth: convert SysBus init method to a realize method
Cédric Le Goater [Mon, 1 Oct 2018 06:37:53 +0000 (08:37 +0200)]
net: etraxfs_eth: convert SysBus init method to a realize method

Cc: Edgar E. Iglesias <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-Id: <20181001063803[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: trace when pre_plugging/plugging/unplugging
David Hildenbrand [Fri, 5 Oct 2018 09:20:24 +0000 (11:20 +0200)]
memory-device: trace when pre_plugging/plugging/unplugging

Let's trace the address and the id of a memory device when
pre_plugging/plugging/unplugging succeeded.

Trace it when pre_plugging as well as when plugging, so we really know
when a specific address is actually used.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: complete factoring out unplug handling
David Hildenbrand [Fri, 5 Oct 2018 09:20:23 +0000 (11:20 +0200)]
memory-device: complete factoring out unplug handling

With the new memory device functions in place, we can factor out
unplugging of memory devices completely.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: complete factoring out plug handling
David Hildenbrand [Fri, 5 Oct 2018 09:20:22 +0000 (11:20 +0200)]
memory-device: complete factoring out plug handling

With the new memory device functions in place, we can factor out
plugging of memory devices completely.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: complete factoring out pre_plug handling
David Hildenbrand [Fri, 5 Oct 2018 09:20:21 +0000 (11:20 +0200)]
memory-device: complete factoring out pre_plug handling

With all required memory device class functions in place, we can factor
out pre_plug handling of memory devices. Take proper care of errors. We
still have to carry along legacy_align required for pc compatibility
handling.

We will factor out tracing of the address separately in a follow-up
patch.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: add device class function set_addr()
David Hildenbrand [Fri, 5 Oct 2018 09:20:20 +0000 (11:20 +0200)]
memory-device: add device class function set_addr()

To be able to factor out address assignment of memory devices, we will
have to read (get_addr()) and write (set_addr()) the address.

We can't use properties for this purpose, as properties are device
specific. E.g. while the address property for a DIMM is called "addr", it
might be called differently (e.g. "memaddr") for other devices.

Especially virtio based memory devices cannot use "addr" as that is already
reserved and used for the address on the bus (for the proxy device).

Also, it might be possible to have memory devices without address
properties (e.g. internal DIMM-like thingies).

In contrast to get_addr(), we expect that set_addr() can fail.

Keep it simple for now for pc-dimm and simply set the static property, that
will fail once realized.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: drop get_region_size()
David Hildenbrand [Fri, 5 Oct 2018 09:20:19 +0000 (11:20 +0200)]
memory-device: drop get_region_size()

There are no remaining users of get_region_size() except
memory_device_get_region_size() itself. We can make
memory_device_get_region_size() work directly on get_memory_region()
instead and drop get_region_size().

In addition, we can now use memory_device_get_region_size() in pc-dimm
code to implement get_plugged_size()"

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: factor out get_memory_region() from pc-dimm
David Hildenbrand [Fri, 5 Oct 2018 09:20:18 +0000 (11:20 +0200)]
memory-device: factor out get_memory_region() from pc-dimm

The memory region is necessary for plugging/unplugging a memory device.
The region size (via get_region_size()) is no longer sufficient, as
besides the alignment, also the region itself is required in order to
add it to the device memory region of the machine via
- memory_region_add_subregion
- memory_region_del_subregion

So, to factor out plugging/unplugging of memory devices from pc-dimm
code, we have to factor out access to the memory region first.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: add and use memory_device_get_region_size()
David Hildenbrand [Fri, 5 Oct 2018 09:20:17 +0000 (11:20 +0200)]
memory-device: add and use memory_device_get_region_size()

We will factor out get_memory_region() from pc-dimm to memory device code
soon. Once that is done, get_region_size() can be implemented
generically and essentially be replaced by
memory_device_get_region_size (and work only on get_memory_region()).

We have some users of get_memory_region() (spapr and pc-dimm code) that are
only interested in the size. So let's rework them to use
memory_device_get_region_size() first, then we can factor out
get_memory_region() and eventually remove get_region_size() without
touching the same code multiple times.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: document MemoryDeviceClass
David Hildenbrand [Fri, 5 Oct 2018 09:20:16 +0000 (11:20 +0200)]
memory-device: document MemoryDeviceClass

Document the functions. Don't document get_region_size(), as we will be
dropping/replacing that one soon.

Use same documentation style as in include/exec/memory.h, but don't
document the parameters, as they are self-explanatory.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: forward errors in get_region_size()/get_plugged_size()
David Hildenbrand [Fri, 5 Oct 2018 09:20:15 +0000 (11:20 +0200)]
memory-device: forward errors in get_region_size()/get_plugged_size()

Let's properly forward the errors, so errors from get_region_size() /
get_plugged_size() can be handled.

Users right now call both functions after the device has been realized,
which is will never fail, so it is fine to continue using error_abort.

While at it, remove a leftover error check (suggested by Igor).

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: introduce separate config option
David Hildenbrand [Fri, 5 Oct 2018 09:20:14 +0000 (11:20 +0200)]
memory-device: introduce separate config option

Some architectures might support memory devices, while they don't
support DIMM/NVDIMM. So let's
- Rename CONFIG_MEM_HOTPLUG to CONFIG_MEM_DEVICE
- Introduce CONFIG_DIMM and use it similarly to CONFIG NVDIMM

CONFIG_DIMM and CONFIG_NVDIMM require CONFIG_MEM_DEVICE.

Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Acked-by: David Gibson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: use memory device terminology in error messages
David Hildenbrand [Fri, 5 Oct 2018 09:20:13 +0000 (11:20 +0200)]
memory-device: use memory device terminology in error messages

While we rephrased most error messages, we missed these.

Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agopc-dimm: pass PCDIMMDevice to pc_dimm_.*plug
David Hildenbrand [Fri, 5 Oct 2018 09:20:12 +0000 (11:20 +0200)]
pc-dimm: pass PCDIMMDevice to pc_dimm_.*plug

We're plugging/unplugging a PCDIMMDevice, so directly pass this type
instead of a more generic DeviceState.

Reviewed-by: David Gibson <[email protected]>
Acked-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: improve "range conflicts" error message
David Hildenbrand [Fri, 5 Oct 2018 09:20:11 +0000 (11:20 +0200)]
memory-device: improve "range conflicts" error message

Handle id==NULL better and indicate that we are dealing with memory
devices.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: fix error message when hinted address is too small
David Hildenbrand [Fri, 5 Oct 2018 09:20:10 +0000 (11:20 +0200)]
memory-device: fix error message when hinted address is too small

The "at" should actually be a "before".
    if (new_addr < address_space_start)
     -> "can't add memory ... before... $address_space_start"

So it looks similar to the other check
    } else if ((new_addr + size) > address_space_end)
     -> "can't add memory ... beyond..."

Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomemory-device: fix alignment error message
David Hildenbrand [Fri, 5 Oct 2018 09:20:09 +0000 (11:20 +0200)]
memory-device: fix alignment error message

We're missing "x" after the leading 0.

Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20181005092024[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agomachine: fix a typo
Li Qiang [Wed, 10 Oct 2018 16:10:25 +0000 (09:10 -0700)]
machine: fix a typo

Cc: [email protected]
Signed-off-by: Li Qiang <[email protected]>
Message-Id: <20181010161025[email protected]>
Reviewed-by: Stefano Garzarella <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/mips/malta: Remove unuseful code
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:21 +0000 (23:25 +0200)]
hw/mips/malta: Remove unuseful code

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/hppa/dino: Remove unuseful code
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:20 +0000 (23:25 +0200)]
hw/hppa/dino: Remove unuseful code

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/alpha/typhoon: Remove unuseful code
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:19 +0000 (23:25 +0200)]
hw/alpha/typhoon: Remove unuseful code

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/sparc64/niagara: Model the I/O Bridge with the 'unimplemented_device'
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:18 +0000 (23:25 +0200)]
hw/sparc64/niagara: Model the I/O Bridge with the 'unimplemented_device'

Since the I/O Bridge device is not implemented,  Use the
TYPE_UNIMPLEMENTED_DEVICE which suits better: if the user
asks for 'unimp' warnings via the -d option then all accesses
will generate logging.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Artyom Tarasenko <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/mips/gt64xxx_pci: Mark as bridge device
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:17 +0000 (23:25 +0200)]
hw/mips/gt64xxx_pci: Mark as bridge device

The gt64120 is currently listed as uncategorized device.
Mark it as bridge device.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:16 +0000 (23:25 +0200)]
hw/mips/gt64xxx_pci: Convert gt64120_reset() function into Device reset method

Convert the gt64120_reset() function into a proper Device reset method.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:15 +0000 (23:25 +0200)]
hw/pci-host/bonito: Use DeviceState::realize rather than SysBusDevice::init

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181002212522[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:14 +0000 (23:25 +0200)]
hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181002212522[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:13 +0000 (23:25 +0200)]
hw/ssi/xilinx_spi: Use DeviceState::realize rather than SysBusDevice::init

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:12 +0000 (23:25 +0200)]
hw/timer/sun4v-rtc: Use DeviceState::realize rather than SysBusDevice::init

Move from the legacy SysBusDevice::init method to using DeviceState::realize.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:11 +0000 (23:25 +0200)]
hw/timer/sun4v-rtc: Convert from DPRINTF() macro to trace events

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Artyom Tarasenko <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agotrace-events: Fix copy/paste typo
Philippe Mathieu-Daudé [Tue, 2 Oct 2018 21:25:10 +0000 (23:25 +0200)]
trace-events: Fix copy/paste typo

Missed while reviewing 5dd85b4b486.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Message-Id: <20181002212522[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agovl:c: make sure that sockets are calculated correctly in '-smp X' case
Igor Mammedov [Thu, 13 Sep 2018 11:06:02 +0000 (13:06 +0200)]
vl:c: make sure that sockets are calculated correctly in '-smp X' case

commit
  (5cdc9b76e3 vl.c: Remove dead assignment)
removed sockets calculation when 'sockets' weren't provided on CLI
since there wasn't any users for it back then. Exiting checks
are neither reachable
   } else if (sockets * cores * threads < cpus) {
or nor triggerable
   if (sockets * cores * threads > max_cpus)
so we weren't noticing wrong topology since then, since users
recalculate sockets adhoc on their own.

However with deprecation check it becomes noticable, for example
  -smp 2
will start printing warning:
  "warning: Invalid CPU topology deprecated: sockets (1) * cores (1) * threads (1) != maxcpus (2)"
calculating sockets if they weren't specified.

Fix it by returning back sockets calculation if it's omitted on CLI.

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-Id: <1536836762[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agovl.c deprecate incorrect CPUs topology
Igor Mammedov [Thu, 13 Sep 2018 11:06:01 +0000 (13:06 +0200)]
vl.c deprecate incorrect CPUs topology

-smp [cpus],sockets/cores/threads[,maxcpus] should describe topology
so that total number of logical CPUs [sockets * cores * threads]
would be equal to [maxcpus], however historically we didn't have
such check in QEMU and it is possible to start VM with an invalid
topology.
Deprecate invalid options combination so we can make sure that
the topology VM started with is always correct in the future.
Users with an invalid sockets/cores/threads/maxcpus values should
fix their CLI to make sure that
   [sockets * cores * threads] == [maxcpus]

Signed-off-by: Igor Mammedov <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <1536836762[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[ehabkost: squashed unit test fix]
Message-Id: <20181019215345.521d58d7@igors-macbook-pro.local>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agohostmem-file: fixed the memory leak while get pmem path.
Zhang Yi [Tue, 28 Aug 2018 16:14:22 +0000 (00:14 +0800)]
hostmem-file: fixed the memory leak while get pmem path.

object_get_canonical_path_component() returns a string which
must be freed using g_free().

Reported-by: Peter Maydell <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Zhang Yi <[email protected]>
Message-Id: <7328fb16c394eaf5d65437d11c2a9343647b6d3d.1535471899[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-10-22' into staging
Peter Maydell [Tue, 23 Oct 2018 16:20:23 +0000 (17:20 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-10-22' into staging

Error reporting patches for 2018-10-22

# gpg: Signature made Mon 22 Oct 2018 13:20:23 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <[email protected]>"
# gpg:                 aka "Markus Armbruster <[email protected]>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2018-10-22: (40 commits)
  error: Drop bogus "use error_setg() instead" admonitions
  vpc: Fail open on bad header checksum
  block: Clean up bdrv_img_create()'s error reporting
  vl: Simplify call of parse_name()
  vl: Fix exit status for -drive format=help
  blockdev: Convert drive_new() to Error
  vl: Assert drive_new() does not fail in default_drive()
  fsdev: Clean up error reporting in qemu_fsdev_add()
  spice: Clean up error reporting in add_channel()
  tpm: Clean up error reporting in tpm_init_tpmdev()
  numa: Clean up error reporting in parse_numa()
  vnc: Clean up error reporting in vnc_init_func()
  ui: Convert vnc_display_init(), init_keyboard_layout() to Error
  ui/keymaps: Fix handling of erroneous include files
  vl: Clean up error reporting in device_init_func()
  vl: Clean up error reporting in parse_fw_cfg()
  vl: Clean up error reporting in mon_init_func()
  vl: Clean up error reporting in machine_set_property()
  vl: Clean up error reporting in chardev_init_func()
  qom: Clean up error reporting in user_creatable_add_opts_foreach()
  ...

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Peter Maydell [Tue, 23 Oct 2018 15:05:00 +0000 (16:05 +0100)]
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

Fam Zheng (2):
  slirp: Add sanity check for str option length
  slirp: Implement RFC2132 TFTP server name

# gpg: Signature made Sun 21 Oct 2018 20:29:34 BST
# gpg:                using RSA key E3F65A9E9560DB4C
# gpg: Good signature from "Samuel Thibault <[email protected]>"
# gpg:                 aka "Samuel Thibault <[email protected]>"
# gpg:                 aka "Samuel Thibault <[email protected]>"
# gpg:                 aka "Samuel Thibault <[email protected]>"
# gpg:                 aka "Samuel Thibault <[email protected]>"
# gpg:                 aka "Samuel Thibault <[email protected]>"
# gpg:                 aka "Samuel Thibault <[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: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: 33FA 7B64 6195 01F8 CE9C  8F97 E3F6 5A9E 9560 DB4C

* remotes/thibault/tags/samuel-thibault:
  slirp: Implement RFC2132 TFTP server name
  slirp: Add sanity check for str option length

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-pull-request' into...
Peter Maydell [Tue, 23 Oct 2018 11:19:44 +0000 (12:19 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-pull-request' into staging

Update min required crypto library versions

The min required versions for crypto libraries are now

 - gnutls >= 3.1.18
 - nettle >= 2.7.1
 - gcrypt >= 1.5.0

# gpg: Signature made Fri 19 Oct 2018 14:42:35 BST
# gpg:                using RSA key BE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <[email protected]>"
# gpg:                 aka "Daniel P. Berrange <[email protected]>"
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/qcrypto-next-pull-request:
  crypto: require nettle >= 2.7.1 for building QEMU
  crypto: require libgcrypt >= 1.5.0 for building QEMU
  crypto: require gnutls >= 3.1.18 for building QEMU

Signed-off-by: Peter Maydell <[email protected]>
6 years agoosdep: Work around MinGW assert
Richard Henderson [Mon, 22 Oct 2018 18:16:23 +0000 (19:16 +0100)]
osdep: Work around MinGW assert

In several places we use assert(FEATURE), and assume that if FEATURE
is disabled, all following code is removed as unreachable.  Which allows
us to compile-out functions that are only present with FEATURE, and
have a link-time failure if the functions remain used.

MinGW does not mark its internal function _assert() as noreturn, so the
compiler cannot see when code is unreachable, which leads to link errors
for this host that are not present elsewhere.

The current build-time failure concerns 62823083b8a2, but I remember
having seen this same error before.  Fix it once and for all for MinGW.

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20181022181623[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agoslirp: Implement RFC2132 TFTP server name
Fam Zheng [Fri, 14 Sep 2018 07:26:16 +0000 (15:26 +0800)]
slirp: Implement RFC2132 TFTP server name

This new usernet option can be used to add data for option 66 (tftp
server name) in the BOOTP reply, which is useful in PXE based automatic
OS install such as OpenBSD.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Tested-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Samuel Thibault <[email protected]>
6 years agoslirp: Add sanity check for str option length
Fam Zheng [Fri, 14 Sep 2018 07:26:15 +0000 (15:26 +0800)]
slirp: Add sanity check for str option length

When user provides a long domainname or hostname that doesn't fit in the
DHCP packet, we mustn't overflow the response packet buffer. Instead,
report errors, following the g_warning() in the slirp->vdnssearch
branch.

Also check the strlen against 256 when initializing slirp, which limit
is also from the protocol where one byte represents the string length.
This gives an early error before the warning which is harder to notice
or diagnose.

Reported-by: Thomas Huth <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Cc: [email protected]
Signed-off-by: Fam Zheng <[email protected]>
Tested-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Samuel Thibault <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.1-pull-request...
Peter Maydell [Sun, 21 Oct 2018 13:00:27 +0000 (14:00 +0100)]
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.1-pull-request' into staging

A series to enable ioctl usbfs in linux-user

# gpg: Signature made Fri 19 Oct 2018 13:18:53 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <[email protected]>"
# gpg:                 aka "Laurent Vivier <[email protected]>"
# gpg:                 aka "Laurent Vivier (Red Hat) <[email protected]>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-3.1-pull-request:
  linux-user: Implement special usbfs ioctls.
  linux-user: Define ordinary usbfs ioctls.
  linux-user: Check for Linux USBFS in configure

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Fri, 19 Oct 2018 18:01:07 +0000 (19:01 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* RTC fixes (Artem)
* icount fixes (Artem)
* rr fixes (Pavel, myself)
* hotplug cleanup (Igor)
* SCSI fixes (myself)
* 4.20-rc1 KVM header update (myself)
* coalesced PIO support (Peng Hao)
* HVF fixes (Roman B.)
* Hyper-V refactoring (Roman K.)
* Support for Hyper-V IPI (Vitaly)

# gpg: Signature made Fri 19 Oct 2018 12:47:58 BST
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <[email protected]>"
# gpg:                 aka "Paolo Bonzini <[email protected]>"
# 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: (47 commits)
  replay: pass raw icount value to replay_save_clock
  target/i386: kvm: just return after migrate_add_blocker failed
  hyperv_testdev: add SynIC message and event testmodes
  hyperv: process POST_MESSAGE hypercall
  hyperv: add support for KVM_HYPERV_EVENTFD
  hyperv: process SIGNAL_EVENT hypercall
  hyperv: add synic event flag signaling
  hyperv: add synic message delivery
  hyperv: make overlay pages for SynIC
  hyperv: only add SynIC in compatible configurations
  hyperv: qom-ify SynIC
  hyperv:synic: split capability testing and setting
  i386: add hyperv-stub for CONFIG_HYPERV=n
  default-configs: collect CONFIG_HYPERV* in hyperv.mak
  hyperv: factor out arch-independent API into hw/hyperv
  hyperv: make hyperv_vp_index inline
  hyperv: split hyperv-proto.h into x86 and arch-independent parts
  hyperv: rename kvm_hv_sint_route_set_sint
  hyperv: make HvSintRoute reference-counted
  hyperv: address HvSintRoute by X86CPU pointer
  ...

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20181018' into staging
Peter Maydell [Fri, 19 Oct 2018 15:17:32 +0000 (16:17 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20181018' into staging

Queued tcg patches.

# gpg: Signature made Fri 19 Oct 2018 07:03:20 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <[email protected]>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20181018: (21 commits)
  cputlb: read CPUTLBEntry.addr_write atomically
  target/s390x: Check HAVE_ATOMIC128 and HAVE_CMPXCHG128 at translate
  target/s390x: Skip wout, cout helpers if op helper does not return
  target/s390x: Split do_cdsg, do_lpq, do_stpq
  target/s390x: Convert to HAVE_CMPXCHG128 and HAVE_ATOMIC128
  target/ppc: Convert to HAVE_CMPXCHG128 and HAVE_ATOMIC128
  target/arm: Check HAVE_CMPXCHG128 at translate time
  target/arm: Convert to HAVE_CMPXCHG128
  target/i386: Convert to HAVE_CMPXCHG128
  tcg: Split CONFIG_ATOMIC128
  tcg: Add tlb_index and tlb_entry helpers
  cputlb: serialize tlb updates with env->tlb_lock
  cputlb: fix assert_cpu_is_self macro
  exec: introduce tlb_init
  target/unicore32: remove tlb_flush from uc32_init_fn
  target/alpha: remove tlb_flush from alpha_cpu_initfn
  tcg: distribute tcg_time into TCG contexts
  tcg: plug holes in struct TCGProfile
  tcg: fix use of uninitialized variable under CONFIG_PROFILER
  tcg: access cpu->icount_decr.u16.high with atomics
  ...

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
Peter Maydell [Fri, 19 Oct 2018 14:30:40 +0000 (15:30 +0100)]
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Fri 19 Oct 2018 04:16:03 BST
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <[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: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request: (26 commits)
  qemu-options: Fix bad "macaddr" property in the documentation
  e1000: indicate dropped packets in HW counters
  net: ignore packet size greater than INT_MAX
  pcnet: fix possible buffer overflow
  rtl8139: fix possible out of bound access
  ne2000: fix possible out of bound access in ne2000_receive
  clean up callback when del virtqueue
  docs: Add COLO status diagram to COLO-FT.txt
  COLO: quick failover process by kick COLO thread
  COLO: notify net filters about checkpoint/failover event
  filter-rewriter: handle checkpoint and failover event
  filter: Add handle_event method for NetFilterClass
  COLO: flush host dirty ram from cache
  savevm: split the process of different stages for loadvm/savevm
  qapi: Add new command to query colo status
  qapi/migration.json: Rename COLO unknown mode to none mode.
  qmp event: Add COLO_EXIT event to notify users while exited COLO
  COLO: Flush memory data from ram cache
  ram/COLO: Record the dirty pages that SVM received
  COLO: Load dirty pages into SVM's RAM cache firstly
  ...

Signed-off-by: Peter Maydell <[email protected]>
6 years agoerror: Drop bogus "use error_setg() instead" admonitions
Markus Armbruster [Fri, 19 Oct 2018 12:39:23 +0000 (14:39 +0200)]
error: Drop bogus "use error_setg() instead" admonitions

Commit 97f40301f1d "error: Functions to report warnings and
informational messages" copied the "use error_setg() instead"
admonition from the error reporting functions to new functions even
though it doesn't actually apply there.  Drop it.  Also drop it from
vreport(), where it doesn't apply anymore.

Reported-by: Kevin Wolf <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20181019123923[email protected]>
Reviewed-by: Eric Blake <[email protected]>
6 years agocrypto: require nettle >= 2.7.1 for building QEMU
Daniel P. Berrangé [Wed, 18 Jul 2018 10:55:05 +0000 (11:55 +0100)]
crypto: require nettle >= 2.7.1 for building QEMU

nettle 2.7.1 was released in 2013 and all the distros that are build
target platforms for QEMU [1] include it:

  RHEL-7: 2.7.1
  Debian (Stretch): 3.3
  Debian (Jessie): 2.7.1
  OpenBSD (ports): 3.4
  FreeBSD (ports): 3.4
  OpenSUSE Leap 15: 3.4
  Ubuntu (Xenial): 3.2
  macOS (Homebrew): 3.4

Based on this, it is reasonable to require nettle >= 2.7.1 in QEMU
which allows for some conditional version checks in the code to be
removed.

[1] https://qemu.weilnetz.de/doc/qemu-doc.html#Supported-build-platforms

Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agovpc: Fail open on bad header checksum
Markus Armbruster [Wed, 17 Oct 2018 08:27:02 +0000 (10:27 +0200)]
vpc: Fail open on bad header checksum

vpc_open() merely prints a warning when it finds a bad header
checksum.  Turn that into a hard error.

Cc: Kevin Wolf <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20181017082702[email protected]>
[Error message capitalized for local consistency]
Reviewed-by: Kevin Wolf <[email protected]>
6 years agoblock: Clean up bdrv_img_create()'s error reporting
Markus Armbruster [Wed, 17 Oct 2018 08:27:00 +0000 (10:27 +0200)]
block: Clean up bdrv_img_create()'s error reporting

bdrv_img_create() takes an Error ** argument and uses it in the
conventional way, except for one place: when qemu_opts_do_parse()
fails, it first reports its error to stderr or the HMP monitor with
error_report_err(), then error_setg()'s a generic error.

When the caller reports that second error similarly, this produces two
consecutive error messages on stderr or the HMP monitor.

When the caller does something else with it, such as send it via QMP,
the first error still goes to stderr or the HMP monitor.  Fortunately,
no such caller exists.

Simply use the first error as is.  Update expected output of
qemu-iotest 049 accordingly.

Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20181017082702[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
6 years agovl: Simplify call of parse_name()
Markus Armbruster [Wed, 17 Oct 2018 08:26:59 +0000 (10:26 +0200)]
vl: Simplify call of parse_name()

main() checks for parse_name() failure even though it can't actually
fail.  That's okay.  Simplify it to check by passing &error_fatal,
like the other users of qemu_opts_foreach().

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Fix exit status for -drive format=help
Markus Armbruster [Wed, 17 Oct 2018 08:26:58 +0000 (10:26 +0200)]
vl: Fix exit status for -drive format=help

Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agoblockdev: Convert drive_new() to Error
Markus Armbruster [Wed, 17 Oct 2018 08:26:57 +0000 (10:26 +0200)]
blockdev: Convert drive_new() to Error

Calling error_report() from within a function that takes an Error **
argument is suspicious.  drive_new() calls error_report() even though
it can run within drive_init_func(), which takes an Error ** argument.
drive_init_func()'s caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway:

* Convert drive_new() to Error

* Update add_init_drive() to report the error received from
  drive_new()

* Make main() pass &error_fatal through qemu_opts_foreach(),
  drive_init_func() to drive_new()

* Make default_drive() pass &error_abort through qemu_opts_foreach(),
  drive_init_func() to drive_new()

Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Assert drive_new() does not fail in default_drive()
Markus Armbruster [Wed, 17 Oct 2018 08:26:56 +0000 (10:26 +0200)]
vl: Assert drive_new() does not fail in default_drive()

If creating (empty) default drives fails, it's a bug.  Therefore,
assert() is more appropriate than exit(1).

Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agofsdev: Clean up error reporting in qemu_fsdev_add()
Markus Armbruster [Wed, 17 Oct 2018 08:26:55 +0000 (10:26 +0200)]
fsdev: Clean up error reporting in qemu_fsdev_add()

Calling error_report() from within a function that takes an Error **
argument is suspicious.  qemu_fsdev_add() does that, and its caller
fsdev_init_func() then fails without setting an error.  Its caller
main(), via qemu_opts_foreach(), is fine with it, but clean it up
anyway.

Cc: Greg Kurz <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Acked-by: Greg Kurz <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agospice: Clean up error reporting in add_channel()
Markus Armbruster [Wed, 17 Oct 2018 08:26:54 +0000 (10:26 +0200)]
spice: Clean up error reporting in add_channel()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  add_channel() does that, and then exit()s.  Its caller
main(), via qemu_opts_foreach(), is fine with it, but clean it up
anyway.

Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
6 years agotpm: Clean up error reporting in tpm_init_tpmdev()
Markus Armbruster [Wed, 17 Oct 2018 08:26:53 +0000 (10:26 +0200)]
tpm: Clean up error reporting in tpm_init_tpmdev()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  tpm_init_tpmdev() does that, and then fails without
setting an error.  Its caller main(), via tpm_init() and
qemu_opts_foreach(), is fine with it, but clean it up anyway.

Cc: Stefan Berger <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Stefan Berger <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agonuma: Clean up error reporting in parse_numa()
Markus Armbruster [Wed, 17 Oct 2018 08:26:52 +0000 (10:26 +0200)]
numa: Clean up error reporting in parse_numa()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  parse_numa() does that, and then fails without setting
an error.  Its caller main(), via qemu_opts_foreach(), is fine with
it, but clean it up anyway.

While there, give parse_numa() internal linkage.

Cc: Eduardo Habkost <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovnc: Clean up error reporting in vnc_init_func()
Markus Armbruster [Wed, 17 Oct 2018 08:26:51 +0000 (10:26 +0200)]
vnc: Clean up error reporting in vnc_init_func()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  vnc_init_func() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

While there, drop a "Failed to start VNC server: " error message
prefix that doesn't really add value.

Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181017082702[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
6 years agoui: Convert vnc_display_init(), init_keyboard_layout() to Error
Fei Li [Wed, 17 Oct 2018 08:26:50 +0000 (10:26 +0200)]
ui: Convert vnc_display_init(), init_keyboard_layout() to Error

Signed-off-by: Fei Li <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181017082702[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
6 years agoui/keymaps: Fix handling of erroneous include files
Markus Armbruster [Wed, 17 Oct 2018 08:26:49 +0000 (10:26 +0200)]
ui/keymaps: Fix handling of erroneous include files

While errors in the keyboard layout named with -k are fatal, errors in
included files are reported, but otherwise ignored:

    $ cat worst
    include bad
    include worse
    $ ls -l bad worse
    ls: cannot access 'bad': No such file or directory
    ls: cannot access 'worse': No such file or directory
    $ qemu-system-x86_64 -nodefaults -S -monitor stdio -display vnc=:0 -k bad
    QEMU 3.0.50 monitor - type 'help' for more information
    (qemu) Could not read keymap file: 'bad'
    $ qemu-system-x86_64 -nodefaults -S -monitor stdio -display vnc=:0 -k worst
    QEMU 3.0.50 monitor - type 'help' for more information
    (qemu) Could not read keymap file: 'bad'
    Could not read keymap file: 'worse'

Fix that.

Note that parse_keyboard_layout() allocates the keymap, except when
it's parsing an include file.  To keep error handling simple, move the
memory management to its caller init_keyboard_layout().

Cc: Gerd Hoffmann <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Message-Id: <20181017082702[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
6 years agovl: Clean up error reporting in device_init_func()
Markus Armbruster [Wed, 17 Oct 2018 08:26:48 +0000 (10:26 +0200)]
vl: Clean up error reporting in device_init_func()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  device_init_func() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Clean up error reporting in parse_fw_cfg()
Markus Armbruster [Wed, 17 Oct 2018 08:26:47 +0000 (10:26 +0200)]
vl: Clean up error reporting in parse_fw_cfg()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  parse_fw_cfg() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Clean up error reporting in mon_init_func()
Markus Armbruster [Wed, 17 Oct 2018 08:26:46 +0000 (10:26 +0200)]
vl: Clean up error reporting in mon_init_func()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  mon_init_func() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Clean up error reporting in machine_set_property()
Markus Armbruster [Wed, 17 Oct 2018 08:26:45 +0000 (10:26 +0200)]
vl: Clean up error reporting in machine_set_property()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  machine_set_property() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Clean up error reporting in chardev_init_func()
Markus Armbruster [Wed, 17 Oct 2018 08:26:44 +0000 (10:26 +0200)]
vl: Clean up error reporting in chardev_init_func()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  chardev_init_func() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agoqom: Clean up error reporting in user_creatable_add_opts_foreach()
Markus Armbruster [Wed, 17 Oct 2018 08:26:43 +0000 (10:26 +0200)]
qom: Clean up error reporting in user_creatable_add_opts_foreach()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  user_creatable_add_opts_foreach() does that, and then
fails without setting an error.  Its caller main(), via
qemu_opts_foreach(), is fine with it, but clean it up anyway.

Cc: Daniel P. Berrangé <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Clean up error reporting in parse_add_fd()
Markus Armbruster [Wed, 17 Oct 2018 08:26:42 +0000 (10:26 +0200)]
vl: Clean up error reporting in parse_add_fd()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  parse_add_fd() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

Also change call of cleanup_add_fd(), which can't fail, for symmetry.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agoseccomp: Clean up error reporting in parse_sandbox()
Markus Armbruster [Wed, 17 Oct 2018 08:26:41 +0000 (10:26 +0200)]
seccomp: Clean up error reporting in parse_sandbox()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  parse_sandbox() does that, and then fails without
setting an error.  Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.

Cc: Eduardo Otubo <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Acked-by: Eduardo Otubo <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agoxen/pt: Fix incomplete conversion to realize()
Markus Armbruster [Wed, 17 Oct 2018 08:26:40 +0000 (10:26 +0200)]
xen/pt: Fix incomplete conversion to realize()

The conversion of "xen-pci-passthrough" to realize() (commit
5a11d0f7549, v2.6.0) neglected to convert the xen_pt_config_init()
error path.  If xen_pt_config_init() fails, xen_pt_realize() reports
the error, then returns success without completing its job.  I don't
know the exact impact, but it can't be good.

Belatedly convert the error path.

Fixes: 5a11d0f7549e24a10e178a9dc8ff5e698031d9a6
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony Perard <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agonuma: Fix QMP command set-numa-node error handling
Markus Armbruster [Wed, 17 Oct 2018 08:26:39 +0000 (10:26 +0200)]
numa: Fix QMP command set-numa-node error handling

Calling error_report() in a function that takes an Error ** argument
is suspicious.  parse_numa_node() does that, and then exit()s.  It
also passes &error_fatal to machine_set_cpu_numa_node().  Both wrong.
Attempting to configure numa when the machine doesn't support it kills
the VM:

    $ qemu-system-x86_64 -nodefaults -S -display none -M none -preconfig -qmp stdio
    {"QMP": {"version": {"qemu": {"micro": 50, "minor": 0, "major": 3}, "package": "v3.0.0-837-gc5e4e49258"}, "capabilities": []}}
    {"execute": "qmp_capabilities"}
    {"return": {}}
    {"execute": "set-numa-node", "arguments": {"type": "node"}}
    NUMA is not supported by this machine-type
    $ echo $?
    1

Messed up when commit 64c2a8f6d3f and 7c88e65d9e9 (v2.10.0) added
incorrect error handling right next to correct examples.  Latent bug
until commit f3be67812c2 (v3.0.0) made it accessible via QMP.  Fairly
harmless in practice, because it's limited to RUN_STATE_PRECONFIG.
The fix is obvious: replace error_report(); exit() by error_setg();
return.

This affects parse_numa_node()'s other caller
numa_complete_configuration(): since it ignores errors, the "NUMA is
not supported by this machine-type" is now ignored, too.  But that
error is as unexpected there as any other.  Change it to abort on
error instead.

Fixes: f3be67812c226162f86ce92634bd913714445420
Cc: Igor Mammedov <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agonet/socket: Fix invalid socket type error handling
Markus Armbruster [Wed, 17 Oct 2018 08:26:38 +0000 (10:26 +0200)]
net/socket: Fix invalid socket type error handling

Calling error_report() in a function that takes an Error ** argument
is suspicious.  net_socket_fd_init() does that, and then fails without
setting an error.  Wrong.  I didn't analyze how exactly this can
break.  A caller that reports the error on failure would crash.

Broken when commit c37f0bb1d0d (v2.11.0) converted the function to
Error.  Fix by calling error_setg() instead of error_report().

Fixes: c37f0bb1d0d24e3a6b5f4659bb305913dcb798a6
Cc: Jason Wang <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agol2tpv3: Improve -netdev/netdev_add/-net/... error reporting
Markus Armbruster [Wed, 17 Oct 2018 08:26:37 +0000 (10:26 +0200)]
l2tpv3: Improve -netdev/netdev_add/-net/... error reporting

When -netdev l2tpv3 fails, it first reports a specific error, then a
generic one, like this:

    $ qemu-system-x86_64 -netdev l2tpv3,id=foo,src=,dst=,txsession=1
    qemu-system-x86_64: -netdev l2tpv3,id=foo,src=,dst=,txsession=1: l2tpv3_open : could not resolve src, errno = Name or service not known
    qemu-system-x86_64: Device 'l2tpv3' could not be initialized

With the command line, the messages go to stderr.  In HMP, they go to
the monitor.  In QMP, the second one becomes the error reply, and the
first one goes to stderr.

Convert net_init_tap() to Error.  This suppresses the unwanted second
message, and makes the specific error the QMP error reply.

Cc: Jason Wang <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agomigration: Fix !replay_can_snapshot() error handling
Markus Armbruster [Wed, 17 Oct 2018 08:26:36 +0000 (10:26 +0200)]
migration: Fix !replay_can_snapshot() error handling

Calling error_report() in a function that takes an Error ** argument
is suspicious.  save_snapshot() and load_snapshot() do that, and then
fail without setting an error.  Wrong.  The HMP commands survive this
unscathed, since hmp_handle_error() does nothing when no error has
been set.  Callers main() (on behalf of -loadvm) and
replay_vmstate_init() crash, but I'm not sure the error is possible
there.

Screwed up when commit 377b21ccea1 (v2.12.0) added incorrect error
handling right next to correct examples.  Fix by calling error_setg()
instead of error_report().

Fixes: 377b21ccea1755a8b0dae822c29567c58dda6939
Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agosmbios: Clean up error handling in smbios_add()
Markus Armbruster [Wed, 17 Oct 2018 08:26:35 +0000 (10:26 +0200)]
smbios: Clean up error handling in smbios_add()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  smbios_entry_add() does that, and then exit()s.  It
also passes &error_fatal to qemu_opts_validate().  Both wrong, but
currently harmless, as its only caller passes &error_fatal.  Messed up
in commit 1007a37e208.  Clean it up.

Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agoioapic: Fix error handling in realize()
Markus Armbruster [Wed, 17 Oct 2018 08:26:34 +0000 (10:26 +0200)]
ioapic: Fix error handling in realize()

Calling error_report() in a function that takes an Error ** argument
is suspicious.  ioapic_realize() does that, and then exit()s.
Currently mostly harmless, as the device cannot be hot-plugged.

Fixes: 20fd4b7b6d9282fe0cb83601f1821f31bd257458
Cc: Peter Xu <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agopc: Fix machine property nvdimm-persistence error handling
Markus Armbruster [Wed, 17 Oct 2018 08:26:33 +0000 (10:26 +0200)]
pc: Fix machine property nvdimm-persistence error handling

Calling error_report() in a function that takes an Error ** argument
is suspicious.  pc.c's pc_machine_set_nvdimm_persistence() does that,
and then exit()s.  Wrong.  Attempting to set machine property
nvdimm-persistence to a bad value instantly kills the VM:

    $ qemu-system-x86_64 -nodefaults -S -display none -qmp stdio
    {"QMP": {"version": {"qemu": {"micro": 50, "minor": 0, "major": 3}, "package": "v3.0.0-837-gc5e4e49258"}, "capabilities": []}}
    {"execute": "qmp_capabilities"}
    {"return": {}}
    {"execute": "qom-set", "arguments": {"path": "/machine", "property": "nvdimm-persistence", "value": "instadeath"}}
    -machine nvdimm-persistence=instadeath: unsupported option
    $ echo $?
    1

Broken when commit 11c39b5cd96 (v3.0.0) replaced error_propagate();
return by error_report(); exit() instead of error_setg(); return.  Fix
that.

Fixes: 11c39b5cd966ddc067a1ca0c5392ec9b666c45b7
Cc: "Michael S. Tsirkin" <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years ago9pfs: Fix CLI parsing crash on error
Markus Armbruster [Wed, 17 Oct 2018 08:26:32 +0000 (10:26 +0200)]
9pfs: Fix CLI parsing crash on error

Calling error_report() in a function that takes an Error ** argument
is suspicious.  9p-handle.c's handle_parse_opts() does that, and then
fails without setting an error.  Wrong.  Its caller crashes when it
tries to report the error:

    $ qemu-system-x86_64 -nodefaults -fsdev id=foo,fsdriver=handle
    qemu-system-x86_64: -fsdev id=foo,fsdriver=handle: warning: handle backend is deprecated
    qemu-system-x86_64: -fsdev id=foo,fsdriver=handle: fsdev: No path specified
    Segmentation fault (core dumped)

Screwed up when commit 91cda4e8f37 (v2.12.0) converted the function to
Error.  Fix by calling error_setg() instead of error_report().

Fixes: 91cda4e8f372602795e3a2f4bd2e3adaf9f82255
Cc: Greg Kurz <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Acked-by: Greg Kurz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agochar: Use error_printf() to print help and such
Markus Armbruster [Wed, 17 Oct 2018 08:26:31 +0000 (10:26 +0200)]
char: Use error_printf() to print help and such

Calling error_report() in a function that takes an Error ** argument
is suspicious.  Convert a few that are actually help and such to
error_printf().

Improves output of -chardev help from

    qemu-system-x86_64: -chardev help: Available chardev backend types:
    serial
    ...

to

    Available chardev backend types:
    serial
    ...

Cc: Paolo Bonzini <[email protected]>
Cc: "Marc-André Lureau" <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovfio: Clean up error reporting after previous commit
Markus Armbruster [Wed, 17 Oct 2018 08:26:30 +0000 (10:26 +0200)]
vfio: Clean up error reporting after previous commit

The previous commit changed vfio's warning messages from

    vfio warning: DEV-NAME: Could not frobnicate

to

    warning: vfio DEV-NAME: Could not frobnicate

To match this change, change error messages from

    vfio error: DEV-NAME: On fire

to

    vfio DEV-NAME: On fire

Note the loss of "error".  If we think marking error messages that way
is a good idea, we should mark *all* error messages, i.e. make
error_report() print it.

Cc: Alex Williamson <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Acked-by: Alex Williamson <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovfio: Use warn_report() & friends to report warnings
Markus Armbruster [Wed, 17 Oct 2018 08:26:29 +0000 (10:26 +0200)]
vfio: Use warn_report() & friends to report warnings

The vfio code reports warnings like

    error_report(WARN_PREFIX "Could not frobnicate", DEV-NAME);

where WARN_PREFIX is defined so the message comes out as

    vfio warning: DEV-NAME: Could not frobnicate

This usage predates the introduction of warn_report() & friends in
commit 97f40301f1d.  It's time to convert to that interface.  Since
these functions already prefix the message with "warning: ", replace
WARN_PREFIX by VFIO_MSG_PREFIX, so the messages come out like

    warning: vfio DEV-NAME: Could not frobnicate

The next commit will replace ERR_PREFIX.

Cc: Alex Williamson <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Acked-by: Alex Williamson <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agocpus hw target: Use warn_report() & friends to report warnings
Markus Armbruster [Wed, 17 Oct 2018 08:26:28 +0000 (10:26 +0200)]
cpus hw target: Use warn_report() & friends to report warnings

Calling error_report() in a function that takes an Error ** argument
is suspicious.  Convert a few that are actually warnings to
warn_report().

While there, split a warning consisting of multiple sentences to
conform to conventions spelled out in warn_report()'s contract.

Cc: Alex Bennée <[email protected]>
Cc: Mark Cave-Ayland <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Fam Zheng <[email protected]>
Cc: Wei Huang <[email protected]>
Cc: David Gibson <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Acked-by: David Gibson <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agoblock: Use warn_report() & friends to report warnings
Markus Armbruster [Wed, 17 Oct 2018 08:26:27 +0000 (10:26 +0200)]
block: Use warn_report() & friends to report warnings

Calling error_report() in a function that takes an Error ** argument
is suspicious.  Convert a few that are actually warnings to
warn_report().

While there, split warnings consisting of multiple sentences to
conform to conventions spelled out in warn_report()'s contract, and
improve a rather useless warning in sheepdog.c.

Cc: Kevin Wolf <[email protected]>
Cc: Ronnie Sahlberg <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Lieven <[email protected]>
Cc: Liu Yuan <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20181017082702[email protected]>

Drop changes to "without an explicit read-only=on" warnings, because
there's a series removing them pending.  Also drop a cc: to a former
Sheepdog maintainer.

Reviewed-by: Kevin Wolf <[email protected]>
6 years agoUse error_fatal to simplify obvious fatal errors (again)
Markus Armbruster [Wed, 17 Oct 2018 08:26:26 +0000 (10:26 +0200)]
Use error_fatal to simplify obvious fatal errors (again)

Add a slight improvement of the Coccinelle semantic patch from commit
007b06578ab, and use it to clean up.  It leaves dead Error * variables
behind, cleaned up manually.

Cc: David Gibson <[email protected]>
Cc: Alexander Graf <[email protected]>
Cc: Eric Blake <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Acked-by: David Gibson <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agoerror: Fix use of error_prepend() with &error_fatal, &error_abort
Markus Armbruster [Wed, 17 Oct 2018 08:26:25 +0000 (10:26 +0200)]
error: Fix use of error_prepend() with &error_fatal, &error_abort

From include/qapi/error.h:

  * Pass an existing error to the caller with the message modified:
  *     error_propagate(errp, err);
  *     error_prepend(errp, "Could not frobnicate '%s': ", name);

Fei Li pointed out that doing error_propagate() first doesn't work
well when @errp is &error_fatal or &error_abort: the error_prepend()
is never reached.

Since I doubt fixing the documentation will stop people from getting
it wrong, introduce error_propagate_prepend(), in the hope that it
lures people away from using its constituents in the wrong order.
Update the instructions in error.h accordingly.

Convert existing error_prepend() next to error_propagate to
error_propagate_prepend().  If any of these get reached with
&error_fatal or &error_abort, the error messages improve.  I didn't
check whether that's the case anywhere.

Cc: Fei Li <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20181017082702[email protected]>

6 years agovl: Print error when using incorrect backend for debugcon
Philippe Mathieu-Daudé [Thu, 11 Oct 2018 17:12:54 +0000 (19:12 +0200)]
vl: Print error when using incorrect backend for debugcon

When using an incorrect backend for the debugcon, QEMU exits silently
without any error indication, which is confusing.
Add a message that the character backend is invalid.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181011171254[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
6 years agoscripts: Remove check-qerror.sh
Alberto Garcia [Wed, 17 Oct 2018 15:17:38 +0000 (18:17 +0300)]
scripts: Remove check-qerror.sh

qerror.h contains leftovers from the now-defunct QError API.

There's only a handful of string macros left, and no one is supposed
to add anything else. The check-qerror.sh script was used to make sure
that all definitions on the qerror.c and qerror.h files were sorted
alphabetically. The former was removed three years ago, and the latter
is now in a different location, so the script doesn't even work (as
a matter of fact the alphabetical order was broken last time someone
added a macro -also in 2015- and no one seemed to notice).

There's no point in fixing this script so let's just remove it.
The rogue macro is also moved to its correct location.

Signed-off-by: Alberto Garcia <[email protected]>
Message-Id: <20181017151738[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
6 years agolinux-user: Implement special usbfs ioctls.
Cortland Tölva [Mon, 8 Oct 2018 16:35:21 +0000 (09:35 -0700)]
linux-user: Implement special usbfs ioctls.

Userspace submits a USB Request Buffer to the kernel, optionally
discards it, and finally reaps the URB.  Thunk buffers from target
to host and back.

Tested by running an i386 scanner driver on ARMv7 and by running
the PowerPC lsusb utility on x86_64.  The discardurb ioctl is
not exercised in these tests.

Signed-off-by: Cortland Tölva <[email protected]>
Message-Id: <20181008163521[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agolinux-user: Define ordinary usbfs ioctls.
Cortland Tölva [Mon, 8 Oct 2018 16:35:20 +0000 (09:35 -0700)]
linux-user: Define ordinary usbfs ioctls.

Provide ioctl definitions for the generic thunk mechanism to
convert most usbfs calls.  Calculate arg size at runtime.

Signed-off-by: Cortland Tölva <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <20181008163521[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agolinux-user: Check for Linux USBFS in configure
Cortland Tölva [Mon, 8 Oct 2018 16:35:19 +0000 (09:35 -0700)]
linux-user: Check for Linux USBFS in configure

In preparation for adding user mode emulation support for the
Linux usbfs interface, check for its kernel header.

Signed-off-by: Cortland Tölva <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <20181008163521[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoreplay: pass raw icount value to replay_save_clock
Paolo Bonzini [Mon, 8 Oct 2018 11:24:14 +0000 (13:24 +0200)]
replay: pass raw icount value to replay_save_clock

This avoids lock recursion when REPLAY_CLOCK is called inside the
timers spinlock.

Signed-off-by: Paolo Bonzini <[email protected]>
6 years agotarget/i386: kvm: just return after migrate_add_blocker failed
Li Qiang [Sat, 6 Oct 2018 09:18:16 +0000 (02:18 -0700)]
target/i386: kvm: just return after migrate_add_blocker failed

When migrate_add_blocker failed, the invtsc_mig_blocker is not
appended so no need to remove. This can save several instructions.

Signed-off-by: Li Qiang <[email protected]>
Message-Id: <20181006091816[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohyperv_testdev: add SynIC message and event testmodes
Roman Kagan [Fri, 21 Sep 2018 08:22:17 +0000 (11:22 +0300)]
hyperv_testdev: add SynIC message and event testmodes

Add testmodes for SynIC messages and events.  The message or event
connection setup / teardown is initiated by the guest via new control
codes written to the test device port.  Then the test connections bounce
the respective operations back to the guest, i.e. the incoming messages
are posted or the incoming events are signaled on the configured vCPUs.

Signed-off-by: Roman Kagan <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohyperv: process POST_MESSAGE hypercall
Roman Kagan [Fri, 21 Sep 2018 08:22:16 +0000 (11:22 +0300)]
hyperv: process POST_MESSAGE hypercall

Add handling of POST_MESSAGE hypercall.  For that, add an interface to
regsiter a handler for the messages arrived from the guest on a
particular connection id (IOW set up a message connection in Hyper-V
speak).

Signed-off-by: Roman Kagan <[email protected]>
Message-Id: <20180921082217[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohyperv: add support for KVM_HYPERV_EVENTFD
Roman Kagan [Fri, 21 Sep 2018 08:22:15 +0000 (11:22 +0300)]
hyperv: add support for KVM_HYPERV_EVENTFD

When setting up a notifier for Hyper-V event connection, try to use the
KVM-assisted one first, and fall back to userspace handling of the
hypercall if the kernel doesn't provide the requested feature.

Signed-off-by: Roman Kagan <[email protected]>
Message-Id: <20180921082217[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohyperv: process SIGNAL_EVENT hypercall
Roman Kagan [Fri, 21 Sep 2018 08:22:14 +0000 (11:22 +0300)]
hyperv: process SIGNAL_EVENT hypercall

Add handling of SIGNAL_EVENT hypercall.  For that, provide an interface
to associate an EventNotifier with an event connection number, so that
it's signaled when the SIGNAL_EVENT hypercall with the matching
connection ID is called by the guest.

Support for using KVM functionality for this will be added in a followup
patch.

Signed-off-by: Roman Kagan <[email protected]>
Message-Id: <20180921082217[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohyperv: add synic event flag signaling
Roman Kagan [Fri, 21 Sep 2018 08:22:13 +0000 (11:22 +0300)]
hyperv: add synic event flag signaling

Add infrastructure to signal SynIC event flags by atomically setting the
corresponding bit in the event flags page and firing a SINT if
necessary.

Signed-off-by: Roman Kagan <[email protected]>
Message-Id: <20180921082217[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohyperv: add synic message delivery
Roman Kagan [Fri, 21 Sep 2018 08:22:12 +0000 (11:22 +0300)]
hyperv: add synic message delivery

Add infrastructure to deliver SynIC messages to the SynIC message page.

Note that KVM may also want to deliver (SynIC timer) messages to the
same message slot.

The problem is that the access to a SynIC message slot is controlled by
the value of its .msg_type field which indicates if the slot is being
owned by the hypervisor (zero) or by the guest (non-zero).

This leaves no room for synchronizing multiple concurrent producers.

The simplest way to deal with this for both KVM and QEMU is to only
deliver messages in the vcpu thread.  KVM already does this; this patch
makes it for QEMU, too.

Specifically,

 - add a function for posting messages, which only copies the message
   into the staging buffer if its free, and schedules a work on the
   corresponding vcpu to actually deliver it to the guest slot;

 - instead of a sint ack callback, set up the sint route with a message
   status callback.  This function is called in a bh whenever there are
   updates to the message slot status: either the vcpu made definitive
   progress delivering the message from the staging buffer (succeeded or
   failed) or the guest issued EOM; the status is passed as an argument
   to the callback.

Signed-off-by: Roman Kagan <[email protected]>
Message-Id: <20180921082217[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agohyperv: make overlay pages for SynIC
Roman Kagan [Fri, 21 Sep 2018 08:22:11 +0000 (11:22 +0300)]
hyperv: make overlay pages for SynIC

Per Hyper-V spec, SynIC message and event flag pages are to be
implemented as so called overlay pages.  That is, they are owned by the
hypervisor and, when mapped into the guest physical address space,
overlay the guest physical pages such that

1) the overlaid guest page becomes invisible to the guest CPUs until the
   overlay page is turned off
2) the contents of the overlay page is preserved when it's turned off
   and back on, even at a different address; it's only zeroed at vcpu
   reset

This particular nature of SynIC message and event flag pages is ignored
in the current code, and guest physical pages are used directly instead.
This happens to (mostly) work because the actual guests seem not to
depend on the features listed above.

This patch implements those pages as the spec mandates.

Since the extra RAM regions, which introduce migration incompatibility,
are only added at SynIC object creation which only happens when
hyperv_synic_kvm_only == false, no extra compat logic is necessary.

Signed-off-by: Roman Kagan <[email protected]>
Message-Id: <20180921082217[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
This page took 0.099635 seconds and 4 git commands to generate.