]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iommu/arm-smmu-v3: Add explicit feature for nesting
authorRobin Murphy <robin.murphy@arm.com>
Wed, 2 Aug 2023 17:02:26 +0000 (17:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 13:13:49 +0000 (15:13 +0200)
commit 1d9777b9f3d55b4b6faf186ba4f1d6fb560c0523 upstream

In certain cases we may want to refuse to allow nested translation even
when both stages are implemented, so let's add an explicit feature for
nesting support which we can control in its own right. For now this
merely serves as documentation, but it means a nice convenient check
will be ready and waiting for the future nesting code.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/r/136c3f4a3a84cc14a5a1978ace57dfd3ed67b688.1683731256.git.robin.murphy@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h

index 6a551a48d2719a023b2f6c7209a6ef3f08c62368..7cec4a457d918eab79172228b69f7e097b115336 100644 (file)
@@ -3703,6 +3703,10 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 
        smmu->ias = max(smmu->ias, smmu->oas);
 
+       if ((smmu->features & ARM_SMMU_FEAT_TRANS_S1) &&
+           (smmu->features & ARM_SMMU_FEAT_TRANS_S2))
+               smmu->features |= ARM_SMMU_FEAT_NESTING;
+
        arm_smmu_device_iidr_probe(smmu);
 
        if (arm_smmu_sva_supported(smmu))
index abaecdf8d5d28a196ee4a853eb06910ff116344b..c594a9b4699956fecd4ced589af85021e702d8d8 100644 (file)
@@ -646,6 +646,7 @@ struct arm_smmu_device {
 #define ARM_SMMU_FEAT_BTM              (1 << 16)
 #define ARM_SMMU_FEAT_SVA              (1 << 17)
 #define ARM_SMMU_FEAT_E2H              (1 << 18)
+#define ARM_SMMU_FEAT_NESTING          (1 << 19)
        u32                             features;
 
 #define ARM_SMMU_OPT_SKIP_PREFETCH     (1 << 0)