[PATCH 6/9] powerpc/powernv: Support eeh_ops->event()
Gavin Shan
shangw at linux.vnet.ibm.com
Tue Feb 25 16:37:47 EST 2014
The patch implements the backend for eeh_ops->event() on PowerNV
platform so that we can allocate or destroy PHB diag-data buffer,
which is attached to eeh_pe::data.
Signed-off-by: Gavin Shan <shangw at linux.vnet.ibm.com>
---
arch/powerpc/platforms/powernv/eeh-powernv.c | 42 +++++++++++++++++++++++++-
arch/powerpc/platforms/pseries/eeh_pseries.c | 3 +-
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index a59788e..cfba40a 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -365,6 +365,45 @@ static int powernv_eeh_restore_config(struct device_node *dn)
return 0;
}
+static int powernv_eeh_event(int event, void *data)
+{
+ struct eeh_pe *pe = data;
+ struct pnv_phb *phb;
+ int ret = 0;
+
+ switch (event) {
+ case EEH_EVENT_PE_ALLOC:
+ if (!pe) {
+ ret = -EINVAL;
+ break;
+ } else if (pe->data) {
+ ret = -EEXIST;
+ break;
+ }
+
+ phb = pe->phb->private_data;
+ if (phb->model == PNV_PHB_MODEL_P7IOC ||
+ phb->model == PNV_PHB_MODEL_PHB3) {
+ pe->data = kzalloc(PNV_PCI_DIAG_BUF_SIZE, GFP_KERNEL);
+ if (!pe->data)
+ ret = -ENOMEM;
+ }
+
+ break;
+ case EEH_EVENT_PE_FREE:
+ if (pe->data) {
+ kfree(pe->data);
+ pe->data = NULL;
+ }
+
+ break;
+ default:
+ return 0;
+ }
+
+ return ret;
+}
+
static struct eeh_ops powernv_eeh_ops = {
.name = "powernv",
.init = powernv_eeh_init,
@@ -381,7 +420,8 @@ static struct eeh_ops powernv_eeh_ops = {
.read_config = pnv_pci_cfg_read,
.write_config = pnv_pci_cfg_write,
.next_error = powernv_eeh_next_error,
- .restore_config = powernv_eeh_restore_config
+ .restore_config = powernv_eeh_restore_config,
+ .event = powernv_eeh_event
};
/**
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 8a8f047..b9a4ddb 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -691,7 +691,8 @@ static struct eeh_ops pseries_eeh_ops = {
.read_config = pseries_eeh_read_config,
.write_config = pseries_eeh_write_config,
.next_error = NULL,
- .restore_config = NULL
+ .restore_config = NULL,
+ .event = NULL
};
/**
--
1.7.10.4
More information about the Linuxppc-dev
mailing list