From 9c760a21bb67899d6ec97658d1311b0ade4614d0 Mon Sep 17 00:00:00 2001 From: Mostafa Saleh Date: Tue, 11 Jun 2024 15:40:53 +0000 Subject: [PATCH] ANDROID: KVM: arm64: iommu: Add idmap trace point Add a trace point for identity mapping callback. Bug: 277989609 Bug: 278749606 Change-Id: I918a7a22123f5358b27a77dc4e25bbec371b1efb Signed-off-by: Mostafa Saleh --- arch/arm64/include/asm/kvm_hypevents.h | 14 ++++++++++++++ arch/arm64/kvm/hyp/nvhe/iommu/iommu.c | 3 +++ 2 files changed, 17 insertions(+) diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h index 956023650df2..2411436db9f9 100644 --- a/arch/arm64/include/asm/kvm_hypevents.h +++ b/arch/arm64/include/asm/kvm_hypevents.h @@ -125,4 +125,18 @@ HYP_EVENT(selftest, ); #endif +HYP_EVENT(iommu_idmap, + HE_PROTO(u64 from, u64 to, int prot), + HE_STRUCT( + he_field(u64, from) + he_field(u64, to) + he_field(int, prot) + ), + HE_ASSIGN( + __entry->from = from; + __entry->to = to; + __entry->prot = prot; + ), + HE_PRINTK("from=0x%llx to=0x%llx prot=0x%x", __entry->from, __entry->to, __entry->prot) +); #endif /* __ARM64_KVM_HYPEVENTS_H_ */ diff --git a/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c b/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c index 93b0508e9ae5..509c22fc9ca2 100644 --- a/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c +++ b/arch/arm64/kvm/hyp/nvhe/iommu/iommu.c @@ -5,6 +5,7 @@ * Copyright (C) 2022 Linaro Ltd. */ #include +#include #include @@ -478,6 +479,8 @@ void kvm_iommu_host_stage2_idmap(phys_addr_t start, phys_addr_t end, if (!kvm_iommu_is_ready()) return; + trace_iommu_idmap(start, end, prot); + domain = __handle_to_domain(KVM_IOMMU_DOMAIN_IDMAP_ID, false); kvm_iommu_ops->host_stage2_idmap(domain, start, end, pkvm_to_iommu_prot(prot));