]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
9 years agovirtio-scsi: move qdev properties into virtio-scsi.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:32 +0000 (23:04 +0800)]
virtio-scsi: move qdev properties into virtio-scsi.c

As only one place in virtio-scsi.c uses DEFINE_VIRTIO_SCSI_PROPERTIES
and DEFINE_VIRTIO_SCSI_FEATURES, there is no need to expose them. Inline
them into virtio-scsi.c to avoid wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net.h: Remove unsed DEFINE_VIRTIO_NET_PROPERTIES
Shannon Zhao [Wed, 10 Jun 2015 15:04:31 +0000 (23:04 +0800)]
virtio-net.h: Remove unsed DEFINE_VIRTIO_NET_PROPERTIES

Remove unsed DEFINE_VIRTIO_NET_PROPERTIES in virtio-net.h and delete a
space typo.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: move qdev properties into virtio-net.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:30 +0000 (23:04 +0800)]
virtio-net: move qdev properties into virtio-net.c

As only one place in virtio-net.c uses DEFINE_VIRTIO_NET_FEATURES,
there is no need to expose it. Inline it into virtio-net.c to avoid
wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-input: emulated devices [pci]
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:42 +0000 (12:34 +0200)]
virtio-input: emulated devices [pci]

This patch adds virtio-pci support for the emulated virtio-input
devices.  Using them is as simple as adding "-device virtio-tablet-pci"
to your command line.  If you want add multiple devices but don't want
waste a pci slot for each you can compose a multifunction device this way:

qemu -device virtio-keyboard-pci,addr=0d.0,multifunction=on \
     -device virtio-tablet-pci,addr=0d.1,multifunction=on

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-input: core code & base class [pci]
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:41 +0000 (12:34 +0200)]
virtio-input: core code & base class [pci]

This patch adds the virtio-pci support bits for virtio-input-device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopci: add PCI_CLASS_INPUT_*
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:40 +0000 (12:34 +0200)]
pci: add PCI_CLASS_INPUT_*

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: fill VirtIOPCIRegions early.
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:39 +0000 (12:34 +0200)]
virtio-pci: fill VirtIOPCIRegions early.

Initialize the modern bar and the VirtIOPCIRegion fields early, in
realize.  Also add a size field to VirtIOPCIRegion and variables for
pci bars to VirtIOPCIProxy.

This allows virtio-pci subclasses to change things before the
device_plugged callback applies them.  virtio-vga will use that to
arrange regions in a way that virtio-vga is compatible to both stdvga
(in vga mode) and virtio-gpu-pci (in pci mode).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: drop identical virtio_pci_cap
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:38 +0000 (12:34 +0200)]
virtio-pci: drop identical virtio_pci_cap

Now the three struct virtio_pci_caps are identical,
lets drop two of them ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: move cap type to VirtIOPCIRegion
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:37 +0000 (12:34 +0200)]
virtio-pci: move cap type to VirtIOPCIRegion

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:36 +0000 (12:34 +0200)]
virtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map

Also fill offset and length automatically,
from VirtIOPCIRegion->offset and region size.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add virtio_pci_modern_region_map()
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:35 +0000 (12:34 +0200)]
virtio-pci: add virtio_pci_modern_region_map()

Add function to map modern virtio regions.
Add offset to VirtIOPCIRegion.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add virtio_pci_modern_regions_init()
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:34 +0000 (12:34 +0200)]
virtio-pci: add virtio_pci_modern_regions_init()

Add init function for the modern pci regions,
move over the init code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add struct VirtIOPCIRegion for virtio-1 regions
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:33 +0000 (12:34 +0200)]
virtio-pci: add struct VirtIOPCIRegion for virtio-1 regions

For now just place the MemoryRegion there,
following patches will add more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-balloon: switch to virtio_add_feature
Cornelia Huck [Thu, 4 Jun 2015 10:34:32 +0000 (12:34 +0200)]
virtio-balloon: switch to virtio_add_feature

This was missed during the conversion of feature bit manipulation.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio_balloon: header update
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:31 +0000 (12:34 +0200)]
virtio_balloon: header update

add modern header

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: correctly set host notifiers for modern bar
Jason Wang [Thu, 4 Jun 2015 10:34:30 +0000 (12:34 +0200)]
virtio-pci: correctly set host notifiers for modern bar

Currently, during host notifier set. We only add eventfd for legacy
bar, this is not correct since:

- Non-transitional device does not have legacy bar, so qemu will crash
  since proxy->bar was not initialized.
- Modern device uses modern bar and notify cap to notify the device,
  we should add eventfd for proxy->notify.

So this patch fixes the above two issues by adding eventfd based on
whether legacy or modern device were supported.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: make modern bar 64bit + prefetchable
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:29 +0000 (12:34 +0200)]
virtio-pci: make modern bar 64bit + prefetchable

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: change & document virtio pci bar layout.
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:28 +0000 (12:34 +0200)]
virtio-pci: change & document virtio pci bar layout.

