summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/vfio_spapr_eeh.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-03-26 06:42:09 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2015-05-12 12:33:35 +0200
commit68cbbc3a9d1fc231810b2490bca73b3b444ef542 (patch)
treeaa46575bc541b0680021a47e80df098bcc16789b /drivers/vfio/vfio_spapr_eeh.c
parentpowerpc/eeh: Introduce eeh_pe_inject_err() (diff)
downloadlinux-68cbbc3a9d1fc231810b2490bca73b3b444ef542.tar.xz
linux-68cbbc3a9d1fc231810b2490bca73b3b444ef542.zip
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;
}