From patchwork Sun Mar 24 18:44:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 2327091 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5387C400E6 for ; Sun, 24 Mar 2013 18:45:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754515Ab3CXSpP (ORCPT ); Sun, 24 Mar 2013 14:45:15 -0400 Received: from mout.web.de ([212.227.17.11]:55937 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754070Ab3CXSo7 (ORCPT ); Sun, 24 Mar 2013 14:44:59 -0400 Received: from localhost.localdomain ([95.157.56.37]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0Lud4y-1UkKyV16Fk-0101EK; Sun, 24 Mar 2013 19:44:55 +0100 From: Jan Kiszka To: Gleb Natapov , Marcelo Tosatti Cc: kvm , Paolo Bonzini , Nadav Har'El Subject: [PATCH v3 1/5] KVM: nVMX: Fix injection of PENDING_INTERRUPT and NMI_WINDOW exits to L1 Date: Sun, 24 Mar 2013 19:44:44 +0100 Message-Id: <2e901b62b1c18527e5685088cea75dd84ca0ec7e.1364150685.git.jan.kiszka@web.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-Provags-ID: V02:K0:fnB/yBe+elr8aoE3K7axQNd1pLp+cTK5n/yi1ivCu4V Db6XAmCWpVJFbvYyoIDjDcz2vKVvc7ZnFhBY13pumMtycSnau1 NnKo1DQv5+/GzcVLDJtq5H5Y7eVHGii5VhaNj6k/KE2jkgYwpt 0nl844EokY67nynLKOW4IuQklvoeb2bxb8ltwIWYfoiFbKCtzL +v/+AFZuhx5dvDlcaquZQ== Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Jan Kiszka Check if the interrupt or NMI window exit is for L1 by testing if it has the corresponding controls enabled. This is required when we allow direct injection from L0 to L2 Signed-off-by: Jan Kiszka Reviewed-by: Gleb Natapov --- arch/x86/kvm/vmx.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 03f5746..8827b3b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -6112,14 +6112,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) case EXIT_REASON_TRIPLE_FAULT: return 1; case EXIT_REASON_PENDING_INTERRUPT: + return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_INTR_PENDING); case EXIT_REASON_NMI_WINDOW: - /* - * prepare_vmcs02() set the CPU_BASED_VIRTUAL_INTR_PENDING bit - * (aka Interrupt Window Exiting) only when L1 turned it on, - * so if we got a PENDING_INTERRUPT exit, this must be for L1. - * Same for NMI Window Exiting. - */ - return 1; + return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_NMI_PENDING); case EXIT_REASON_TASK_SWITCH: return 1; case EXIT_REASON_CPUID: