]> Git Repo - qemu.git/log
qemu.git
7 years agoMerge remote-tracking branch 'mcayland/tags/qemu-openbios-signed' into staging
Stefan Hajnoczi [Mon, 22 May 2017 09:12:50 +0000 (10:12 +0100)]
Merge remote-tracking branch 'mcayland/tags/qemu-openbios-signed' into staging

Update OpenBIOS images

# gpg: Signature made Fri 19 May 2017 05:05:54 PM BST
# gpg:                using RSA key 0x5BC2C56FAE0F321F
# gpg: Good signature from "Mark Cave-Ayland <[email protected]>"
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* mcayland/tags/qemu-openbios-signed:
  Update OpenBIOS images to 3ebaaa2 built from submodule.

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'kraxel/tags/pull-audio-20170519-1' into staging
Stefan Hajnoczi [Fri, 19 May 2017 15:54:10 +0000 (16:54 +0100)]
Merge remote-tracking branch 'kraxel/tags/pull-audio-20170519-1' into staging

audio: move & rename soundhw init code.

# gpg: Signature made Fri 19 May 2017 12:22:51 PM BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* kraxel/tags/pull-audio-20170519-1:
  audio: Rename hw/audio/audio.h to hw/audio/soundhw.h
  audio: Rename audio_init() to soundhw_init()
  audio: Move arch_init audio code to hw/audio/soundhw.c

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoUpdate OpenBIOS images to 3ebaaa2 built from submodule.
Mark Cave-Ayland [Fri, 19 May 2017 15:51:47 +0000 (16:51 +0100)]
Update OpenBIOS images to 3ebaaa2 built from submodule.

Signed-off-by: Mark Cave-Ayland <[email protected]>
7 years agoMerge remote-tracking branch 'kraxel/tags/pull-ui-20170519-1' into staging
Stefan Hajnoczi [Fri, 19 May 2017 15:44:18 +0000 (16:44 +0100)]
Merge remote-tracking branch 'kraxel/tags/pull-ui-20170519-1' into staging

ui: egl-headless requires dmabuf support

# gpg: Signature made Fri 19 May 2017 09:46:40 AM BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* kraxel/tags/pull-ui-20170519-1:
  ui: egl-headless requires dmabuf support

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'quintela/tags/migration/20170518' into staging
Stefan Hajnoczi [Fri, 19 May 2017 15:36:51 +0000 (16:36 +0100)]
Merge remote-tracking branch 'quintela/tags/migration/20170518' into staging

migration/next for 20170518

# gpg: Signature made Thu 18 May 2017 06:23:26 PM BST
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <[email protected]>"
# gpg:                 aka "Juan Quintela <[email protected]>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* quintela/tags/migration/20170518:
  migration: Make savevm.c target independent
  exec: Create include for target_page_size()
  migration: migration.h was not needed
  migration: Remove vmstate.h from migration.h
  migration: Remove qemu-file.h from vmstate.h
  migration: Split vmstate-types.c from vmstate.c
  migration: Move qjson.h to migration/
  migration: Remove migration.h from colo.h
  migration: Export qemu-file-channel.c functions in its own file
  migration: Split migration/channel.c for channel operations
  migration: Create migration/xbzrle.h
  block migration: Allow compile time disable
  migration: Remove old MigrationParams
  migration: Remove use of old MigrationParams
  migration: Create block capability
  hmp: Use visitor api for hmp_migrate_set_parameter()
  postcopy: Require RAMBlocks that are whole pages
  migration: Fix non-multiple of page size migration

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agos390/kvm: do not reset riccb on initial cpu reset
Christian Borntraeger [Fri, 12 May 2017 11:47:30 +0000 (13:47 +0200)]
s390/kvm: do not reset riccb on initial cpu reset

The riccb is kept unchanged during initial cpu reset. Move the data
structure to the other registers that are unchanged.

Signed-off-by: Christian Borntraeger <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoMAINTAINERS: Add vfio-ccw maintainer
Dong Jia Shi [Wed, 17 May 2017 00:48:13 +0000 (02:48 +0200)]
MAINTAINERS: Add vfio-ccw maintainer

Add Cornelia Huck as the vfio-ccw maintainer.

Acked-by: Alex Williamson <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
[CH: add tree]
Signed-off-by: Cornelia Huck <[email protected]>
7 years agovfio/ccw: update sense data if a unit check is pending
Dong Jia Shi [Wed, 17 May 2017 00:48:12 +0000 (02:48 +0200)]
vfio/ccw: update sense data if a unit check is pending

Concurrent-sense data is currently not delivered. This patch stores
the concurrent-sense data to the subchannel if a unit check is pending
and the concurrent-sense bit is enabled. Then a TSCH can retreive the
right IRB data back to the guest.

Acked-by: Alex Williamson <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: ccw translation infrastructure
Xiao Feng Ren [Wed, 17 May 2017 00:48:11 +0000 (02:48 +0200)]
s390x/css: ccw translation infrastructure

Implement a basic infrastructure of handling channel I/O instruction
interception for passed through subchannels:
1. Branch the code path of instruction interception handling by
   SubChannel type.
2. For a passed-through subchannel, issue the ORB to kernel to do ccw
   translation and perform an I/O operation.
3. Assign different condition code based on the I/O result, or
   trigger a program check.

Signed-off-by: Xiao Feng Ren <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: introduce and realize ccw-request callback
Xiao Feng Ren [Wed, 17 May 2017 00:48:10 +0000 (02:48 +0200)]
s390x/css: introduce and realize ccw-request callback

Introduce a new callback on subchannel to handle ccw-request.
Realize the callback in vfio-ccw device. Besides, resort to
the event notifier handler to handling the ccw-request results.
1. Pread the I/O results via MMIO region.
2. Update the scsw info to guest.
3. Inject an I/O interrupt to notify guest the I/O result.

Acked-by: Alex Williamson <[email protected]>
Signed-off-by: Xiao Feng Ren <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agovfio/ccw: get irqs info and set the eventfd fd
Dong Jia Shi [Wed, 17 May 2017 00:48:09 +0000 (02:48 +0200)]
vfio/ccw: get irqs info and set the eventfd fd

vfio-ccw resorts to the eventfd mechanism to communicate with userspace.
We fetch the irqs info via the ioctl VFIO_DEVICE_GET_IRQ_INFO,
register a event notifier to get the eventfd fd which is sent
to kernel via the ioctl VFIO_DEVICE_SET_IRQS, then we can implement
read operation once kernel sends the signal.

Reviewed-by: Eric Auger <[email protected]>
Acked-by: Alex Williamson <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agovfio/ccw: get io region info
Dong Jia Shi [Wed, 17 May 2017 00:48:08 +0000 (02:48 +0200)]
vfio/ccw: get io region info

vfio-ccw provides an MMIO region for I/O operations. We fetch its
information via ioctls here, then we can use it performing I/O
instructions and retrieving I/O results later on.

Reviewed-by: Eric Auger <[email protected]>
Acked-by: Alex Williamson <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agovfio/ccw: vfio based subchannel passthrough driver
Xiao Feng Ren [Wed, 17 May 2017 00:48:07 +0000 (02:48 +0200)]
vfio/ccw: vfio based subchannel passthrough driver

