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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250924184346.GI2617119@nvidia.com>
Date: Wed, 24 Sep 2025 15:43:46 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: joro@...tes.org, bhelgaas@...gle.com, suravee.suthikulpanit@....com,
	will@...nel.org, robin.murphy@....com, sven@...nel.org,
	j@...nau.net, alyssa@...enzweig.io, neal@...pa.dev,
	robin.clark@....qualcomm.com, m.szyprowski@...sung.com,
	krzk@...nel.org, alim.akhtar@...sung.com, dwmw2@...radead.org,
	baolu.lu@...ux.intel.com, kevin.tian@...el.com,
	yong.wu@...iatek.com, matthias.bgg@...il.com,
	angelogioacchino.delregno@...labora.com, tjeznach@...osinc.com,
	paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
	alex@...ti.fr, heiko@...ech.de, schnelle@...ux.ibm.com,
	mjrosato@...ux.ibm.com, gerald.schaefer@...ux.ibm.com,
	orsonzhai@...il.com, baolin.wang@...ux.alibaba.com,
	zhang.lyra@...il.com, wens@...e.org, jernej.skrabec@...il.com,
	samuel@...lland.org, jean-philippe@...aro.org, rafael@...nel.org,
	lenb@...nel.org, yi.l.liu@...el.com, cwabbott0@...il.com,
	quic_pbrahma@...cinc.com, iommu@...ts.linux.dev,
	linux-kernel@...r.kernel.org, asahi@...ts.linux.dev,
	linux-arm-kernel@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
	linux-samsung-soc@...r.kernel.org,
	linux-mediatek@...ts.infradead.org, linux-riscv@...ts.infradead.org,
	linux-rockchip@...ts.infradead.org, linux-s390@...r.kernel.org,
	linux-sunxi@...ts.linux.dev, linux-tegra@...r.kernel.org,
	virtualization@...ts.linux.dev, linux-acpi@...r.kernel.org,
	linux-pci@...r.kernel.org, patches@...ts.linux.dev,
	vsethi@...dia.com, helgaas@...nel.org, etzhao1900@...il.com
Subject: Re: [PATCH v4 4/7] iommu: Pass in old domain to attach_dev callback
 functions

On Sun, Aug 31, 2025 at 04:31:56PM -0700, Nicolin Chen wrote:
> The IOMMU core attaches each device to a default domain on probe(). Then,
> every new "attach" operation has a fundamental meaning of two-fold:
>  - detach from its currently attached (old) domain
>  - attach to a given new domain
> 
> Modern IOMMU drivers following this pattern usually want to clean up the
> things related to the old domain, so they call iommu_get_domain_for_dev()
> to fetch the old domain.
> 
> Pass in the old domain pointer from the core to drivers, aligning with the
> set_dev_pasid op that passes in already.
> 
> Ensure all low-level attach fcuntions in the core can forward the correct
> old domain pointer. Thus, rework those functions as well.
> 
> Suggested-by: Jason Gunthorpe <jgg@...dia.com>
> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
> ---
>  include/linux/iommu.h                         |  3 +-
>  drivers/iommu/amd/iommu.c                     | 11 ++++---
>  drivers/iommu/apple-dart.c                    |  9 +++--
>  .../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c     |  5 +--
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c   | 33 ++++++++++++-------
>  drivers/iommu/arm/arm-smmu/arm-smmu.c         |  9 +++--
>  drivers/iommu/arm/arm-smmu/qcom_iommu.c       | 11 ++++---
>  drivers/iommu/exynos-iommu.c                  |  6 ++--
>  drivers/iommu/fsl_pamu_domain.c               | 12 +++----
>  drivers/iommu/intel/iommu.c                   | 10 ++++--
>  drivers/iommu/intel/nested.c                  |  2 +-
>  drivers/iommu/iommu.c                         | 26 +++++++++------
>  drivers/iommu/iommufd/selftest.c              |  2 +-
>  drivers/iommu/ipmmu-vmsa.c                    | 10 +++---
>  drivers/iommu/msm_iommu.c                     |  8 ++---
>  drivers/iommu/mtk_iommu.c                     |  8 ++---
>  drivers/iommu/mtk_iommu_v1.c                  |  7 ++--
>  drivers/iommu/omap-iommu.c                    | 12 +++----
>  drivers/iommu/riscv/iommu.c                   |  9 +++--
>  drivers/iommu/rockchip-iommu.c                | 20 ++++++++---
>  drivers/iommu/s390-iommu.c                    |  9 +++--
>  drivers/iommu/sprd-iommu.c                    |  3 +-
>  drivers/iommu/sun50i-iommu.c                  |  8 +++--
>  drivers/iommu/tegra-smmu.c                    | 10 +++---
>  drivers/iommu/virtio-iommu.c                  |  6 ++--
>  25 files changed, 152 insertions(+), 97 deletions(-)

I've split things like this into more patches before, but this
actually isn't too bad, so I wouldn't push for it.

A series version would be:
 - add a new op 'attach_dev2' or whatever
 - Convert all drivers that just change the signature
 - Convert drivers that have a trivial iommu_get_domain_for_dev()
 - N patches to convert more complex drivers one by one
 - Remove old op attach_dev

Again, looks Ok as-is:

Reviewed-by: Jason Gunthorpe <jgg@...dia.com>

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