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: <aAaElAdVObJdK64d@Asurada-Nvidia>
Date: Mon, 21 Apr 2025 10:47:00 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
CC: "jgg@...dia.com" <jgg@...dia.com>, "corbet@....net" <corbet@....net>,
	"will@...nel.org" <will@...nel.org>, "robin.murphy@....com"
	<robin.murphy@....com>, "joro@...tes.org" <joro@...tes.org>,
	"thierry.reding@...il.com" <thierry.reding@...il.com>, "vdumpa@...dia.com"
	<vdumpa@...dia.com>, "jonathanh@...dia.com" <jonathanh@...dia.com>,
	"shuah@...nel.org" <shuah@...nel.org>, "praan@...gle.com" <praan@...gle.com>,
	"nathan@...nel.org" <nathan@...nel.org>, "peterz@...radead.org"
	<peterz@...radead.org>, "Liu, Yi L" <yi.l.liu@...el.com>,
	"jsnitsel@...hat.com" <jsnitsel@...hat.com>, "mshavit@...gle.com"
	<mshavit@...gle.com>, "zhangzekun11@...wei.com" <zhangzekun11@...wei.com>,
	"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>, "linux-doc@...r.kernel.org"
	<linux-doc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-tegra@...r.kernel.org"
	<linux-tegra@...r.kernel.org>, "linux-kselftest@...r.kernel.org"
	<linux-kselftest@...r.kernel.org>, "patches@...ts.linux.dev"
	<patches@...ts.linux.dev>
Subject: Re: [PATCH v1 14/16] iommu/arm-smmu-v3: Add vsmmu_alloc impl op

On Mon, Apr 21, 2025 at 08:23:50AM +0000, Tian, Kevin wrote:
> > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > index 66855cae775e..aa8653af50f2 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
> > @@ -392,10 +392,7 @@ struct iommufd_viommu *arm_vsmmu_alloc(struct
> > device *dev,
> >  		iommu_get_iommu_dev(dev, struct arm_smmu_device,
> > iommu);
> >  	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> >  	struct arm_smmu_domain *s2_parent = to_smmu_domain(parent);
> > -	struct arm_vsmmu *vsmmu;
> > -
> > -	if (viommu_type != IOMMU_VIOMMU_TYPE_ARM_SMMUV3)
> > -		return ERR_PTR(-EOPNOTSUPP);
> > +	struct arm_vsmmu *vsmmu = NULL;
> > 
> >  	if (!(smmu->features & ARM_SMMU_FEAT_NESTING))
> >  		return ERR_PTR(-EOPNOTSUPP);
> > @@ -423,8 +420,16 @@ struct iommufd_viommu *arm_vsmmu_alloc(struct
> > device *dev,
> >  	    !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> >  		return ERR_PTR(-EOPNOTSUPP);
> > 
> > -	vsmmu = iommufd_viommu_alloc(ictx, struct arm_vsmmu, core,
> > -				     &arm_vsmmu_ops);
> > +	if (master->smmu->impl_ops && master->smmu->impl_ops-
> > >vsmmu_alloc)
> > +		vsmmu = master->smmu->impl_ops->vsmmu_alloc(
> > +			master->smmu, s2_parent, ictx, viommu_type,
> > user_data);
> > +	if (PTR_ERR(vsmmu) == -EOPNOTSUPP) {
> 
> did it work on standard SMMUv3 when there is no @vsmmu_alloc()
> and the variable 'vsmmu' is initialized to NULL?

You are right. We should do:

-	struct arm_vsmmu *vsmmu = NULL;
+	struct arm_vsmmu *vsmmu = ERR_PTR(-EOPNOTSUPP);

Thanks!
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