This patch adds variables for the pci bars (to get rid of the magic
numbers in the code) and moves the modern virtio bar to region 4 so
regions 2+3 are kept free.  virtio-vga wants use them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: make QEMU_VIRTIO_PCI_QUEUE_MEM_MULT smaller
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:27 +0000 (12:34 +0200)]
virtio-pci: make QEMU_VIRTIO_PCI_QUEUE_MEM_MULT smaller

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add flags to enable/disable legacy/modern
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:26 +0000 (12:34 +0200)]
virtio-pci: add flags to enable/disable legacy/modern

Add VIRTIO_PCI_FLAG_DISABLE_LEGACY and VIRTIO_PCI_FLAG_DISABLE_MODERN
for VirtIOPCIProxy->flags.  Also add properties for them.  They can be
used to disable modern (virtio 1.0) or legacy (virtio 0.9) modes.

By default only legacy is advertized, modern will be turned on by
default once all remaining spec compilance issues are addressed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: switch to modern accessors for 1.0
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:25 +0000 (12:34 +0200)]
virtio-pci: switch to modern accessors for 1.0

virtio 1.0 config space is in LE format for all
devices, use modern wrappers when accessed through
the 1.0 BAR.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: add modern config accessors
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:24 +0000 (12:34 +0200)]
virtio: add modern config accessors

virtio 1.0 defines config space as LE,
as opposed to pre-1.0 which was native endian.

Add API for transports to execute word/dword accesses in
little endian format - will be useful for mmio
and pci (byte access is also wrapped, for completeness).

For simplicity, we still keep config in host native
endian format, byteswap to LE on guest access.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: generation counter support
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:23 +0000 (12:34 +0200)]
virtio: generation counter support

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: initial virtio 1.0 support
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:22 +0000 (12:34 +0200)]
virtio-pci: initial virtio 1.0 support

This is somewhat functional.  With this, and linux driver from my tree,
I was able to use virtio net as virtio 1.0 device for light browsing.

At the moment, dataplane and vhost code is
still missing.

Based on Cornelia's virtio 1.0 patchset:
    Date: Thu, 11 Dec 2014 14:25:02 +0100
    From: Cornelia Huck <cornelia.huck@de.ibm.com>
    To: virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org
Cc: rusty@rustcorp.com.au, thuth@linux.vnet.ibm.com, mst@redhat.com,
    Cornelia Huck <cornelia.huck@de.ibm.com>
    Subject: [PATCH RFC v6 00/20] qemu: towards virtio-1 host support
    Message-Id: <1418304322-7546-1-git-send-email-cornelia.huck@de.ibm.com>

which is itself still missing some core bits.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agolinux-headers: add virtio_pci
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:21 +0000 (12:34 +0200)]
linux-headers: add virtio_pci

Easier than duplicating code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost: 64 bit features
Cornelia Huck [Thu, 4 Jun 2015 10:34:20 +0000 (12:34 +0200)]
vhost: 64 bit features

Make sure that all vhost interfaces use 64 bit features, as the virtio
core does, and make sure to use ULL everywhere possible to be on the
safe side.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost_net: add version_1 feature
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:19 +0000 (12:34 +0200)]
vhost_net: add version_1 feature

Add VERSION_1 to list of features that we should
test at the backend.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: enable virtio 1.0
Cornelia Huck [Thu, 4 Jun 2015 10:34:18 +0000 (12:34 +0200)]
virtio-net: enable virtio 1.0

virtio-net (non-vhost) now should have everything in place to support
virtio 1.0: let's enable the feature bit for it.

Note that VIRTIO_F_VERSION_1 is technically a transport feature; once
every device is ready for virtio 1.0, we can move setting this
feature bit out of the individual devices.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: support longer header
Cornelia Huck [Thu, 4 Jun 2015 10:34:17 +0000 (12:34 +0200)]
virtio-net: support longer header

virtio-1 devices always use num_buffers in the header, even if
mergeable rx buffers have not been negotiated.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: no writeable mac for virtio-1
Cornelia Huck [Thu, 4 Jun 2015 10:34:16 +0000 (12:34 +0200)]
virtio-net: no writeable mac for virtio-1

Devices operating as virtio 1.0 may not allow writes to the mac
address in config space.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: allow to fail setting status
Cornelia Huck [Thu, 4 Jun 2015 10:34:15 +0000 (12:34 +0200)]
virtio: allow to fail setting status

virtio-1 allow setting of the FEATURES_OK status bit to fail if
the negotiated feature bits are inconsistent: let's fail
virtio_set_status() in that case and update virtio-ccw to post an
error to the guest.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: disallow late feature changes for virtio-1
Cornelia Huck [Thu, 4 Jun 2015 10:34:14 +0000 (12:34 +0200)]
virtio: disallow late feature changes for virtio-1

