aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel@redhat.com>2017-02-20 22:43:12 +0200
committerMichael S. Tsirkin <mst@redhat.com>2017-03-16 01:46:41 +0200
commitd584f1b9ca7452ed8d6cd80f7fccd79d667ae49b (patch)
tree7bff296599edb06fae38918ee3bfaac35ed51b10 /hw/virtio
parentc2cabb34220d63f93e4a0162a26535cbd1f30243 (diff)
downloadqemu-d584f1b9ca7452ed8d6cd80f7fccd79d667ae49b.zip
qemu-d584f1b9ca7452ed8d6cd80f7fccd79d667ae49b.tar.gz
qemu-d584f1b9ca7452ed8d6cd80f7fccd79d667ae49b.tar.bz2
hw/virtio: fix Link Control Register for PCI Express virtio devices
Make several Link Control Register flags writable to conform with the PCI Express spec. 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>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio-pci.c8
-rw-r--r--hw/virtio/virtio-pci.h4
2 files changed, 12 insertions, 0 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index f6de5ee..300aa4a 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1824,6 +1824,11 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
pcie_cap_deverr_init(pci_dev);
}
+ if (proxy->flags & VIRTIO_PCI_FLAG_INIT_LNKCTL) {
+ /* Init Link Control Register */
+ pcie_cap_lnkctl_init(pci_dev);
+ }
+
if (proxy->flags & VIRTIO_PCI_FLAG_ATS) {
pcie_ats_init(pci_dev, 256);
}
@@ -1871,6 +1876,7 @@ static void virtio_pci_reset(DeviceState *qdev)
if (pci_is_express(dev)) {
pcie_cap_deverr_reset(dev);
+ pcie_cap_lnkctl_reset(dev);
}
}
@@ -1894,6 +1900,8 @@ static Property virtio_pci_properties[] = {
VIRTIO_PCI_FLAG_ATS_BIT, false),
DEFINE_PROP_BIT("x-pcie-deverr-init", VirtIOPCIProxy, flags,
VIRTIO_PCI_FLAG_INIT_DEVERR_BIT, true),
+ DEFINE_PROP_BIT("x-pcie-lnkctl-init", VirtIOPCIProxy, flags,
+ VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 120661d..9b5dd5a 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -74,6 +74,7 @@ enum {
VIRTIO_PCI_FLAG_PAGE_PER_VQ_BIT,
VIRTIO_PCI_FLAG_ATS_BIT,
VIRTIO_PCI_FLAG_INIT_DEVERR_BIT,
+ VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT,
};
/* Need to activate work-arounds for buggy guests at vmstate load. */
@@ -104,6 +105,9 @@ enum {
/* Init error enabling flags */
#define VIRTIO_PCI_FLAG_INIT_DEVERR (1 << VIRTIO_PCI_FLAG_INIT_DEVERR_BIT)
+/* Init Link Control register */
+#define VIRTIO_PCI_FLAG_INIT_LNKCTL (1 << VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT)
+
typedef struct {
MSIMessage msg;
int virq;