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

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