]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
9 years agopci: Don't register a specialized 'config_write' if default behavior is intended
Shmulik Ladkani [Tue, 16 Jun 2015 08:24:39 +0000 (11:24 +0300)]
pci: Don't register a specialized 'config_write' if default behavior is intended

Few devices have their specialized 'config_write' methods which simply
call 'pci_default_write_config' followed by a 'msix_write_config' or
'msi_write_config' calls, using exact same arguments.

This is unnecessary as 'pci_default_write_config' already invokes
'msi_write_config' and 'msix_write_config'.

Also, since 'pci_default_write_config' is the default 'config_write'
handler, we can simply avoid the registration of these specialized
versions.

Cc: Leonid Shatz <leonid.shatz@ravellosystems.com>
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agohw/core: rebase sysbus_get_fw_dev_path() to g_strdup_printf()
Laszlo Ersek [Wed, 17 Jun 2015 12:45:03 +0000 (14:45 +0200)]
hw/core: rebase sysbus_get_fw_dev_path() to g_strdup_printf()

This is done mainly for improving readability, and in preparation for the
next patch, but Markus pointed out another bonus for the string being
returned:

"No arbitrary length limit. Before the patch, it's 39 characters, and the
code breaks catastrophically when qdev_fw_name() is longer: the second
snprintf() is called with its first argument pointing beyond path[], and
its second argument underflowing to a huge size."

Cc: qemu-stable@nongnu.org
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost_net: re-enable when cross endian
Cédric Le Goater [Wed, 17 Jun 2015 13:23:54 +0000 (15:23 +0200)]
vhost_net: re-enable when cross endian

Cross-endianness is now checked by the core vhost code.

