Skip to content

Commit d11974d

Browse files
committed
KVM: arm64: Add tracepoint for MMIO accesses where ISV==0
It is a pretty well known fact that KVM does not support MMIO emulation without valid instruction syndrome information (ESR_EL2.ISV == 0). The current kvm_pr_unimpl() is pretty useless, as it contains zero context to relate the event to a vCPU. Replace it with a precise tracepoint that dumps the relevant context so the user can make sense of what the guest is doing. Acked-by: Zenghui Yu <[email protected]> Acked-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 06899aa commit d11974d

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

arch/arm64/kvm/mmio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ int io_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa)
135135
* volunteered to do so, and bail out otherwise.
136136
*/
137137
if (!kvm_vcpu_dabt_isvalid(vcpu)) {
138+
trace_kvm_mmio_nisv(*vcpu_pc(vcpu), kvm_vcpu_get_esr(vcpu),
139+
kvm_vcpu_get_hfar(vcpu), fault_ipa);
140+
138141
if (test_bit(KVM_ARCH_FLAG_RETURN_NISV_IO_ABORT_TO_USER,
139142
&vcpu->kvm->arch.flags)) {
140143
run->exit_reason = KVM_EXIT_ARM_NISV;
@@ -143,7 +146,6 @@ int io_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa)
143146
return 0;
144147
}
145148

146-
kvm_pr_unimpl("Data abort outside memslots with no valid syndrome info\n");
147149
return -ENOSYS;
148150
}
149151

arch/arm64/kvm/trace_arm.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,31 @@ TRACE_EVENT(kvm_mmio_emulate,
136136
__entry->vcpu_pc, __entry->instr, __entry->cpsr)
137137
);
138138

139+
TRACE_EVENT(kvm_mmio_nisv,
140+
TP_PROTO(unsigned long vcpu_pc, unsigned long esr,
141+
unsigned long far, unsigned long ipa),
142+
TP_ARGS(vcpu_pc, esr, far, ipa),
143+
144+
TP_STRUCT__entry(
145+
__field( unsigned long, vcpu_pc )
146+
__field( unsigned long, esr )
147+
__field( unsigned long, far )
148+
__field( unsigned long, ipa )
149+
),
150+
151+
TP_fast_assign(
152+
__entry->vcpu_pc = vcpu_pc;
153+
__entry->esr = esr;
154+
__entry->far = far;
155+
__entry->ipa = ipa;
156+
),
157+
158+
TP_printk("ipa %#016lx, esr %#016lx, far %#016lx, pc %#016lx",
159+
__entry->ipa, __entry->esr,
160+
__entry->far, __entry->vcpu_pc)
161+
);
162+
163+
139164
TRACE_EVENT(kvm_set_way_flush,
140165
TP_PROTO(unsigned long vcpu_pc, bool cache),
141166
TP_ARGS(vcpu_pc, cache),

0 commit comments

Comments
 (0)