Skip to content

Commit 5f53638

Browse files
yiliu1765joergroedel
authored andcommitted
iommu/amd: Make the blocked domain support PASID
The blocked domain can be extended to park PASID of a device to be the DMA blocking state. By this the remove_dev_pasid() op is dropped. Remove PASID from old domain and device GCR3 table. No need to attach PASID to the blocked domain as clearing PASID from GCR3 table will make sure all DMAs for that PASID are blocked. Suggested-by: Jason Gunthorpe <[email protected]> Reviewed-by: Vasant Hegde <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Signed-off-by: Yi Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 4f0bdab commit 5f53638

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2475,10 +2475,19 @@ static int blocked_domain_attach_device(struct iommu_domain *domain,
24752475
return 0;
24762476
}
24772477

2478+
static int blocked_domain_set_dev_pasid(struct iommu_domain *domain,
2479+
struct device *dev, ioasid_t pasid,
2480+
struct iommu_domain *old)
2481+
{
2482+
amd_iommu_remove_dev_pasid(dev, pasid, old);
2483+
return 0;
2484+
}
2485+
24782486
static struct iommu_domain blocked_domain = {
24792487
.type = IOMMU_DOMAIN_BLOCKED,
24802488
.ops = &(const struct iommu_domain_ops) {
24812489
.attach_dev = blocked_domain_attach_device,
2490+
.set_dev_pasid = blocked_domain_set_dev_pasid,
24822491
}
24832492
};
24842493

@@ -2901,7 +2910,6 @@ const struct iommu_ops amd_iommu_ops = {
29012910
.def_domain_type = amd_iommu_def_domain_type,
29022911
.dev_enable_feat = amd_iommu_dev_enable_feature,
29032912
.dev_disable_feat = amd_iommu_dev_disable_feature,
2904-
.remove_dev_pasid = amd_iommu_remove_dev_pasid,
29052913
.page_response = amd_iommu_page_response,
29062914
.default_domain_ops = &(const struct iommu_domain_ops) {
29072915
.attach_dev = amd_iommu_attach_device,

0 commit comments

Comments
 (0)