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: <ZxsTAANTTuQzQ9HR@Asurada-Nvidia>
Date: Thu, 24 Oct 2024 20:39:44 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: <jgg@...dia.com>, <kevin.tian@...el.com>, <will@...nel.org>
CC: <joro@...tes.org>, <suravee.suthikulpanit@....com>,
	<robin.murphy@....com>, <dwmw2@...radead.org>, <baolu.lu@...ux.intel.com>,
	<shuah@...nel.org>, <linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kselftest@...r.kernel.org>,
	<eric.auger@...hat.com>, <jean-philippe@...aro.org>, <mdf@...nel.org>,
	<mshavit@...gle.com>, <shameerali.kolothum.thodi@...wei.com>,
	<smostafa@...gle.com>, <yi.l.liu@...el.com>, <aik@....com>,
	<zhangfei.gao@...aro.org>, <patches@...ts.linux.dev>
Subject: Re: [PATCH v4 08/14] iommufd/viommu: Add vdev_to_dev helper

On Mon, Oct 21, 2024 at 05:20:17PM -0700, Nicolin Chen wrote:
> +/* Caller should xa_lock(&viommu->vdevs) to protect the return value */
> +struct device *vdev_to_dev(struct iommufd_vdevice *vdev)
> +{
> +       return vdev ? vdev->idev->dev : NULL;
> +}
> +EXPORT_SYMBOL_NS_GPL(vdev_to_dev, IOMMUFD);

Changing to not exposing the iommufd_vdevice structure, I reworked
this helper to a vIOMMU-based one:

+/* Caller should xa_lock(&viommu->vdevs) to protect the return value */
+struct device *iommufd_viommu_find_dev(struct iommufd_viommu *viommu,
+                                      unsigned long vdev_id)
+{
+       struct iommufd_vdevice *vdev;
+
+       lockdep_is_held(&viommu->vdevs.xa_lock);
+
+       vdev = xa_load(&viommu->vdevs, vdev_id);
+       return vdev ? vdev->idev->dev : NULL;
+}
+EXPORT_SYMBOL_NS_GPL(iommufd_viommu_find_dev, IOMMUFD);

Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