[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxFb+O5NX9fS4KFe@Asurada-Nvidia>
Date: Thu, 17 Oct 2024 11:48:24 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: <kevin.tian@...el.com>, <will@...nel.org>, <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>,
<patches@...ts.linux.dev>
Subject: Re: [PATCH v3 11/11] iommu/arm-smmu-v3: Add
IOMMU_VIOMMU_TYPE_ARM_SMMUV3 support
On Thu, Oct 17, 2024 at 03:40:15PM -0300, Jason Gunthorpe wrote:
> On Wed, Oct 09, 2024 at 09:38:11AM -0700, Nicolin Chen wrote:
> > Add a new driver-type for ARM SMMUv3 to enum iommu_viommu_type. Implement
> > +static inline struct iommufd_viommu *
> > +arm_vsmmu_alloc(struct iommu_device *iommu_dev, struct iommu_domain *parent,
> > + struct iommufd_ctx *ictx, unsigned int viommu_type)
> > +{
> > + return ERR_PTR(-EOPNOTSUPP);
> > +}
>
> Let's do #define NULL here instead so we don't get an op at all.
Ack.
> > +struct iommufd_viommu *
> > +arm_vsmmu_alloc(struct iommu_device *iommu_dev, struct iommu_domain *parent,
> > + struct iommufd_ctx *ictx, unsigned int viommu_type)
> > +{
> > + struct arm_smmu_device *smmu =
> > + container_of(iommu_dev, struct arm_smmu_device, iommu);
> > + 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);
>
> So what happens if the user tries to create a default domain?
>
> It skips this and just creates an normal viommu object
>
> But then what? The driver needs to make sure it never casts that to a
> arm_vsmmu ? How?
So long as a driver doesn't provide iommu_ops->default_viommu_ops,
it should be fine. We may also block DEFAULT viommu allocations in
the core if the driver doesn't provide that default_viommu_ops.
Nicolin
Powered by blists - more mailing lists