Commit c67d8187 authored by Nicolin Chen's avatar Nicolin Chen Committed by Kunkun Jiang
Browse files

iommu/arm-smmu-v3: Implement arm_smmu_get_msi_mapping_domain

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IB4WDJ


CVE: NA

--------------------------------

In a 1-stage translation setup, a device is attached to a paging domain.
In a 2-stage translation setup, a device is attached to a nested domain,
which does not have the mappings for the MSI page but only an s2_parent
paging domain pointer that holds the mappings.

Add arm_smmu_get_msi_mapping_domain in arm_smmu_nested_ops to return the
correct paging domain.

Signed-off-by: default avatarNicolin Chen <nicolinc@nvidia.com>
Signed-off-by: default avatarKunkun Jiang <jiangkunkun@huawei.com>
parent 622e6259
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -30,6 +30,15 @@ void *arm_smmu_hw_info(struct device *dev, u32 *length, u32 *type)
	return info;
}

static struct iommu_domain *
arm_smmu_get_msi_mapping_domain(struct iommu_domain *domain)
{
	struct arm_smmu_nested_domain *nested_domain =
		container_of(domain, struct arm_smmu_nested_domain, domain);

	return &nested_domain->vsmmu->s2_parent->domain;
}

static void arm_smmu_make_nested_cd_table_ste(
	struct arm_smmu_ste *target, struct arm_smmu_master *master,
	struct arm_smmu_nested_domain *nested_domain, bool ats_enabled)
@@ -134,6 +143,7 @@ static void arm_smmu_domain_nested_free(struct iommu_domain *domain)
}

static const struct iommu_domain_ops arm_smmu_nested_ops = {
	.get_msi_mapping_domain	= arm_smmu_get_msi_mapping_domain,
	.attach_dev = arm_smmu_attach_dev_nested,
	.free = arm_smmu_domain_nested_free,
};