We use the IOMMU_TYPE1 of VFIO to realize the subchannels
passthrough, implement a vfio based subchannels passthrough
driver called "vfio-ccw".

Support qemu parameters in the style of:
"-device vfio-ccw,sysfsdev=$mdev_file_path,devno=xx.x.xxxx'

Reviewed-by: Eric Auger <[email protected]>
Acked-by: Alex Williamson <[email protected]>
Signed-off-by: Xiao Feng Ren <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: device support for s390-ccw passthrough
Dong Jia Shi [Wed, 17 May 2017 00:48:06 +0000 (02:48 +0200)]
s390x/css: device support for s390-ccw passthrough

In order to support subchannels pass-through, we introduce a s390
subchannel device called "s390-ccw" to hold the real subchannel info.
The s390-ccw devices inherit from the abstract CcwDevice which connect
to the existing virtual-css-bus.

Reviewed-by: Eric Auger <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: realize css_create_sch
Dong Jia Shi [Wed, 17 May 2017 00:48:05 +0000 (02:48 +0200)]
s390x/css: realize css_create_sch

The S390 virtual css support already has a mechanism to create a
virtual subchannel and provide it to the guest. However, to
pass-through subchannels to a guest, we need to introduce a new
mechanism to create the subchannel according to the real device
information. Thus we reconstruct css_create_virtual_sch to a new
css_create_sch function to handle all these cases and do allocation
and initialization of the subchannel according to the device type
and machine configuration.

Reviewed-by: Pierre Morel <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: realize css_sch_build_schib
Xiao Feng Ren [Wed, 17 May 2017 00:48:04 +0000 (02:48 +0200)]
s390x/css: realize css_sch_build_schib

The S390 virtual css support already has a mechanism to build a
virtual subchannel information block (schib) and provide virtual
subchannels to the guest. However, to pass-through subchannels to
a guest, we need to introduce a new mechanism to build its schib
according to the real device information. Thus we realize a new css
sch_build_schib function to extract the path_masks, chpids, chpid
type from sysfs. To reuse the existing code, we refactor
css_add_virtual_chpid to css_add_chpid.

Reviewed-by: Pierre Morel <[email protected]>
Signed-off-by: Xiao Feng Ren <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: add s390-squash-mcss machine option
Xiao Feng Ren [Wed, 17 May 2017 00:48:03 +0000 (02:48 +0200)]
s390x/css: add s390-squash-mcss machine option

We want to support real (i.e. not virtual) channel devices
even for guests that do not support MCSS-E (where guests may
see devices from any channel subsystem image at once). As all
virtio-ccw devices are in css 0xfe (and show up in the default
css 0 for guests not activating MCSS-E), we need an option to
squash both the virtio subchannels and e.g. passed-through
subchannels from their real css (0-3, or 0 for hosts not
activating MCSS-E) into the default css. This will be
exploited in a later patch.