For virtio-1 devices, the driver must not attempt to set feature bits
after it set FEATURES_OK in the device status. Simply reject it in
that case.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agodataplane: allow virtio-1 devices
Cornelia Huck [Thu, 4 Jun 2015 10:34:13 +0000 (12:34 +0200)]
dataplane: allow virtio-1 devices

Handle endianness conversion for virtio-1 virtqueues correctly.

Note that dataplane now needs to be built per-target.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: allow virtio-1 queue layout
Cornelia Huck [Thu, 4 Jun 2015 10:34:12 +0000 (12:34 +0200)]
virtio: allow virtio-1 queue layout

For virtio-1 devices, we allow a more complex queue layout that doesn't
require descriptor table and rings on a physically-contigous memory area:
add virtio_queue_set_rings() to allow transports to set this up.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: endianness checks for virtio 1.0 devices
Cornelia Huck [Thu, 4 Jun 2015 10:34:11 +0000 (12:34 +0200)]
virtio: endianness checks for virtio 1.0 devices

Add code that checks for the VERSION_1 feature bit in order to make
decisions about the device's endianness. This allows us to support
transitional devices.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost: put log correctly in vhost_dev_start()
Jason Wang [Fri, 5 Jun 2015 03:05:58 +0000 (23:05 -0400)]
vhost: put log correctly in vhost_dev_start()

We allocate an dummy log even if the size is zero. So we should put it
unconditionally too.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost: logs sharing
Jason Wang [Thu, 4 Jun 2015 09:28:46 +0000 (05:28 -0400)]
vhost: logs sharing

Currently we allocate one vhost log per vhost device. This is sub
optimal when:

- Guest has several device with vhost as backend
- Guest has multiqueue devices

In the above cases, we can avoid the memory allocation by sharing a
single vhost log among all the vhost devices. This is done through:

- Introducing a new vhost_log structure with refcnt inside.
- Using a global pointer to vhost_log structure that will be used. And
  introduce helper to get the log with expected log size and helper to
- drop the refcnt to the old log.
- Each vhost device still keep track of a pointer to the log that was
  used.

With above, if no resize happens, all vhost device will share a single
vhost log. During resize, a new vhost_log structure will be allocated
and made for the global pointer. And each vhost devices will drop the
refcnt to the old log.

Tested by doing scp during migration for a 2 queues virtio-net-pci.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/acpi: piix4_pm_init(): take fw_cfg object no more
Laszlo Ersek [Wed, 29 Apr 2015 13:20:16 +0000 (15:20 +0200)]
hw/acpi: piix4_pm_init(): take fw_cfg object no more

This PIIX4 init function has no more reason to receive a pointer to the
FwCfg object. Remove the parameter from the prototype, and update callers.

As a result, the pc_init1() function no longer needs to save the return
value of pc_memory_init() and xen_load_linux(), which makes it more
similar to pc_q35_init().

The return type & value of pc_memory_init() and xen_load_linux() are not
changed themselves; maybe we'll need their return values sometime later.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1204696
Cc: Amit Shah <amit.shah@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/acpi: move "etc/system-states" fw_cfg file from PIIX4 to core
Laszlo Ersek [Wed, 29 Apr 2015 13:20:15 +0000 (15:20 +0200)]
hw/acpi: move "etc/system-states" fw_cfg file from PIIX4 to core

The acpi_pm1_cnt_init() core function is responsible for setting up the
register block that will ultimately react to S3 and S4 requests (see
acpi_pm1_cnt_write()). It makes sense to advertise this configuration to
the guest firmware via an easy to parse fw_cfg file (ACPI is too complex
for firmware to parse), and indeed PIIX4 does that. However, since
acpi_pm1_cnt_init() is not specific to PIIX4, neither should be the fw_cfg
file.

This patch makes "etc/system-states" appear on all chipsets modified in
the previous patch, not just PIIX4 (assuming they have fw_cfg at all).

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1204696
Cc: Amit Shah <amit.shah@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/acpi: acpi_pm1_cnt_init(): take "disable_s3" and "disable_s4"
Laszlo Ersek [Wed, 29 Apr 2015 13:20:14 +0000 (15:20 +0200)]
hw/acpi: acpi_pm1_cnt_init(): take "disable_s3" and "disable_s4"

This patch only modifies the function prototype and updates all chipset
code that calls acpi_pm1_cnt_init() to pass in their own disable_s3 and
disable_s4 settings. vt82c686 is assumed to be fixed "S3 and S4 enabled".

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1204696
Cc: Amit Shah <amit.shah@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9 years agopc-dimm: don't assert if pc-dimm alignment != hotpluggable mem range size
Igor Mammedov [Wed, 3 Jun 2015 15:10:43 +0000 (17:10 +0200)]
pc-dimm: don't assert if pc-dimm alignment != hotpluggable mem range size

