From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z74Dq-00058A-DG for qemu-devel@nongnu.org; Mon, 22 Jun 2015 12:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z74Dp-0003RT-FR for qemu-devel@nongnu.org; Mon, 22 Jun 2015 12:05:22 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:20166 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z74Dp-0003R2-1G for qemu-devel@nongnu.org; Mon, 22 Jun 2015 12:05:21 -0400 From: "Denis V. Lunev" Date: Mon, 22 Jun 2015 19:05:05 +0300 Message-Id: <1434989108-20924-9-git-send-email-den@openvz.org> In-Reply-To: <1434989108-20924-1-git-send-email-den@openvz.org> References: <1434989108-20924-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 08/11] kvm/x86: add sending hyper-v crash notification to user space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Gleb Natapov , qemu-devel@nongnu.org, Paolo Bonzini , Andrey Smetanin , "Denis V. Lunev" From: Andrey Smetanin Sending of notification is done by exiting vcpu to user space if KVM_REQ_HV_CRASH is set for vcpu. kvm_run structure will contain system_event with type equals to KVM_SYSTEM_EVENT_CRASH and flag KVM_SYSTEM_EVENT_FL_HV_CRASH to clarify that the crash occures inside Hyper-V based guest. Signed-off-by: Andrey Smetanin Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Gleb Natapov --- arch/x86/kvm/x86.c | 8 ++++++++ include/uapi/linux/kvm.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2046b78..111fa83 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6027,6 +6027,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) vcpu_scan_ioapic(vcpu); if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu)) kvm_vcpu_reload_apic_access_page(vcpu); + if (kvm_check_request(KVM_REQ_HV_CRASH, vcpu)) { + vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT; + vcpu->run->system_event.type = KVM_SYSTEM_EVENT_CRASH; + vcpu->run->system_event.flags = + KVM_SYSTEM_EVENT_FL_HV_CRASH; + r = 0; + goto out; + } } if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) { diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 4b60056..22b6cca 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -317,6 +317,8 @@ struct kvm_run { struct { #define KVM_SYSTEM_EVENT_SHUTDOWN 1 #define KVM_SYSTEM_EVENT_RESET 2 +#define KVM_SYSTEM_EVENT_CRASH 3 +#define KVM_SYSTEM_EVENT_FL_HV_CRASH (1ULL << 0) __u32 type; __u64 flags; } system_event; -- 1.9.1