[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230614154304.2860121-14-mshavit@google.com>
Date: Wed, 14 Jun 2023 23:42:05 +0800
From: Michael Shavit <mshavit@...gle.com>
To: Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>
Cc: Michael Shavit <mshavit@...gle.com>, jean-philippe@...aro.org,
nicolinc@...dia.com, jgg@...dia.com, baolu.lu@...ux.intel.com,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 13/13] iommu/arm-smmu-v3-sva: Add check when enabling sva
SVA domains can only be attached when the master's STEs have a stage 1
domain.
Signed-off-by: Michael Shavit <mshavit@...gle.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
index b615a85e6a54e..e2a91f20f0906 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
@@ -499,9 +499,15 @@ int arm_smmu_master_enable_sva(struct arm_smmu_master *master)
int ret;
mutex_lock(&sva_lock);
+
+ if (!master->s1_cfg) {
+ ret = -EBUSY;
+ goto unlock;
+ }
ret = arm_smmu_master_sva_enable_iopf(master);
if (!ret)
master->sva_enabled = true;
+unlock:
mutex_unlock(&sva_lock);
return ret;
--
2.41.0.162.gfafddb0af9-goog
Powered by blists - more mailing lists