Commit e5c38a20 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Alex Williamson

vfio/spapr: Move VFIO_CHECK_EXTENSION into tce_iommu_ioctl()

The PPC64 kconfig is a bit of a rats nest, but it turns out that if
CONFIG_SPAPR_TCE_IOMMU is on then EEH must be too:

config SPAPR_TCE_IOMMU
	bool "sPAPR TCE IOMMU Support"
	depends on PPC_POWERNV || PPC_PSERIES
	select IOMMU_API
	help
	  Enables bits of IOMMU API required by VFIO. The iommu_ops
	  is not implemented as it is not necessary for VFIO.

config PPC_POWERNV
	select FORCE_PCI

config PPC_PSERIES
	select FORCE_PCI

config EEH
	bool
	depends on (PPC_POWERNV || PPC_PSERIES) && PCI
	default y

So, just open code the call to eeh_enabled() into tce_iommu_ioctl().
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/2-v5-fc5346cacfd4+4c482-vfio_modules_jgg@nvidia.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 8f8bcc8c
...@@ -785,14 +785,12 @@ static long tce_iommu_ioctl(void *iommu_data, ...@@ -785,14 +785,12 @@ static long tce_iommu_ioctl(void *iommu_data,
switch (arg) { switch (arg) {
case VFIO_SPAPR_TCE_IOMMU: case VFIO_SPAPR_TCE_IOMMU:
case VFIO_SPAPR_TCE_v2_IOMMU: case VFIO_SPAPR_TCE_v2_IOMMU:
ret = 1; return 1;
break; case VFIO_EEH:
return eeh_enabled();
default: default:
ret = vfio_spapr_iommu_eeh_ioctl(NULL, cmd, arg); return 0;
break;
} }
return (ret < 0) ? 0 : ret;
} }
/* /*
......
...@@ -24,12 +24,6 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, ...@@ -24,12 +24,6 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
long ret = -EINVAL; long ret = -EINVAL;
switch (cmd) { switch (cmd) {
case VFIO_CHECK_EXTENSION:
if (arg == VFIO_EEH)
ret = eeh_enabled() ? 1 : 0;
else
ret = 0;
break;
case VFIO_EEH_PE_OP: case VFIO_EEH_PE_OP:
pe = eeh_iommu_group_to_pe(group); pe = eeh_iommu_group_to_pe(group);
if (!pe) if (!pe)
......
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