]> Git Repo - qemu.git/log
qemu.git
5 years agoconfigure: check for gdbus-codegen presence
Marc-André Lureau [Fri, 10 Jan 2020 11:27:25 +0000 (15:27 +0400)]
configure: check for gdbus-codegen presence

Some distros ship gdbus-codegen separately for gio headers/pc...

Reported-by: Peter Maydell <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Message-id: 20200110112725[email protected]
Signed-off-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/elmarco/tags/prop-ptr-pull-request' into staging
Peter Maydell [Tue, 7 Jan 2020 17:54:29 +0000 (17:54 +0000)]
Merge remote-tracking branch 'remotes/elmarco/tags/prop-ptr-pull-request' into staging

Clean-ups: qom-ify serial and remove QDEV_PROP_PTR

Hi,

QDEV_PROP_PTR is marked in multiple places as "FIXME/TODO/remove
me". In most cases, it can be easily replaced with QDEV_PROP_LINK when
the pointer points to an Object.

There are a few places where such substitution isn't possible. For
those places, it seems reasonable to use a specific setter method
instead, and keep the user_creatable = false. In other places,
proper usage of qdev or other facilies is the solution.

The serial code wasn't converted to qdev, which makes it a bit more
archaic to deal with. Let's convert it first, so we can more easily
embed it from other devices, and re-export some properties and drop
QDEV_PROP_PTR usage.

# gpg: Signature made Tue 07 Jan 2020 15:01:26 GMT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Marc-André Lureau <[email protected]>" [full]
# gpg:                 aka "Marc-André Lureau <[email protected]>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/prop-ptr-pull-request: (37 commits)
  qdev/qom: remove some TODO limitations now that PROP_PTR is gone
  qdev: remove QDEV_PROP_PTR
  qdev: remove PROP_MEMORY_REGION
  omap-gpio: remove PROP_PTR
  omap-i2c: remove PROP_PTR
  omap-intc: remove PROP_PTR
  smbus-eeprom: remove PROP_PTR
  cris: improve passing PIC interrupt vector to the CPU
  mips/cps: fix setting saar property
  qdev: use g_strcmp0() instead of open-coding it
  leon3: use qdev gpio facilities for the PIL
  leon3: use qemu_irq framework instead of callback as property
  dp8393x: replace PROP_PTR with PROP_LINK
  etraxfs: remove PROP_PTR usage
  lance: replace PROP_PTR with PROP_LINK
  vmmouse: replace PROP_PTR with PROP_LINK
  sm501: make SerialMM a child, export chardev property
  mips: use sysbus_mmio_get_region() instead of internal fields
  mips: use sysbus_add_io()
  mips: baudbase is 115200 by default
  ...

Signed-off-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/vivier/tags/q800-for-5.0-pull-request' into...
Peter Maydell [Tue, 7 Jan 2020 17:08:21 +0000 (17:08 +0000)]
Merge remote-tracking branch 'remotes/vivier/tags/q800-for-5.0-pull-request' into staging

m68k: fix CACR valid bits
q800: add a fake mac rom reset (used by linux)
      fix and improve PRAM emulation

# gpg: Signature made Tue 07 Jan 2020 13:25:50 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <[email protected]>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/q800-for-5.0-pull-request:
  target/m68k: only change valid bits in CACR
  q800: implement mac rom reset function for BIOS-less mode
  q800: add a block backend to the PRAM
  q800: fix mac_via RTC PRAM commands

