From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: linuxppc-dev@ozlabs.org
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Subject: [PATCH 5/9] powerpc/eeh: Introduce eeh_ops->event()
Date: Tue, 25 Feb 2014 13:37:46 +0800 [thread overview]
Message-ID: <1393306670-17435-6-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 introduces eeh_ops->event() so that we can pass various
events to underly platform. One reason to have that is to allocate
or free PHB diag-data for individual PEs on PowerNV platform in
future when EEH core to create or destroy PE instances.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/eeh.h | 6 ++++++
arch/powerpc/kernel/eeh_pe.c | 14 ++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index a61b06f..8fd1c2d 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -71,6 +71,7 @@ struct eeh_pe {
struct list_head child_list; /* Link PE to the child list */
struct list_head edevs; /* Link list of EEH devices */
struct list_head child; /* Child PEs */
+ void *data; /* Platform dependent data */
};
#define eeh_pe_for_each_dev(pe, edev, tmp) \
@@ -151,6 +152,10 @@ enum {
#define EEH_LOG_TEMP 1 /* EEH temporary error log */
#define EEH_LOG_PERM 2 /* EEH permanent error log */
+/* EEH events sent to platform */
+#define EEH_EVENT_PE_ALLOC 0
+#define EEH_EVENT_PE_FREE 1
+
struct eeh_ops {
char *name;
int (*init)(void);
@@ -168,6 +173,7 @@ struct eeh_ops {
int (*write_config)(struct device_node *dn, int where, int size, u32 val);
int (*next_error)(struct eeh_pe **pe);
int (*restore_config)(struct device_node *dn);
+ int (*event)(int event, void *data);
};
extern struct eeh_ops *eeh_ops;
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 2add834..6cdc7a8 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -44,6 +44,7 @@ static LIST_HEAD(eeh_phb_pe);
static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type)
{
struct eeh_pe *pe;
+ int ret;
/* Allocate PHB PE */
pe = kzalloc(sizeof(struct eeh_pe), GFP_KERNEL);
@@ -56,6 +57,16 @@ static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type)
INIT_LIST_HEAD(&pe->child);
INIT_LIST_HEAD(&pe->edevs);
+ if (eeh_ops->event) {
+ ret = eeh_ops->event(EEH_EVENT_PE_ALLOC, pe);
+ if (ret) {
+ pr_warn("%s: Can't alloc PE (%d)\n",
+ __func__, ret);
+ kfree(pe);
+ return NULL;
+ }
+ }
+
return pe;
}
@@ -77,6 +88,9 @@ static void eeh_pe_free(struct eeh_pe *pe)
return;
}
+ if (eeh_ops->event)
+ eeh_ops->event(EEH_EVENT_PE_FREE, pe);
+
kfree(pe);
}
--
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 ` Gavin Shan [this message]
2014-02-25 5:37 ` [PATCH 6/9] powerpc/powernv: Support eeh_ops->event() Gavin Shan
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-6-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).