[RFC kvmtool 30/31] arm64: realm: inject an abort on an unhandled MMIO access

Suzuki K Poulose
2023-01-27T11:43:06Z

From: Joey Gouly <joey.gouly@arm.com>

For Realms, inject a synchronous external abort, instead of ignoring unknown
MMIO accesses.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arm/kvm-cpu.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c
index 90a15ae9..c96d75eb 100644
--- a/arm/kvm-cpu.c
+++ b/arm/kvm-cpu.c
@@ -155,4 +155,13 @@ void kvm_cpu__show_page_tables(struct kvm_cpu *vcpu)

void kvm_cpu__arch_unhandled_mmio(struct kvm_cpu *vcpu)
{
+ struct kvm_vcpu_events events = { };
+
+ if (!vcpu->kvm->cfg.arch.is_realm)
+ return;
+
+ events.exception.ext_dabt_pending = 1;
+
+ if (ioctl(vcpu->vcpu_fd, KVM_SET_VCPU_EVENTS, &events) < 0)
+ die_perror("KVM_SET_VCPU_EVENTS failed");
}
--
2.34.1