Signed-off-by: Xiao Feng Ren <[email protected]>
Signed-off-by: Dong Jia Shi <[email protected]>
Message-Id: <20170517004813[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agolinux-headers: update
Cornelia Huck [Thu, 18 May 2017 11:47:27 +0000 (13:47 +0200)]
linux-headers: update

Update against Linux v4.12-rc1.

Also include the new vfio_ccw.h header.

Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw.img: rebuild image
Eric Farman [Wed, 10 May 2017 15:53:59 +0000 (17:53 +0200)]
pc-bios/s390-ccw.img: rebuild image

Contains the following commits:
- pc-bios/s390-ccw: Remove duplicate blk_factor adjustment
- pc-bios/s390-ccw: Move SCSI block factor to outer read
- pc-bios/s390-ccw: Break up virtio-scsi read into multiples
- pc-bios/s390-ccw: Refactor scsi_inquiry function
- pc-bios/s390-ccw: Get list of supported EVPD pages
- pc-bios/s390-ccw: Get Block Limits VPD device data
- pc-bios/s390-ccw: Build a reasonable max_sectors limit

Signed-off-by: Eric Farman <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: Build a reasonable max_sectors limit
Eric Farman [Wed, 10 May 2017 15:53:58 +0000 (17:53 +0200)]
pc-bios/s390-ccw: Build a reasonable max_sectors limit

Now that we've read all the possible limits that have been defined for
a virtio-scsi controller and the disk we're booting from, it's possible
that we are STILL going to exceed the limits of the host device.
For example, a "-device scsi-generic" device does not support the
Block Limits VPD page.

So, let's fallback to something that seems to work for most boot
configurations if larger values were specified (including if nothing
was explicitly specified, and we took default values).

Signed-off-by: Eric Farman <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: Get Block Limits VPD device data
Eric Farman [Wed, 10 May 2017 15:53:57 +0000 (17:53 +0200)]
pc-bios/s390-ccw: Get Block Limits VPD device data

The "Block Limits" Inquiry VPD page is optional for any SCSI device,
but if it's supported it provides a hint of the maximum I/O transfer
length for this particular device. If this page is supported by the
disk, let's issue that Inquiry and use the minimum of it and the
SCSI controller limit. That will cover this scenario:

  qemu-system-s390x ...
    -device virtio-scsi-ccw,id=scsi0,max_sectors=32768 ...
    -drive file=/dev/sda,if=none,id=drive0,format=raw ...
    -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,
            drive=drive0,id=disk0,max_io_size=1048576

controller: 32768 sectors x 512 bytes/sector = 16777216 bytes
      disk:                                     1048576 bytes

Now that we have a limit for a virtio-scsi disk, compare that with the
limit for the virtio-scsi controller when we actually build the I/O.
The minimum of these two limits should be the one we use.

Signed-off-by: Eric Farman <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: Get list of supported VPD pages
Eric Farman [Wed, 10 May 2017 15:53:56 +0000 (17:53 +0200)]
pc-bios/s390-ccw: Get list of supported VPD pages

The "Supported Pages" Inquiry EVPD page is mandatory for all SCSI devices,
and is used as a gateway for what VPD pages the device actually supports.
Let's issue this Inquiry, and dump that list with the debug facility.

Signed-off-by: Eric Farman <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: Refactor scsi_inquiry function
Eric Farman [Wed, 10 May 2017 15:53:55 +0000 (17:53 +0200)]
pc-bios/s390-ccw: Refactor scsi_inquiry function

If we want to issue any of the SCSI Inquiry EVPD pages,
which we do, we could use this function to issue both types
of commands with a little bit of refactoring.

Signed-off-by: Eric Farman <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: Break up virtio-scsi read into multiples
Eric Farman [Wed, 10 May 2017 15:53:54 +0000 (17:53 +0200)]
pc-bios/s390-ccw: Break up virtio-scsi read into multiples

A virtio-scsi request that goes through the host sd driver and exceeds
the maximum transfer size is automatically broken up for us.  But the
equivalent request going to the sg driver presumes that any length
requirements have already been honored.

Let's use the max_sectors field on the virtio-scsi controller device,
and break up all requests (both sd and sg) to avoid this problem.

Signed-off-by: Eric Farman <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: Move SCSI block factor to outer read
Eric Farman [Wed, 10 May 2017 15:53:53 +0000 (17:53 +0200)]
pc-bios/s390-ccw: Move SCSI block factor to outer read

Simple refactoring so that the blk_factor adjustment is
moved into virtio_scsi_read_many routine, in preparation
for another change.

Signed-off-by: Eric Farman <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: Remove duplicate blk_factor adjustment
Eric Farman [Wed, 10 May 2017 15:53:52 +0000 (17:53 +0200)]
pc-bios/s390-ccw: Remove duplicate blk_factor adjustment

When using virtio-scsi, we multiply the READ(10) data_size by
a block factor twice when building the I/O.  This is fine,
since it's only 1 for SCSI disks, but let's clean it up.

Signed-off-by: Eric Farman <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Message-Id: <20170510155359[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoaudio: Rename hw/audio/audio.h to hw/audio/soundhw.h
Eduardo Habkost [Mon, 8 May 2017 20:57:35 +0000 (17:57 -0300)]
audio: Rename hw/audio/audio.h to hw/audio/soundhw.h

All the functions in hw/audio/audio.h are called "soundhw_*()"
and live in hw/audio/audiohw.c. Rename the header file for
consistency.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Hervé Poussineau <[email protected]>
Message-id: 20170508205735[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoaudio: Rename audio_init() to soundhw_init()
Eduardo Habkost [Mon, 8 May 2017 20:57:34 +0000 (17:57 -0300)]
audio: Rename audio_init() to soundhw_init()

To make it consistent with the remaining soundhw.c functions and
avoid confusion with the audio_init() function in audio/audio.c,
rename audio_init() to soundhw_init().

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Message-id: 20170508205735[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoaudio: Move arch_init audio code to hw/audio/soundhw.c
Eduardo Habkost [Mon, 8 May 2017 20:57:33 +0000 (17:57 -0300)]
audio: Move arch_init audio code to hw/audio/soundhw.c

There's no reason to keep the soundhw table in arch_init.c. Move
that code to a new hw/audio/soundhw.c file.

While moving the code, trivial coding style issues were fixed.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20170508205735[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
7 years agoui: egl-headless requires dmabuf support
Gerd Hoffmann [Wed, 17 May 2017 12:27:44 +0000 (14:27 +0200)]
ui: egl-headless requires dmabuf support

Reported-by: Thomas Huth <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20170517122744[email protected]

7 years agomigration: Make savevm.c target independent
Juan Quintela [Mon, 24 Apr 2017 19:03:48 +0000 (21:03 +0200)]
migration: Make savevm.c target independent

It only needed TARGET_PAGE_SIZE/BITS/BITS_MIN values, so just export
them from exec.h

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
7 years agoexec: Create include for target_page_size()
Juan Quintela [Mon, 24 Apr 2017 18:50:19 +0000 (20:50 +0200)]
exec: Create include for target_page_size()

That is the only function that we need from exec.c, and having to
include the whole sysemu.h for this.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
---

/me leans to be less sloppy with copyright notices
thanks Dave

7 years agomigration: migration.h was not needed
Juan Quintela [Thu, 6 Apr 2017 10:12:21 +0000 (12:12 +0200)]
migration: migration.h was not needed

This files don't use any function from migration.h, so drop it.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
7 years agomigration: Remove vmstate.h from migration.h
Juan Quintela [Mon, 17 Apr 2017 17:02:59 +0000 (19:02 +0200)]
migration: Remove vmstate.h from migration.h

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
---

Minor rearrangements due to rebase

7 years agomigration: Remove qemu-file.h from vmstate.h
Juan Quintela [Mon, 17 Apr 2017 16:59:13 +0000 (18:59 +0200)]
migration: Remove qemu-file.h from vmstate.h

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
--

minor rearangements due to the rebase

7 years agomigration: Split vmstate-types.c from vmstate.c
Juan Quintela [Thu, 20 Apr 2017 11:41:20 +0000 (13:41 +0200)]
migration: Split vmstate-types.c from vmstate.c

Now one just has the interperter, and the other has the basic types.
Once there, add copyright boilerplate.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
--

Use GPL v2 or later.  Detected by David.

7 years agomigration: Move qjson.h to migration/
Juan Quintela [Thu, 20 Apr 2017 11:10:28 +0000 (13:10 +0200)]
migration: Move qjson.h to migration/

It is only used for migration code.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
7 years agomigration: Remove migration.h from colo.h
Juan Quintela [Thu, 6 Apr 2017 10:03:13 +0000 (12:03 +0200)]
migration: Remove migration.h from colo.h

migration.h is not included in any includes now.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
7 years agomigration: Export qemu-file-channel.c functions in its own file
Juan Quintela [Mon, 17 Apr 2017 17:34:36 +0000 (19:34 +0200)]
migration: Export qemu-file-channel.c functions in its own file

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
7 years agomigration: Split migration/channel.c for channel operations
Juan Quintela [Mon, 17 Apr 2017 15:07:04 +0000 (17:07 +0200)]
migration: Split migration/channel.c for channel operations

Create an include for its exported functions.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
---
Add proper header

7 years agomigration: Create migration/xbzrle.h
Juan Quintela [Wed, 5 Apr 2017 19:47:50 +0000 (21:47 +0200)]
migration: Create migration/xbzrle.h

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
7 years agoblock migration: Allow compile time disable
Dr. David Alan Gilbert [Mon, 15 May 2017 14:05:29 +0000 (15:05 +0100)]
block migration: Allow compile time disable

Many users now prefer to use drive_mirror over NBD as an
alternative to the older migrate -b option; drive_mirror is
more complex to setup but gives you more options (e.g. only
migrating some of the disks if some of them are shared).

Allow the large chunk of block migration code to be compiled
out for those who don't use it.

Based on a downstream-patch we've had for a while by Jeff Cody.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
--

- When compiled out, allow seting block only with false value (eric)

7 years agomigration: Remove old MigrationParams
Juan Quintela [Wed, 5 Apr 2017 19:00:09 +0000 (21:00 +0200)]
migration: Remove old MigrationParams

Not used anymore after moving block migration to use capabilities.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: zhanghailiang <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
7 years agomigration: Remove use of old MigrationParams
Juan Quintela [Wed, 5 Apr 2017 18:45:22 +0000 (20:45 +0200)]
migration: Remove use of old MigrationParams

We have change in the previous patch to use migration capabilities for
it.  Notice that we continue using the old command line flags from
migrate command from the time being.  Remove the set_params method as
now it is empty.

For savevm, one can't do a:

savevm -b/-i foo

but now one can do:

migrate_set_capability block on
savevm foo

And we can't use block migration. We could disable block capability
unconditionally, but it would not be much better.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
---
- Maintain shared/enabled dependency (Xu suggestion)
- Now we maintain the dependency on the setter functions
- improve error messages

7 years agomigration: Create block capability
Juan Quintela [Wed, 5 Apr 2017 16:32:37 +0000 (18:32 +0200)]
migration: Create block capability

Create one capability for block migration and one parameter for
incremental block migration.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
---

- address all Markus comments
- use Markus and Eric text descriptions
- change logic another time
- improve text messages

7 years agohmp: Use visitor api for hmp_migrate_set_parameter()
Juan Quintela [Tue, 16 May 2017 09:37:45 +0000 (11:37 +0200)]
hmp: Use visitor api for hmp_migrate_set_parameter()

We only use it for int64 at this point, I am not able to find a way to
parse an int with MiB units.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
7 years agopostcopy: Require RAMBlocks that are whole pages
Dr. David Alan Gilbert [Wed, 17 May 2017 16:58:10 +0000 (17:58 +0100)]
postcopy: Require RAMBlocks that are whole pages

It turns out that it's legal to create a VM with RAMBlocks that aren't
a multiple of the pagesize in use; e.g. a 1025M main memory using
2M host pages.  That breaks postcopy's atomic placement of pages,
so disallow it.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
7 years agomigration: Fix non-multiple of page size migration
Dr. David Alan Gilbert [Wed, 17 May 2017 16:58:09 +0000 (17:58 +0100)]
migration: Fix non-multiple of page size migration

Unfortunately it's legal to create a VM with a RAM size that's
not a multiple of the underlying host page or huge page size.
Recently I'd changed things to always send host sized pages,
and that breaks if we have say a 1025MB guest on 2MB hugepages.

Unfortunately we can't just make that illegal since it would break
migration from/to existing oddly configured VMs.

Symptom: qemu-system-x86_64: Illegal RAM offset 40100000
     as it transmits the fraction of the hugepage after the end
     of the RAMBlock (may also cause a crash on the source
     - possibly due to clearing bits after the bitmap)

Reported-by: Yumei Huang <[email protected]>
Red Hat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1449037

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
7 years agoMerge remote-tracking branch 'dgilbert/tags/pull-hmp-20170517' into staging
Stefan Hajnoczi [Thu, 18 May 2017 09:16:38 +0000 (10:16 +0100)]
Merge remote-tracking branch 'dgilbert/tags/pull-hmp-20170517' into staging

HMP pull

# gpg: Signature made Wed 17 May 2017 07:03:39 PM BST
# gpg:                using RSA key 0x0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* dgilbert/tags/pull-hmp-20170517:
  ramblock: add new hmp command "info ramblock"
  utils: provide size_to_str()
  ramblock: add RAMBLOCK_FOREACH()

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'quintela/tags/migration/20170517' into staging
Stefan Hajnoczi [Thu, 18 May 2017 09:05:50 +0000 (10:05 +0100)]
Merge remote-tracking branch 'quintela/tags/migration/20170517' into staging

migration/next for 20170517

# gpg: Signature made Wed 17 May 2017 11:46:36 AM BST
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <[email protected]>"
# gpg:                 aka "Juan Quintela <[email protected]>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* quintela/tags/migration/20170517:
  migration: Move check_migratable() into qdev.c
  migration: Move postcopy stuff to postcopy-ram.c
  migration: Move page_cache.c to migration/
  migration: Create migration/blocker.h
  ram: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO
  migration: Pass Error ** argument to {save,load}_vmstate
  migration: Fix regression with compression threads

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'mst/tags/for_upstream' into staging
Stefan Hajnoczi [Thu, 18 May 2017 09:01:00 +0000 (10:01 +0100)]
Merge remote-tracking branch 'mst/tags/for_upstream' into staging

pci, virtio, vhost: fixes

A bunch of fixes that missed the release.
Most notably we are reverting shpc back to enabled by default state
as guests uses that as an indicator that hotplug is supported
(even though it's unused). Unfortunately we can't fix this
on the stable branch since that would break migration.

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

* mst/tags/for_upstream:
  exec: abstract address_space_do_translate()
  pci: deassert intx when pci device unrealize
  virtio: allow broken device to notify guest
  Revert "hw/pci: disable pci-bridge's shpc by default"
  acpi-defs: clean up open brace usage
  ACPI: don't call acpi_pcihp_device_plug_cb on xen
  iommu: Don't crash if machine is not PC_MACHINE
  pc: add 2.10 machine type
  pc/fwcfg: unbreak migration from qemu-2.5 and qemu-2.6 during firmware boot
  libvhost-user: fix crash when rings aren't ready
  hw/virtio: fix vhost user fails to startup when MQ
  hw/arm/virt: generate 64-bit addressable ACPI objects
  hw/acpi-defs: replace leading X with x_ in FADT field names

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoexec: abstract address_space_do_translate()
Peter Xu [Wed, 17 May 2017 08:57:42 +0000 (16:57 +0800)]
exec: abstract address_space_do_translate()

This function is an abstraction helper for address_space_translate() and
address_space_get_iotlb_entry(). It does the lookup of address into
memory region section, then does proper IOMMU translation if necessary.
Refactor the two existing functions to use it.

This fixes vhost when IOMMU is disabled by guest.

Tested-by: Maxime Coquelin <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agopci: deassert intx when pci device unrealize
Herongguang (Stephen) [Tue, 25 Apr 2017 02:29:54 +0000 (10:29 +0800)]
pci: deassert intx when pci device unrealize

If a pci device is not reset by VM (by writing into config space)
and unplugged by VM, after that when VM reboots, qemu may assert:
pcibus_reset: Assertion `bus->irq_count[i] == 0' failed

Cc: [email protected]
Signed-off-by: herongguang <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agovirtio: allow broken device to notify guest
Greg Kurz [Wed, 17 May 2017 08:17:51 +0000 (10:17 +0200)]
virtio: allow broken device to notify guest

According to section 2.1.2 of the virtio-1 specification:

"The device SHOULD set DEVICE_NEEDS_RESET when it enters an error state that
a reset is needed. If DRIVER_OK is set, after it sets DEVICE_NEEDS_RESET,
the device MUST send a device configuration change notification to the
driver."

Commit "f5ed36635d8f virtio: stop virtqueue processing if device is broken"
introduced a virtio_error() call that just does that:

- internally mark the device as broken
- set the DEVICE_NEEDS_RESET bit in the status
- send a configuration change notification

Unfortunately, virtio_notify_vector(), called by virtio_notify_config(),
returns right away when the device is marked as broken and the notification
isn't sent in this case.

The spec doesn't say whether a broken device can send notifications
in other situations or not. But since the driver isn't supposed to do
anything but to reset the device, it makes sense to keep the check in
virtio_notify_config().

Marking the device as broken AFTER the configuration change notification was
sent is enough to fix the issue.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
7 years agoRevert "hw/pci: disable pci-bridge's shpc by default"
Marcel Apfelbaum [Thu, 11 May 2017 10:25:29 +0000 (13:25 +0300)]
Revert "hw/pci: disable pci-bridge's shpc by default"

This reverts commit dc0ae767700c156894e36fab89a745a2dc4173de.

Disabling the shpc controller has an undesired side effect.
The PCI bridge remains with no attached devices at boot time,
and the guest operating systems do not allocate any resources
for it, leaving the bridge unusable. Note that the behaviour
is dictated by the pci bridge specification.

Revert the commit and leave the shpc controller even if is not
actually used by any architecture. Slot 0 remains unusable at boot time.

Keep shpc off for QEMU 2.9 machines.

Signed-off-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
7 years agoramblock: add new hmp command "info ramblock"
Peter Xu [Fri, 12 May 2017 04:17:41 +0000 (12:17 +0800)]
ramblock: add new hmp command "info ramblock"

To dump information about ramblocks. It looks like:

(qemu) info ramblock
              Block Name    PSize              Offset               Used              Total
            /objects/mem    2 MiB  0x0000000000000000 0x0000000080000000 0x0000000080000000
                vga.vram    4 KiB  0x0000000080060000 0x0000000001000000 0x0000000001000000
    /rom@etc/acpi/tables    4 KiB  0x00000000810b0000 0x0000000000020000 0x0000000000200000
                 pc.bios    4 KiB  0x0000000080000000 0x0000000000040000 0x0000000000040000
  0000:00:03.0/e1000.rom    4 KiB  0x0000000081070000 0x0000000000040000 0x0000000000040000
                  pc.rom    4 KiB  0x0000000080040000 0x0000000000020000 0x0000000000020000
    0000:00:02.0/vga.rom    4 KiB  0x0000000081060000 0x0000000000010000 0x0000000000010000
   /rom@etc/table-loader    4 KiB  0x00000000812b0000 0x0000000000001000 0x0000000000001000
      /rom@etc/acpi/rsdp    4 KiB  0x00000000812b1000 0x0000000000001000 0x0000000000001000

Ramblock is something hidden internally in QEMU implementation, and this
command should only be used by mostly QEMU developers on RAM stuff. It
is not a command suitable for QMP interface. So only HMP interface is
provided for it.

Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <1494562661[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agoutils: provide size_to_str()
Peter Xu [Fri, 12 May 2017 04:17:40 +0000 (12:17 +0800)]
utils: provide size_to_str()

Moving the algorithm from print_type_size() into size_to_str() so that
other component can also leverage it. With that, refactor
print_type_size().

The assert() in that logic is removed though, since even UINT64_MAX
would not overflow.

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <1494562661[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agoramblock: add RAMBLOCK_FOREACH()
Peter Xu [Fri, 12 May 2017 04:17:39 +0000 (12:17 +0800)]
ramblock: add RAMBLOCK_FOREACH()

So that it can simplifies the iterators.

Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <1494562661[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agoMerge remote-tracking branch 'ehabkost/tags/x86-and-machine-pull-request' into staging
Stefan Hajnoczi [Wed, 17 May 2017 15:34:32 +0000 (16:34 +0100)]
Merge remote-tracking branch 'ehabkost/tags/x86-and-machine-pull-request' into staging

x86 and machine queue, 2017-05-17

# gpg: Signature made Wed 17 May 2017 02:37:54 PM BST
# gpg:                using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <[email protected]>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* ehabkost/tags/x86-and-machine-pull-request: (22 commits)
  tests: Add [+-]feature and feature=on|off test cases
  s390-pcibus: No need to set user_creatable=false explicitly
  xen-sysdev: Remove user_creatable flag
  virtio-mmio: Remove user_creatable flag
  sysbus-ohci: Remove user_creatable flag
  hpet: Remove user_creatable flag
  generic-sdhci: Remove user_creatable flag
  esp: Remove user_creatable flag
  fw_cfg: Remove user_creatable flag
  unimplemented-device: Remove user_creatable flag
  isabus-bridge: Remove user_creatable flag
  allwinner-ahci: Remove user_creatable flag
  sysbus-ahci: Remove user_creatable flag
  kvmvapic: Remove user_creatable flag
  ioapic: Remove user_creatable flag
  kvmclock: Remove user_creatable flag
  pflash_cfi01: Remove user_creatable flag
  fdc: Remove user_creatable flag from sysbus-fdc & SUNW,fdtwo
  iommu: Remove FIXME comment about user_creatable=true
  xen-backend: Remove FIXME comment about user_creatable flag
  ...

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agotests: Add [+-]feature and feature=on|off test cases
Eduardo Habkost [Mon, 8 May 2017 18:32:05 +0000 (15:32 -0300)]
tests: Add [+-]feature and feature=on|off test cases

Add test code to ensure features are enabled/disabled correctly in the
command-line. The test case use the "feature-words" and
"filtered-features" properties to check if the features were
enabled/disabled correctly.

Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170508183205[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agos390-pcibus: No need to set user_creatable=false explicitly
Eduardo Habkost [Wed, 3 May 2017 20:36:04 +0000 (17:36 -0300)]
s390-pcibus: No need to set user_creatable=false explicitly

TYPE_S390_PCI_HOST_BRIDGE is a subclass of TYPE_PCI_HOST_BRIDGE,
which is a subclass of TYPE_SYS_BUS_DEVICE. TYPE_SYS_BUS_DEVICE
already sets user_creatable=false, so we don't require an
explicit user_creatable=false assignment in
s390_pcihost_class_init().

Cc: Alexander Graf <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Frank Blaschka <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Yi Min Zhao <[email protected]>
Acked-by: Cornelia Huck <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoxen-sysdev: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:36:03 +0000 (17:36 -0300)]
xen-sysdev: Remove user_creatable flag

TYPE_XENSYSDEV is only used internally by xen_be_init(), and is
not supposed to be plugged/unplugged dynamically. Remove the
user_creatable flag from the device class.

Cc: Juergen Gross <[email protected]>,
Cc: Peter Maydell <[email protected]>,
Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Cc: Markus Armbruster <[email protected]>,
Cc: Marcel Apfelbaum <[email protected]>,
Cc: Laszlo Ersek <[email protected]>
Acked-by: Juergen Gross <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agovirtio-mmio: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:36:02 +0000 (17:36 -0300)]
virtio-mmio: Remove user_creatable flag

virtio-mmio needs to be wired and mapped by other device or board
code, and won't work with -device. Remove the user_creatable flag
from the device class.

Cc: Laszlo Ersek <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Shannon Zhao <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agosysbus-ohci: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:36:01 +0000 (17:36 -0300)]
sysbus-ohci: Remove user_creatable flag

sysbus-ohci needs to be mapped and wired by device or board code,
and won't work with -device. Remove the user_creatable flag from
the device class.

Cc: Marcel Apfelbaum <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agohpet: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:36:00 +0000 (17:36 -0300)]
hpet: Remove user_creatable flag

hpet needs to be mapped and wired by the board code and won't
work with -device. Remove the user_creatable flag from the device
class.

Cc: Marcel Apfelbaum <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agogeneric-sdhci: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:59 +0000 (17:35 -0300)]
generic-sdhci: Remove user_creatable flag

generic-sdhci needs to be wired by other devices' code, so it
can't be used with -device. Remove the user_creatable flag from
the device class.

Cc: Peter Maydell <[email protected]>
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Alexander Graf <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Prasad J Pandit <[email protected]>
Cc: Alistair Francis <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoesp: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:58 +0000 (17:35 -0300)]
esp: Remove user_creatable flag

esp devices aren't going to work with -device, as they need IRQs
to be connected and mmio to be mapped (this is done by
esp_init()). Remove the user_creatable flag from the device
class.

Cc: Marcel Apfelbaum <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agofw_cfg: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:57 +0000 (17:35 -0300)]
fw_cfg: Remove user_creatable flag

fw_cfg won't work with -device, as:
* fw_cfg_init1() won't get called for the device;
* The device won't appear at /machine/fw_cfg, and won't work with
  the -fw_cfg command-line option.

Remove the user_creatable flag from the device class.

Cc: Marcel Apfelbaum <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Gabriel L. Somlo <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agounimplemented-device: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:56 +0000 (17:35 -0300)]
unimplemented-device: Remove user_creatable flag

unimplemented-device needs to be created and mapped using
create_unimplemented_device() (or equivalent code), and won't
work with -device. Remove the user_creatable flag from the device
class.

Cc: Marcel Apfelbaum <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoisabus-bridge: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:55 +0000 (17:35 -0300)]
isabus-bridge: Remove user_creatable flag

isabus-bridge needs to be created by isa_bus_new(), and won't
work with -device, as it won't create the TYPE_ISA_BUS bus
itself. Remove the user_creatable flag from the device class.

Cc: Marcel Apfelbaum <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoallwinner-ahci: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:54 +0000 (17:35 -0300)]
allwinner-ahci: Remove user_creatable flag

allwinner-ahci needs its IRQ to be connected and mmio to be
mapped (this is done by the alwinner-a10 device realize method),
and won't work with -device. Remove the user_creatable flag from
the device class.

Cc: John Snow <[email protected]>
Cc: [email protected]
Cc: Beniamino Galvani <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: [email protected]
Cc: Marcel Apfelbaum <[email protected]>
Acked-by: John Snow <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agosysbus-ahci: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:53 +0000 (17:35 -0300)]
sysbus-ahci: Remove user_creatable flag

The sysbus-ahci devices are supposed to be created and wired by
code from other devices, like calxeda_init() and
xlnx_zynqmp_realize(), and won't work with -device. Remove the
user_creatable flag from the device class.

Cc: John Snow <[email protected]>
Cc: [email protected]
Cc: Rob Herring <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Acked-by: John Snow <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agokvmvapic: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:52 +0000 (17:35 -0300)]
kvmvapic: Remove user_creatable flag

The kvmvapic device is only usable when created by
apic_common_realize(), not using -device. Remove the
user_creatable flag from the device class.

Cc: Igor Mammedov <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoioapic: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:51 +0000 (17:35 -0300)]
ioapic: Remove user_creatable flag

An ioapic device is already created by the q35 initialization
code, and using "-device ioapic" or "-device kvm-ioapic" will
always fail with "Only 1 ioapics allowed". Remove the
user_creatable flag from the ioapic device classes.

Cc: Igor Mammedov <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agokvmclock: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:50 +0000 (17:35 -0300)]
kvmclock: Remove user_creatable flag

kvmclock should be used by guests only when the appropriate CPUID
feature flags are set on the VCPU, and it is automatically
created by kvmclock_create() when those feature flags are set.
This means creating a kvmclock device using -device is useless.
Remove user_creatable from its device class.

Cc: Marcel Apfelbaum <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Thomas Huth <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agopflash_cfi01: Remove user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:49 +0000 (17:35 -0300)]
pflash_cfi01: Remove user_creatable flag

TYPE_CFI_PFLASH01 devices need to be mapped by
pflash_cfi01_register() (or equivalent) and can't be used with
-device. Remove user_creatable from the device class.

Cc: Kevin Wolf <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: [email protected]
Cc: Laszlo Ersek <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agofdc: Remove user_creatable flag from sysbus-fdc & SUNW,fdtwo
Eduardo Habkost [Wed, 3 May 2017 20:35:48 +0000 (17:35 -0300)]
fdc: Remove user_creatable flag from sysbus-fdc & SUNW,fdtwo

sysbus-fdc and SUNW,fdtwo devices need IRQs to be wired and mmio
to be mapped, and can't be used with -device. Unset
user_creatable on their device classes.

Cc: John Snow <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: [email protected]
Cc: Thomas Huth <[email protected]>
Acked-by: John Snow <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoiommu: Remove FIXME comment about user_creatable=true
Eduardo Habkost [Wed, 3 May 2017 20:35:47 +0000 (17:35 -0300)]
iommu: Remove FIXME comment about user_creatable=true

amd-iommu and intel-iommu are really meant to be used with
-device, so they need user_creatable=true. Remove the FIXME
comment.

Cc: Marcel Apfelbaum <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoxen-backend: Remove FIXME comment about user_creatable flag
Eduardo Habkost [Wed, 3 May 2017 20:35:46 +0000 (17:35 -0300)]
xen-backend: Remove FIXME comment about user_creatable flag

xen-backend can be plugged/unplugged dynamically when using the
Xen accelerator, so keep the user_creatable flag on the device
class and remove the FIXME comment.

Cc: Juergen Gross <[email protected]>,
Cc: Peter Maydell <[email protected]>,
Cc: Thomas Huth <[email protected]>
Cc: [email protected]
Cc: Markus Armbruster <[email protected]>,
Cc: Marcel Apfelbaum <[email protected]>,
Cc: Laszlo Ersek <[email protected]>
Acked-by: Juergen Gross <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agosysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE
Eduardo Habkost [Wed, 3 May 2017 20:35:45 +0000 (17:35 -0300)]
sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE

commit 33cd52b5d7b9adfd009e95f07e6c64dd88ae2a31 unset
cannot_instantiate_with_device_add_yet in TYPE_SYSBUS, making all
sysbus devices appear on "-device help" and lack the "no-user"
flag in "info qdm".

To fix this, we can set user_creatable=false by default on
TYPE_SYS_BUS_DEVICE, but this requires setting
user_creatable=true explicitly on the sysbus devices that
actually work with -device.

Fortunately today we have just a few has_dynamic_sysbus=1
machines: virt, pc-q35-*, ppce500, and spapr.

virt, ppce500, and spapr have extra checks to ensure just a few
device types can be instantiated:

* virt supports only TYPE_VFIO_CALXEDA_XGMAC, TYPE_VFIO_AMD_XGBE.
* ppce500 supports only TYPE_ETSEC_COMMON.
* spapr supports only TYPE_SPAPR_PCI_HOST_BRIDGE.

This patch sets user_creatable=true explicitly on those 4 device
classes.

Now, the more complex cases:

pc-q35-*: q35 has no sysbus device whitelist yet (which is a
separate bug). We are in the process of fixing it and building a
sysbus whitelist on q35, but in the meantime we can fix the
"-device help" and "info qdm" bugs mentioned above. Also, despite
not being strictly necessary for fixing the q35 bug, reducing the
list of user_creatable=true devices will help us be more
confident when building the q35 whitelist.

xen: We also have a hack at xen_set_dynamic_sysbus(), that sets
has_dynamic_sysbus=true at runtime when using the Xen
accelerator. This hack is only used to allow xen-backend devices
to be dynamically plugged/unplugged.

This means today we can use -device with the following 22 device
types, that are the ones compiled into the qemu-system-x86_64 and
qemu-system-i386 binaries:

* allwinner-ahci
* amd-iommu
* cfi.pflash01
* esp
* fw_cfg_io
* fw_cfg_mem
* generic-sdhci
* hpet
* intel-iommu
* ioapic
* isabus-bridge
* kvmclock
* kvm-ioapic
* kvmvapic
* SUNW,fdtwo
* sysbus-ahci
* sysbus-fdc
* sysbus-ohci
* unimplemented-device
* virtio-mmio
* xen-backend
* xen-sysdev

This patch adds user_creatable=true explicitly to those devices,
temporarily, just to keep 100% compatibility with existing
behavior of q35. Subsequent patches will remove
user_creatable=true from the devices that are really not meant to
user-creatable on any machine, and remove the FIXME comment from
the ones that are really supposed to be user-creatable. This is
being done in separate patches because we still don't have an
obvious list of devices that will be whitelisted by q35, and I
would like to get each device reviewed individually.

Cc: Alexander Graf <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Alistair Francis <[email protected]>
Cc: Beniamino Galvani <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: David Gibson <[email protected]>
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Frank Blaschka <[email protected]>
Cc: Gabriel L. Somlo <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: John Snow <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Max Reitz <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Pierre Morel <[email protected]>
Cc: Prasad J Pandit <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Richard Henderson <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Shannon Zhao <[email protected]>
Cc: [email protected]
Cc: Thomas Huth <[email protected]>
Cc: Yi Min Zhao <[email protected]>
Acked-by: John Snow <[email protected]>
Acked-by: Juergen Gross <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
[ehabkost: Small changes at sysbus_device_class_init() comments]
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoqdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable
Eduardo Habkost [Wed, 3 May 2017 20:35:44 +0000 (17:35 -0300)]
qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable

cannot_instantiate_with_device_add_yet was introduced by commit
efec3dd631d94160288392721a5f9c39e50fb2bc to replace no_user. It was
supposed to be a temporary measure.

When it was introduced, we had 54
cannot_instantiate_with_device_add_yet=true lines in the code.
Today (3 years later) this number has not shrunk: we now have
57 cannot_instantiate_with_device_add_yet=true lines. I think it
is safe to say it is not a temporary measure, and we won't see
the flag go away soon.

Instead of a long field name that misleads people to believe it
is temporary, replace it a shorter and less misleading field:
user_creatable.

Except for code comments, changes were generated using the
following Coccinelle patch:

  @@
  expression DC;
  @@
  (
  -DC->cannot_instantiate_with_device_add_yet = false;
  +DC->user_creatable = true;
  |
  -DC->cannot_instantiate_with_device_add_yet = true;
  +DC->user_creatable = false;
  )

  @@
  typedef ObjectClass;
  expression dc;
  identifier class, data;
  @@
   static void device_class_init(ObjectClass *class, void *data)
   {
   ...
   dc->hotpluggable = true;
  +dc->user_creatable = true;
   ...
   }

  @@
  @@
   struct DeviceClass {
   ...
  -bool cannot_instantiate_with_device_add_yet;
  +bool user_creatable;
   ...
  }

  @@
  expression DC;
  @@
  (
  -!DC->cannot_instantiate_with_device_add_yet
  +DC->user_creatable
  |
  -DC->cannot_instantiate_with_device_add_yet
  +!DC->user_creatable
  )

Cc: Alistair Francis <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Thomas Huth <[email protected]>
Acked-by: Alistair Francis <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Acked-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Message-Id: <20170503203604[email protected]>
[ehabkost: kept "TODO remove once we're there" comment]
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
7 years agoMerge remote-tracking branch 'sstabellini/tags/xen-20170516-tag' into staging
Stefan Hajnoczi [Wed, 17 May 2017 13:03:32 +0000 (14:03 +0100)]
Merge remote-tracking branch 'sstabellini/tags/xen-20170516-tag' into staging

Xen 2017/05/16

# gpg: Signature made Tue 16 May 2017 08:18:32 PM BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <[email protected]>"
# gpg:                 aka "Stefano Stabellini <[email protected]>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* sstabellini/tags/xen-20170516-tag:
  xen: call qemu_set_cloexec instead of fcntl
  xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
  configure: Remove -lxencall for Xen detection
  xen/mapcache: store dma information in revmapcache entries for debugging

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agoMerge remote-tracking branch 'jtc/tags/block-pull-request' into staging
Stefan Hajnoczi [Wed, 17 May 2017 12:52:02 +0000 (13:52 +0100)]
Merge remote-tracking branch 'jtc/tags/block-pull-request' into staging

# gpg: Signature made Tue 16 May 2017 04:47:09 PM BST
# gpg:                using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# gpg:                 aka "Jeffrey Cody <[email protected]>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* jtc/tags/block-pull-request:
  curl: do not do aio_poll when waiting for a free CURLState
  curl: convert readv to coroutines
  curl: convert CURLAIOCB to byte values
  curl: split curl_find_state/curl_init_state
  curl: avoid recursive locking of BDRVCURLState mutex
  curl: never invoke callbacks with s->mutex held
  curl: strengthen assertion in curl_clean_state
  block: curl: Allow passing cookies via QCryptoSecret

Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agomigration: Move check_migratable() into qdev.c
Juan Quintela [Mon, 17 Apr 2017 12:57:54 +0000 (14:57 +0200)]
migration: Move check_migratable() into qdev.c

The function is only used once, and nothing else in migration knows
about objects.  Create the function vmstate_device_is_migratable() in
savem.c that really do the bit that is related with migration.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
7 years agomigration: Move postcopy stuff to postcopy-ram.c
Juan Quintela [Mon, 24 Apr 2017 14:50:35 +0000 (16:50 +0200)]
migration: Move postcopy stuff to postcopy-ram.c

Yes, we don't have a good place to put that stuff.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
7 years agomigration: Move page_cache.c to migration/
Juan Quintela [Thu, 20 Apr 2017 10:37:23 +0000 (12:37 +0200)]
migration: Move page_cache.c to migration/

It is only used by migration, so move it there.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
7 years agomigration: Create migration/blocker.h
Juan Quintela [Thu, 6 Apr 2017 10:00:28 +0000 (12:00 +0200)]
migration: Create migration/blocker.h

This allows us to remove lots of includes of migration/migration.h

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
7 years agoram: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO
Juan Quintela [Fri, 28 Apr 2017 07:39:55 +0000 (09:39 +0200)]
ram: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO

Reflects better what it does now, and avoid confussions with
RAM_SAVE_FLAG_COMPRESS_PAGE.

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
7 years agomigration: Pass Error ** argument to {save,load}_vmstate
Juan Quintela [Tue, 18 Apr 2017 16:12:35 +0000 (18:12 +0200)]
migration: Pass Error ** argument to {save,load}_vmstate

This way we use the "normal" way of printing errors for hmp commands.

Signed-off-by: Juan Quintela <[email protected]>
Suggested-by: Paolo Bonzini <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
7 years agomigration: Fix regression with compression threads
Juan Quintela [Wed, 10 May 2017 11:28:13 +0000 (13:28 +0200)]
migration: Fix regression with compression threads

Compression threads got broken on commit

  commit 247956946651ae0280f7b1ea88bb6237dd01c231
  Author: Juan Quintela <[email protected]>
  Date:   Tue Mar 21 11:45:01 2017 +0100

      ram: reorganize last_sent_block

On do_compress_ram_page() we use a different QEMUFile than the
migration one.  We need to pass it there.  The failure can be seen as:

(qemu) qemu-system-x86_64: Unknown combination of migration flags: 0
qemu-system-x86_64: error while loading state section id 3(ram)
qemu-system-x86_64: load of migration failed: Invalid argument

Signed-off-by: Juan Quintela <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Tested-by: Peter Xu <[email protected]>
7 years agoxen: call qemu_set_cloexec instead of fcntl
Stefano Stabellini [Tue, 9 May 2017 19:04:53 +0000 (12:04 -0700)]
xen: call qemu_set_cloexec instead of fcntl

Use the common utility function, which contains checks on return values
and first calls F_GETFD as recommended by POSIX.1-2001, instead of
manually calling fcntl.

CID: 1374831

Signed-off-by: Stefano Stabellini <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: Eric Blake <[email protected]>
7 years agoxen/9pfs: fix two resource leaks on error paths, discovered by Coverity
Stefano Stabellini [Tue, 9 May 2017 19:04:51 +0000 (12:04 -0700)]
xen/9pfs: fix two resource leaks on error paths, discovered by Coverity

CID: 1374836

Signed-off-by: Stefano Stabellini <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
7 years agoconfigure: Remove -lxencall for Xen detection
Anthony PERARD [Thu, 11 May 2017 11:35:42 +0000 (12:35 +0100)]
configure: Remove -lxencall for Xen detection

QEMU does not depends on libxencall, it was added because it was a
missing link dependency of libxendevicemodel, but now the later should
be built properly.

Signed-off-by: Anthony PERARD <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
7 years agoxen/mapcache: store dma information in revmapcache entries for debugging
Stefano Stabellini [Wed, 3 May 2017 21:00:35 +0000 (14:00 -0700)]
xen/mapcache: store dma information in revmapcache entries for debugging

The Xen mapcache is able to create long term mappings, they are called
"locked" mappings. The third parameter of the xen_map_cache call
specifies if a mapping is a "locked" mapping.

>From the QEMU point of view there are two kinds of long term mappings:

[a] device memory mappings, such as option roms and video memory
[b] dma mappings, created by dma_memory_map & friends

After certain operations, ballooning a VM in particular, Xen asks QEMU
kindly to destroy all mappings. However, certainly [a] mappings are
present and cannot be removed. That's not a problem as they are not
affected by balloonning. The *real* problem is that if there are any
mappings of type [b], any outstanding dma operations could fail. This is
a known shortcoming. In other words, when Xen asks QEMU to destroy all
mappings, it is an error if any [b] mappings exist.

However today we have no way of distinguishing [a] from [b]. Because of
that, we cannot even print a decent warning.

This patch introduces a new "dma" bool field to MapCacheRev entires, to
remember if a given mapping is for dma or is a long term device memory
mapping. When xen_invalidate_map_cache is called, we print a warning if
any [b] mappings exist. We ignore [a] mappings.

Mappings created by qemu_map_ram_ptr are assumed to be [a], while
mappings created by address_space_map->qemu_ram_ptr_length are assumed
to be [b].

The goal of the patch is to make debugging and system understanding
easier.

Signed-off-by: Stefano Stabellini <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
7 years agocurl: do not do aio_poll when waiting for a free CURLState
Paolo Bonzini [Mon, 15 May 2017 10:00:59 +0000 (12:00 +0200)]
curl: do not do aio_poll when waiting for a free CURLState

Instead, put the CURLAIOCB on a wait list and yield; curl_clean_state will
wake the corresponding coroutine.

Because of CURL's callback-based structure, we cannot easily convert
everything to CoMutex/CoQueue; keeping the QemuMutex is simpler.  However,
CoQueue is a simple wrapper around a linked list, so we can easily
use QSIMPLEQ and open-code a CoQueue, protected by the BDRVCURLState
QemuMutex instead of a CoMutex.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: convert readv to coroutines
Paolo Bonzini [Mon, 15 May 2017 10:00:58 +0000 (12:00 +0200)]
curl: convert readv to coroutines

This is pretty simple.  The bottom half goes away because, unlike
bdrv_aio_readv, coroutine-based read can return immediately without
yielding.  However, for simplicity I kept the former bottom half
handler in a separate function.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: convert CURLAIOCB to byte values
Paolo Bonzini [Mon, 15 May 2017 10:00:57 +0000 (12:00 +0200)]
curl: convert CURLAIOCB to byte values

This is in preparation for the conversion from bdrv_aio_readv to
bdrv_co_preadv, and it also requires changing some of the size_t values
to uint64_t.  This was broken before for disks > 2TB, but now it would
break at 4GB.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agocurl: split curl_find_state/curl_init_state
Paolo Bonzini [Mon, 15 May 2017 10:00:56 +0000 (12:00 +0200)]
curl: split curl_find_state/curl_init_state

If curl_easy_init fails, a CURLState is left with s->in_use = 1.  Split
curl_init_state in two, so that we can distinguish the two failures and
call curl_clean_state if needed.

While at it, simplify curl_find_state, removing a dummy loop.  The
aio_poll loop is moved to the sole caller that needs it.

Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 20170515100059[email protected]
Signed-off-by: Jeff Cody <[email protected]>
7 years agoblock/win32: fix 'ret not initialized' warning
Gerd Hoffmann [Tue, 16 May 2017 07:42:55 +0000 (09:42 +0200)]
block/win32: fix 'ret not initialized' warning

Signed-off-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Stefan Weil <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Message-id: 20170516074256[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
7 years agocurl: avoid recursive locking of BDRVCURLState mutex
Paolo Bonzini [Mon, 15 May 2017 10:00:55 +0000 (12:00 +0200)]
curl: avoid recursive locking of BDRVCURLState mutex

The curl driver has a ugly hack where, if it cannot find an empty CURLState,
it just uses aio_poll to wait for one to be empty.  This is probably
buggy when used together with dataplane, and the simplest way to fix it
is to use coroutines instead.

A more immediate effect of the bug however is that it can cause a
recursive call to curl_readv_bh_cb and recursively taking the
BDRVCURLState mutex.  This causes a deadlock.

The fix is to unlock the mutex around aio_poll, but for cleanliness we
should also take the mutex around all calls to curl_init_state, even if
reaching the unlock/lock pair is impossible.  The same is true for
curl_clean_state.

Reported-by: Kun Wei <[email protected]>
Tested-by: Richard W.M. Jones <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Message-id: 20170515100059[email protected]
Cc: [email protected]
Cc: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Jeff Cody <[email protected]>
This page took 0.10281 seconds and 4 git commands to generate.