Commit fa646c3c authored by Gavin Shan's avatar Gavin Shan Committed by Benjamin Herrenschmidt

powerpc/powernv: Drop PHB operation err_inject()

The patch drops PHB EEH operation err_inject() and merge its logic
to eeh_ops::err_inject().
Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 01f3bfb7
...@@ -70,7 +70,6 @@ static ssize_t ioda_eeh_ei_write(struct file *filp, ...@@ -70,7 +70,6 @@ static ssize_t ioda_eeh_ei_write(struct file *filp,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct pci_controller *hose = filp->private_data; struct pci_controller *hose = filp->private_data;
struct pnv_phb *phb = hose->private_data;
struct eeh_dev *edev; struct eeh_dev *edev;
struct eeh_pe *pe; struct eeh_pe *pe;
int pe_no, type, func; int pe_no, type, func;
...@@ -78,7 +77,7 @@ static ssize_t ioda_eeh_ei_write(struct file *filp, ...@@ -78,7 +77,7 @@ static ssize_t ioda_eeh_ei_write(struct file *filp,
char buf[50]; char buf[50];
int ret; int ret;
if (!phb->eeh_ops || !phb->eeh_ops->err_inject) if (!eeh_ops || !eeh_ops->err_inject)
return -ENXIO; return -ENXIO;
ret = simple_write_to_buffer(buf, sizeof(buf), ppos, user_buf, count); 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, ...@@ -103,7 +102,7 @@ static ssize_t ioda_eeh_ei_write(struct file *filp,
return -ENODEV; return -ENODEV;
/* Do error injection */ /* 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; return ret < 0 ? ret : count;
} }
...@@ -756,49 +755,6 @@ static int ioda_eeh_configure_bridge(struct eeh_pe *pe) ...@@ -756,49 +755,6 @@ static int ioda_eeh_configure_bridge(struct eeh_pe *pe)
return 0; 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) static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
{ {
/* GEM */ /* GEM */
...@@ -1144,6 +1100,5 @@ struct pnv_eeh_ops ioda_eeh_ops = { ...@@ -1144,6 +1100,5 @@ struct pnv_eeh_ops ioda_eeh_ops = {
.reset = ioda_eeh_reset, .reset = ioda_eeh_reset,
.get_log = ioda_eeh_get_log, .get_log = ioda_eeh_get_log,
.configure_bridge = ioda_eeh_configure_bridge, .configure_bridge = ioda_eeh_configure_bridge,
.err_inject = ioda_eeh_err_inject,
.next_error = ioda_eeh_next_error .next_error = ioda_eeh_next_error
}; };
...@@ -406,12 +406,42 @@ static int pnv_eeh_err_inject(struct eeh_pe *pe, int type, int func, ...@@ -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 pci_controller *hose = pe->phb;
struct pnv_phb *phb = hose->private_data; 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) if (func < OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_ADDR ||
ret = phb->eeh_ops->err_inject(pe, type, func, addr, mask); 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) static inline bool pnv_eeh_cfg_blocked(struct device_node *dn)
......
...@@ -85,8 +85,6 @@ struct pnv_eeh_ops { ...@@ -85,8 +85,6 @@ struct pnv_eeh_ops {
int (*get_log)(struct eeh_pe *pe, int severity, int (*get_log)(struct eeh_pe *pe, int severity,
char *drv_log, unsigned long len); char *drv_log, unsigned long len);
int (*configure_bridge)(struct eeh_pe *pe); 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); int (*next_error)(struct eeh_pe **pe);
}; };
#endif /* CONFIG_EEH */ #endif /* CONFIG_EEH */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment