RE: [PATCH v4 08/12] iommu/arm-smmu-v3: Support IOMMU_VIOMMU_ALLOC

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

 



Hi Jason,

> -----Original Message-----
> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Thursday, October 31, 2024 12:21 AM
> To: acpica-devel@xxxxxxxxxxxxxxx; iommu@xxxxxxxxxxxxxxx; Joerg Roedel
> <joro@xxxxxxxxxx>; Kevin Tian <kevin.tian@xxxxxxxxx>;
> kvm@xxxxxxxxxxxxxxx; Len Brown <lenb@xxxxxxxxxx>; linux-
> acpi@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; Lorenzo
> Pieralisi <lpieralisi@xxxxxxxxxx>; Rafael J. Wysocki <rafael@xxxxxxxxxx>;
> Robert Moore <robert.moore@xxxxxxxxx>; Robin Murphy
> <robin.murphy@xxxxxxx>; Sudeep Holla <sudeep.holla@xxxxxxx>; Will
> Deacon <will@xxxxxxxxxx>
> Cc: Alex Williamson <alex.williamson@xxxxxxxxxx>; Donald Dutile
> <ddutile@xxxxxxxxxx>; Eric Auger <eric.auger@xxxxxxxxxx>; Guohanjun
> (Hanjun Guo) <guohanjun@xxxxxxxxxx>; Jean-Philippe Brucker <jean-
> philippe@xxxxxxxxxx>; Jerry Snitselaar <jsnitsel@xxxxxxxxxx>; Moritz
> Fischer <mdf@xxxxxxxxxx>; Michael Shavit <mshavit@xxxxxxxxxx>; Nicolin
> Chen <nicolinc@xxxxxxxxxx>; patches@xxxxxxxxxxxxxxx; Rafael J. Wysocki
> <rafael.j.wysocki@xxxxxxxxx>; Shameerali Kolothum Thodi
> <shameerali.kolothum.thodi@xxxxxxxxxx>; Mostafa Saleh
> <smostafa@xxxxxxxxxx>
> Subject: [PATCH v4 08/12] iommu/arm-smmu-v3: Support
> IOMMU_VIOMMU_ALLOC

[...]

> +struct iommufd_viommu *arm_vsmmu_alloc(struct device *dev,
> +				       struct iommu_domain *parent,
> +				       struct iommufd_ctx *ictx,
> +				       unsigned int viommu_type)
> +{
> +	struct arm_smmu_device *smmu =
> +		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);
> +
> +	if (!(smmu->features & ARM_SMMU_FEAT_NESTING))
> +		return ERR_PTR(-EOPNOTSUPP);
> +
> +	if (s2_parent->smmu != master->smmu)
> +		return ERR_PTR(-EINVAL);
> +
> +	/*
> +	 * Must support some way to prevent the VM from bypassing the
> cache
> +	 * because VFIO currently does not do any cache maintenance.
> canwbs
> +	 * indicates the device is fully coherent and no cache maintenance
> is
> +	 * ever required, even for PCI No-Snoop."
> +	 */
> +	if (!arm_smmu_master_canwbs(master))
> +		return ERR_PTR(-EOPNOTSUPP);
> +
> +	vsmmu = iommufd_viommu_alloc(ictx, struct arm_vsmmu, core,
> +				     &arm_vsmmu_ops);
> +	if (IS_ERR(vsmmu))
> +		return ERR_CAST(vsmmu);
> +
> +	vsmmu->smmu = smmu;
> +	vsmmu->s2_parent = s2_parent;
> +	/* FIXME Move VMID allocation from the S2 domain allocation to
> here */

I am planning to respin the " iommu/arm-smmu-v3: Use pinned KVM VMID for
stage 2" [0] based on the latest IOMMUF code. One of the comment on that
RFC was, we should associate the KVM pointer to the sub objects like  viommu
instead of iommufd itself[1]. But at present the s2 domain is already finalized
with a VMID before a viommu object is allocated.

So does the above comment indicates that we plan to do another
S2 VMID allocation here and replace the old one?

Please let me know your thoughts on this.

Thanks,
Shameer
[0] https://lore.kernel.org/linux-iommu/20240208151837.35068-1-shameerali.kolothum.thodi@xxxxxxxxxx/
[1] https://lore.kernel.org/linux-iommu/BN9PR11MB527662A2AB0A9BABD5E20E6D8CD52@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux