aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-09-04 17:22:34 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-09-04 17:22:34 +0100
commita8b5ad8e1faef0d1bb3e550530328e8ec76fe87c (patch)
tree8b975dc3f75a6e9ea184eb335a8e952ab4b7021e /hw/virtio
parent9de65783e188b6cc3816847e03602864921bf504 (diff)
parenteeb39263aa9b05b4ac3f8d8e957958071834a7b6 (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
virtio,vhost: fixes, features, cleanups. FLR support. Misc fixes, cleanups. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Wed 04 Sep 2019 12:53:35 BST # gpg: using RSA key 281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: libvhost-user: introduce and use vu_has_protocol_feature() libvhost-user: fix SLAVE_SEND_FD handling virtio-pci: Add Function Level Reset support virtio-rng: change default backend to rng-builtin virtio-rng: Keep the default backend out of VirtIORNGConf rng-builtin: add an RNG backend that uses qemu_guest_getrandom() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio-pci.c10
-rw-r--r--hw/virtio/virtio-pci.h4
-rw-r--r--hw/virtio/virtio-rng.c19
3 files changed, 22 insertions, 11 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index ffb03728f9..c6b47a9c73 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -604,6 +604,10 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
pci_default_write_config(pci_dev, address, val, len);
+ if (proxy->flags & VIRTIO_PCI_FLAG_INIT_FLR) {
+ pcie_cap_flr_write_config(pci_dev, address, val, len);
+ }
+
if (range_covers_byte(address, len, PCI_COMMAND) &&
!(pci_dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
virtio_pci_stop_ioeventfd(proxy);
@@ -1780,6 +1784,10 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
pcie_ats_init(pci_dev, 256);
}
+ if (proxy->flags & VIRTIO_PCI_FLAG_INIT_FLR) {
+ /* Set Function Level Reset capability bit */
+ pcie_cap_flr_init(pci_dev);
+ }
} else {
/*
* make future invocations of pci_is_express() return false
@@ -1847,6 +1855,8 @@ static Property virtio_pci_properties[] = {
VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true),
DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags,
VIRTIO_PCI_FLAG_INIT_PM_BIT, true),
+ DEFINE_PROP_BIT("x-pcie-flr-init", VirtIOPCIProxy, flags,
+ VIRTIO_PCI_FLAG_INIT_FLR_BIT, true),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 292275acb1..e2eaaa9182 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -44,6 +44,7 @@ enum {
VIRTIO_PCI_FLAG_INIT_DEVERR_BIT,
VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
VIRTIO_PCI_FLAG_INIT_PM_BIT,
+ VIRTIO_PCI_FLAG_INIT_FLR_BIT,
};
/* Need to activate work-arounds for buggy guests at vmstate load. */
@@ -80,6 +81,9 @@ enum {
/* Init Power Management */
#define VIRTIO_PCI_FLAG_INIT_PM (1 << VIRTIO_PCI_FLAG_INIT_PM_BIT)
+/* Init Function Level Reset capability */
+#define VIRTIO_PCI_FLAG_INIT_FLR (1 << VIRTIO_PCI_FLAG_INIT_FLR_BIT)
+
typedef struct {
MSIMessage msg;
int virq;
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index d1650e1dee..e93bed020f 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -192,27 +192,24 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
}
if (vrng->conf.rng == NULL) {
- vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));
+ Object *default_backend = object_new(TYPE_RNG_BUILTIN);
- user_creatable_complete(USER_CREATABLE(vrng->conf.default_backend),
+ user_creatable_complete(USER_CREATABLE(default_backend),
&local_err);
if (local_err) {
error_propagate(errp, local_err);
- object_unref(OBJECT(vrng->conf.default_backend));
+ object_unref(default_backend);
return;
}
- object_property_add_child(OBJECT(dev),
- "default-backend",
- OBJECT(vrng->conf.default_backend),
- NULL);
+ object_property_add_child(OBJECT(dev), "default-backend",
+ default_backend, &error_abort);
/* The child property took a reference, we can safely drop ours now */
- object_unref(OBJECT(vrng->conf.default_backend));
+ object_unref(default_backend);
- object_property_set_link(OBJECT(dev),
- OBJECT(vrng->conf.default_backend),
- "rng", NULL);
+ object_property_set_link(OBJECT(dev), default_backend,
+ "rng", &error_abort);
}
vrng->rng = vrng->conf.rng;