[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC PATCH 08/14] spapr_pci: Fold spapr_phb_vfio_eeh_configur
From: |
David Gibson |
Subject: |
[Qemu-ppc] [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
- [Qemu-ppc] [RFC PATCH 03/14] spapr_pci: Expose and generalize spapr_phb_check_vfio_group(), (continued)
- [Qemu-ppc] [RFC PATCH 03/14] spapr_pci: Expose and generalize spapr_phb_check_vfio_group(), David Gibson, 2015/09/19
- [Qemu-ppc] [RFC PATCH 04/14] spapr_pci: Fold spapr_phb_vfio_eeh_configure() into spapr_pci code, David Gibson, 2015/09/19
- [Qemu-ppc] [RFC PATCH 09/14] vfio: Expose a VFIO PCI device's group for EEH, David Gibson, 2015/09/19
- [Qemu-ppc] [RFC PATCH 02/14] spapr_pci: Switch EEH to vfio_eeh_op() interface, David Gibson, 2015/09/19
- [Qemu-ppc] [RFC PATCH 14/14] vfio: Eliminate vfio_container_ioctl(), David Gibson, 2015/09/19
- [Qemu-ppc] [RFC PATCH 05/14] spapr_pci: Fold spapr_phb_vfio_eeh_reset() into spapr_pci code, David Gibson, 2015/09/19
- [Qemu-ppc] [RFC PATCH 06/14] spapr_pci: Fold spapr_phb_vfio_eeh_get_state() into spapr_pci code, David Gibson, 2015/09/19
- [Qemu-ppc] [RFC PATCH 08/14] spapr_pci: Fold spapr_phb_vfio_eeh_configure() into spapr_pci code,
David Gibson <=
- [Qemu-ppc] [RFC PATCH 11/14] spapr_pci: Allow EEH on spapr-pci-host-bridge, David Gibson, 2015/09/19
[Qemu-ppc] [RFC PATCH 10/14] spapr_pci: Track guest Partitionable Endpoints, David Gibson, 2015/09/19
[Qemu-ppc] [RFC PATCH 13/14] spapr_pci: Remove finish_realize hook, David Gibson, 2015/09/19
[Qemu-ppc] [RFC PATCH 07/14] spapr_pci: Fold spapr_phb_vfio_eeh_set_option() into spapr_pci code, David Gibson, 2015/09/19
[Qemu-ppc] [RFC PATCH 01/14] vfio: Start adding VFIO/EEH interface, David Gibson, 2015/09/19