aboutsummaryrefslogtreecommitdiff
path: root/hw/pci/pcie.c
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/pci/pcie.c
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/pci/pcie.c')
-rw-r--r--hw/pci/pcie.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 82a8902..18e634f 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -223,6 +223,20 @@ void pcie_cap_deverr_reset(PCIDevice *dev)
PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE);
}
+void pcie_cap_lnkctl_init(PCIDevice *dev)
+{
+ uint32_t pos = dev->exp.exp_cap;
+ pci_long_test_and_set_mask(dev->wmask + pos + PCI_EXP_LNKCTL,
+ PCI_EXP_LNKCTL_CCC | PCI_EXP_LNKCTL_ES);
+}
+
+void pcie_cap_lnkctl_reset(PCIDevice *dev)
+{
+ uint8_t *lnkctl = dev->config + dev->exp.exp_cap + PCI_EXP_LNKCTL;
+ pci_long_test_and_clear_mask(lnkctl,
+ PCI_EXP_LNKCTL_CCC | PCI_EXP_LNKCTL_ES);
+}
+
static void hotplug_event_update_event_status(PCIDevice *dev)
{
uint32_t pos = dev->exp.exp_cap;