From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: linuxppc-dev@ozlabs.org
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Subject: [PATCH 6/9] powerpc/powernv: Support eeh_ops->event()
Date: Tue, 25 Feb 2014 13:37:47 +0800 [thread overview]
Message-ID: <1393306670-17435-7-git-send-email-shangw@linux.vnet.ibm.com> (raw)
In-Reply-To: <1393306670-17435-1-git-send-email-shangw@linux.vnet.ibm.com>
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@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
next prev parent reply other threads:[~2014-02-25 5:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-25 5:37 [PATCH v2 0/9] EEH improvement Gavin Shan
2014-02-25 5:37 ` [PATCH 1/9] powerpc/eeh: Remove EEH_PE_PHB_DEAD Gavin Shan
2014-02-25 5:37 ` [PATCH 2/9] powerpc/powernv: Remove PNV_EEH_STATE_REMOVED Gavin Shan
2014-02-25 5:37 ` [PATCH 3/9] powerpc/powernv: Move PNV_EEH_STATE_ENABLED around Gavin Shan
2014-02-25 5:37 ` [PATCH 4/9] powerpc/eeh: Introduce eeh_pe_free() Gavin Shan
2014-02-25 5:37 ` [PATCH 5/9] powerpc/eeh: Introduce eeh_ops->event() Gavin Shan
2014-02-25 5:37 ` Gavin Shan [this message]
2014-02-25 5:37 ` [PATCH 7/9] powerpc/powernv: Cache PHB diag-data Gavin Shan
2014-02-25 5:37 ` [PATCH 8/9] powerpc/powernv: Add /proc/powerpc/eeh_inf_err Gavin Shan
2014-02-25 5:37 ` [PATCH 9/9] powerpc/powernv: Refactor PHB diag-data dump Gavin Shan
2014-02-25 7:26 ` [PATCH v2 0/9] EEH improvement Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393306670-17435-7-git-send-email-shangw@linux.vnet.ibm.com \
--to=shangw@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).