q35: make pci window address/size match guest cfg

For Q35, MMCFG address and size are guest configurable.
Update w32 property to make it behave accordingly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
range: add Range to typedefs

will help simplify header dependencies.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
range: add min/max operations on ranges

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: add helper to retrieve the 64-bit range

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
q35: use 64 bit window programmed by guest

Detect the 64 bit window programmed by firmware
and configure properties accordingly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
piix: use 64 bit window programmed by guest

Detect the 64 bit window programmed by firmware
and configure properties accordingly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
piix4: disable io on reset

io base register at 0x40 is cleared on reset,
but io is not disabled until some other event
happens to call pm_io_space_update.

Invoke pm_io_space_update directly to make this
consistent.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
pci: remove explicit check to 64K ioport size

This check is useless, as bigger addresses will be ignored when
added to 'io' MemoryRegion, which has a size of 64K.

However, some architectures don't use the 'io' MemoryRegion, like
the alpha and versatile platforms. They create a PCI I/O region
bigger than 64K, so let them handle PCI I/O BARs in the higher range.

MST: reinstated work-around for BAR sizing.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
s390/kvm: Add check for priviledged SCLP handler

The SCLP instruction is priviledged, so we should make sure that
we generate an exception when it is called from the problem state.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/dump: zero out padding bytes in notes sections

The prstatus of an s390x dump contains several padding areas. Zero out
these bytes to make reading the notes section easier with a hexdump.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/ipl: Fix waiting for virtio processing

The guest side must not manipulate the index for the used buffers. Instead,
remember the state of the used buffer locally and wait until it has moved.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/ipl: Update the s390-ccw.img rom

Rebuild of the virtio-ccw rom containing these patches:
1. s390/ipl: Fix waiting for virtio processing

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/cpu: Make setcc() function available to other files

Moved the setcc() function to cpu.h so that it can be used by other
files, too. It now also does not modify the kvm state anymore since
this gets updated during kvm_arch_put_registers() anyway.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/ioinst: Moved the CC setting to the IO instruction handlers

The IO instruction handlers now take care of setting the CC value on
their own, so that the confusing return code magic in kvm_handle_css_inst()
is not needed anymore.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/kexec: Implement diag308 subcode 0

This patch implements subcode 0 of diag 308. This is necessary for kexec
(without kdump). The main difference to subcode 1 is that all CPUs get
a full reset, instead of the architectured CPU reset (which leaves all
registers untouched).

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/sclpconsole: modify definition of input buffer

To use VMState for migration, we need to adapt some sclp code:
   - allocate console buffer as part of the console
   - change semantic of sclpconsole offset fields

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/sclpconsole: Add code to support live migration for sclpconsole

This patch adds the necessary life migration pieces to the sclp code
by using vmstate_register.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/sclpquiesce: Add code to support live migration

This patch adds the necessary life migration pieces to sclpquiesce
by using the vmstate_register.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/sclp: add reset() functions

Add reset() functions for event-facility, sclpconsole, and sclpquiesce.
The reset() functions perform variable initialization
at IPL and e.g. when monitor system_reset is called.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
s390/eventfacility: fix multiple Read Event Data sources

Make the handler for SCLP Read Event Data deal with notifications
for multiple sources correctly.

Signed-off-by: Ralf Hoppe <rhoppe@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[split bigger patch into smaller independent chunks]
Reviewed-by: Alexander Graf <agraf@suse.de>