ANDROID: KVM: arm64: iommu: Add host_stage2_idmap_complete

Add a new callback to pkvm_iommu_ops called after
host_stage2_idmap_apply on all IOMMU devices. This allows the drivers to
complete operations like invalidation in two stages.

Bug: 249161451
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I9c077fd2b18ce54ad67eb34ef16bc94428797419
This commit is contained in:
David Brazdil
2022-11-16 17:54:51 +00:00
parent f0c53a5637
commit ce39549d92
2 changed files with 11 additions and 0 deletions

View File

@@ -48,6 +48,12 @@ struct pkvm_iommu_ops {
void (*host_stage2_idmap_apply)(struct pkvm_iommu *dev,
phys_addr_t start, phys_addr_t end);
/*
* Callback to finish a host stage-2 mapping change at device level.
* Called after 'host_stage2_idmap_apply' with host lock held.
*/
void (*host_stage2_idmap_complete)(struct pkvm_iommu *dev);
/* Power management callbacks. Called with host lock held. */
int (*suspend)(struct pkvm_iommu *dev);
int (*resume)(struct pkvm_iommu *dev);

View File

@@ -546,4 +546,9 @@ void pkvm_iommu_host_stage2_idmap(phys_addr_t start, phys_addr_t end,
if (dev->powered && dev->ops->host_stage2_idmap_apply)
dev->ops->host_stage2_idmap_apply(dev, start, end);
}
list_for_each_entry(dev, &iommu_list, list) {
if (dev->powered && dev->ops->host_stage2_idmap_complete)
dev->ops->host_stage2_idmap_complete(dev);
}
}