@@ -20,6 +20,7 @@ void kvm_cpu__run(struct kvm_cpu *vcpu);
int kvm_cpu__start(struct kvm_cpu *cpu);
bool kvm_cpu__handle_exit(struct kvm_cpu *vcpu);
int kvm_cpu__get_endianness(struct kvm_cpu *vcpu);
+bool kvm_cpu__arch_handle_system_event(struct kvm_cpu *vcpu);
int kvm_cpu__get_debug_fd(void);
void kvm_cpu__set_debug_fd(int fd);
@@ -23,6 +23,11 @@ int __attribute__((weak)) kvm_cpu__get_endianness(struct kvm_cpu *vcpu)
return VIRTIO_ENDIAN_HOST;
}
+bool __attribute__((weak)) kvm_cpu__arch_handle_system_event(struct kvm_cpu *vcpu)
+{
+ return false;
+}
+
void kvm_cpu__enable_singlestep(struct kvm_cpu *vcpu)
{
struct kvm_guest_debug debug = {
@@ -224,6 +229,9 @@ int kvm_cpu__start(struct kvm_cpu *cpu)
*/
switch (cpu->kvm_run->system_event.type) {
default:
+ if (kvm_cpu__arch_handle_system_event(cpu))
+ break;
+
pr_warning("unknown system event type %d",
cpu->kvm_run->system_event.type);
/* fall through for now */
Certain system events require architecture-specific handling. Allow architectures to intervene for exits unhandled by the default exit handler. Signed-off-by: Oliver Upton <oupton@google.com> --- include/kvm/kvm-cpu.h | 1 + kvm-cpu.c | 8 ++++++++ 2 files changed, 9 insertions(+)