revert 371df9f5e0f1 "vhost-net: disable when cross-endian"

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
[ added commit message, Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost-net: tell tap backend about the vnet endianness
Greg Kurz [Wed, 17 Jun 2015 13:23:49 +0000 (15:23 +0200)]
vhost-net: tell tap backend about the vnet endianness

The default behaviour for TAP/MACVTAP is to consider vnet as native endian.

This patch handles the cases when this is not true:
- virtio 1.0: always little-endian
- legacy cross-endian

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agotap: fix non-linux build
Michael S. Tsirkin [Thu, 18 Jun 2015 14:52:23 +0000 (16:52 +0200)]
tap: fix non-linux build

tap_fd_set_vnet_le/tap_fd_set_vnet_be was missing,
fix it up.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
9 years agotap: add VNET_LE/VNET_BE operations
Greg Kurz [Wed, 17 Jun 2015 13:23:44 +0000 (15:23 +0200)]
tap: add VNET_LE/VNET_BE operations

The linux tap and macvtap backends can be told to parse vnet headers
according to little or big endian. This is done through the TUNSETVNETLE
and TUNSETVNETBE ioctls.

This patch brings all the plumbing for QEMU to use these APIs.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost: set vring endianness for legacy virtio
Greg Kurz [Wed, 17 Jun 2015 13:23:39 +0000 (15:23 +0200)]
vhost: set vring endianness for legacy virtio

Legacy virtio is native endian: if the guest and host endianness differ,
we have to tell vhost so it can swap bytes where appropriate. This is
done through a vhost ring ioctl.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: introduce virtio_legacy_is_cross_endian()
Greg Kurz [Wed, 17 Jun 2015 13:23:34 +0000 (15:23 +0200)]
virtio: introduce virtio_legacy_is_cross_endian()

This helper will be used by vhost and tap to detect cross-endianness in
the legacy virtio case.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agolinux-headers: sync vhost.h
Greg Kurz [Wed, 17 Jun 2015 13:23:29 +0000 (15:23 +0200)]
linux-headers: sync vhost.h

This patch brings the cross-endian vhost API to QEMU.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost-user: part of virtio
Michael S. Tsirkin [Mon, 15 Jun 2015 14:20:21 +0000 (16:20 +0200)]
vhost-user: part of virtio

vhost user is related to virtio, add it to the relevant entry.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoi386/acpi-build: fix PXB workarounds for unsupported BIOSes
Laszlo Ersek [Thu, 11 Jun 2015 00:37:59 +0000 (02:37 +0200)]
i386/acpi-build: fix PXB workarounds for unsupported BIOSes

The patch

  apci: fix PXB behaviour if used with unsupported BIOS

uses the following condition to see if a "PXB mem/IO chunk" has *not* been
configured by the BIOS:

  (!range_base || range_base > range_limit)

When this condition evaluates to true, said patch *omits* the
corresponding entry from the _CRS.

Later on the patch checks for the opposite condition (with the intent of
*adding* entries to the _CRS if the "PXB mem/IO chunks" *have* been
configured). Unfortunately, the condition was negated incorrectly: only
the first ! operator was removed, which led to the nonsensical expression

  (range_base || range_base > range_limit)

leading to bogus entries in the _CRS, and causing BSOD in Windows Server
2012 R2 when it runs on OVMF.

The correct negative of the condition seen at the top is

  (range_base && range_base <= range_limit)

Fix the expressions.

Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-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 agoi386/acpi-build: more traditional _UID and _HID for PXB root buses
Laszlo Ersek [Thu, 11 Jun 2015 00:37:58 +0000 (02:37 +0200)]
i386/acpi-build: more traditional _UID and _HID for PXB root buses

The ACPI specification permits the _HID and _UID objects to evaluate to
strings. (See "6.1.5 _HID (Hardware ID)" and "6.1.12 _UID (Unique ID)" in
the ACPI v6.0 spec.)

With regard to related standards, the UEFI specification can also express
a device address composed from string _HID and _UID identifiers, inside
the Expanded ACPI Device Path Node. (See "9.3.3 ACPI Device Path", Table
49, in the UEFI v2.5 spec.)

However, numeric (integer) contents for both _HID and _UID are more
traditional. They are recommended by the UEFI spec for size reasons:

  [...] the ACPI Device Path node is smaller and should be used if
  possible to reduce the size of device paths that may potentially be
  stored in nonvolatile storage [...]

External tools support them better (for example the --acpi_hid and
--acpi_uid options of "efibootmgr" only take numeric identifiers).
Finally, numeric _HID and _UID contents are existing practice in the QEMU
source.

This patch was tested with a Fedora 20 LiveCD and a preexistent Windows
Server 2012 R2 guest. Using "acpidump" and "iasl" in the Fedora guest, we
get, in the SSDT:

> Scope (\_SB)
> {
>   Device (PC04)
>   {
>     Name (_UID, 0x04)  // _UID: Unique ID
>     Name (_HID, EisaId ("PNP0A03") /* PCI Bus */)  // _HID: Hardware ID

Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-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 agovhost-scsi: move qdev properties into vhost-scsi.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:36 +0000 (23:04 +0800)]
vhost-scsi: move qdev properties into vhost-scsi.c

As only one place in vhost-scsi.c uses DEFINE_VHOST_SCSI_PROPERTIES,
there is no need to expose it. Inline it into vhost-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-9p-device: move qdev properties into virtio-9p-device.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:35 +0000 (23:04 +0800)]
virtio-9p-device: move qdev properties into virtio-9p-device.c

As only one place in virtio-9p-device.c uses
DEFINE_VIRTIO_9P_PROPERTIES, there is no need to expose it. Inline it
into virtio-9p-device.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-serial-bus: move qdev properties into virtio-serial-bus.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:34 +0000 (23:04 +0800)]
virtio-serial-bus: move qdev properties into virtio-serial-bus.c

As only one place in virtio-serial-bus.c uses
DEFINE_VIRTIO_SERIAL_PROPERTIES, there is no need to expose it. Inline
it into virtio-serial-bus.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-rng: move qdev properties into virtio-rng.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:33 +0000 (23:04 +0800)]
virtio-rng: move qdev properties into virtio-rng.c

As only one place in virtio-rng.c uses DEFINE_VIRTIO_RNG_PROPERTIES,
there is no need to expose it. Inline it into virtio-rng.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-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>