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: <Z8ClD4jMtSH31IqA@Asurada-Nvidia>
Date: Thu, 27 Feb 2025 09:46:55 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Robin Murphy <robin.murphy@....com>, <kevin.tian@...el.com>,
	<tglx@...utronix.de>, <maz@...nel.org>, <joro@...tes.org>, <will@...nel.org>,
	<shuah@...nel.org>, <iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kselftest@...r.kernel.org>,
	<eric.auger@...hat.com>, <baolu.lu@...ux.intel.com>, <yi.l.liu@...el.com>,
	<yury.norov@...il.com>, <jacob.pan@...ux.microsoft.com>,
	<patches@...ts.linux.dev>
Subject: Re: [PATCH v2 3/7] iommu: Make iommu_dma_prepare_msi() into a
 generic operation

On Thu, Feb 27, 2025 at 11:32:42AM -0400, Jason Gunthorpe wrote:
> On Thu, Feb 27, 2025 at 11:21:28AM +0000, Robin Murphy wrote:
> > All I'm saying is to hide the callback detail in the IOMMUFD code because
> > being IOMMUFD modular is unique to IOMMUFD and not the rest of the core
> > code's problem.
> 
> Maybe we could use a global function pointer set/cleared on iommufd
> module load?
> 
> Regardless, we need to first find a way for the core code to tell if
> the domain is iommufd owned or not.
> 
> We should also make it so we can tell if dma-iommu.c is linked to that
> domain (eg vfio or the default_domain), then we can do the iova_cookie
> move without changing the destruction flows. This would be the missing
> union struct tag you mentioned in the other email.
> 
> What I've been thinking of is changing type into flags. I think we
> have now removed type from all drivers so this should be a small
> enough work.
> 
> Nicolin should be able to look into some followup here, it is not a
> small change.
> 
> > And frankly otherwise, what even is the benefit of moving the iova_cookie
> > pointer into the union if we have to replace it with another whole pointer
> > to make it work?
> 
> It makes a lot more semantic sense that the domain owners all share a
> single "private data" pointer.

I found a bit confusing to use "owner" as the domain->owner isn't
the same thing in this context. Maybe it should be "driver_ops"?

Then, "owner" could be another op structure that holds the owner-
specific things, such as:
	enum iommu_domain_owner { DMA/VFIO/IOMMUFD}; // or flag?
	union {
		iova_cookie;  // DMA
		msi_cookie;   // VFIO
		iommufd_hwpt; // IOMMUFD
	}
	(*sw_msi);
?

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