Re: [PATCH v3 11/11] iommu/arm-smmu-v3: Add IOMMU_VIOMMU_TYPE_ARM_SMMUV3 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux