lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aEy2IYL5XTbR54Z3@nvidia.com>
Date: Fri, 13 Jun 2025 16:37:05 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <kevin.tian@...el.com>, <will@...nel.org>, <robin.murphy@....com>,
	<joro@...tes.org>, <ddutile@...hat.com>, <yi.l.liu@...el.com>,
	<peterz@...radead.org>, <jsnitsel@...hat.com>, <praan@...gle.com>,
	<linux-arm-kernel@...ts.infradead.org>, <iommu@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>, <patches@...ts.linux.dev>,
	<baolu.lu@...ux.intel.com>
Subject: Re: [PATCH v1 06/12] iommufd/selftest: Implement
 mock_get_viommu_size and mock_viommu_init

On Fri, Jun 13, 2025 at 08:23:18PM -0300, Jason Gunthorpe wrote:
> On Fri, Jun 13, 2025 at 01:19:33PM -0700, Nicolin Chen wrote:
> > > The patches will read better if you add the call logic for init along
> > > side alloc based on init or alloc ops being non-NULL in the prior
> > > patch and then have these driver patches replace alloc with init.
> > > 
> > > Duplicating alloc into init and leaving both makes the patch harder to
> > > check.
> > 
> > I see. That will add an additional patch tentatively supporting
> > both ops.
> 
> An additional patch is not needed, just add calls to the ops in the
> same patch where you add the ops.

I have a long writing in that iommu ops patch, as Don requested
per an offline email. So separating them would be a bit cleaner.

Yet, I am merging two cleanup patches (viommu.c + iommu.h):

iommu: Introduce get_viommu_size and viommu_init ops
iommufd/viommu: Support get_viommu_size and viommu_init ops
iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init
iommu/arm-smmu-v3: Replace arm_vsmmu_alloc with arm_vsmmu_init
iommu: Deprecate viommu_alloc op

Net-net will be the same. And the driver patch has viommu_alloc
and viommu_init parts side by side.

> Then the patch that removes the old ops removes the extra logic
> deciding which set to call. This is the preferred way to do driver
> conversions.

Yes. I made a very small diff in the last patch:

@@ -33,8 +33,6 @@ int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd)

        ops = dev_iommu_ops(idev->dev);
        if (!ops->get_viommu_size || !ops->viommu_init) {
-               if (ops->viommu_alloc)
-                       goto get_hwpt_paging;
                rc = -EOPNOTSUPP;
                goto out_put_idev;
        }
@@ -54,7 +52,6 @@ int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd)
                goto out_put_idev;
        }

-get_hwpt_paging:
        hwpt_paging = iommufd_get_hwpt_paging(ucmd, cmd->hwpt_id);
        if (IS_ERR(hwpt_paging)) {
                rc = PTR_ERR(hwpt_paging);
@@ -66,13 +63,8 @@ int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd)
                goto out_put_hwpt;
        }

-       if (!ops->viommu_init)
-               viommu = ops->viommu_alloc(idev->dev,
-                                          hwpt_paging->common.domain,
-                                          ucmd->ictx, cmd->type);
-       else
-               viommu = (struct iommufd_viommu *)_iommufd_object_alloc(
-                       ucmd->ictx, viommu_size, IOMMUFD_OBJ_VIOMMU);
+       viommu = (struct iommufd_viommu *)_iommufd_object_alloc(
+               ucmd->ictx, viommu_size, IOMMUFD_OBJ_VIOMMU);
        if (IS_ERR(viommu)) {
                rc = PTR_ERR(viommu);
                goto out_put_hwpt;

Thanks!
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