qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 08/14] spapr_pci: Fold spapr_phb_vfio_eeh_config


From: David Gibson
Subject: [Qemu-devel] [RFC PATCH 08/14] spapr_pci: Fold spapr_phb_vfio_eeh_configure() into spapr_pci code
Date: Sat, 19 Sep 2015 17:18:31 +1000

Because spapr_phb_check_vfio_group() now safely returns an error on a non
VFIO papr host bridge, it becomes safe to call
spapr_phb_vfio_eeh_reenable() on any host bridge, not just the special
VFIO host bridges.  Thus the same is true of spapr_phb_vfio_reset() which
does nothing but call spapr_phb_vfio_eeh_reenable().

So, we can call spapr_phb_vfio_eeh_reenable() from the normal PAPR host
bridge reset hook, instead of overriding the hook in
spapr-pci-vfio-host-bridge to only call it there.

Signed-off-by: David Gibson <address@hidden>
---
 hw/ppc/spapr_pci.c      | 20 ++++++++++++++++++++
 hw/ppc/spapr_pci_vfio.c | 24 ------------------------
 2 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 446770c..3a1ebea 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1533,10 +1533,30 @@ static int spapr_phb_children_reset(Object *child, void 
*opaque)
     return 0;
 }
 
+static void spapr_phb_eeh_reenable(sPAPRPHBState *phb)
+{
+    VFIOGroup *group;
+    int ret;
+
+    ret = spapr_phb_check_vfio_group(phb, &group);
+    if (ret != RTAS_OUT_SUCCESS) {
+        return;
+    }
+    vfio_eeh_op(group, VFIO_EEH_PE_ENABLE);
+}
+
 static void spapr_phb_reset(DeviceState *qdev)
 {
     /* Reset the IOMMU state */
     object_child_foreach(OBJECT(qdev), spapr_phb_children_reset, NULL);
+
+    /*
+     * The PE might be in frozen state. To reenable the EEH
+     * functionality on it will clean the frozen state, which
+     * ensures that the contained PCI devices will work properly
+     * after reboot.
+     */
+    spapr_phb_eeh_reenable(SPAPR_PCI_HOST_BRIDGE(qdev));
 }
 
 static Property spapr_phb_properties[] = {
diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c
index 0c34283..b61923c 100644
--- a/hw/ppc/spapr_pci_vfio.c
+++ b/hw/ppc/spapr_pci_vfio.c
@@ -91,36 +91,12 @@ static void spapr_phb_vfio_finish_realize(sPAPRPHBState 
*sphb, Error **errp)
                                 spapr_tce_get_iommu(tcet));
 }
 
-static void spapr_phb_vfio_eeh_reenable(sPAPRPHBVFIOState *svphb)
-{
-    VFIOGroup *group;
-    int ret;
-
-    ret = spapr_phb_check_vfio_group(SPAPR_PCI_HOST_BRIDGE(svphb), &group);
-    if (ret != RTAS_OUT_SUCCESS) {
-        return;
-    }
-    vfio_eeh_op(group, VFIO_EEH_PE_ENABLE);
-}
-
-static void spapr_phb_vfio_reset(DeviceState *qdev)
-{
-    /*
-     * The PE might be in frozen state. To reenable the EEH
-     * functionality on it will clean the frozen state, which
-     * ensures that the contained PCI devices will work properly
-     * after reboot.
-     */
-    spapr_phb_vfio_eeh_reenable(SPAPR_PCI_VFIO_HOST_BRIDGE(qdev));
-}
-
 static void spapr_phb_vfio_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     sPAPRPHBClass *spc = SPAPR_PCI_HOST_BRIDGE_CLASS(klass);
 
     dc->props = spapr_phb_vfio_properties;
-    dc->reset = spapr_phb_vfio_reset;
     spc->finish_realize = spapr_phb_vfio_finish_realize;
 }
 
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]