Message ID | 2-v3-8db96837cdf9+784-vfio_modules_jgg@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Simplify the module and kconfig structure in vfio | expand |
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
On 17/10/22 20:38, Jason Gunthorpe wrote: > 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(). > > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> > --- > drivers/vfio/vfio_iommu_spapr_tce.c | 10 ++++------ > drivers/vfio/vfio_spapr_eeh.c | 6 ------ > 2 files changed, 4 insertions(+), 12 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 169f07ac162d9c..73cec2beae70b1 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c @@ -785,14 +785,12 @@ static long tce_iommu_ioctl(void *iommu_data, switch (arg) { case VFIO_SPAPR_TCE_IOMMU: case VFIO_SPAPR_TCE_v2_IOMMU: - ret = 1; - break; + return 1; + case VFIO_EEH: + return eeh_enabled(); default: - ret = vfio_spapr_iommu_eeh_ioctl(NULL, cmd, arg); - break; + return 0; } - - return (ret < 0) ? 0 : ret; } /* diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c index c9d102aafbcd11..221b1b637e18b0 100644 --- a/drivers/vfio/vfio_spapr_eeh.c +++ b/drivers/vfio/vfio_spapr_eeh.c @@ -24,12 +24,6 @@ long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, long ret = -EINVAL; switch (cmd) { - case VFIO_CHECK_EXTENSION: - if (arg == VFIO_EEH) - ret = eeh_enabled() ? 1 : 0; - else - ret = 0; - break; case VFIO_EEH_PE_OP: pe = eeh_iommu_group_to_pe(group); if (!pe)
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(). Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> --- drivers/vfio/vfio_iommu_spapr_tce.c | 10 ++++------ drivers/vfio/vfio_spapr_eeh.c | 6 ------ 2 files changed, 4 insertions(+), 12 deletions(-)