Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iommu/arm-smmu-v3: Do not set disable_ats unless vSTE is Translate

A vSTE may have three configuration types: Abort, Bypass, and Translate.

An Abort vSTE wouldn't enable ATS, but the other two might.

It makes sense for a Transalte vSTE to rely on the guest vSTE.EATS field.

For a Bypass vSTE, it would end up with an S2-only physical STE, similar
to an attachment to a regular S2 domain. However, the nested case always
disables ATS following the Bypass vSTE, while the regular S2 case always
enables ATS so long as arm_smmu_ats_supported(master) == true.

Note that ATS is needed for certain VM centric workloads and historically
non-vSMMU cases have relied on this automatic enablement. So, having the
nested case behave differently causes problems.

To fix that, add a condition to disable_ats, so that it might enable ATS
for a Bypass vSTE, aligning with the regular S2 case.

Fixes: f27298a82ba0 ("iommu/arm-smmu-v3: Allow ATS for IOMMU_DOMAIN_NESTED")
Cc: stable@vger.kernel.org
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Nicolin Chen and committed by
Will Deacon
a45dd346 a4f976ed

+3 -1
+3 -1
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
··· 177 177 * config bit here base this off the EATS value in the STE. If the EATS 178 178 * is set then the VM must generate ATC flushes. 179 179 */ 180 - state.disable_ats = !nested_domain->enable_ats; 180 + if (FIELD_GET(STRTAB_STE_0_CFG, le64_to_cpu(nested_domain->ste[0])) == 181 + STRTAB_STE_0_CFG_S1_TRANS) 182 + state.disable_ats = !nested_domain->enable_ats; 181 183 ret = arm_smmu_attach_prepare(&state, domain); 182 184 if (ret) { 183 185 mutex_unlock(&arm_smmu_asid_lock);