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: <Z8H4VL+OUfi2+5eA@Asurada-Nvidia>
Date: Fri, 28 Feb 2025 09:54:28 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <kevin.tian@...el.com>, <robin.murphy@....com>, <joro@...tes.org>,
	<will@...nel.org>, <iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/4] iommufd: Move iommufd_sw_msi and related
 functions to driver.c

On Fri, Feb 28, 2025 at 01:32:12PM -0400, Jason Gunthorpe wrote:
> On Thu, Feb 27, 2025 at 05:31:16PM -0800, Nicolin Chen wrote:
> > @@ -187,6 +188,8 @@ struct iommufd_object *_iommufd_object_alloc(struct iommufd_ctx *ictx,
> >  					     enum iommufd_object_type type);
> >  struct device *iommufd_viommu_find_dev(struct iommufd_viommu *viommu,
> >  				       unsigned long vdev_id);
> > +int iommufd_sw_msi(struct iommu_domain *domain, struct msi_desc *desc,
> > +		   phys_addr_t msi_addr);
> 
> This should probably go into drivers/iommu/iommu-priv.h ?

Oh right, I forgot we had that.

> > +int iommufd_sw_msi_install(struct iommufd_ctx *ictx,
> > +			   struct iommufd_hwpt_paging *hwpt_paging,
> > +			   struct iommufd_sw_msi_map *msi_map)
> > +{
> > +	unsigned long iova;
> > +
> > +	lockdep_assert_held(&ictx->sw_msi_lock);
> > +
> > +	iova = msi_map->sw_msi_start + msi_map->pgoff * PAGE_SIZE;
> > +	if (!test_bit(msi_map->id, hwpt_paging->present_sw_msi.bitmap)) {
> > +		int rc;
> > +
> > +		rc = iommu_map(hwpt_paging->common.domain, iova,
> > +			       msi_map->msi_addr, PAGE_SIZE,
> > +			       IOMMU_WRITE | IOMMU_READ | IOMMU_MMIO,
> > +			       GFP_KERNEL_ACCOUNT);
> > +		if (rc)
> > +			return rc;
> > +		__set_bit(msi_map->id, hwpt_paging->present_sw_msi.bitmap);
> > +	}
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_NS_GPL(iommufd_sw_msi_install, "IOMMUFD");
> 
> Stubbed out too if CONFIG_IRQ_MSI_IOMMU ?

In that case, the other caller iommufd_group_setup_msi() could be
{
#if IS_ENABLED(CONFIG_IRQ_MSI_IOMMU)
	....
	iommufd_sw_msi_install();
	...
#endif
	return 0;
}
?

> I'm still wondering if we should use a function pointer, how big was
> this compiled anyhow?

Hmm, you mean the size of driver.o? It's 192K (before) vs 212K
(after).

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