Drop superfluous pc-dimm alignment on hot-pluggable mem
range size assert, since it causes QEMU crash during hotplug
when hotplugging pc-dimm with alignment bigger than
an alignment of hot-pluggable mem range size.

Instead allow pc_dimm_get_free_addr() find free address
and bail out gracefully later in that function during
checking if pc-dimm will fit in hot-pluggable mem range.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agodocs: Add PXB documentation
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:12 +0000 (14:23 +0300)]
docs: Add PXB documentation

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agoapci: fix PXB behaviour if used with unsupported BIOS
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:11 +0000 (14:23 +0300)]
apci: fix PXB behaviour if used with unsupported BIOS

PXB does not work with unsupported bioses, but should
not interfere with normal OS operation.
We don't ship them anymore, but it's reasonable
to keep the work-around until we update the bios in qemu.

Fix this by not adding PXB mem/IO chunks to _CRS
if they weren't configured by BIOS.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pxb: add numa_node parameter
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:10 +0000 (14:23 +0300)]
hw/pxb: add numa_node parameter

The pxb can be attach to and existing numa node by specifying
numa_node option that equals the desired numa nodeid.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pci: add support for NUMA nodes
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:09 +0000 (14:23 +0300)]
hw/pci: add support for NUMA nodes

PCI root buses can be attached to a specific NUMA node.
PCI buses are not attached by default to a NUMA node.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pxb: add map_irq func
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:08 +0000 (14:23 +0300)]
hw/pxb: add map_irq func

The bios does not index the pxb slot number when
it computes the IRQ because it resides on bus 0
and not on the current bus.
However Qemu routes the irq through bus 0 and adds
the pxb slot to the IRQ computation of the PXB device.

Synchronize between bios and Qemu by canceling
pxb's effect.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pci: inform bios if the system has extra pci root buses
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:07 +0000 (14:23 +0300)]
hw/pci: inform bios if the system has extra pci root buses

The bios looks for 'etc/extra-pci-roots' to decide if
is going to scan further buses after bus 0 tree.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pci: introduce PCI Expander Bridge (PXB)
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:06 +0000 (14:23 +0300)]
hw/pci: introduce PCI Expander Bridge (PXB)

PXB is a "light-weight" host bridge whose purpose is to enable
the main host bridge to support multiple PCI root buses
for pc machines.

As oposed to PCI-2-PCI bridge's secondary bus, PXB's bus
is a primary bus and can be associated with a NUMA node
(different from the main host bridge) allowing the guest OS
to recognize the proximity of a pass-through device to
other resources as RAM and CPUs.

The PXB is composed from:
 - A primary PCI bus (can be associated with a NUMA node)
   Acts like a normal pci bus and from the functionality point
   of view is an "expansion" of the bus behind the
   main host bridge.
 - A pci-2-pci bridge behind the primary PCI bus where the actual
   devices will be attached.
 - A host-bridge PCI device
   Situated on the bus behind the main host bridge, allows
   the BIOS to configure the bus number and IO/mem resources.
   It does not have its own config/data register for configuration
   cycles, this being handled by the main host bridge.
-  A host-bridge sysbus to comply with QEMU current design.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pci: removed 'rootbus nr is 0' assumption from qmp_pci_query
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:05 +0000 (14:23 +0300)]
hw/pci: removed 'rootbus nr is 0' assumption from qmp_pci_query

Use the newer pci_bus_num to correctly get the root bus number.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/acpi: remove from root bus 0 the crs resources used by other buses.
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:04 +0000 (14:23 +0300)]
hw/acpi: remove from root bus 0 the crs resources used by other buses.

If multiple root buses are used, root bus 0 cannot use all the
pci holes ranges. Remove the IO/mem ranges used by the other
primary buses.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/acpi: add _CRS method for extra root busses
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:03 +0000 (14:23 +0300)]
hw/acpi: add _CRS method for extra root busses

Save the IO/mem/bus numbers ranges assigned to the extra root busses
to be removed from the root bus 0 range.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/apci: add _PRT method for extra PCI root busses
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:02 +0000 (14:23 +0300)]
hw/apci: add _PRT method for extra PCI root busses

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/acpi: add support for i440fx 'snooping' root busses
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:01 +0000 (14:23 +0300)]
hw/acpi: add support for i440fx 'snooping' root busses

If the machine has extra root busses that are snooping to
the i440fx host bridge, we need to add them to
acpi in order to be properly detected by guests.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pci: extend PCI config access to support devices behind PXB
Marcel Apfelbaum [Tue, 2 Jun 2015 11:23:00 +0000 (14:23 +0300)]
hw/pci: extend PCI config access to support devices behind PXB

