From: Jason Gunthorpe <jgg@nvidia.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Alex Williamson <alex.williamson@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH v2 2/4] vfio: Move vfio_spapr_iommu_eeh_ioctl into vfio_iommu_spapr_tce.c
Date: Mon, 10 Oct 2022 15:42:03 -0300 [thread overview]
Message-ID: <Y0Rne7dwZVdqF3cX@nvidia.com> (raw)
In-Reply-To: <Y0PFJwIlaeJY0nSe@infradead.org>
On Mon, Oct 10, 2022 at 12:09:27AM -0700, Christoph Hellwig wrote:
> On Mon, Oct 03, 2022 at 12:39:31PM -0300, Jason Gunthorpe wrote:
> > So we don't need to worry about the fact that asm/eeh.h doesn't define
> > enough stuff to compile vfio_spapr_iommu_eeh_ioctl() in !CONFIG_EEH. If
> > someday someone changes the kconfig around they can also fix the ifdefs in
> > asm/eeh.h to compile this code too.
>
> Please just break it up by opencoding the VFIO_CHECK_EXTENSION
> cases and just having a helper for VFIO_EEH_PE_OP. I could look
> for my patch doing that but again it should be trivial to redo.
You mean to fold the case branches into the existing switch statements
in tce_iommu_ioctl()? Like below with indenting fixed?
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index 47a8b138cf7f6d..b6426109db5e0f 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -773,8 +773,8 @@ static long tce_iommu_create_default_window(struct tce_container *container)
return ret;
}
-static long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
- unsigned int cmd, unsigned long arg)
+static long vfio_spapr_ioctl_eeh_pe_op(struct iommu_group *group,
+ unsigned long arg)
{
struct eeh_pe *pe;
struct vfio_eeh_pe_op op;
@@ -784,14 +784,6 @@ static long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
if (!IS_ENABLED(CONFIG_EEH))
return -ENOTTY;
- 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)
return -ENODEV;
@@ -843,8 +835,6 @@ static long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
default:
ret = -EINVAL;
}
- }
-
return ret;
}
@@ -860,14 +850,14 @@ 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:
+ if (IS_ENABLED(CONFIG_EEH) && eeh_enabled)
+ return 1;
+ return 0;
default:
- ret = vfio_spapr_iommu_eeh_ioctl(NULL, cmd, arg);
- break;
+ return 0;
}
-
- return (ret < 0) ? 0 : ret;
}
/*
@@ -1121,8 +1111,7 @@ static long tce_iommu_ioctl(void *iommu_data,
ret = 0;
list_for_each_entry(tcegrp, &container->group_list, next) {
- ret = vfio_spapr_iommu_eeh_ioctl(tcegrp->grp,
- cmd, arg);
+ ret = vfio_spapr_ioctl_eeh_pe_op(tcegrp->grp, arg);
if (ret)
return ret;
}
next prev parent reply other threads:[~2022-10-10 18:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 15:39 [PATCH v2 0/4] Simplify the module and kconfig structure in vfio Jason Gunthorpe
2022-10-03 15:39 ` [PATCH v2 1/4] vfio/pci: Move all the SPAPR PCI specific logic to vfio_pci_core.ko Jason Gunthorpe
2022-10-10 7:07 ` Christoph Hellwig
2022-10-10 18:32 ` Jason Gunthorpe
2022-10-11 6:30 ` Christoph Hellwig
2022-10-03 15:39 ` [PATCH v2 2/4] vfio: Move vfio_spapr_iommu_eeh_ioctl into vfio_iommu_spapr_tce.c Jason Gunthorpe
2022-10-10 7:09 ` Christoph Hellwig
2022-10-10 18:42 ` Jason Gunthorpe [this message]
2022-10-11 6:31 ` Christoph Hellwig
2022-10-03 15:39 ` [PATCH v2 3/4] vfio: Remove CONFIG_VFIO_SPAPR_EEH Jason Gunthorpe
2022-10-03 15:39 ` [PATCH v2 4/4] vfio: Fold vfio_virqfd.ko into vfio.ko Jason Gunthorpe
2022-10-05 16:37 ` Cornelia Huck
2022-10-05 16:53 ` Jason Gunthorpe
2022-10-10 7:13 ` Christoph Hellwig
2022-10-11 16:40 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y0Rne7dwZVdqF3cX@nvidia.com \
--to=jgg@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=hch@infradead.org \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox