Re: [PATCH v3 2/3] iommufd: Move iommufd_sw_msi and related functions to driver.c

From: Nicolin Chen
Date: Wed Mar 05 2025 - 13:54:22 EST


On Wed, Mar 05, 2025 at 01:53:15PM -0400, Jason Gunthorpe wrote:
> On Mon, Mar 03, 2025 at 12:52:51PM -0800, Nicolin Chen wrote:
> > @@ -458,6 +337,7 @@ iommufd_device_attach_reserved_iova(struct iommufd_device *idev,
> > if (rc)
> > return rc;
> >
> > +#ifdef CONFIG_IRQ_MSI_IOMMU
> > if (list_empty(&idev->igroup->device_list)) {
> > rc = iommufd_group_setup_msi(idev->igroup, hwpt_paging);
> > if (rc) {
> > @@ -466,6 +346,7 @@ iommufd_device_attach_reserved_iova(struct iommufd_device *idev,
> > return rc;
> > }
> > }
> > +#endif
> > return 0;
> > }
> >
> > @@ -682,9 +563,11 @@ iommufd_group_do_replace_reserved_iova(struct iommufd_group *igroup,
> > }
> > }
> >
> > +#ifdef CONFIG_IRQ_MSI_IOMMU
> > rc = iommufd_group_setup_msi(igroup, hwpt_paging);
> > if (rc)
> > goto err_unresv;
> > +#endif
> > return 0;
>
> Lets try to avoid these ifdefs, maybe a empty inline, or maybe just
> need to put a if (!IS_ENABLED(CONFIG_IRQ_MSI_IOMMU) in the right
> spots..
>
> I'd also include the size measurement that you did in the commit
> message

Ack. Will rework.

Thanks
Nicolin