pviommu: Add domain_free function
Add domain_free function through HVC.
Signed-off-by: Mostafa Saleh <smostafa@google.com>
diff --git a/drivers/iommu/pkvm-pviommu.c b/drivers/iommu/pkvm-pviommu.c
index 76e8204b..24a028d 100644
--- a/drivers/iommu/pkvm-pviommu.c
+++ b/drivers/iommu/pkvm-pviommu.c
@@ -90,6 +90,13 @@ static phys_addr_t pviommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t
static void pviommu_domain_free(struct iommu_domain *domain)
{
struct pviommu_domain *pv_domain = container_of(domain, struct pviommu_domain, domain);
+ struct pviommu *pv = pv_domain->pv;
+ struct arm_smccc_res res;
+
+ arm_smccc_1_1_hvc(ARM_SMCCC_VENDOR_HYP_KVM_IOMMU_FREE_DOMAIN_FUNC_ID,
+ pv->id, pv_domain->id, &res);
+ if (res.a0 < 0)
+ pr_err("domain_free failed for, ret %d\n", res.a0);
kfree(pv_domain);
}