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 <smostafa@google.com>
This commit is contained in:
Mostafa Saleh 2024-06-11 15:40:53 +00:00
parent ce6eb6fa08
commit abd6c25f0d
2 changed files with 18 additions and 0 deletions

View File

@ -129,4 +129,19 @@ HYP_EVENT(psci_mem_protect,
), ),
HE_PRINTK("count=%llu was=%llu", __entry->count, __entry->was) HE_PRINTK("count=%llu was=%llu", __entry->count, __entry->was)
); );
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 #endif

View File

@ -6,6 +6,7 @@
*/ */
#include <asm/kvm_hyp.h> #include <asm/kvm_hyp.h>
#include <asm/kvm_hypevents.h>
#include <hyp/adjust_pc.h> #include <hyp/adjust_pc.h>
@ -580,6 +581,8 @@ void kvm_iommu_host_stage2_idmap(phys_addr_t start, phys_addr_t end,
if (!kvm_iommu_is_ready()) if (!kvm_iommu_is_ready())
return; return;
trace_iommu_idmap(start, end, prot);
domain = __handle_to_domain(KVM_IOMMU_DOMAIN_IDMAP_ID, false); domain = __handle_to_domain(KVM_IOMMU_DOMAIN_IDMAP_ID, false);
kvm_iommu_ops->host_stage2_idmap(domain, start, end, pkvm_to_iommu_prot(prot)); kvm_iommu_ops->host_stage2_idmap(domain, start, end, pkvm_to_iommu_prot(prot));