The cell config creation tool was changed to allow writes to the PCIe
capability, while Jailhouse will in fact only do reads and fake that
writes happen. This is getting in so that Linux thinks it did OK at
pci_disable_pcie_error_reporting() (disabling AER reporting for
functions will be taken care of at hypervisor level on following
patches). That is a common function call from .remove() struct
pci_driver entries on drivers.

This is a preparation for a scheme where Jailhouse will suppress all AER
reporting on device handover.

Signed-off-by: Gustavo Lima Chaves <[email protected]>
---
 hypervisor/include/jailhouse/pci.h | 1 +
 hypervisor/pci.c                   | 9 ++++++++-
 tools/jailhouse-config-create      | 7 +++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/hypervisor/include/jailhouse/pci.h 
b/hypervisor/include/jailhouse/pci.h
index c0c10e96..720ecacd 100644
--- a/hypervisor/include/jailhouse/pci.h
+++ b/hypervisor/include/jailhouse/pci.h
@@ -37,6 +37,7 @@
 
 #define PCI_CAP_MSI            0x05
 #define PCI_CAP_MSIX           0x11
+#define PCI_CAP_EXPRESS        0x10
 
 #define PCI_IVSHMEM_NUM_MMIO_REGIONS   2
 
diff --git a/hypervisor/pci.c b/hypervisor/pci.c
index 2f95dd74..39f36f5f 100644
--- a/hypervisor/pci.c
+++ b/hypervisor/pci.c
@@ -350,7 +350,14 @@ enum pci_access pci_cfg_write_moderate(struct pci_device 
*device, u16 address,
 
                if (pci_update_msix(device, cap) < 0)
                        return PCI_ACCESS_REJECT;
-       }
+       /*
+        * Let Linux think it did OK at
+        * pci_disable_pcie_error_reporting()—this will be taken care
+        * of at hypervisor level. That is a common function call from
+        * .remove() struct pci_driver entries on drivers.
+        */
+       } else if (cap->id == PCI_CAP_EXPRESS)
+               return PCI_ACCESS_DONE;
 
        return PCI_ACCESS_PERFORM;
 }
diff --git a/tools/jailhouse-config-create b/tools/jailhouse-config-create
index 505e8050..8ede9b28 100755
--- a/tools/jailhouse-config-create
+++ b/tools/jailhouse-config-create
@@ -260,6 +260,13 @@ class PCICapability:
                 (cap_reg,) = struct.unpack('<H', f.read(2))
                 if (cap_reg & 0xf) >= 2:  # v2 capability
                     len = 60
+                # Let Linux think it did OK at
+                # pci_disable_pcie_error_reporting(): this will be
+                # taken care of at hypervisor level. That is a common
+                # function call from .remove() struct pci_driver
+                # entries on drivers. All writes to the capability
+                # will have no effect, though.
+                flags = PCICapability.RW
                 has_extended_caps = True
             elif id == 0x11:  # MSI-X
                 # access will be moderated by hypervisor
-- 
2.14.3

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to