Skip to content

Commit e9f1f72

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/arm-smmu-v3: Make set_dev_pasid() op support replace
set_dev_pasid() op is going to be enhanced to support domain replacement of a pasid. This prepares for this op definition. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Link: https://lore.kernel.org/r/20241107122234.7424-13-yi.l.liu@intel.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 67f6f56 commit e9f1f72

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain,
349349
* get reassigned
350350
*/
351351
arm_smmu_make_sva_cd(&target, master, domain->mm, smmu_domain->cd.asid);
352-
ret = arm_smmu_set_pasid(master, smmu_domain, id, &target);
352+
ret = arm_smmu_set_pasid(master, smmu_domain, id, &target, old);
353353

354354
mmput(domain->mm);
355355
return ret;

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,7 +2883,7 @@ static int arm_smmu_s1_set_dev_pasid(struct iommu_domain *domain,
28832883
*/
28842884
arm_smmu_make_s1_cd(&target_cd, master, smmu_domain);
28852885
return arm_smmu_set_pasid(master, to_smmu_domain(domain), id,
2886-
&target_cd);
2886+
&target_cd, old);
28872887
}
28882888

28892889
static void arm_smmu_update_ste(struct arm_smmu_master *master,
@@ -2913,16 +2913,13 @@ static void arm_smmu_update_ste(struct arm_smmu_master *master,
29132913

29142914
int arm_smmu_set_pasid(struct arm_smmu_master *master,
29152915
struct arm_smmu_domain *smmu_domain, ioasid_t pasid,
2916-
struct arm_smmu_cd *cd)
2916+
struct arm_smmu_cd *cd, struct iommu_domain *old)
29172917
{
29182918
struct iommu_domain *sid_domain = iommu_get_domain_for_dev(master->dev);
29192919
struct arm_smmu_attach_state state = {
29202920
.master = master,
2921-
/*
2922-
* For now the core code prevents calling this when a domain is
2923-
* already attached, no need to set old_domain.
2924-
*/
29252921
.ssid = pasid,
2922+
.old_domain = old,
29262923
};
29272924
struct arm_smmu_cd *cdptr;
29282925
int ret;

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ void arm_smmu_write_cd_entry(struct arm_smmu_master *master, int ssid,
875875

876876
int arm_smmu_set_pasid(struct arm_smmu_master *master,
877877
struct arm_smmu_domain *smmu_domain, ioasid_t pasid,
878-
struct arm_smmu_cd *cd);
878+
struct arm_smmu_cd *cd, struct iommu_domain *old);
879879

880880
void arm_smmu_tlb_inv_asid(struct arm_smmu_device *smmu, u16 asid);
881881
void arm_smmu_tlb_inv_range_asid(unsigned long iova, size_t size, int asid,

0 commit comments

Comments
 (0)