linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: linuxppc-dev@ozlabs.org
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: [PATCH 02/10] powerpc/powernv: Drop PHB operation err_inject()
Date: Mon, 16 Feb 2015 14:45:40 +1100	[thread overview]
Message-ID: <1424058348-28951-3-git-send-email-gwshan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1424058348-28951-1-git-send-email-gwshan@linux.vnet.ibm.com>

The patch drops PHB EEH operation err_inject() and merge its logic
to eeh_ops::err_inject().

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/eeh-ioda.c    | 49 ++--------------------------
 arch/powerpc/platforms/powernv/eeh-powernv.c | 38 ++++++++++++++++++---
 arch/powerpc/platforms/powernv/pci.h         |  2 --
 3 files changed, 36 insertions(+), 53 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 2809c98..dd154cf 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -70,7 +70,6 @@ static ssize_t ioda_eeh_ei_write(struct file *filp,
 				 size_t count, loff_t *ppos)
 {
 	struct pci_controller *hose = filp->private_data;
-	struct pnv_phb *phb = hose->private_data;
 	struct eeh_dev *edev;
 	struct eeh_pe *pe;
 	int pe_no, type, func;
@@ -78,7 +77,7 @@ static ssize_t ioda_eeh_ei_write(struct file *filp,
 	char buf[50];
 	int ret;
 
-	if (!phb->eeh_ops || !phb->eeh_ops->err_inject)
+	if (!eeh_ops || !eeh_ops->err_inject)
 		return -ENXIO;
 
 	ret = simple_write_to_buffer(buf, sizeof(buf), ppos, user_buf, count);
@@ -103,7 +102,7 @@ static ssize_t ioda_eeh_ei_write(struct file *filp,
 		return -ENODEV;
 
 	/* Do error injection */
-	ret = phb->eeh_ops->err_inject(pe, type, func, addr, mask);
+	ret = eeh_ops->err_inject(pe, type, func, addr, mask);
 	return ret < 0 ? ret : count;
 }
 
@@ -756,49 +755,6 @@ static int ioda_eeh_configure_bridge(struct eeh_pe *pe)
 	return 0;
 }
 
-static int ioda_eeh_err_inject(struct eeh_pe *pe, int type, int func,
-			       unsigned long addr, unsigned long mask)
-{
-	struct pci_controller *hose = pe->phb;
-	struct pnv_phb *phb = hose->private_data;
-	s64 ret;
-
-	/* Sanity check on error type */
-	if (type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR &&
-	    type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64) {
-		pr_warn("%s: Invalid error type %d\n",
-			__func__, type);
-		return -ERANGE;
-	}
-
-	if (func < OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_ADDR ||
-	    func > OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_TARGET) {
-		pr_warn("%s: Invalid error function %d\n",
-			__func__, func);
-		return -ERANGE;
-	}
-
-	/* Firmware supports error injection ? */
-	if (!opal_check_token(OPAL_PCI_ERR_INJECT)) {
-		pr_warn("%s: Firmware doesn't support error injection\n",
-			__func__);
-		return -ENXIO;
-	}
-
-	/* Do error injection */
-	ret = opal_pci_err_inject(phb->opal_id, pe->addr,
-				  type, func, addr, mask);
-	if (ret != OPAL_SUCCESS) {
-		pr_warn("%s: Failure %lld injecting error "
-			"%d-%d to PHB#%x-PE#%x\n",
-			__func__, ret, type, func,
-			hose->global_number, pe->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
 static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
 {
 	/* GEM */
@@ -1144,6 +1100,5 @@ struct pnv_eeh_ops ioda_eeh_ops = {
 	.reset			= ioda_eeh_reset,
 	.get_log		= ioda_eeh_get_log,
 	.configure_bridge	= ioda_eeh_configure_bridge,
-	.err_inject		= ioda_eeh_err_inject,
 	.next_error		= ioda_eeh_next_error
 };
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index f562dd1..df33daa 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -406,12 +406,42 @@ static int pnv_eeh_err_inject(struct eeh_pe *pe, int type, int func,
 {
 	struct pci_controller *hose = pe->phb;
 	struct pnv_phb *phb = hose->private_data;
-	int ret = -EEXIST;
+	s64 rc;
+
+	/* Sanity check on error type */
+	if (type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR &&
+	    type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64) {
+		pr_warn("%s: Invalid error type %d\n",
+			__func__, type);
+		return -ERANGE;
+	}
 
-	if (phb->eeh_ops && phb->eeh_ops->err_inject)
-		ret = phb->eeh_ops->err_inject(pe, type, func, addr, mask);
+	if (func < OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_ADDR ||
+	    func > OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_TARGET) {
+		pr_warn("%s: Invalid error function %d\n",
+			__func__, func);
+		return -ERANGE;
+	}
 
-	return ret;
+	/* Firmware supports error injection ? */
+	if (!opal_check_token(OPAL_PCI_ERR_INJECT)) {
+		pr_warn("%s: Firmware doesn't support error injection\n",
+			__func__);
+		return -ENXIO;
+	}
+
+	/* Do error injection */
+	rc = opal_pci_err_inject(phb->opal_id, pe->addr,
+				 type, func, addr, mask);
+	if (rc != OPAL_SUCCESS) {
+		pr_warn("%s: Failure %lld injecting error "
+			"%d-%d to PHB#%x-PE#%x\n",
+			__func__, rc, type, func,
+			hose->global_number, pe->addr);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 static inline bool pnv_eeh_cfg_blocked(struct device_node *dn)
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 6c02ff8..a9f2362 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -85,8 +85,6 @@ struct pnv_eeh_ops {
 	int (*get_log)(struct eeh_pe *pe, int severity,
 		       char *drv_log, unsigned long len);
 	int (*configure_bridge)(struct eeh_pe *pe);
-	int (*err_inject)(struct eeh_pe *pe, int type, int func,
-			  unsigned long addr, unsigned long mask);
 	int (*next_error)(struct eeh_pe **pe);
 };
 #endif /* CONFIG_EEH */
-- 
1.8.3.2

  parent reply	other threads:[~2015-02-16  3:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16  3:45 [PATCH 00/10] powerpc/powernv: Simplify EEH Implementation Gavin Shan
2015-02-16  3:45 ` [PATCH 01/10] powerpc/powernv: Shorten EEH function names Gavin Shan
2015-02-16  3:45 ` Gavin Shan [this message]
2015-02-16  3:45 ` [PATCH 03/10] powerpc/powernv: Drop PHB operation post_init() Gavin Shan
2015-02-16  3:45 ` [PATCH 04/10] powerpc/powernv: Drop PHB operation get_log() Gavin Shan
2015-02-16  3:45 ` [PATCH 05/10] powerpc/powernv: Drop PHB operation configure_bridge() Gavin Shan
2015-02-16  3:45 ` [PATCH 06/10] powerpc/powernv: Drop PHB operation set_option() Gavin Shan
2015-02-16  3:45 ` [PATCH 07/10] powerpc/powernv: Drop PHB operation get_state() Gavin Shan
2015-02-16  3:45 ` [PATCH 08/10] powerpc/powernv: Drop PHB operation next_error() Gavin Shan
2015-02-16  3:45 ` [PATCH 09/10] powerpc/powernv: Drop PHB operation reset() Gavin Shan
2015-02-16  3:45 ` [PATCH 10/10] powerpc/powernv: Remove unused file 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=1424058348-28951-3-git-send-email-gwshan@linux.vnet.ibm.com \
    --to=gwshan@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).