Signed-off-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Tue, 7 Jan 2020 16:25:00 +0000 (16:25 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio, pci, pc: fixes, features

Bugfixes all over the place.
HMAT support.
New flags for vhost-user-blk utility.
Auto-tuning of seg max for virtio storage.

Signed-off-by: Michael S. Tsirkin <[email protected]>
# gpg: Signature made Mon 06 Jan 2020 17:05:05 GMT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Michael S. Tsirkin <[email protected]>" [full]
# gpg:                 aka "Michael S. Tsirkin <[email protected]>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream: (32 commits)
  intel_iommu: add present bit check for pasid table entries
  intel_iommu: a fix to vtd_find_as_from_bus_num()
  virtio-net: delete also control queue when TX/RX deleted
  virtio: reset region cache when on queue deletion
  virtio-mmio: update queue size on guest write
  tests: add virtio-scsi and virtio-blk seg_max_adjust test
  virtio: make seg_max virtqueue size dependent
  hw: fix using 4.2 compat in 5.0 machine types for i440fx/q35
  vhost-user-scsi: reset the device if supported
  vhost-user: add VHOST_USER_RESET_DEVICE to reset devices
  hw/pci/pci_host: Let pci_data_[read/write] use unsigned 'size' argument
  hw/pci/pci_host: Remove redundant PCI_DPRINTF()
  virtio-mmio: Clear v2 transport state on soft reset
  ACPI: add expected files for HMAT tests (acpihmat)
  tests/bios-tables-test: add test cases for ACPI HMAT
  tests/numa: Add case for QMP build HMAT
  hmat acpi: Build Memory Side Cache Information Structure(s)
  hmat acpi: Build System Locality Latency and Bandwidth Information Structure(s)
  hmat acpi: Build Memory Proximity Domain Attributes Structure(s)
  numa: Extend CLI to provide memory side cache information
  ...

Signed-off-by: Peter Maydell <[email protected]>
5 years agotests/iothread: Always connect iothread GSource to a GMainContext
Peter Maydell [Mon, 6 Jan 2020 14:45:52 +0000 (14:45 +0000)]
tests/iothread: Always connect iothread GSource to a GMainContext

On older versions of glib (anything prior to glib commit 0f056ebe
from May 2019), the implementation of g_source_ref() and
g_source_unref() is not threadsafe for a GSource which is not
attached to a GMainContext.

QEMU's real iothread.c implementation always attaches its
iothread->ctx's GSource to a GMainContext created for that iothread,
so it is OK, but the simple test framework implementation in
tests/iothread.c was not doing this.  This was causing intermittent
assertion failures in the test-aio-multithread subtest
"/aio/multi/mutex/contended" test on the BSD hosts.  (It's unclear
why only BSD seems to have been affected -- perhaps a combination of
the specific glib version being used in the VMs and their happening
to run on a host with a lot of CPUs).

Borrow the iothread_init_gcontext() from the real iothread.c
and add the corresponding cleanup code and the calls to
g_main_context_push/pop_thread_default() so we actually use
the GMainContext we create.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Message-id: 20200106144552[email protected]

5 years agoqdev/qom: remove some TODO limitations now that PROP_PTR is gone
Marc-André Lureau [Sat, 26 Oct 2019 20:55:46 +0000 (22:55 +0200)]
qdev/qom: remove some TODO limitations now that PROP_PTR is gone

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
5 years agoqdev: remove QDEV_PROP_PTR
Marc-André Lureau [Fri, 18 Oct 2019 13:50:10 +0000 (15:50 +0200)]
qdev: remove QDEV_PROP_PTR

No longer used in the tree. The comment about user_creatable is still
quite relevant, but there is already a similar comment in qdev-core.h.

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
5 years agoqdev: remove PROP_MEMORY_REGION
Marc-André Lureau [Fri, 18 Oct 2019 13:52:40 +0000 (15:52 +0200)]
qdev: remove PROP_MEMORY_REGION

PROP_MEMORY_REGION was a derivative of PROP_PTR, added in commit
ed03d749f3f513b8fb0287757cfda2cb6825f063 (qdev: add MemoryRegion
property) and thankfully no longer needed since commit
3eff40dbf44896a8180c86c84dbdefb2eb173fbe (hw/misc: Remove
mmio_interface device).

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoomap-gpio: remove PROP_PTR
Marc-André Lureau [Fri, 18 Oct 2019 13:26:19 +0000 (15:26 +0200)]
omap-gpio: remove PROP_PTR

Since clocks are not QOM objects, replace PROP_PTR of clocks with
setters methods.

Move/adapt the existing TODO comment about a clock framework.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoomap-i2c: remove PROP_PTR
Marc-André Lureau [Fri, 18 Oct 2019 12:56:44 +0000 (14:56 +0200)]
omap-i2c: remove PROP_PTR

Since clocks are not QOM objects, replace PROP_PTR of clocks with
setters methods.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Corey Minyard <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoomap-intc: remove PROP_PTR
Marc-André Lureau [Fri, 18 Oct 2019 12:42:57 +0000 (14:42 +0200)]
omap-intc: remove PROP_PTR

Since clocks are not QOM objects, replace PROP_PTR of clocks with
setters methods.

(in theory there should probably be different methods for omap1 &
omap2 intc, but this is left as a future improvement)

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agosmbus-eeprom: remove PROP_PTR
Marc-André Lureau [Fri, 18 Oct 2019 10:19:36 +0000 (12:19 +0200)]
smbus-eeprom: remove PROP_PTR

Instead, set the initial data field directly.

(the initial data is an array of 256 bytes. As I don't know if it may
change over time, I keep the pointer to original buffer as is, but it
might be worth to consider to copy it instead)

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Corey Minyard <[email protected]>
5 years agocris: improve passing PIC interrupt vector to the CPU
Marc-André Lureau [Thu, 17 Oct 2019 17:16:53 +0000 (19:16 +0200)]
cris: improve passing PIC interrupt vector to the CPU

Instead of accessing cpu interrupt vector directly from PIC, send the
vector value over the qemu_irq.

Suggested-by: Peter Maydell <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agomips/cps: fix setting saar property
Marc-André Lureau [Thu, 17 Oct 2019 17:04:11 +0000 (19:04 +0200)]
mips/cps: fix setting saar property

There is no "saar" property. Note: I haven't been able to test this
code. Help welcome.

May fix commit 043715d1e0fbb3e3411be3f898c5b77b7f90327a ("target/mips:
Update ITU to utilize SAARI and SAAR CP0 registers")

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
5 years agoqdev: use g_strcmp0() instead of open-coding it
Marc-André Lureau [Wed, 20 Nov 2019 13:42:01 +0000 (17:42 +0400)]
qdev: use g_strcmp0() instead of open-coding it

Minor code simplification.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoleon3: use qdev gpio facilities for the PIL
Marc-André Lureau [Wed, 20 Nov 2019 13:38:51 +0000 (17:38 +0400)]
leon3: use qdev gpio facilities for the PIL

As Peter Maydell once said:
"Creating a gpio pin on some object that isn't yourself
looks a bit odd, but all this leon3 code is modifying
the CPU object from the outside anyway. Someday we might
tidy it up, but not today."

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoleon3: use qemu_irq framework instead of callback as property
Marc-André Lureau [Thu, 17 Oct 2019 16:42:35 +0000 (18:42 +0200)]
leon3: use qemu_irq framework instead of callback as property

"set_pin_in" property is used to define a callback mechanism where the
device says "call the callback function, passing it an opaque cookie
and a 32-bit value". We already have a generic mechanism for doing
that, which is the qemu_irq. So we should just use that.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
5 years agodp8393x: replace PROP_PTR with PROP_LINK
Marc-André Lureau [Thu, 17 Oct 2019 16:03:43 +0000 (18:03 +0200)]
dp8393x: replace PROP_PTR with PROP_LINK

Link property is the correct way to pass a MemoryRegion to a device
for DMA purposes.

Sidenote: as a sysbus device, this remains non-usercreatable
even though we can drop the specific flag here.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Tested-by: Laurent Vivier <[email protected]>
5 years agoetraxfs: remove PROP_PTR usage
Marc-André Lureau [Thu, 17 Oct 2019 15:49:22 +0000 (17:49 +0200)]
etraxfs: remove PROP_PTR usage

etraxfs_dma_client are not Object, so can't be exposed to user with
QOM path. Let's remove property usage and move the constructor to the
.c unit, simplifying some code on the way.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agolance: replace PROP_PTR with PROP_LINK
Marc-André Lureau [Thu, 17 Oct 2019 15:31:48 +0000 (17:31 +0200)]
lance: replace PROP_PTR with PROP_LINK

The device remains non-user creatable since it is a sysbus device.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agovmmouse: replace PROP_PTR with PROP_LINK
Marc-André Lureau [Thu, 17 Oct 2019 15:06:05 +0000 (17:06 +0200)]
vmmouse: replace PROP_PTR with PROP_LINK

While at it, use the expected type.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agosm501: make SerialMM a child, export chardev property
Marc-André Lureau [Wed, 23 Oct 2019 14:06:23 +0000 (16:06 +0200)]
sm501: make SerialMM a child, export chardev property

Embed the SerialMM sybus device, and re-export its "chardev" property.
That way, we can get rid of PROP_PTR "chr-state" and better track
devices relationship.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agomips: use sysbus_mmio_get_region() instead of internal fields
Marc-André Lureau [Wed, 20 Nov 2019 11:16:29 +0000 (15:16 +0400)]
mips: use sysbus_mmio_get_region() instead of internal fields

Register the memory region with sysbus_init_mmio() and look it up with
sysbus_mmio_get_region() to avoid accessing internal device fields.

Suggested-by: Peter Maydell <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agomips: use sysbus_add_io()
Marc-André Lureau [Wed, 20 Nov 2019 09:41:10 +0000 (13:41 +0400)]
mips: use sysbus_add_io()

sysbus devices should use the associated helper function instead of
calling memory_region_add_subregion() manually. This simplifies
slightly the code.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agomips: baudbase is 115200 by default
Marc-André Lureau [Wed, 20 Nov 2019 11:20:22 +0000 (15:20 +0400)]
mips: baudbase is 115200 by default

(The default value is set for TYPE_SERIAL in serial_properties)

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
5 years agomips: inline serial_init()
Marc-André Lureau [Wed, 23 Oct 2019 13:29:55 +0000 (15:29 +0200)]
mips: inline serial_init()

The function is specific to mipssim, let's inline it.

(when inlining, we use a DeviceState variable instead of SerialIO, as
it is the most common type used, and avoids having too many casts)

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
5 years agoserial: make SerialIO a sysbus device
Marc-André Lureau [Wed, 23 Oct 2019 16:37:33 +0000 (18:37 +0200)]
serial: make SerialIO a sysbus device

Make serial IO a proper sysbus device, similar to serial MM.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoserial-mm: use sysbus facilities
Marc-André Lureau [Wed, 20 Nov 2019 08:28:15 +0000 (12:28 +0400)]
serial-mm: use sysbus facilities

Make SerialMM a regular sysbus device, by registering the irq, and the
mmio region. Reexport the internal serial properties.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agoserial-mm: add endianness property
Marc-André Lureau [Wed, 23 Oct 2019 16:07:03 +0000 (18:07 +0200)]
serial-mm: add endianness property

Add a qdev property for endianness, so memory region setup can be done
in realize.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoserial-mm: add "regshift" property
Marc-André Lureau [Mon, 21 Oct 2019 18:14:02 +0000 (20:14 +0200)]
serial-mm: add "regshift" property

And a property and rename "it_shift" field to "regshift", as it seems
to be more popular (and I don't know what "it" stands for).

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agoserial: start making SerialMM a sysbus device
Marc-André Lureau [Wed, 23 Oct 2019 15:50:06 +0000 (17:50 +0200)]
serial: start making SerialMM a sysbus device

Memory mapped serial device is in fact a sysbus device. The following
patches will make use of sysbus facilities for resource and
registration. In particular, "serial-mm: use sysbus facilities" will
move internal serial realization to serial_mm_realize callback to
follow qdev best practices.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agotarget/m68k: only change valid bits in CACR
Laurent Vivier [Fri, 20 Dec 2019 17:24:15 +0000 (18:24 +0100)]
target/m68k: only change valid bits in CACR

This is used by netBSD (and MacOS ROM) to detect the MMU type

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <20191220172415[email protected]>
[lv: add a comment before m680x0_cpu_common()]
Signed-off-by: Laurent Vivier <[email protected]>
5 years agoserial: replace serial_exit_core() with unrealize
Marc-André Lureau [Mon, 21 Oct 2019 23:14:43 +0000 (01:14 +0200)]
serial: replace serial_exit_core() with unrealize

Instead of calling serial_exit_core() directly, use the QDev unrealize
callback.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoserial: realize the serial device
Marc-André Lureau [Mon, 21 Oct 2019 23:02:50 +0000 (01:02 +0200)]
serial: realize the serial device

Instead of calling serial_realize_core(), use the QDev realize
callback.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agoserial: add "baudbase" property
Marc-André Lureau [Mon, 21 Oct 2019 22:35:36 +0000 (00:35 +0200)]
serial: add "baudbase" property

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agoserial: add "chardev" property
Marc-André Lureau [Mon, 21 Oct 2019 22:32:57 +0000 (00:32 +0200)]
serial: add "chardev" property

This is more QOM-friendly, callers may set/get the property themself.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agoserial: register vmsd with DeviceClass
Marc-André Lureau [Mon, 21 Oct 2019 22:32:41 +0000 (00:32 +0200)]
serial: register vmsd with DeviceClass

Migration from old to new code works, however the other way fails for
devices that use serial_init/serial_mm_init with "base", used as
instance_id previously.

(with qdev_set_legacy_instance_id, the alias_id is only used in
savevm.c:find_se(), and thus can only be used to match against
"legacy" instance id values. On new code, instance_id is generated
incrementally from 0 with calculate_new_instance_id(), based on
"qdev-path/vmsd-name")

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: xiaoqiang zhao <[email protected]>
5 years agoserial: initial qom-ification
Marc-André Lureau [Mon, 21 Oct 2019 21:32:12 +0000 (23:32 +0200)]
serial: initial qom-ification

Make SerialState a device (the following patches will introduce IO/MM
sysbus serial devices)

None of the serial_{,mm}_init() callers actually free the returned
value (even if they did, it would be quite harmless), so we can change
the object allocation at will.

However, the devices that embed SerialState must now have their field
QOM-initialized manually (isa, pci, pci-multi).

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agoserial-pci-multi: factor out multi_serial_get_port_count()
Marc-André Lureau [Mon, 21 Oct 2019 21:31:20 +0000 (23:31 +0200)]
serial-pci-multi: factor out multi_serial_get_port_count()

Common function to be reused in next patch.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agochardev: generate an internal id when none given
Marc-André Lureau [Mon, 21 Oct 2019 14:31:31 +0000 (16:31 +0200)]
chardev: generate an internal id when none given

Internally, qemu may create chardev without ID. Those will not be
looked up with qemu_chr_find(), which prevents using qdev_prop_set_chr().

Use id_generate(), to generate an internal name (prefixed with #), so
no conflict exist with user-named chardev.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: xiaoqiang zhao <[email protected]>
5 years agoq800: implement mac rom reset function for BIOS-less mode
Jason A. Donenfeld [Thu, 2 Jan 2020 12:01:50 +0000 (13:01 +0100)]
q800: implement mac rom reset function for BIOS-less mode

On Linux, calling `reboot(RB_AUTOBOOT);` will result in
arch/m68k/mac/misc.c's mac_reset function being called. That in turn
looks at the rombase (or uses 0x40800000 is there's no rombase), adds
0xa, and jumps to that address. At the moment, there's nothing there, so
the kernel just crashes when trying to reboot. So, this commit adds a
very simple implementation at that location, which just writes to via2
to power down. We also correct the value of ROMBASE while we're at it.

Signed-off-by: Jason A. Donenfeld <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <20200102120150[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
5 years agoq800: add a block backend to the PRAM
Laurent Vivier [Thu, 19 Dec 2019 20:14:39 +0000 (21:14 +0100)]
q800: add a block backend to the PRAM

This allows to save and restore the content of the PRAM.
It may be useful if we want to check the configuration or to change it.

The backend is added using mtd interface, for instance:

    ... -drive file=pram.img,format=raw,if=mtd ...

where pram.img is the file where the data will be stored, its size must
be 256 bytes.

Signed-off-by: Laurent Vivier <[email protected]>
Message-Id: <20191219201439[email protected]>

5 years agoq800: fix mac_via RTC PRAM commands
Laurent Vivier [Thu, 19 Dec 2019 20:14:38 +0000 (21:14 +0100)]
q800: fix mac_via RTC PRAM commands

The command byte is not decoded correctly.

This patch reworks the RTC/PRAM interface and fixes the problem.
It adds a comment before the function to explain how are encoded commands
and some trace-events to ease debugging.

Bug: https://bugs.launchpad.net/qemu/+bug/1856549
Fixes: 6dca62a000 ("hw/m68k: add VIA support")
Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Mark Cave-Ayland <[email protected]>
Message-Id: <20191219201439[email protected]>

5 years agosysbus: remove outdated comment
Marc-André Lureau [Wed, 23 Oct 2019 10:56:31 +0000 (12:56 +0200)]
sysbus: remove outdated comment

The init callback is no more since commit
817a17fc60f44e29a1944b60d32f45ea127f0cf9 ("core/sysbus: remove the
SysBusDeviceClass::init path")

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
5 years agosysbus: remove unused sysbus_try_create*
Marc-André Lureau [Tue, 22 Oct 2019 17:18:12 +0000 (19:18 +0200)]
sysbus: remove unused sysbus_try_create*

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agohw/display/sm501: Always map the UART0
Philippe Mathieu-Daudé [Fri, 22 Nov 2019 13:36:23 +0000 (14:36 +0100)]
hw/display/sm501: Always map the UART0

The SM501 is a Mobile Multimedia Companion Chip with 2 UARTs.
This model only implements the first UART. Being part of the
chipset, the UART block is always mapped in memory, regardless
of whether we provide a chardev backend.

Since commit 12051d82f, qemu_chr_fe_init() accepts a NULL chardev.
Let's remove the chardev check and always map the UART in the
chipset memory.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20191122133623[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20200106.0' into staging
Peter Maydell [Tue, 7 Jan 2020 11:09:54 +0000 (11:09 +0000)]
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20200106.0' into staging

VFIO fixes 2020-01-06

 - Fix irqchip notifier de-registration if not registered (Peter Xu)

# gpg: Signature made Mon 06 Jan 2020 21:58:17 GMT
# gpg:                using RSA key 239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <[email protected]>" [full]
# gpg:                 aka "Alex Williamson <[email protected]>" [full]
# gpg:                 aka "Alex Williamson <[email protected]>" [full]
# gpg:                 aka "Alex Williamson <[email protected]>" [full]
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-fixes-20200106.0:
  vfio/pci: Don't remove irqchip notifier if not registered

Signed-off-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/xtensa/tags/20200106-xtensa' into staging
Peter Maydell [Tue, 7 Jan 2020 10:31:07 +0000 (10:31 +0000)]
Merge remote-tracking branch 'remotes/xtensa/tags/20200106-xtensa' into staging

target/xtensa improvements for v5.0:

- fix ps.ring use in MPU configs;
- use MPU background map from the configuration overlay.

# gpg: Signature made Mon 06 Jan 2020 20:00:33 GMT
# gpg:                using RSA key 2B67854B98E5327DCDEB17D851F9CC91F83FA044
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Max Filippov <[email protected]>" [unknown]
# gpg:                 aka "Max Filippov <[email protected]>" [full]
# gpg:                 aka "Max Filippov <[email protected]>" [full]
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044

* remotes/xtensa/tags/20200106-xtensa:
  target/xtensa: use MPU background map from core configuration
  target/xtensa: import xtensa/config/core-isa.h
  target/xtensa: fix ps.ring use in MPU configs

Signed-off-by: Peter Maydell <[email protected]>
5 years agovfio/pci: Don't remove irqchip notifier if not registered
Peter Xu [Mon, 6 Jan 2020 20:34:45 +0000 (13:34 -0700)]
vfio/pci: Don't remove irqchip notifier if not registered

The kvm irqchip notifier is only registered if the device supports
INTx, however it's unconditionally removed.  If the assigned device
does not support INTx, this will cause QEMU to crash when unplugging
the device from the system.  Change it to conditionally remove the
notifier only if the notify hook is setup.

CC: Eduardo Habkost <[email protected]>
CC: David Gibson <[email protected]>
CC: Alex Williamson <[email protected]>
Cc: [email protected] # v4.2
Reported-by: [email protected]
Debugged-by: Eduardo Habkost <[email protected]>
Fixes: c5478fea27ac ("vfio/pci: Respond to KVM irqchip change notifier")
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1782678
Signed-off-by: Peter Xu <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
5 years agotarget/xtensa: use MPU background map from core configuration
Max Filippov [Sun, 8 Dec 2019 06:27:23 +0000 (22:27 -0800)]
target/xtensa: use MPU background map from core configuration

Configuration overlay may define MPU background map. Import
core-matmap.h from the overlay and use XCHAL_MPU_BACKGROUND_MAP macro
if it's defined.

Signed-off-by: Max Filippov <[email protected]>
5 years agotarget/xtensa: import xtensa/config/core-isa.h
Max Filippov [Sun, 8 Dec 2019 09:54:43 +0000 (01:54 -0800)]
target/xtensa: import xtensa/config/core-isa.h

Import core-isa.h from its canonical place in the configuration overlay.
Drop --xform option from the tar command line.

Signed-off-by: Max Filippov <[email protected]>
5 years agotarget/xtensa: fix ps.ring use in MPU configs
Max Filippov [Mon, 4 Nov 2019 08:01:27 +0000 (00:01 -0800)]
target/xtensa: fix ps.ring use in MPU configs

Allow ps.ring modification by wsr.ps/xsr.ps and use ps.ring value in
xtensa_get_[c]ring on configurations with MPU.

Signed-off-by: Max Filippov <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/elmarco/tags/dbus-vmstate7-pull-request' into...
Peter Maydell [Mon, 6 Jan 2020 18:22:42 +0000 (18:22 +0000)]
Merge remote-tracking branch 'remotes/elmarco/tags/dbus-vmstate7-pull-request' into staging

Add dbus-vmstate

Hi,

With external processes or helpers participating to the VM support, it
becomes necessary to handle their migration. Various options exist to
transfer their state:
1) as the VM memory, RAM or devices (we could say that's how
   vhost-user devices can be handled today, they are expected to
   restore from ring state)
2) other "vmstate" (as with TPM emulator state blobs)
3) left to be handled by management layer

1) is not practical, since an external processes may legitimatelly
need arbitrary state date to back a device or a service, or may not
even have an associated device.

2) needs ad-hoc code for each helper, but is simple and working

3) is complicated for management layer, QEMU has the migration timing

The proposed "dbus-vmstate" object will connect to a given D-Bus
address, and save/load from org.qemu.VMState1 owners on migration.

Thus helpers can easily have their state migrated with QEMU, without
implementing ad-hoc support (such as done for TPM emulation)

D-Bus is ubiquitous on Linux (it is systemd IPC), and can be made to
work on various other OSes. There are several implementations and good
bindings for various languages.  (the tests/dbus-vmstate-test.c is a
good example of how simple the implementation of services can be, even
in C)

dbus-vmstate is put into use by the libvirt series "[PATCH 00/23] Use
a slirp helper process".

v2:
 - fix build with broken mingw-glib

# gpg: Signature made Mon 06 Jan 2020 14:43:35 GMT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Marc-André Lureau <[email protected]>" [full]
# gpg:                 aka "Marc-André Lureau <[email protected]>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/dbus-vmstate7-pull-request:
  tests: add dbus-vmstate-test
  tests: add migration-helpers unit
  dockerfiles: add dbus-daemon to some of latest distributions
  configure: add GDBUS_CODEGEN
  Add dbus-vmstate object
  util: add dbus helper unit
  docs: start a document to describe D-Bus usage
  vmstate: replace DeviceState with VMStateIf
  vmstate: add qom interface to get id

Signed-off-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-01-06' into staging
Peter Maydell [Mon, 6 Jan 2020 17:44:22 +0000 (17:44 +0000)]
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-01-06' into staging

Block patches:
- Minor fixes and tests from the freeze period (too minor to be included
  in 4.2)
- Allow many bash iotests to test qcow2's external data file feature
- Add compress filter driver
- Fix Python iotests after 6f6e1698a6
- Fix for the backup job

# gpg: Signature made Mon 06 Jan 2020 14:33:06 GMT
# gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Max Reitz <[email protected]>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* remotes/maxreitz/tags/pull-block-2020-01-06: (34 commits)
  backup-top: Begin drain earlier
  tests/qemu-iotests: Update tests to recent desugarized -accel option
  tests/qemu-iotests: add case to write compressed data of multiple clusters
  qcow2: Allow writing compressed data of multiple clusters
  block: introduce compress filter driver
  iotests: Allow check -o data_file
  iotests: Disable data_file where it cannot be used
  iotests: Make 198 work with data_file
  iotests: Make 137 work with data_file
  iotests: Make 110 work with data_file
  iotests: Make 091 work with data_file
  iotests: Avoid cp/mv of test images
  iotests: Use _rm_test_img for deleting test images
  iotests: Avoid qemu-img create
  iotests: Drop IMGOPTS use in 267
  iotests: Replace IMGOPTS='' by --no-opts
  iotests: Replace IMGOPTS= by -o
  iotests: Inject space into -ocompat=0.10 in 051
  iotests: Add -o and --no-opts to _make_test_img
  iotests: Let _make_test_img parse its parameters
  ...

Signed-off-by: Peter Maydell <[email protected]>
5 years agointel_iommu: add present bit check for pasid table entries
Liu Yi L [Fri, 3 Jan 2020 13:28:06 +0000 (21:28 +0800)]
intel_iommu: add present bit check for pasid table entries

The present bit check for pasid entry (pe) and pasid directory
entry (pdire) were missed in previous commits as fpd bit check
doesn't require present bit as "Set". This patch adds the present
bit check for callers which wants to get a valid pe/pdire.

Cc: [email protected]
Cc: Kevin Tian <[email protected]>
Cc: Jacob Pan <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Yi Sun <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Signed-off-by: Liu Yi L <[email protected]>
Message-Id: <1578058086[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
5 years agointel_iommu: a fix to vtd_find_as_from_bus_num()
Liu Yi L [Fri, 3 Jan 2020 13:28:05 +0000 (21:28 +0800)]
intel_iommu: a fix to vtd_find_as_from_bus_num()

Ensure the return value of vtd_find_as_from_bus_num() is NULL by
enforcing vtd_bus=NULL. This would help caller of vtd_find_as_from_bus_num()
to decide if any further operation on the returned vtd_bus.

Cc: [email protected]
Cc: Kevin Tian <[email protected]>
Cc: Jacob Pan <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Yi Sun <[email protected]>
Signed-off-by: Liu Yi L <[email protected]>
Signed-off-by: Yi Sun <[email protected]>
Message-Id: <1578058086[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
5 years agovirtio-net: delete also control queue when TX/RX deleted
Yuri Benditovich [Thu, 26 Dec 2019 04:36:49 +0000 (06:36 +0200)]
virtio-net: delete also control queue when TX/RX deleted

https://bugzilla.redhat.com/show_bug.cgi?id=1708480
If the control queue is not deleted together with TX/RX, it
later will be ignored in freeing cache resources and hot
unplug will not be completed.

Cc: [email protected]
Signed-off-by: Yuri Benditovich <[email protected]>
Message-Id: <20191226043649[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
5 years agovirtio: reset region cache when on queue deletion
Yuri Benditovich [Thu, 26 Dec 2019 04:36:48 +0000 (06:36 +0200)]
virtio: reset region cache when on queue deletion

https://bugzilla.redhat.com/show_bug.cgi?id=1708480
Fix leak of region reference that prevents complete
device deletion on hot unplug.

Cc: [email protected]
Signed-off-by: Yuri Benditovich <[email protected]>
Message-Id: <20191226043649[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
5 years agovirtio-mmio: update queue size on guest write
Denis Plotnikov [Tue, 24 Dec 2019 08:14:46 +0000 (11:14 +0300)]
virtio-mmio: update queue size on guest write

Some guests read back queue size after writing it.
Always update the on size write otherwise they might be confused.

Cc: [email protected]
Signed-off-by: Denis Plotnikov <[email protected]>
Message-Id: <20191224081446[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
5 years agotests: add virtio-scsi and virtio-blk seg_max_adjust test
Denis Plotnikov [Fri, 20 Dec 2019 14:09:05 +0000 (17:09 +0300)]
tests: add virtio-scsi and virtio-blk seg_max_adjust test

It tests proper seg_max_adjust settings for all machine types except
'none', 'isapc', 'microvm'

Signed-off-by: Denis Plotnikov <[email protected]>
Message-Id: <20191220140905[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
5 years agovirtio: make seg_max virtqueue size dependent
Denis Plotnikov [Fri, 20 Dec 2019 14:09:04 +0000 (17:09 +0300)]
virtio: make seg_max virtqueue size dependent

Before the patch, seg_max parameter was immutable and hardcoded
to 126 (128 - 2) without respect to queue size. This has two negative effects:

1. when queue size is < 128, we have Virtio 1.1 specfication violation:
   (2.6.5.3.1 Driver Requirements) seq_max must be <= queue_size.
   This violation affects the old Linux guests (ver < 4.14). These guests
   crash on these queue_size setups.

2. when queue_size > 128, as was pointed out by Denis Lunev <[email protected]>,
   seg_max restrics guest's block request length which affects guests'
   performance making them issues more block request than needed.
   https://lists.gnu.org/archive/html/qemu-devel/2017-12/msg03721.html

To mitigate this two effects, the patch adds the property adjusting seg_max
to queue size automaticaly. Since seg_max is a guest visible parameter,
the property is machine type managable and allows to choose between
old (seg_max = 126 always) and new (seg_max = queue_size - 2) behaviors.

Not to change the behavior of the older VMs, prevent setting the default
seg_max_adjust value for older machine types.

Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Denis Plotnikov <[email protected]>
Message-Id: <20191220140905[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/audio-20200106-pull-request' into...
Peter Maydell [Mon, 6 Jan 2020 16:48:35 +0000 (16:48 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20200106-pull-request' into staging

audio: bugfixes.

# gpg: Signature made Mon 06 Jan 2020 12:51:15 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>" [full]
# gpg:                 aka "Gerd Hoffmann <[email protected]>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20200106-pull-request:
  audio: fix integer overflow
  paaudio: wait until the recording stream is ready
  paaudio: try to drain the recording stream
  paaudio: drop recording stream in qpa_fini_in
  hda-codec: fix recording rate control
  hda-codec: fix playback rate control

Signed-off-by: Peter Maydell <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/elmarco/tags/screendump-pull-request' into...
Peter Maydell [Mon, 6 Jan 2020 14:51:51 +0000 (14:51 +0000)]
Merge remote-tracking branch 'remotes/elmarco/tags/screendump-pull-request' into staging

console: screendump improvements

Hi,

The following patches have been extracted from the "[PATCH v6 00/25]
monitor: add asynchronous command type", as they are
reviewable/mergeable independantly.

They introduce some internal API changes, and fix
qemu_open()/qemu_close()/unlink() misusages which should be quite
harmless.

# gpg: Signature made Fri 03 Jan 2020 09:07:51 GMT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Marc-André Lureau <[email protected]>" [full]
# gpg:                 aka "Marc-André Lureau <[email protected]>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/screendump-pull-request:
  screendump: use qemu_unlink()
  osdep: add qemu_unlink()
  screendump: replace FILE with QIOChannel and fix close()/qemu_close()
  object: add g_autoptr support
  ui: add pixman image g_autoptr support
  ppm-save: pass opened fd
  console: add graphic_hw_update_done()

Signed-off-by: Peter Maydell <[email protected]>
5 years agotests: add dbus-vmstate-test
Marc-André Lureau [Fri, 27 Sep 2019 08:39:08 +0000 (12:39 +0400)]
tests: add dbus-vmstate-test

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
5 years agotests: add migration-helpers unit
Marc-André Lureau [Mon, 16 Dec 2019 10:59:44 +0000 (14:59 +0400)]
tests: add migration-helpers unit

Move a few helper functions from migration-test.c to migration-helpers.c

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
5 years agodockerfiles: add dbus-daemon to some of latest distributions
Marc-André Lureau [Mon, 30 Sep 2019 10:05:46 +0000 (14:05 +0400)]
dockerfiles: add dbus-daemon to some of latest distributions

To get dbus-vmstate test covered.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
5 years agoconfigure: add GDBUS_CODEGEN
Marc-André Lureau [Fri, 27 Sep 2019 07:34:42 +0000 (11:34 +0400)]
configure: add GDBUS_CODEGEN

gdbus-codegen generated code requires gio-unix on Unix, so add it to
GIO libs/cflags.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
5 years agoAdd dbus-vmstate object
Marc-André Lureau [Mon, 16 Dec 2019 07:48:53 +0000 (11:48 +0400)]
Add dbus-vmstate object

When instantiated, this object will connect to the given D-Bus bus
"addr". During migration, it will take/restore the data from
org.qemu.VMState1 instances. See documentation for details.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
5 years agoutil: add dbus helper unit
Marc-André Lureau [Fri, 27 Sep 2019 08:16:54 +0000 (12:16 +0400)]
util: add dbus helper unit

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
5 years agodocs: start a document to describe D-Bus usage
Marc-André Lureau [Thu, 12 Sep 2019 12:03:32 +0000 (16:03 +0400)]
docs: start a document to describe D-Bus usage

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
5 years agovmstate: replace DeviceState with VMStateIf
Marc-André Lureau [Wed, 28 Aug 2019 12:02:32 +0000 (16:02 +0400)]
vmstate: replace DeviceState with VMStateIf

Replace DeviceState dependency with VMStateIf on vmstate API.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Acked-by: Halil Pasic <[email protected]>
5 years agovmstate: add qom interface to get id
Marc-André Lureau [Wed, 28 Aug 2019 12:00:19 +0000 (16:00 +0400)]
vmstate: add qom interface to get id

Add an interface to get the instance id, instead of depending on
Device and qdev_get_dev_path().

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Acked-by: Dr. David Alan Gilbert <[email protected]>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request...
Peter Maydell [Mon, 6 Jan 2020 14:08:04 +0000 (14:08 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging

x86 and machine queue, 2019-12-20

Bug fix:
* Resolve CPU models to v1 by default (Eduardo Habkost)

Cleanup:
* Remove incorrect numa_mem_supported checks (Igor Mammedov)

# gpg: Signature made Fri 20 Dec 2019 19:19:02 GMT
# gpg:                using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Eduardo Habkost <[email protected]>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-and-machine-pull-request:
  numa: properly check if numa is supported
  numa: remove not needed check
  i386: Resolve CPU models to v1 by default

Signed-off-by: Peter Maydell <[email protected]>
5 years agobackup-top: Begin drain earlier
Max Reitz [Thu, 19 Dec 2019 18:26:38 +0000 (19:26 +0100)]
backup-top: Begin drain earlier

When dropping backup-top, we need to drain the node before freeing the
BlockCopyState.  Otherwise, requests may still be in flight and then the
assertion in shres_destroy() will fail.

(This becomes visible in intermittent failure of 056.)

Cc: [email protected]
Signed-off-by: Max Reitz <[email protected]>
Message-id: 20191219182638[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agotests/qemu-iotests: Update tests to recent desugarized -accel option
Philippe Mathieu-Daudé [Mon, 6 Jan 2020 13:09:51 +0000 (14:09 +0100)]
tests/qemu-iotests: Update tests to recent desugarized -accel option

Commit 6f6e1698a6 desugarized "-machine accel=" to a list
of "-accel" options. Since now "-machine accel" and "-accel"
became incompatible, update the iotests to the new format.

Error reported here:
https://gitlab.com/qemu-project/qemu/-/jobs/385801004#L3400

Reported-by: GitLab CI
Fixes: 6f6e1698a6 (vl: configure accelerators from -accel options)
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20200106130951[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agotests/qemu-iotests: add case to write compressed data of multiple clusters
Andrey Shinkevich [Mon, 2 Dec 2019 12:15:06 +0000 (15:15 +0300)]
tests/qemu-iotests: add case to write compressed data of multiple clusters

Add the case to the iotest #214 that checks possibility of writing
compressed data of more than one cluster size. The test case involves
the compress filter driver showing a sample usage of that.

Signed-off-by: Andrey Shinkevich <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 1575288906[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoqcow2: Allow writing compressed data of multiple clusters
Andrey Shinkevich [Mon, 2 Dec 2019 12:15:05 +0000 (15:15 +0300)]
qcow2: Allow writing compressed data of multiple clusters

QEMU currently supports writing compressed data of the size equal to
one cluster. This patch allows writing QCOW2 compressed data that
exceed one cluster. Now, we split buffered data into separate clusters
and write them compressed using the block/aio_task API.

Suggested-by: Pavel Butsykin <[email protected]>
Suggested-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Signed-off-by: Andrey Shinkevich <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 1575288906[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoblock: introduce compress filter driver
Andrey Shinkevich [Mon, 2 Dec 2019 12:15:04 +0000 (15:15 +0300)]
block: introduce compress filter driver

Allow writing all the data compressed through the filter driver.
The written data will be aligned by the cluster size.
Based on the QEMU current implementation, that data can be written to
unallocated clusters only. May be used for a backup job.

Suggested-by: Max Reitz <[email protected]>
Signed-off-by: Andrey Shinkevich <[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-id: 1575288906[email protected]
[mreitz: Replace NULL bdrv_get_format_name() by "(no format)"]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Allow check -o data_file
Max Reitz [Thu, 7 Nov 2019 16:37:08 +0000 (17:37 +0100)]
iotests: Allow check -o data_file

The problem with allowing the data_file option is that you want to use a
different data file per image used in the test.  Therefore, we need to
allow patterns like -o data_file='$TEST_IMG.data_file'.

Then, we need to filter it out from qemu-img map, qemu-img create, and
remove the data file in _rm_test_img.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Disable data_file where it cannot be used
Max Reitz [Thu, 7 Nov 2019 16:37:07 +0000 (17:37 +0100)]
iotests: Disable data_file where it cannot be used

Signed-off-by: Max Reitz <[email protected]>
Message-id: 20191107163708[email protected]
[mreitz: Also disable 273]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Make 198 work with data_file
Max Reitz [Thu, 7 Nov 2019 16:37:06 +0000 (17:37 +0100)]
iotests: Make 198 work with data_file

We do not care about the json:{} filenames here, so we can just filter
them out and thus make the test work both with and without external data
files.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Make 137 work with data_file
Max Reitz [Thu, 7 Nov 2019 16:37:05 +0000 (17:37 +0100)]
iotests: Make 137 work with data_file

When using an external data file, there are no refcounts for data
clusters.  We thus have to adjust the corruption test in this patch to
not be based around a data cluster allocation, but the L2 table
allocation (L2 tables are still refcounted with external data files).

Furthermore, we should not print qcow2.py's list of incompatible
features because it differs depending on whether there is an external
data file or not.

With those two changes, the test will work both with and without
external data files (once that options works with the iotests at all).

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Make 110 work with data_file
Max Reitz [Thu, 7 Nov 2019 16:37:04 +0000 (17:37 +0100)]
iotests: Make 110 work with data_file

The only difference is that the json:{} filename of the image looks
different.  We actually do not care about that filename in this test, we
are only interested in (1) that there is a json:{} filename, and (2)
whether the backing filename can be constructed.

So just filter out the json:{} data, thus making this test pass both
with and without data_file.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Make 091 work with data_file
Max Reitz [Thu, 7 Nov 2019 16:37:03 +0000 (17:37 +0100)]
iotests: Make 091 work with data_file

The image end offset as reported by qemu-img check is different when
using an external data file; we do not care about its value here, so we
can just filter it.  Incidentally, common.rc already has _check_test_img
for us which does exactly that.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Avoid cp/mv of test images
Max Reitz [Thu, 7 Nov 2019 16:37:02 +0000 (17:37 +0100)]
iotests: Avoid cp/mv of test images

This will not work with external data files, so try to get tests working
without it as far as possible.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Use _rm_test_img for deleting test images
Max Reitz [Thu, 7 Nov 2019 16:37:01 +0000 (17:37 +0100)]
iotests: Use _rm_test_img for deleting test images

Just rm will not delete external data files.  Use _rm_test_img every
time we delete a test image.

(In the process, clean up the indentation of every _cleanup() this patch
touches.)

((Also, use quotes consistently.  I am happy to see unquoted instances
like "rm -rf $TEST_DIR/..." go.))

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Avoid qemu-img create
Max Reitz [Thu, 7 Nov 2019 16:37:00 +0000 (17:37 +0100)]
iotests: Avoid qemu-img create

Use _make_test_img whenever possible.  This way, we will not ignore
user-specified image options.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Drop IMGOPTS use in 267
Max Reitz [Thu, 7 Nov 2019 16:36:59 +0000 (17:36 +0100)]
iotests: Drop IMGOPTS use in 267

Overwriting IMGOPTS means ignoring all user-supplied options, which is
not what we want.  Replace the current IMGOPTS use by a new BACKING_FILE
variable.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Replace IMGOPTS='' by --no-opts
Max Reitz [Thu, 7 Nov 2019 16:36:58 +0000 (17:36 +0100)]
iotests: Replace IMGOPTS='' by --no-opts

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Replace IMGOPTS= by -o
Max Reitz [Thu, 7 Nov 2019 16:36:57 +0000 (17:36 +0100)]
iotests: Replace IMGOPTS= by -o

Tests should not overwrite all user-supplied image options, but only add
to it (which will effectively overwrite conflicting values).  Accomplish
this by passing options to _make_test_img via -o instead of $IMGOPTS.

For some tests, there is no functional change because they already only
appended options to IMGOPTS.  For these, this patch is just a
simplification.

For others, this is a change, so they now heed user-specified $IMGOPTS.
Some of those tests do not work with all image options, though, so we
need to disable them accordingly.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Inject space into -ocompat=0.10 in 051
Max Reitz [Thu, 7 Nov 2019 16:36:56 +0000 (17:36 +0100)]
iotests: Inject space into -ocompat=0.10 in 051

It did not matter before, but now that _make_test_img understands -o, we
should use it properly here.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Add -o and --no-opts to _make_test_img
Max Reitz [Thu, 7 Nov 2019 16:36:55 +0000 (17:36 +0100)]
iotests: Add -o and --no-opts to _make_test_img

Blindly overriding IMGOPTS is suboptimal as this discards user-specified
options.  Whatever options the test needs should simply be appended.

Some tests do this (with IMGOPTS=$(_optstr_add "$IMGOPTS" "...")), but
that is cumbersome.  It’s simpler to just give _make_test_img an -o
parameter with which tests can add options.

Some tests actually must override the user-specified options, though,
for example when creating an image in a different format than the test
$IMGFMT.  For such cases, --no-opts allows clearing the current option
list.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Let _make_test_img parse its parameters
Max Reitz [Thu, 7 Nov 2019 16:36:54 +0000 (17:36 +0100)]
iotests: Let _make_test_img parse its parameters

This will allow us to add more options than just -b.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Drop compat=1.1 in 050
Max Reitz [Thu, 7 Nov 2019 16:36:53 +0000 (17:36 +0100)]
iotests: Drop compat=1.1 in 050

IMGOPTS can never be empty for qcow2, because the check scripts adds
compat=1.1 unless the user specified any compat option themselves.
Thus, this block does not do anything and can be dropped.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Replace IMGOPTS by _unsupported_imgopts
Max Reitz [Thu, 7 Nov 2019 16:36:52 +0000 (17:36 +0100)]
iotests: Replace IMGOPTS by _unsupported_imgopts

Some tests require compat=1.1 and thus set IMGOPTS='compat=1.1'
globally.  That is not how it should be done; instead, they should
simply set _unsupported_imgopts to compat=0.10 (compat=1.1 is the
default anyway).

This makes the tests heed user-specified $IMGOPTS.  Some do not work
with all image options, though, so we need to disable them accordingly.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Filter refcount_order in 036
Max Reitz [Thu, 7 Nov 2019 16:36:51 +0000 (17:36 +0100)]
iotests: Filter refcount_order in 036

This test can run just fine with other values for refcount_bits, so we
should filter the value from qcow2.py's dump-header.  In fact, we can
filter everything but the feature bits and header extensions, because
that is what the test is about.

(036 currently ignores user-specified image options, but that will be
fixed in the next patch.)

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: Add _filter_json_filename
Max Reitz [Thu, 7 Nov 2019 16:36:50 +0000 (17:36 +0100)]
iotests: Add _filter_json_filename

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests/qcow2.py: Split feature fields into bits
Max Reitz [Thu, 7 Nov 2019 16:36:49 +0000 (17:36 +0100)]
iotests/qcow2.py: Split feature fields into bits

Print the feature fields as a set of bits so that filtering is easier.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests/qcow2.py: Add dump-header-exts
Max Reitz [Thu, 7 Nov 2019 16:36:48 +0000 (17:36 +0100)]
iotests/qcow2.py: Add dump-header-exts

This is useful for tests that want to whitelist fields from dump-header
(with grep) but still print all header extensions.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Message-id: 20191107163708[email protected]
Signed-off-by: Max Reitz <[email protected]>
5 years agoiotests: s/qocw2/qcow2/
Max Reitz [Thu, 7 Nov 2019 16:36:47 +0000 (17:36 +0100)]
iotests: s/qocw2/qcow2/

Probably due to blind copy-pasting, we have several instances of "qocw2"
in our iotests.  Fix them.

Reported-by: Maxim Levitsky <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
Message-id: 20191107163708[email protected]
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Maxim Levitsky <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
This page took 0.090178 seconds and 4 git commands to generate.