summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/vfio_spapr_eeh.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2022-12-05 11:29:18 -0400
committerAlex Williamson <alex.williamson@redhat.com>2022-12-05 12:04:32 -0700
commite276e25819b8a173a21947720bb0a548c0b724b7 (patch)
treecbe05321e446b7d6f3d2d6633e0bca80801b0522 /drivers/vfio/vfio_spapr_eeh.c
parente5c38a203eb4343993e889eb69f5386f085f25ef (diff)
downloadlinux-e276e25819b8a173a21947720bb0a548c0b724b7.tar.bz2
vfio: Move vfio_spapr_iommu_eeh_ioctl into vfio_iommu_spapr_tce.c
As with the previous patch EEH is always enabled if SPAPR_TCE_IOMMU, so move this last bit of code into the main module. Now that this function only processes VFIO_EEH_PE_OP remove a level of indenting as well, it is only called by a case statement that already checked VFIO_EEH_PE_OP. This eliminates an unnecessary module and SPAPR code in a global header. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/3-v5-fc5346cacfd4+4c482-vfio_modules_jgg@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/vfio_spapr_eeh.c')
-rw-r--r--drivers/vfio/vfio_spapr_eeh.c88
1 files changed, 0 insertions, 88 deletions
diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
deleted file mode 100644
index 221b1b637e18..000000000000
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ /dev/null
@@ -1,88 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * EEH functionality support for VFIO devices. The feature is only
- * available on sPAPR compatible platforms.
- *
- * Copyright Gavin Shan, IBM Corporation 2014.
- */
-
-#include <linux/module.h>
-#include <linux/uaccess.h>
-#include <linux/vfio.h>
-#include <asm/eeh.h>
-
-#define DRIVER_VERSION "0.1"
-#define DRIVER_AUTHOR "Gavin Shan, IBM Corporation"
-#define DRIVER_DESC "VFIO IOMMU SPAPR EEH"
-
-long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
- unsigned int cmd, unsigned long arg)
-{
- struct eeh_pe *pe;
- struct vfio_eeh_pe_op op;
- unsigned long minsz;
- long ret = -EINVAL;
-
- switch (cmd) {
- case VFIO_EEH_PE_OP:
- pe = eeh_iommu_group_to_pe(group);
- if (!pe)
- return -ENODEV;
-
- minsz = offsetofend(struct vfio_eeh_pe_op, op);
- if (copy_from_user(&op, (void __user *)arg, minsz))
- return -EFAULT;
- if (op.argsz < minsz || op.flags)
- return -EINVAL;
-
- switch (op.op) {
- case VFIO_EEH_PE_DISABLE:
- ret = eeh_pe_set_option(pe, EEH_OPT_DISABLE);
- break;
- case VFIO_EEH_PE_ENABLE:
- ret = eeh_pe_set_option(pe, EEH_OPT_ENABLE);
- break;
- case VFIO_EEH_PE_UNFREEZE_IO:
- ret = eeh_pe_set_option(pe, EEH_OPT_THAW_MMIO);
- break;
- case VFIO_EEH_PE_UNFREEZE_DMA:
- ret = eeh_pe_set_option(pe, EEH_OPT_THAW_DMA);
- break;
- case VFIO_EEH_PE_GET_STATE:
- ret = eeh_pe_get_state(pe);
- break;
- case VFIO_EEH_PE_RESET_DEACTIVATE:
- ret = eeh_pe_reset(pe, EEH_RESET_DEACTIVATE, true);
- break;
- case VFIO_EEH_PE_RESET_HOT:
- ret = eeh_pe_reset(pe, EEH_RESET_HOT, true);
- break;
- case VFIO_EEH_PE_RESET_FUNDAMENTAL:
- ret = eeh_pe_reset(pe, EEH_RESET_FUNDAMENTAL, true);
- break;
- 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;
- }
- }
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(vfio_spapr_iommu_eeh_ioctl);
-
-MODULE_VERSION(DRIVER_VERSION);
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);