PXB buses are assumed to be children of bus 0. Look for them
while scanning the buses.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/i386: query only for q35/pc when looking for pci host bridge
Marcel Apfelbaum [Tue, 2 Jun 2015 11:22:59 +0000 (14:22 +0300)]
hw/i386: query only for q35/pc when looking for pci host bridge

Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE anymore.
On i386 arch we only have two pci hosts, so we can look only for them.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pci: made pci_bus_num a PCIBusClass method
Marcel Apfelbaum [Tue, 2 Jun 2015 11:22:58 +0000 (14:22 +0300)]
hw/pci: made pci_bus_num a PCIBusClass method

Refactoring it as a method of PCIBusClass will allow
different implementations for subclasses.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agohw/pci: made pci_bus_is_root a PCIBusClass method
Marcel Apfelbaum [Tue, 2 Jun 2015 11:22:57 +0000 (14:22 +0300)]
hw/pci: made pci_bus_is_root a PCIBusClass method

Refactoring it as a method of PCIBusClass will allow
different implementations for subclasses.

Removed the assumption that the root bus does not
have a parent device because is specific only
to the default class implementation.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agoacpi: add implementation of aml_while() term
Marcel Apfelbaum [Tue, 2 Jun 2015 11:22:56 +0000 (14:22 +0300)]
acpi: add implementation of aml_while() term

Commit 68e6b0af7 (acpi: add aml_while() term) added
the definition of aml_while without the actual implementation.
Implement the term.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
9 years agoacpi: add acpi_send_gpe_event() to rise sci for hotplug
Zhu Guihua [Wed, 13 May 2015 09:21:36 +0000 (17:21 +0800)]
acpi: add acpi_send_gpe_event() to rise sci for hotplug

Add a new API named acpi_send_gpe_event() to send hotplug SCI.
This API can be used by pci, cpu and memory hotplug.

This patch is rebased on master.

Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9 years agovirtio: 64bit features fixups.
Gerd Hoffmann [Wed, 3 Jun 2015 12:47:19 +0000 (14:47 +0200)]
virtio: 64bit features fixups.

Commit "019a3ed virtio: make features 64bit wide" missed a few changes,
as I've noticed while trying to rebase the virtio-1 branch to latest
master.  This patch adds them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoTPM: fix build with tpm disabled
Juan Quintela [Tue, 2 Jun 2015 13:47:20 +0000 (15:47 +0200)]
TPM: fix build with tpm disabled

Failure was included on commit

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: don't try to mask or unmask vqs without notifiers
Jason Wang [Wed, 27 May 2015 08:26:07 +0000 (16:26 +0800)]
virtio-pci: don't try to mask or unmask vqs without notifiers

We should validate the vq index against nvqs_with_notifiers. Otherwise we may
try to mask or unmask vector for vqs without notifiers (e.g control vq). This
will lead qemu abort on kvm_irqchip_commit_routes() when trying to boot win8.1
guest.

Fixes 851c2a75a6e80c8aa5e713864d98cfb512e7229b ("virtio-pci: speedup MSI-X
masking and unmasking")

Reported-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/q35: fix floppy controller definition in ich9
Marcel Apfelbaum [Mon, 1 Jun 2015 14:09:12 +0000 (17:09 +0300)]
hw/q35: fix floppy controller definition in ich9

In DSDT FDC0 declares the IO region as IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04).
Use the same in lpc_ich9 initialization code.
Now the floppy drive is detected correctly on Windows.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add missing ssdt
Michael S. Tsirkin [Mon, 1 Jun 2015 19:03:59 +0000 (21:03 +0200)]
acpi: add missing ssdt

commit 5cb18b3d7bff2a83275ee98af2a14eb9e21c93ab
    TPM2 ACPI table support

was missing a file, so build with iasl fails
(build without iasl works since it uses the generated
 hex files).

