Blame SOURCES/kvm-hw-gen_pcie_root_port-make-IO-RO-0-on-IO-disabled.patch

4a2fec
From 7802df183a0b1f457c97e6f920e720f6fef36a18 Mon Sep 17 00:00:00 2001
4a2fec
From: Marcel Apfelbaum <marcel@redhat.com>
4a2fec
Date: Mon, 13 Nov 2017 19:03:30 +0100
4a2fec
Subject: [PATCH 04/30] hw/gen_pcie_root_port: make IO RO 0 on IO disabled
4a2fec
4a2fec
RH-Author: Marcel Apfelbaum <marcel@redhat.com>
4a2fec
Message-id: <20171113190330.57188-1-marcel@redhat.com>
4a2fec
Patchwork-id: 77666
4a2fec
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH] hw/gen_pcie_root_port: make IO RO 0 on IO disabled
4a2fec
Bugzilla: 1344299
4a2fec
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
4a2fec
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4a2fec
4a2fec
IO_LIMIT and IO_BASE registers should not be writable if
4a2fec
gen_pcie_root_port's io-reserve property is set to 0.
4a2fec
The COMMAND register should have the IO flag read only.
4a2fec
4a2fec
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
4a2fec
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
4a2fec
(cherry picked from commit 8e36c336d943c3bfe0d06f5465cc64d44b306e13)
4a2fec
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/pci-bridge/gen_pcie_root_port.c | 7 +++++++
4a2fec
 1 file changed, 7 insertions(+)
4a2fec
4a2fec
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
4a2fec
index ed03ffc..ad4e6aa 100644
4a2fec
--- a/hw/pci-bridge/gen_pcie_root_port.c
4a2fec
+++ b/hw/pci-bridge/gen_pcie_root_port.c
4a2fec
@@ -85,6 +85,13 @@ static void gen_rp_realize(DeviceState *dev, Error **errp)
4a2fec
         rpc->parent_class.exit(d);
4a2fec
         return;
4a2fec
     }
4a2fec
+
4a2fec
+    if (!grp->io_reserve) {
4a2fec
+        pci_word_test_and_clear_mask(d->wmask + PCI_COMMAND,
4a2fec
+                                     PCI_COMMAND_IO);
4a2fec
+        d->wmask[PCI_IO_BASE] = 0;
4a2fec
+        d->wmask[PCI_IO_LIMIT] = 0;
4a2fec
+    }
4a2fec
 }
4a2fec
 
4a2fec
 static const VMStateDescription vmstate_rp_dev = {
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec