|
@@ -673,6 +673,49 @@ 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 */
|
|
@@ -994,5 +1037,6 @@ 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
|
|
|
};
|