Reported-by: "Daniel P. Berrange" <berrange@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Mon, 1 Jun 2015 14:22:46 +0000 (15:22 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc, pci, tpm, virtio, vhost enhancements and fixes

A bunch of cleanups and fixes all over the place,
enhancements in TPM, virtio and vhost.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon Jun  1 13:19:48 2015 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (60 commits)
  vhost-user: add multi queue support
  virtio: make features 64bit wide
  qdev: add 64bit properties
  virtio-mmio: ioeventfd support
  hw/acpi/aml-build: Fix memory leak
  acpi: add aml_while() term
  acpi: add aml_increment() term
  acpi: add aml_shiftright() term
  acpi: add aml_shiftleft() term
  acpi: add aml_index() term
  acpi: add aml_lless() term
  acpi: add aml_add() term
  TPM2 ACPI table support
  tpm: Probe for connected TPM 1.2 or TPM 2
  Extend TPM TIS interface to support TPM 2
  Add stream ID to MSI write
  acpi: Simplify printing to dynamic string
  i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted
  i386/pc_q35: don't insist on board FDC if there's no default floppy
  i386/pc: '-drive if=floppy' should imply a board-default FDC
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agovhost-user: add multi queue support
Ouyang Changchun [Thu, 28 May 2015 01:23:06 +0000 (09:23 +0800)]
vhost-user: add multi queue support

Based on patch by Nikolay Nikolaev:
Vhost-user will implement the multi queue support in a similar way
to what vhost already has - a separate thread for each queue.
To enable the multi queue functionality - a new command line parameter
"queues" is introduced for the vhost-user netdev.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: make features 64bit wide
Gerd Hoffmann [Mon, 1 Jun 2015 08:45:40 +0000 (10:45 +0200)]
virtio: make features 64bit wide

Make features 64bit wide everywhere.

On migration a full 64bit guest_features field is sent if one of the
high bits is set, in addition to the lower 32bit guest_features field
which must stay for compatibility reasons.  That way we send the lower
32 feature bits twice, but the code is simpler because we don't have
to split and compose the 64bit features into two 32bit fields.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoqdev: add 64bit properties
Gerd Hoffmann [Mon, 1 Jun 2015 08:45:39 +0000 (10:45 +0200)]
qdev: add 64bit properties

Needed for virtio features which go from 32bit to 64bit with virtio 1.0

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-mmio: ioeventfd support
Ying-Shiuan Pan [Tue, 12 May 2015 08:10:50 +0000 (11:10 +0300)]
virtio-mmio: ioeventfd support

set_host_notifier and set_guest_notifiers supported by virtio-mmio now.
Most code copied from virtio-pci.

This makes it possible to use vhost-net with virtio-mmio,
improving performance by about 30%.

The kvm-arm does not yet support irqfd, need to fix the hard-coded part after
kvm-arm gets irqfd support.

Signed-off-by: Ying-Shiuan Pan <yingshiuan.pan@gmail.com>
Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/acpi/aml-build: Fix memory leak
Shannon Zhao [Mon, 25 May 2015 07:14:37 +0000 (15:14 +0800)]
hw/acpi/aml-build: Fix memory leak

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9 years agoacpi: add aml_while() term
Marcel Apfelbaum [Mon, 25 May 2015 15:33:46 +0000 (18:33 +0300)]
acpi: add aml_while() term

Add encoding for ACPI DefWhile Opcode.

Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_increment() term
Marcel Apfelbaum [Mon, 25 May 2015 15:33:45 +0000 (18:33 +0300)]
acpi: add aml_increment() term

Add encoding for ACPI DefIncrement Opcode.

Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_shiftright() term
Marcel Apfelbaum [Mon, 25 May 2015 15:33:44 +0000 (18:33 +0300)]
acpi: add aml_shiftright() term

Add encoding for ACPI DefShiftRight Opcode.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
9 years agoacpi: add aml_shiftleft() term
Marcel Apfelbaum [Mon, 25 May 2015 15:33:43 +0000 (18:33 +0300)]
acpi: add aml_shiftleft() term

Add encoding for ACPI DefShiftLeft Opcode.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
9 years agoacpi: add aml_index() term
Marcel Apfelbaum [Mon, 25 May 2015 15:33:42 +0000 (18:33 +0300)]
acpi: add aml_index() term

Add encoding for ACPI DefIndex Opcode.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
9 years agoacpi: add aml_lless() term
Marcel Apfelbaum [Mon, 25 May 2015 15:33:41 +0000 (18:33 +0300)]
acpi: add aml_lless() term

Add encoding for ACPI DefLLess Opcode.

Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: add aml_add() term
Marcel Apfelbaum [Mon, 25 May 2015 15:33:40 +0000 (18:33 +0300)]
acpi: add aml_add() term

Add encoding for ACPI DefAdd Opcode.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
9 years agoTPM2 ACPI table support
Stefan Berger [Tue, 26 May 2015 20:51:07 +0000 (16:51 -0400)]
TPM2 ACPI table support

Add a TPM2 ACPI table if a TPM 2 is used in the backend.
Also add an SSDT for the TPM 2.

Rename tpm_find() to tpm_get_version() and have this function
return the version of the TPM found, TPMVersion_Unspec if
no TPM is found. Use the version number to build version
specific ACPI tables.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150530' into...
Peter Maydell [Mon, 1 Jun 2015 10:29:37 +0000 (11:29 +0100)]
Merge remote-tracking branch 'remotes/bkoppelmann/tags/pull-tricore-20150530' into staging

TriCore bugfixes

# gpg: Signature made Sat May 30 15:50:49 2015 BST using RSA key ID 6B69CA14
# gpg: Good signature from "Bastian Koppelmann <kbastian@mail.uni-paderborn.de>"

* remotes/bkoppelmann/tags/pull-tricore-20150530:
  target-tricore: fix BOL_ST_H_LONGOFF using ld
  target-tricore: fix msub32_q producing the wrong overflow bit
  target-tricore: fix OPC2_32_RR_DVINIT_HU having write before use on the result

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotpm: Probe for connected TPM 1.2 or TPM 2
Stefan Berger [Tue, 26 May 2015 20:51:06 +0000 (16:51 -0400)]
tpm: Probe for connected TPM 1.2 or TPM 2

In the TPM passthrough backend driver, modify the probing code so
that we can check whether a TPM 1.2 or TPM 2 is being used
and adapt the behavior of the TPM TIS accordingly.

Move the code that tested for a TPM 1.2 into tpm_utils.c
and extend it with test for probing for TPM 2. Have the
function return the version of TPM found.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoExtend TPM TIS interface to support TPM 2
Stefan Berger [Tue, 26 May 2015 20:51:05 +0000 (16:51 -0400)]
Extend TPM TIS interface to support TPM 2

Following the recent upgrade to version 1.3, extend the TPM TIS
interface with capabilities introduced for support of a TPM 2.

TPM TIS for TPM 2 introduced the following extensions beyond the
TPM TIS 1.3 (used for TPM 1.2):

- A new 32bit interface Id register was introduced.
- New flags for the status (STS) register were defined.
- New flags for the capability flags were defined.

Support the above if a TPM TIS 1.3 for TPM 2 is used with a TPM 2
on the backend side. Support the old TPM TIS 1.3 configuration if a
TPM 1.2 is being used. A subsequent patch will then determine which
TPM version is being used in the backend.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoAdd stream ID to MSI write
Pavel Fedin [Wed, 27 May 2015 12:59:59 +0000 (15:59 +0300)]
Add stream ID to MSI write

GICv3 ITS distinguishes between devices by using hardwired device IDs passed on the bus.
This patch implements passing these IDs in qemu.
SMMU is also known to use stream IDs, therefore this addition can also be useful for
implementing platforms with SMMU.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
 Changes from v1:
- Added bus number to the stream ID
- Added stream ID not only to MSI-X, but also to plain MSI. Some common code was made into
msi_send_message() function.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoacpi: Simplify printing to dynamic string
Markus Armbruster [Wed, 27 May 2015 17:55:55 +0000 (19:55 +0200)]
acpi: Simplify printing to dynamic string

build_append_namestringv() and aml_string() first calculate the
resulting string's length with vsnprintf(NULL, ...), then allocate,
then print for real.  Simply use g_strdup_vprintf() or g_vasprintf()
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9 years agoi386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted
Laszlo Ersek [Thu, 28 May 2015 20:04:11 +0000 (22:04 +0200)]
i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted

It is Very annoying to carry forward an outdatEd coNtroller with a mOdern
Machine type.

Hence, let us not instantiate the FDC when all of the following apply:
- the machine type is pc-q35-2.4 or later,
- "-device isa-fdc" is not passed on the command line (nor in the config
  file),
- no "-drive if=floppy,..." is requested.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9 years agoi386/pc_q35: don't insist on board FDC if there's no default floppy
Laszlo Ersek [Thu, 28 May 2015 20:04:10 +0000 (22:04 +0200)]
i386/pc_q35: don't insist on board FDC if there's no default floppy

The "no_floppy = 1" machine class setting causes "default_floppy" in
main() to become zero. Consequently, default_drive() will not call
drive_add() and drive_new() for IF_FLOPPY, index=0, meaning that no
default floppy drive will be created for the virtual machine. In that
case, board code should also not insist on the creation of the
board-default FDC.

The board-default FDC will still be created if the user requests a floppy
drive with "-drive if=floppy".

Additionally, separate FDCs can be specified manually with "-device
isa-fdc". They allow the

  -device isa-fdc,driveA=...

syntax that is more flexible than the one required by the board-default
FDC:

  -global isa-fdc.driveA=...

This patch doesn't change the behavior observably, as all Q35 machine
types have "no_floppy = 0".

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9 years agoi386/pc: '-drive if=floppy' should imply a board-default FDC
Laszlo Ersek [Thu, 28 May 2015 20:04:09 +0000 (22:04 +0200)]
i386/pc: '-drive if=floppy' should imply a board-default FDC

Even if board code decides not to request the creation of the FDC (keyed
off board-level factors, to be determined later), we should create the FDC
nevertheless if the user passes '-drive if=floppy' on the command line.

Otherwise '-drive if=floppy' would break without explicit '-device
isa-fdc' on such boards.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9 years agoi386/pc: pc_basic_device_init(): delegate FDC creation request
Laszlo Ersek [Thu, 28 May 2015 20:04:08 +0000 (22:04 +0200)]
i386/pc: pc_basic_device_init(): delegate FDC creation request

This patch introduces no observable change, but it allows the callers of
pc_basic_device_init(), ie. pc_init1() and pc_q35_init(), to request (or
not request) the creation of the FDC explicitly.

At the moment both callers pass constant create_fdctrl=true (hence no
observable change).

Assuming a board passes create_fdctrl=false, "floppy" will be NULL on
output, and (beyond the FDC not being created) that NULL will be passed on
to pc_cmos_init(). Luckily, pc_cmos_init() already handles that case.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9 years agovirtio: increase the queue limit to 1024
Jason Wang [Fri, 29 May 2015 06:15:32 +0000 (14:15 +0800)]
virtio: increase the queue limit to 1024

Increase the queue limit to 1024. But virtio-ccw and s390-virtio won't
support this, this is done through failing device_plugged() for those
two transports if the number of virtqueues is greater than 64.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAX
Jason Wang [Fri, 29 May 2015 06:15:31 +0000 (14:15 +0800)]
virtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAX

VIRTIO_PCI_QUEUE_MAX is not only used for pci, so rename it be generic.

Cc: Amit Shah <amit.shah@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-s390: introduce virtio_s390_device_plugged()
Jason Wang [Fri, 29 May 2015 06:15:30 +0000 (14:15 +0800)]
virtio-s390: introduce virtio_s390_device_plugged()

This patch introduce a virtio-s390 specific device_plugged() function
and doing the number of virtqueue validation inside.

Cc: Alexander Graf <agraf@suse.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-s390: introduce virito s390 queue limit
Jason Wang [Fri, 29 May 2015 06:15:29 +0000 (14:15 +0800)]
virtio-s390: introduce virito s390 queue limit

Cc: Alexander Graf <agraf@suse.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-ccw: validate the number of queues against bus limitation
Jason Wang [Fri, 29 May 2015 06:15:28 +0000 (14:15 +0800)]
virtio-ccw: validate the number of queues against bus limitation

Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-ccw: introduce ccw specific queue limit
Jason Wang [Fri, 29 May 2015 06:15:27 +0000 (14:15 +0800)]
virtio-ccw: introduce ccw specific queue limit

Cc: Alexander Graf <agraf@suse.de>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: introduce virtio_get_num_queues()
Jason Wang [Fri, 29 May 2015 06:15:26 +0000 (14:15 +0800)]
virtio: introduce virtio_get_num_queues()

This patch introduces virtio_get_num_queues() which iterates the vqs
array and return the number of virtqueues used by device.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: device_plugged() can fail
Jason Wang [Fri, 29 May 2015 06:15:25 +0000 (14:15 +0800)]
virtio: device_plugged() can fail

This patch passes error pointer to transport specific device_plugged()
callback. Through this way, device_plugged() can do some transport
specific check and fail. This will be uesd by following patches that
check the number of virtqueues against the transport limitation.

Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: adding all queues in .realize()
Jason Wang [Fri, 29 May 2015 06:15:24 +0000 (14:15 +0800)]
virtio-net: adding all queues in .realize()

Instead of adding queues for multiqueue during feature set. This patch
did this in .realize(), this will help the following patches that
count the number of virtqueues used in .device_plugged() callback.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core
Cornelia Huck [Fri, 29 May 2015 09:29:40 +0000 (11:29 +0200)]
virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core

Nearly all transports have been offering VIRTIO_F_NOTIFY_ON_EMPTY,
s390-virtio being the exception. There's no reason why it shouldn't
offer it as well, though (handling is done in core anyway), so let's
move it to the common virtio features.

While we're changing it anyway, fix the indentation for the
DEFINE_VIRTIO_COMMON_FEATURES macro.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE
Cornelia Huck [Fri, 29 May 2015 09:29:39 +0000 (11:29 +0200)]
virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE

This was copied from virtio-pci, but it doesn't make much sense for
ccw, as it doesn't have to handle the broken implementations this bit
is supposed to deal with. Remove it.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: move host_features
Cornelia Huck [Tue, 26 May 2015 14:34:47 +0000 (16:34 +0200)]
virtio: move host_features

Move host_features from the individual transport proxies into
the virtio device. Transports may continue to add feature bits
during device plugging.

This should it make easier to offer different sets of host features
for virtio-1/transitional support.

Tested-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopc: acpi: fix pvpanic for buggy guests
Radim Krčmář [Fri, 29 May 2015 19:57:32 +0000 (21:57 +0200)]
pc: acpi: fix pvpanic for buggy guests

In the old times, we always had pvpanic in ACPI and a _STA method told
the guest not to use it.  Automatic generation dropped the _STA method
as the specification says that missing _STA means enabled and working.
Some guests (Linux) had buggy drivers and this change made them unable
to utilize pvpanic.

A Linux patch is posted as well, but I think it's worth to make pvpanic
useable on old guests at the price of three lines and few bytes of SSDT.

The old _STA method was
  Method (_STA, 0, NotSerialized) {
      Store (PEST, Local0)
      If (LEqual (Local0, Zero)) {
          Return (Zero) }
      Else {
          Return (0x0F) }}

Igor pointed out that we don't need to use a method to return a constant
and that 0xB (don't show in UI) is the common definition now.

Also, the device used to be PEVT.  (PEVT as in "panic event"?)

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>