summaryrefslogtreecommitdiff
path: root/drivers/vfio/vfio_spapr_eeh.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-03-26 08:42:09 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2015-05-12 13:33:35 +0300
commit68cbbc3a9d1fc231810b2490bca73b3b444ef542 (patch)
treeaa46575bc541b0680021a47e80df098bcc16789b /drivers/vfio/vfio_spapr_eeh.c
parentec33d36e5ab5d52d59a8f696f7efb682bfc58494 (diff)
downloadlinux-68cbbc3a9d1fc231810b2490bca73b3b444ef542.tar.xz
drivers/vfio: Support EEH error injection
The patch adds one more EEH sub-command (VFIO_EEH_PE_INJECT_ERR) to inject the specified EEH error, which is represented by (struct vfio_eeh_pe_err), to the indicated PE for testing purpose. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/vfio/vfio_spapr_eeh.c')
-rw-r--r--drivers/vfio/vfio_spapr_eeh.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
index 5fa42db769ee..38edeb4729a9 100644
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ b/drivers/vfio/vfio_spapr_eeh.c
@@ -85,6 +85,16 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
case VFIO_EEH_PE_CONFIGURE:
ret = eeh_pe_configure(pe);
break;
+ case VFIO_EEH_PE_INJECT_ERR:
+ minsz = offsetofend(struct vfio_eeh_pe_op, err.mask);
+ if (op.argsz < minsz)
+ return -EINVAL;
+ if (copy_from_user(&op, (void __user *)arg, minsz))
+ return -EFAULT;
+
+ ret = eeh_pe_inject_err(pe, op.err.type, op.err.func,
+ op.err.addr, op.err.mask);
+ break;
default:
ret = -EINVAL;
}