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

Message ID 20230127113932.166089-31-suzuki.poulose@arm.com
State New
Headers
Series arm64: Support for Arm Confidential Compute Architecture |

Commit Message

Suzuki K Poulose Jan. 27, 2023, 11:39 a.m. UTC
  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(+)
  

Patch

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");
 }